Subversion Repositories SmartDukaan

Rev

Rev 2505 | Rev 3126 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2505 Rev 2942
Line 1... Line 1...
1
package in.shop2020.serving.utils;
1
package in.shop2020.serving.utils;
2
 
2
 
-
 
3
import org.apache.log4j.Logger;
-
 
4
 
3
import in.shop2020.config.ConfigException;
5
import in.shop2020.config.ConfigException;
4
import in.shop2020.model.v1.catalog.InventoryService.Client;
6
import in.shop2020.model.v1.catalog.InventoryService.Client;
5
import in.shop2020.model.v1.catalog.Item;
7
import in.shop2020.model.v1.catalog.Item;
6
import in.shop2020.thrift.clients.CatalogServiceClient;
8
import in.shop2020.thrift.clients.CatalogServiceClient;
7
import in.shop2020.thrift.clients.config.ConfigClient;
9
import in.shop2020.thrift.clients.config.ConfigClient;
8
 
10
 
9
public class Utils {
11
public class Utils {
-
 
12
    private static Logger logger = Logger.getLogger(Utils.class);
-
 
13
    
10
	public static final String EXPORT_ENTITIES_PATH = getExportPath();
14
	public static final String EXPORT_ENTITIES_PATH = getExportPath();
11
	public static final long ROOT_CATEGORY = 10000;
15
	public static final long ROOT_CATEGORY = 10000;
12
	public static final long MOBILE_PHONES_CATEGORY = 10001;
16
	public static final long MOBILE_PHONES_CATEGORY = 10001;
13
	public static final long MOBILE_ACCESSORIES_CATEGORY = 10011;
17
	public static final long MOBILE_ACCESSORIES_CATEGORY = 10011;
14
	public static final long TABLETS_CATEGORY = 10010;
18
	public static final long TABLETS_CATEGORY = 10010;
Line 17... Line 21...
17
		String exportPath=null;
21
		String exportPath=null;
18
		ConfigClient client = ConfigClient.getClient();
22
		ConfigClient client = ConfigClient.getClient();
19
		try{
23
		try{
20
			exportPath = client.get("export_entities_path");
24
			exportPath = client.get("export_entities_path");
21
		}catch(ConfigException ce){
25
		}catch(ConfigException ce){
-
 
26
			logger.error("Unable to read export path from the config client: ", ce);
22
			ce.printStackTrace();
27
			logger.warn("Setting the default export path");
23
			exportPath = "/var/lib/tomcat6/webapps/export/html/entities/";
28
			exportPath = "/var/lib/tomcat6/webapps/export/html/entities/";
24
		}
29
		}
25
		return exportPath;
30
		return exportPath;
26
	}
31
	}
27
	
32
	
Line 33... Line 38...
33
			catalogServiceClient = new CatalogServiceClient();
38
			catalogServiceClient = new CatalogServiceClient();
34
			client = catalogServiceClient.getClient();
39
			client = catalogServiceClient.getClient();
35
			Item item = client.getItem(itemId);
40
			Item item = client.getItem(itemId);
36
			itemPrice = item.getSellingPrice();
41
			itemPrice = item.getSellingPrice();
37
			
42
			
38
		}
-
 
39
		catch(Exception e){
43
		} catch(Exception e){
40
			e.printStackTrace();
44
			logger.error("Unable to get the item price because of:", e);
41
		}
45
		}
42
		return itemPrice;
46
		return itemPrice;
43
	}
47
	}
44
 
48
 
45
 
49