| Line 145... |
Line 145... |
| 145 |
*/
|
145 |
*/
|
| 146 |
private boolean isTablet(Item item) {
|
146 |
private boolean isTablet(Item item) {
|
| 147 |
in.shop2020.metamodel.definitions.Category parentCategory = defContainer.getCategory(item.getCategory()).getParentCategory();
|
147 |
in.shop2020.metamodel.definitions.Category parentCategory = defContainer.getCategory(item.getCategory()).getParentCategory();
|
| 148 |
return parentCategory.getID() == Utils.TABLETS_CATEGORY;
|
148 |
return parentCategory.getID() == Utils.TABLETS_CATEGORY;
|
| 149 |
}
|
149 |
}
|
| - |
|
150 |
|
| - |
|
151 |
/**
|
| - |
|
152 |
* Checks whether a product is camera or not
|
| - |
|
153 |
*/
|
| - |
|
154 |
private boolean isCamera(Item item) {
|
| - |
|
155 |
in.shop2020.metamodel.definitions.Category parentCategory = defContainer.getCategory(item.getCategory()).getParentCategory();
|
| - |
|
156 |
return parentCategory.getID() == Utils.CAMERAS_CATEGORY;
|
| - |
|
157 |
}
|
| 150 |
|
158 |
|
| 151 |
/**
|
159 |
/**
|
| 152 |
* Checks whether a product is laptop or not
|
160 |
* Checks whether a product is laptop or not
|
| 153 |
*/
|
161 |
*/
|
| 154 |
private boolean isLaptop(Item item) {
|
162 |
private boolean isLaptop(Item item) {
|
| Line 354... |
Line 362... |
| 354 |
// Write it to file
|
362 |
// Write it to file
|
| 355 |
String accessoriesXMLFilename = Utils.EXPORT_PARTNERS_CONTENT_PATH + "saholicaccessories.xml";
|
363 |
String accessoriesXMLFilename = Utils.EXPORT_PARTNERS_CONTENT_PATH + "saholicaccessories.xml";
|
| 356 |
DBUtils.store(accessoriesXML, accessoriesXMLFilename);
|
364 |
DBUtils.store(accessoriesXML, accessoriesXMLFilename);
|
| 357 |
}
|
365 |
}
|
| 358 |
|
366 |
|
| - |
|
367 |
|
| - |
|
368 |
|
| - |
|
369 |
/**
|
| - |
|
370 |
* Generate the xml list of all the active cameras and store in a file
|
| - |
|
371 |
* @throws Exception
|
| - |
|
372 |
*/
|
| - |
|
373 |
public void generateCamerasXML() throws Exception {
|
| - |
|
374 |
LogisticsService.Client prod_client = null;
|
| - |
|
375 |
|
| - |
|
376 |
try {
|
| - |
|
377 |
LogisticsClient logistics_prod = new LogisticsClient("logistics_service_prod_server_host","logistics_service_prod_server_port");
|
| - |
|
378 |
prod_client = logistics_prod.getClient();
|
| - |
|
379 |
|
| - |
|
380 |
} catch (Exception e) {
|
| - |
|
381 |
prod_client = null;
|
| - |
|
382 |
Utils.info("Logistics estimations can't be fetched as Logistics Service is inaccessible" + e);
|
| - |
|
383 |
}
|
| - |
|
384 |
List<String> camerasXMLSnippets = new ArrayList<String>();
|
| - |
|
385 |
|
| - |
|
386 |
camerasXMLSnippets.add("<saholic.com>");
|
| - |
|
387 |
|
| - |
|
388 |
for(Long entityId: entityIdItemMap.keySet()) {
|
| - |
|
389 |
|
| - |
|
390 |
List<Item> items = entityIdItemMap.get(entityId);
|
| - |
|
391 |
Item firstItem = items.get(0);
|
| - |
|
392 |
|
| - |
|
393 |
if(! isCamera(firstItem)) {
|
| - |
|
394 |
continue;
|
| - |
|
395 |
}
|
| - |
|
396 |
String title = getProductTitle(firstItem);
|
| - |
|
397 |
String url = getProductURL(entityId, firstItem);
|
| - |
|
398 |
String imageUrl = "http://static" + ((entityId+1)%3) + ".saholic.com" + File.separator + "images" + File.separator +
|
| - |
|
399 |
"website" + File.separator + entityId + File.separator + "icon.jpg";
|
| - |
|
400 |
|
| - |
|
401 |
camerasXMLSnippets.add(this.xmlIndentation[1] + "<products>");
|
| - |
|
402 |
camerasXMLSnippets.add(this.xmlIndentation[2] + "<ProductSKU>" + entityId + "</ProductSKU>");
|
| - |
|
403 |
camerasXMLSnippets.add(this.xmlIndentation[2] + "<ProductName>" + StringEscapeUtils.escapeXml(title) + "</ProductName>");
|
| - |
|
404 |
camerasXMLSnippets.add(this.xmlIndentation[2] + "<ProductURL>" + StringEscapeUtils.escapeXml(url) + "</ProductURL>");
|
| - |
|
405 |
camerasXMLSnippets.add(this.xmlIndentation[2] + "<ProductPrice>" + getMinPrice(items) + "</ProductPrice>");
|
| - |
|
406 |
camerasXMLSnippets.add(this.xmlIndentation[2] + "<ProductMRP>" + getMinMRP(items) + "</ProductMRP>");
|
| - |
|
407 |
|
| - |
|
408 |
LogisticsInfo logisticsInfo = null;
|
| - |
|
409 |
if(prod_client != null){
|
| - |
|
410 |
try {
|
| - |
|
411 |
Long itemId = prod_client.getEntityLogisticsEstimation(entityId, DEFAULT_PINCODE, DeliveryType.PREPAID).get(0);
|
| - |
|
412 |
logisticsInfo = prod_client.getLogisticsEstimation(itemId, DEFAULT_PINCODE, DeliveryType.PREPAID);
|
| - |
|
413 |
camerasXMLSnippets.add(this.xmlIndentation[2] + "<ProductDeliveryEstimate>" + logisticsInfo.getDeliveryTime() + "</ProductDeliveryEstimate>");
|
| - |
|
414 |
} catch (Exception e1) {
|
| - |
|
415 |
Utils.info("Unable to get Estimation for Entity: " + entityId + "\n" + e1);
|
| - |
|
416 |
}
|
| - |
|
417 |
}
|
| - |
|
418 |
camerasXMLSnippets.add(this.xmlIndentation[2] + "<ProductImageURL>" + imageUrl + "</ProductImageURL>");
|
| - |
|
419 |
camerasXMLSnippets.add(this.xmlIndentation[1] + "</products>");
|
| - |
|
420 |
}
|
| - |
|
421 |
|
| - |
|
422 |
camerasXMLSnippets.add("</saholic.com>");
|
| - |
|
423 |
|
| - |
|
424 |
String camerasXML = StringUtils.join(camerasXMLSnippets, "\n");
|
| - |
|
425 |
|
| - |
|
426 |
Utils.info(camerasXML);
|
| - |
|
427 |
|
| - |
|
428 |
// Write it to file
|
| - |
|
429 |
String accessoriesXMLFilename = Utils.EXPORT_PARTNERS_CONTENT_PATH + "saholiccameras.xml";
|
| - |
|
430 |
DBUtils.store(camerasXML, accessoriesXMLFilename);
|
| - |
|
431 |
}
|
| - |
|
432 |
|
| 359 |
/**
|
433 |
/**
|
| 360 |
* get xml feed for partner sites
|
434 |
* get xml feed for partner sites
|
| 361 |
* @param irDataXMLSnippets
|
435 |
* @param irDataXMLSnippets
|
| 362 |
* @throws Exception
|
436 |
* @throws Exception
|
| 363 |
*/
|
437 |
*/
|