Wrote Enum for webshops

changed code in respective classes
This commit is contained in:
Leonie Eitze
2023-06-15 18:47:10 +02:00
parent 5e6a2541fa
commit 5436118829
4 changed files with 16 additions and 13 deletions

View File

@@ -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;
}