| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.utils;
|
1 |
package in.shop2020.serving.utils;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.config.ConfigException;
|
3 |
import in.shop2020.config.ConfigException;
|
| 4 |
import in.shop2020.model.v1.order.LineItem;
|
4 |
import in.shop2020.model.v1.order.LineItem;
|
| 5 |
import in.shop2020.model.v1.order.Order;
|
5 |
import in.shop2020.model.v1.order.Order;
|
| - |
|
6 |
import in.shop2020.model.v1.order.RechargeType;
|
| 6 |
import in.shop2020.model.v1.user.Cart;
|
7 |
import in.shop2020.model.v1.user.Cart;
|
| 7 |
import in.shop2020.model.v1.user.Line;
|
8 |
import in.shop2020.model.v1.user.Line;
|
| - |
|
9 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 8 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
10 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
| 9 |
|
11 |
|
| 10 |
import java.util.ArrayList;
|
12 |
import java.util.ArrayList;
|
| 11 |
import java.util.List;
|
13 |
import java.util.List;
|
| - |
|
14 |
import java.util.Map;
|
| 12 |
|
15 |
|
| 13 |
import javax.mail.internet.AddressException;
|
16 |
import javax.mail.internet.AddressException;
|
| 14 |
import javax.mail.internet.InternetAddress;
|
17 |
import javax.mail.internet.InternetAddress;
|
| 15 |
|
18 |
|
| 16 |
import org.apache.commons.lang.StringUtils;
|
19 |
import org.apache.commons.lang.StringUtils;
|
| 17 |
import org.apache.log4j.Logger;
|
20 |
import org.apache.log4j.Logger;
|
| - |
|
21 |
import org.apache.thrift.transport.TTransportException;
|
| 18 |
|
22 |
|
| 19 |
public class Utils {
|
23 |
public class Utils {
|
| 20 |
private static Logger logger = Logger.getLogger(Utils.class);
|
24 |
private static Logger logger = Logger.getLogger(Utils.class);
|
| 21 |
|
25 |
|
| 22 |
public static final String EXPORT_ENTITIES_PATH = getExportPath();
|
26 |
public static final String EXPORT_ENTITIES_PATH = getExportPath();
|
| Line 25... |
Line 29... |
| 25 |
public static final long MOBILE_PHONES_CATEGORY = 10001;
|
29 |
public static final long MOBILE_PHONES_CATEGORY = 10001;
|
| 26 |
public static final long MOBILE_ACCESSORIES_CATEGORY = 10011;
|
30 |
public static final long MOBILE_ACCESSORIES_CATEGORY = 10011;
|
| 27 |
public static final long TABLETS_CATEGORY = 10010;
|
31 |
public static final long TABLETS_CATEGORY = 10010;
|
| 28 |
public static final long LAPTOPS_CATEGORY = 10050;
|
32 |
public static final long LAPTOPS_CATEGORY = 10050;
|
| 29 |
public static final long CAMERAS_CATEGORY = 11001;
|
33 |
public static final long CAMERAS_CATEGORY = 11001;
|
| - |
|
34 |
|
| - |
|
35 |
static Map<Long, String> providersMap;
|
| 30 |
|
36 |
|
| 31 |
public static String[] facetDefIDs = new String[] {
|
37 |
public static String[] facetDefIDs = new String[] {
|
| 32 |
"F_50010","F_50011","F_50002","F_50001", "F_50006", "F_50007", "F_50012", "F_50013", "F_50014", "F_50015", "F_50017", "F_50018", "F_50019", "F_50020", "F_50021", "F_50022", "F_50023", "F_50024", "F_50025", "F_50026", "F_50027" };
|
38 |
"F_50010","F_50011","F_50002","F_50001", "F_50006", "F_50007", "F_50012", "F_50013", "F_50014", "F_50015", "F_50017", "F_50018", "F_50019", "F_50020", "F_50021", "F_50022", "F_50023", "F_50024", "F_50025", "F_50026", "F_50027" };
|
| 33 |
public static String[] facetLabels = new String[] {"Category","Sub Category","Price", "Brand", "Data Connectivity",
|
39 |
public static String[] facetLabels = new String[] {"Category","Sub Category","Price", "Brand", "Data Connectivity",
|
| 34 |
"Camera Resolution", "Display", "Operating System", "RAM", "Storage Capacity", "Processor",
|
40 |
"Camera Resolution", "Display", "Operating System", "RAM", "Storage Capacity", "Processor",
|
| 35 |
"Capacity", "Class", "Capacity", "Capacity", "Type", "Interface", "Resolution", "Optical Zoom", "Display Size", "Effective Resolution" };
|
41 |
"Capacity", "Class", "Capacity", "Capacity", "Type", "Interface", "Resolution", "Optical Zoom", "Display Size", "Effective Resolution" };
|
| 36 |
public static String[] rootfacetDefIDs = new String[] {"F_50010","F_50011","F_50002","F_50001"};
|
42 |
public static String[] rootfacetDefIDs = new String[] {"F_50010","F_50011","F_50002","F_50001"};
|
| 37 |
public static String[] rootfacetLabels = new String[] {"Category","Sub Category","Price", "Brand"};
|
43 |
public static String[] rootfacetLabels = new String[] {"Category","Sub Category","Price", "Brand"};
|
| - |
|
44 |
|
| - |
|
45 |
static {
|
| - |
|
46 |
TransactionClient tcl;
|
| - |
|
47 |
try {
|
| - |
|
48 |
tcl = new TransactionClient();
|
| - |
|
49 |
providersMap = tcl.getClient().getServiceProviders(RechargeType.MOBILE);
|
| - |
|
50 |
providersMap.putAll(tcl.getClient().getServiceProviders(RechargeType.DTH));
|
| - |
|
51 |
} catch (Exception e) {
|
| - |
|
52 |
logger.error("Could not get providers", e);
|
| - |
|
53 |
}
|
| - |
|
54 |
}
|
| - |
|
55 |
|
| - |
|
56 |
|
| - |
|
57 |
|
| 38 |
private static String getExportPath(){
|
58 |
private static String getExportPath(){
|
| 39 |
String exportPath=null;
|
59 |
String exportPath=null;
|
| 40 |
ConfigClient client = ConfigClient.getClient();
|
60 |
ConfigClient client = ConfigClient.getClient();
|
| 41 |
try{
|
61 |
try{
|
| 42 |
exportPath = client.get("export_entities_path");
|
62 |
exportPath = client.get("export_entities_path");
|
| Line 110... |
Line 130... |
| 110 |
itemIds.add(Long.toString(lItem.getItem_id()));
|
130 |
itemIds.add(Long.toString(lItem.getItem_id()));
|
| 111 |
}
|
131 |
}
|
| 112 |
}
|
132 |
}
|
| 113 |
}
|
133 |
}
|
| 114 |
return StringUtils.join(itemIds, '_');
|
134 |
return StringUtils.join(itemIds, '_');
|
| 115 |
}
|
135 |
}
|
| - |
|
136 |
|
| - |
|
137 |
|
| - |
|
138 |
|
| - |
|
139 |
public static String getRechargeProviderName(long providerId) {
|
| - |
|
140 |
return providersMap.get(providerId);
|
| - |
|
141 |
}
|
| 116 |
}
|
142 |
}
|
| 117 |
|
143 |
|