Subversion Repositories SmartDukaan

Rev

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

Rev 3850 Rev 3872
Line 148... Line 148...
148
            logger.error("Error while getting the best sellers from the catalog service", e);
148
            logger.error("Error while getting the best sellers from the catalog service", e);
149
        }
149
        }
150
        return itemList;        
150
        return itemList;        
151
    }
151
    }
152
 
152
 
-
 
153
    @Override
153
    public List<Item> getLatestArrivals(){
154
    public List<Item> getLatestArrivals(){
154
        List<Item> itemList = new ArrayList<Item>();
155
        List<Item> itemList = new ArrayList<Item>();
155
 
156
 
156
        try {
157
        try {
157
            CatalogClient catalogServiceClient = new CatalogClient();
158
            CatalogClient catalogServiceClient = new CatalogClient();
Line 166... Line 167...
166
            logger.error("Error while getting the latest arrivals from the catalog service", e);
167
            logger.error("Error while getting the latest arrivals from the catalog service", e);
167
        }
168
        }
168
        return itemList;
169
        return itemList;
169
    }
170
    }
170
 
171
 
-
 
172
    @Override
-
 
173
    public List<Item> searchItems(int start, int limit, List<String> searchTerms) {
-
 
174
        List<Item> itemList = new ArrayList<Item>();
-
 
175
 
-
 
176
        try {
-
 
177
            CatalogClient catalogServiceClient = new CatalogClient();
-
 
178
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
-
 
179
 
-
 
180
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.searchItemsInRange(searchTerms, start, limit);
-
 
181
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
-
 
182
                itemList.add(getItemFromThriftItem(thriftItem, null, null, null));
-
 
183
            }
-
 
184
        } catch(Exception e){
-
 
185
            logger.error("Error while getting the search results from the catalog service", e);
-
 
186
        }
-
 
187
        return itemList;
-
 
188
    }
-
 
189
    
-
 
190
    @Override
-
 
191
    public int getSearchResultCount(List<String> searchTerms){
-
 
192
        int count = 0;
-
 
193
        try {
-
 
194
            CatalogClient catalogServiceClient = new CatalogClient();
-
 
195
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
-
 
196
 
-
 
197
            count = catalogClient.getSearchResultCount(searchTerms);
-
 
198
        } catch(Exception e){
-
 
199
            logger.error("Error while getting the search results from the catalog service", e);
-
 
200
        }
-
 
201
        
-
 
202
        return count;
-
 
203
    }
-
 
204
    
171
    public Item getItem(long itemId){
205
    public Item getItem(long itemId){
172
        try{
206
        try{
173
            CatalogClient catalogServiceClient = new CatalogClient();
207
            CatalogClient catalogServiceClient = new CatalogClient();
174
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
208
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
175
            in.shop2020.model.v1.catalog.Item thriftItem = catalogClient.getItem(itemId);
209
            in.shop2020.model.v1.catalog.Item thriftItem = catalogClient.getItem(itemId);