| Line 775... |
Line 775... |
| 775 |
public void generateThinkDigitFeed() throws Exception{
|
775 |
public void generateThinkDigitFeed() throws Exception{
|
| 776 |
|
776 |
|
| 777 |
List<String> productXMLSnippets = new ArrayList<String>();
|
777 |
List<String> productXMLSnippets = new ArrayList<String>();
|
| 778 |
productXMLSnippets.add("<root>");
|
778 |
productXMLSnippets.add("<root>");
|
| 779 |
String thinkDigitFeedFileName = Utils.EXPORT_PARTNERS_CONTENT_PATH + "all-categories.xml";
|
779 |
String thinkDigitFeedFileName = Utils.EXPORT_PARTNERS_CONTENT_PATH + "all-categories.xml";
|
| 780 |
cc = new CatalogClient().getClient();
|
- |
|
| 781 |
List<Item> items = cc.getAllItemsByStatus(status.ACTIVE);
|
- |
|
| 782 |
Client catalogClientProd = new CatalogClient(ConfigClientKeys.catalog_service_server_host_prod.toString(), ConfigClientKeys.catalog_service_server_port.toString()).getClient();
|
780 |
Client catalogClientProd = new CatalogClient(ConfigClientKeys.catalog_service_server_host_prod.toString(), ConfigClientKeys.catalog_service_server_port.toString()).getClient();
|
| 783 |
for (Item item : items){
|
781 |
for (Long entityId : entityIdItemMap.keySet()){
|
| - |
|
782 |
List<Item> items = entityIdItemMap.get(entityId);
|
| 784 |
Category parentCategory = Catalog.getInstance().getDefinitionsContainer().getCategory(item.getCategory()).getParentCategory();
|
783 |
Category parentCategory = Catalog.getInstance().getDefinitionsContainer().getCategory(items.get(0).getCategory()).getParentCategory();
|
| 785 |
boolean isActive = true;
|
- |
|
| 786 |
if(!inStockCatalogItemIds.contains(item.getCatalogItemId())) {
|
- |
|
| 787 |
if(item.isRisky()){
|
- |
|
| 788 |
try {
|
784 |
|
| 789 |
ItemShippingInfo isi = catalogClientProd.isActive(item.getId());
|
- |
|
| 790 |
isActive = isi.isIsActive();
|
- |
|
| 791 |
} catch (Exception e) {
|
785 |
for(Item item: items){
|
| 792 |
Utils.info("Some problem Occurred while fetching shippingInfo for catalogitem " + item.getCatalogItemId() + "\n" +e + "\nTrying again");
|
- |
|
| 793 |
try {
|
- |
|
| 794 |
catalogClientProd = new CatalogClient(ConfigClientKeys.catalog_service_server_host_prod.toString(), ConfigClientKeys.catalog_service_server_port.toString()).getClient();
|
- |
|
| 795 |
ItemShippingInfo isi = catalogClientProd.isActive(item.getId());
|
- |
|
| 796 |
isActive = isi.isIsActive();
|
786 |
if(!item.getItemStatus().equals(status.ACTIVE)){
|
| 797 |
} catch (Exception e1) {
|
- |
|
| 798 |
Utils.info("Some problem in catalog Service for catalog item " + item.getCatalogItemId()+ " . Marking it true");
|
- |
|
| 799 |
isActive = true;
|
- |
|
| 800 |
}
|
- |
|
| 801 |
}
|
787 |
continue;
|
| 802 |
}
|
788 |
}
|
| - |
|
789 |
boolean isActive = true;
|
| - |
|
790 |
if(!inStockCatalogItemIds.contains(entityId)) {
|
| - |
|
791 |
if(item.isRisky()){
|
| - |
|
792 |
try {
|
| - |
|
793 |
ItemShippingInfo isi = catalogClientProd.isActive(item.getId());
|
| - |
|
794 |
isActive = isi.isIsActive();
|
| - |
|
795 |
} catch (Exception e) {
|
| - |
|
796 |
Utils.info("Some problem Occurred while fetching shippingInfo for catalogitem " + item.getCatalogItemId() + "\n" +e + "\nTrying again");
|
| - |
|
797 |
try {
|
| - |
|
798 |
catalogClientProd = new CatalogClient(ConfigClientKeys.catalog_service_server_host_prod.toString(), ConfigClientKeys.catalog_service_server_port.toString()).getClient();
|
| - |
|
799 |
ItemShippingInfo isi = catalogClientProd.isActive(item.getId());
|
| - |
|
800 |
isActive = isi.isIsActive();
|
| - |
|
801 |
} catch (Exception e1) {
|
| - |
|
802 |
Utils.info("Some problem in catalog Service for catalog item " + item.getCatalogItemId()+ " . Marking it true");
|
| - |
|
803 |
isActive = true;
|
| - |
|
804 |
}
|
| - |
|
805 |
}
|
| - |
|
806 |
}
|
| 803 |
if(isActive) {
|
807 |
if(isActive) {
|
| 804 |
inStockCatalogItemIds.add(item.getCatalogItemId());
|
808 |
inStockCatalogItemIds.add(item.getCatalogItemId());
|
| 805 |
if(validParentCategories.contains(parentCategory.getID())) {
|
809 |
if(validParentCategories.contains(parentCategory.getID())) {
|
| 806 |
productXMLSnippets.add(this.xmlIndentation[1] + "<products>");
|
810 |
productXMLSnippets.add(this.xmlIndentation[1] + "<products>");
|
| 807 |
productXMLSnippets.add(this.xmlIndentation[2] + "<id>" + item.getCatalogItemId() + "</id>");
|
811 |
productXMLSnippets.add(this.xmlIndentation[2] + "<id>" + item.getCatalogItemId() + "</id>");
|
| 808 |
productXMLSnippets.add(this.xmlIndentation[2] + "<product>" + getProductTitle(item) + "</product>");
|
812 |
productXMLSnippets.add(this.xmlIndentation[2] + "<product>" + getProductTitle(item) + "</product>");
|
| 809 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Product_URL>" + getProductURL(item.getCatalogItemId(), item, 59) + "</Product_URL>");
|
813 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Product_URL>" + getProductURL(item.getCatalogItemId(), item, 59) + "</Product_URL>");
|
| 810 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Product_Price>" + (int)item.getSellingPrice() + "</Product_Price>");
|
814 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Product_Price>" + (int)item.getSellingPrice() + "</Product_Price>");
|
| 811 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Merchant_Name>" + "saholic.com" + "</Merchant_Name>");
|
815 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Merchant_Name>" + "saholic.com" + "</Merchant_Name>");
|
| 812 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Category_Name>" + parentCategory.getLabel() + "</Category_Name>");
|
816 |
productXMLSnippets.add(this.xmlIndentation[2] + "<Category_Name>" + parentCategory.getLabel() + "</Category_Name>");
|
| 813 |
productXMLSnippets.add(this.xmlIndentation[1] + "</products>");
|
817 |
productXMLSnippets.add(this.xmlIndentation[1] + "</products>");
|
| - |
|
818 |
}
|
| 814 |
}
|
819 |
}
|
| 815 |
}
|
820 |
}
|
| 816 |
}
|
821 |
}
|
| 817 |
}
|
822 |
}
|
| 818 |
productXMLSnippets.add("</root>");
|
823 |
productXMLSnippets.add("</root>");
|