Wrote Enum for webshops
changed code in respective classes
This commit is contained in:
@@ -90,17 +90,14 @@ public class ProductRetriever {
|
||||
* @param productName Product name, translated to the correct product ID for the data source
|
||||
* @return Product from that data source or null if data source not available
|
||||
*/
|
||||
public Product getProductFromDataSource(final String dataSourceName, final String productName) {
|
||||
switch(dataSourceName.toLowerCase()) {
|
||||
case "amazon":
|
||||
public Product getProductFromDataSource(Product.webshop dataSourceName, final String productName) {
|
||||
switch(dataSourceName) {
|
||||
case AMAZON:
|
||||
// TODO: Translation from productName to productId (Amazon) needed
|
||||
return getProductFromAmazon(productName);
|
||||
case "ebay":
|
||||
case EBAY:
|
||||
// TODO: Translation from productName to productId (eBay) needed
|
||||
return getProductFromEbay(productName);
|
||||
case "persistence":
|
||||
// TODO: Translation from productName to productId (persistence layer) needed
|
||||
return getProductFromPersistence(productName);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user