Subversion Repositories SmartDukaan

Rev

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

Rev 5306 Rev 5395
Line 69... Line 69...
69
			client = new CatalogClient().getClient();
69
			client = new CatalogClient().getClient();
70
			long warehouseId = Long.parseLong(getId());
70
			long warehouseId = Long.parseLong(getId());
71
			Warehouse warehouse = client.getWarehouse(warehouseId);
71
			Warehouse warehouse = client.getWarehouse(warehouseId);
72
			timestampAndItemIds = warehouse.getVendorString();
72
			timestampAndItemIds = warehouse.getVendorString();
73
 
73
 
74
			client = new CatalogClient().getClient();
-
 
75
			List<String> itemKeys = client.getItemKeysToBeProcessed(warehouseId);
-
 
76
			if (fullPlbSync) {
-
 
77
			    loadHotspotMappings();
-
 
78
			    itemKeys = new ArrayList<String>();
74
			List<String> itemKeys = new ArrayList<String>();
79
			    List<Item> items = fetchItems();
-
 
80
			    for (Item item : items) {
-
 
81
			        if (ItemType.NON_SERIALIZED.equals(item.getType())) {
-
 
82
			            continue;
-
 
83
			        }
-
 
84
 
75
 
-
 
76
			if (!fullPlbSync) {
85
			        if (hotspotMappings.containsKey(item.getId())) {
77
			    client = new CatalogClient().getClient();
86
			            itemKeys.add(hotspotMappings.get(item.getId()));
78
			    itemKeys = client.getItemKeysToBeProcessed(warehouseId);
87
			        }
-
 
88
			    }
-
 
89
			}
79
			}
90
 
80
 
91
			if (!itemKeys.isEmpty()) {
-
 
92
			    for (String itemKey : itemKeys) {
81
			for (String itemKey : itemKeys) {
93
			        timestampAndItemIds += FIELD_DELIMITER + itemKey;
82
			    timestampAndItemIds += FIELD_DELIMITER + itemKey;
94
			    }
-
 
95
			}
83
			}
96
		} catch (Exception e) {
84
		} catch (Exception e) {
97
			logger.error("Error getting the warehouse or setting the timestamp", e);
85
			logger.error("Error getting the warehouse or setting the timestamp", e);
98
		}
86
		}
99
		return new DefaultHttpHeaders("lsuccess");
87
		return new DefaultHttpHeaders("lsuccess");
Line 106... Line 94...
106
        try {
94
        try {
107
            Client snapshotClient = new CatalogClient().getClient();
95
            Client snapshotClient = new CatalogClient().getClient();
108
            return snapshotClient.getAllItems(true);
96
            return snapshotClient.getAllItems(true);
109
        } catch (Exception e) {
97
        } catch (Exception e) {
110
            logger.error("Could not fetch all items. Retrying.", e);
98
            logger.error("Could not fetch all items. Retrying.", e);
111
//            return fetchItems();
99
            return fetchItems();
112
            return new ArrayList<Item>();
-
 
113
        }
100
        }
114
    }
101
    }
115
 
102
 
116
	/**
103
	/**
117
     * @return
104
     * @return
Line 138... Line 125...
138
                            mapping.getItemKey());
125
                            mapping.getItemKey());
139
                }
126
                }
140
            }
127
            }
141
        } catch (Exception e) {
128
        } catch (Exception e) {
142
            logger.error("Could not load vendor item mappings. Trying to reload.", e);
129
            logger.error("Could not load vendor item mappings. Trying to reload.", e);
143
//            loadHotspotMappings();
130
            loadHotspotMappings();
144
        }
131
        }
145
    }
132
    }
146
 
133
 
147
    /**
134
    /**
148
	 * Stores the inventory updates on the history and the production server.
135
	 * Stores the inventory updates on the history and the production server.