Subversion Repositories SmartDukaan

Rev

Rev 2105 | Rev 2126 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1961 ankur.sing 1
package in.shop2020.catalog.dashboard.server;
2
 
3
import in.shop2020.catalog.dashboard.client.CatalogService;
4
import in.shop2020.catalog.dashboard.shared.Item;
2068 ankur.sing 5
import in.shop2020.catalog.dashboard.shared.ItemsComparator;
2119 ankur.sing 6
import in.shop2020.catalog.dashboard.shared.VendorItemMapping;
7
import in.shop2020.catalog.dashboard.shared.VendorPricings;
1961 ankur.sing 8
import in.shop2020.model.v1.catalog.InventoryService;
2105 ankur.sing 9
import in.shop2020.model.v1.catalog.status;
1961 ankur.sing 10
import in.shop2020.thrift.clients.CatalogServiceClient;
2119 ankur.sing 11
import in.shop2020.utils.CategoryManager;
1961 ankur.sing 12
 
13
import java.util.ArrayList;
2105 ankur.sing 14
import java.util.Calendar;
2068 ankur.sing 15
import java.util.Collections;
1992 ankur.sing 16
import java.util.HashMap;
1961 ankur.sing 17
import java.util.List;
1992 ankur.sing 18
import java.util.Map;
1961 ankur.sing 19
 
20
import com.google.gwt.core.client.GWT;
21
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
22
 
23
@SuppressWarnings("serial")
24
public class CatalogServiceImpl extends RemoteServiceServlet implements CatalogService {
25
 
26
    public List<Item> getAllItems(){
27
        List<Item> itemList = new ArrayList<Item>();
28
 
29
        try {
30
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
31
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
32
 
2119 ankur.sing 33
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllItems(false);
34
 
35
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
36
                //List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
37
                itemList.add(getItemFromThriftItem(thriftItem, null, null));
38
            }
39
        } catch (Exception e) {
40
            e.printStackTrace();
41
        }
42
        Collections.sort(itemList, new ItemsComparator());
43
        return itemList;
44
    }
45
 
46
    public List<Item> getAllActiveItems(){
47
        List<Item> itemList = new ArrayList<Item>();
48
 
49
        try {
50
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
51
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
52
 
1961 ankur.sing 53
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getAllItems(true);
1992 ankur.sing 54
 
55
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
2105 ankur.sing 56
                //List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
57
                itemList.add(getItemFromThriftItem(thriftItem, null, null));
1992 ankur.sing 58
            }
1961 ankur.sing 59
        } catch (Exception e) {
60
            e.printStackTrace();
61
        }
2068 ankur.sing 62
        Collections.sort(itemList, new ItemsComparator());
1961 ankur.sing 63
        return itemList;
64
    }
65
 
66
    public List<Item> getBestDeals(){
67
        List<Item> itemList = new ArrayList<Item>();
68
 
69
        try {
70
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
71
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
72
 
73
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getBestDeals();
1992 ankur.sing 74
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
2105 ankur.sing 75
                //List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
76
                itemList.add(getItemFromThriftItem(thriftItem, null, null));
1992 ankur.sing 77
            }
1961 ankur.sing 78
        } catch(Exception e){
79
            e.printStackTrace();
80
        }
2068 ankur.sing 81
        Collections.sort(itemList, new ItemsComparator());
1961 ankur.sing 82
        return itemList;
83
    }
84
 
85
    public List<Item> getBestSellers(){
86
        List<Item> itemList = new ArrayList<Item>();
87
 
88
        try {
89
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
90
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
91
 
92
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getBestSellers();
1992 ankur.sing 93
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
2105 ankur.sing 94
                //List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
95
                itemList.add(getItemFromThriftItem(thriftItem, null, null));
1992 ankur.sing 96
            }
1961 ankur.sing 97
        } catch(Exception e){
98
            e.printStackTrace();
99
        }
2068 ankur.sing 100
        Collections.sort(itemList, new ItemsComparator());
1961 ankur.sing 101
        return itemList;        
102
    }
103
 
104
    public List<Item> getLatestArrivals(){
105
        List<Item> itemList = new ArrayList<Item>();
106
 
107
        try {
108
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
109
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
110
 
111
            List<in.shop2020.model.v1.catalog.Item> thriftItems = catalogClient.getLatestArrivals();
1992 ankur.sing 112
            for(in.shop2020.model.v1.catalog.Item thriftItem : thriftItems) {
2105 ankur.sing 113
                //List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
114
                itemList.add(getItemFromThriftItem(thriftItem, null, null));
1992 ankur.sing 115
            }
1961 ankur.sing 116
        } catch(Exception e){
117
            e.printStackTrace();
118
        }
2068 ankur.sing 119
        Collections.sort(itemList, new ItemsComparator());
1961 ankur.sing 120
        return itemList;
121
    }
122
 
123
    public Item getItem(long itemId){
124
        try{
125
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
126
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
127
            in.shop2020.model.v1.catalog.Item thriftItem = catalogClient.getItem(itemId);
1992 ankur.sing 128
 
129
            List<in.shop2020.model.v1.catalog.VendorItemPricing> vip = catalogClient.getAllItemPricing(thriftItem.getId());
2119 ankur.sing 130
            List<in.shop2020.model.v1.catalog.VendorItemMapping> vim = catalogClient.getVendorItemMappings(thriftItem.getId());
131
            return getItemFromThriftItem(thriftItem, vip, vim);
1961 ankur.sing 132
        }catch(Exception e){
133
            // Oops! We didn't receive the details. We should let the user know
134
            // that the catalog service is currently unavailable.
135
            e.printStackTrace();
136
        }
137
        return null;
138
    }
139
 
2105 ankur.sing 140
    private Item getItemFromThriftItem(in.shop2020.model.v1.catalog.Item thriftItem, 
141
            List<in.shop2020.model.v1.catalog.VendorItemPricing> tVendorPricings, 
142
            List<in.shop2020.model.v1.catalog.VendorItemMapping> tVendorMappings){
1992 ankur.sing 143
 
2119 ankur.sing 144
        Map<Long, VendorItemMapping> vItemMap = new HashMap<Long, VendorItemMapping>();
145
        VendorItemMapping vItemMapping;
2105 ankur.sing 146
        if(tVendorMappings != null) {
2119 ankur.sing 147
            for(in.shop2020.model.v1.catalog.VendorItemMapping vim : tVendorMappings) {
148
                vItemMapping = new VendorItemMapping();
149
                vItemMapping.setVendorId(vim.getVendorId());
150
                vItemMapping.setItemKey(vim.getItemKey());
151
                vItemMap.put(vItemMapping.getVendorId(), vItemMapping);
1992 ankur.sing 152
            }
153
        }
2119 ankur.sing 154
 
155
        // TODO: For testing. Remove this code before moving to production.
156
        /* 
157
        Map<Long, VendorItemMapping> vItemMap = new HashMap<Long, VendorItemMapping>();
158
        vItemMap.put(1L, new VendorItemMapping(1, "Item Key Test 1"));
159
        vItemMap.put(1L, new VendorItemMapping(1, "Item Key Test 2"));
160
        */
161
 
162
        Map<Long, VendorPricings> vendorPricingMap = new HashMap<Long, VendorPricings>();
163
        VendorPricings vPricings;
2105 ankur.sing 164
        if(tVendorPricings != null) {
2119 ankur.sing 165
            for(in.shop2020.model.v1.catalog.VendorItemPricing vip : tVendorPricings) {
166
                vPricings = new VendorPricings();
167
                vPricings.setVendorId(vip.getVendorId());
168
                vPricings.setMop(vip.getMop());
169
                vPricings.setDealerPrice(vip.getDealerPrice());
170
                vPricings.setTransferPrice(vip.getTransferPrice());
171
                vendorPricingMap.put(vPricings.getVendorId(), vPricings);
2105 ankur.sing 172
            }
173
        }
174
 
1961 ankur.sing 175
        Item item = new Item(thriftItem.getId(),
176
                thriftItem.getProductGroup(),
177
                thriftItem.getBrand(),
178
                thriftItem.getModelNumber(),
179
                thriftItem.getModelName(),
180
                thriftItem.getColor(),
2119 ankur.sing 181
                //thriftItem.getCategory(),
182
                CategoryManager.getCategoryManager().getCategoryLabel(thriftItem.getCategory()),
1961 ankur.sing 183
                thriftItem.getComments(),
184
                thriftItem.getCatalogItemId(),
185
                thriftItem.getFeatureId(),
186
                thriftItem.getFeatureDescription(),
187
                thriftItem.getMrp(),
188
                thriftItem.getMop(),
189
                thriftItem.getSellingPrice(),
190
                thriftItem.getDealerPrice(),
191
                thriftItem.getWeight(),
192
                thriftItem.getAddedOn(),
193
                thriftItem.getStartDate(),
194
                thriftItem.getRetireDate(),
195
                thriftItem.getUpdatedOn(),
1992 ankur.sing 196
                thriftItem.getItemStatus().name(),
1961 ankur.sing 197
                thriftItem.getOtherInfo(),
198
                thriftItem.getBestDealText(),
1992 ankur.sing 199
                thriftItem.getBestDealValue(),
2066 ankur.sing 200
                thriftItem.getBestSellingRank(),
201
                thriftItem.isDefaultForEntity(),
1992 ankur.sing 202
                (thriftItem.getItemInventory() != null ? thriftItem.getItemInventory().getAvailability() : null),
2119 ankur.sing 203
                vendorPricingMap,
204
                vItemMap
1992 ankur.sing 205
                );
1961 ankur.sing 206
        return item;
207
    }
208
 
209
    @Override
1992 ankur.sing 210
    public boolean updateItem(Item item) {
211
        GWT.log("Got a call to update item, Item Id: " + item.getId());
1961 ankur.sing 212
        try{
213
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
214
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
1992 ankur.sing 215
 
216
            in.shop2020.model.v1.catalog.Item tItem = catalogClient.getItem(item.getId());
2027 ankur.sing 217
            tItem.setProductGroup(item.getProductGroup());
218
            tItem.setBrand(item.getBrand());
219
            tItem.setModelName(item.getModelName());
220
            tItem.setModelNumber(item.getModelNumber());
221
            tItem.setColor(item.getColor());
1992 ankur.sing 222
 
2027 ankur.sing 223
            tItem.setComments(item.getComments());
224
 
1992 ankur.sing 225
            tItem.setMrp(item.getMrp());
226
            tItem.setSellingPrice(item.getSellingPrice());
227
            tItem.setWeight(item.getWeight());
228
 
2027 ankur.sing 229
            tItem.setMop(item.getMop());
230
            tItem.setDealerPrice(item.getDealerPrice());
231
            tItem.setTransferPrice(item.getTransferPrice());
232
 
233
            tItem.setBestDealText(item.getBestDealsText());
234
            tItem.setBestDealValue(item.getBestDealsValue());
2066 ankur.sing 235
            tItem.setBestSellingRank(item.getBestSellingRank());
236
            tItem.setDefaultForEntity(item.isDefaultForEntity());
2027 ankur.sing 237
 
2068 ankur.sing 238
            tItem.setStartDate(item.getStartDate());
2027 ankur.sing 239
//          tItem.setAddedOn(item.getAddedOn());
240
 
241
//          tItem.setCatalogItemId(item.getCatalogItemId());
242
//          tItem.setCategory(item.getCategory());
243
 
244
//          tItem.setFeatureId(item.getFeatureId());
245
//          tItem.setFeatureDescription(item.getFeatureDescription());
246
 
2105 ankur.sing 247
            long rItemId;
248
            if((rItemId = catalogClient.updateItem(tItem)) != item.getId()) {
249
                GWT.log("Error updating item, returned Item Id: " + rItemId);
250
                return false;
251
            }
252
            GWT.log("Item updated successfully, Item Id: " + item.getId());
253
 
2119 ankur.sing 254
            Map<Long, VendorItemMapping> vendorMappings = item.getVendorMappingsMap();
255
            if(vendorMappings != null && !vendorMappings.isEmpty()) {
256
                in.shop2020.model.v1.catalog.VendorItemMapping tVendorMapping;
257
                for(VendorItemMapping v : vendorMappings.values()) {
258
                    tVendorMapping = new in.shop2020.model.v1.catalog.VendorItemMapping();
259
                    tVendorMapping.setVendorId(v.getVendorId());
260
                    tVendorMapping.setItemKey(v.getItemKey());
261
                    tVendorMapping.setItemId(item.getId());
262
                    tVendorMapping.setVendorCategory(item.getVendorCategory());
263
                    catalogClient.addVendorItemMapping(tVendorMapping);
264
                    GWT.log("VendorItemMapping updated. " + tVendorMapping.getVendorId() + ", " + tVendorMapping.getItemId() + ", " +
265
                            tVendorMapping.getItemKey() + ", " + tVendorMapping.getVendorCategory());
266
                }
267
            }
268
 
269
            Map<Long, VendorPricings> vendorPricings = item.getVendorPricesMap();
270
            if(vendorPricings != null && !vendorPricings.isEmpty()) {
2105 ankur.sing 271
                in.shop2020.model.v1.catalog.VendorItemPricing tVendorPricing;
2119 ankur.sing 272
                for(VendorPricings v : vendorPricings.values()) {
273
                    tVendorPricing = new in.shop2020.model.v1.catalog.VendorItemPricing();
2105 ankur.sing 274
                    tVendorPricing.setVendorId(v.getVendorId());
275
                    tVendorPricing.setItemId(item.getId());
276
                    tVendorPricing.setMop(v.getMop());
277
                    tVendorPricing.setTransferPrice(v.getTransferPrice());
278
                    tVendorPricing.setDealerPrice(v.getDealerPrice());
279
                    catalogClient.addVendorItemPricing(tVendorPricing);
280
                    GWT.log("VendorItemPricing updated. " + tVendorPricing.getVendorId() + ", " + tVendorPricing.getItemId() + ", " +
281
                            tVendorPricing.getMop() + ", " + tVendorPricing.getTransferPrice() + ", " + tVendorPricing.getDealerPrice());
282
                }
283
            }
284
 
285
        }catch(Exception e){
286
            e.printStackTrace();
287
        }
288
        return true;
289
 
290
 
2066 ankur.sing 291
            /*List<VendorItemPricing> tVendorPrices = tItem.getVendorPrices();
292
            if(tVendorPrices == null) {
293
                tVendorPrices = new ArrayList<VendorItemPricing>();
294
            }
295
            for(Entry<Long, double[]> vendorItemPricing : item.getVendorPricings().entrySet()) {
296
                VendorItemPricing vip = null;
297
                for(VendorItemPricing v : tVendorPrices) {
298
                    if(v.getVendorId() == vendorItemPricing.getKey()) {
299
                        vip = v;
300
                        break;
301
                    }
302
                }
303
                if(vip == null) {
304
                    vip = new VendorItemPricing();
305
                    tVendorPrices.add(vip);
306
                }
307
                vip.setItemId(item.getId());
308
                vip.setVendorId(vendorItemPricing.getKey());
309
                vip.setMop(vendorItemPricing.getValue()[Item.INDEX_MOP]);
310
                vip.setDealerPrice(vendorItemPricing.getValue()[Item.INDEX_DP]);
311
                vip.setTransferPrice(vendorItemPricing.getValue()[Item.INDEX_TP]);
312
                //catalogClient.updateVendorItemPricing(vip);
313
            }*/
1961 ankur.sing 314
    }
2066 ankur.sing 315
 
316
 
317
    @Override
318
    public Map<Long, String> getAllVendors() {
319
        Map<Long, String> vendorMap = new HashMap<Long, String>();
320
        try {
321
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
322
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
323
 
324
            List<in.shop2020.model.v1.catalog.Vendor> vendors = catalogClient.getAllVendors();
325
 
326
            for(in.shop2020.model.v1.catalog.Vendor v : vendors) {
327
                vendorMap.put(v.getId(), v.getName());
328
            }
329
        } catch (Exception e) {
330
            e.printStackTrace();
331
        }
332
        return vendorMap;
333
    }
334
 
335
    @Override
336
    public Map<Long, String> getAllWarehouses() {
337
        Map<Long, String> warehouseMap = new HashMap<Long, String>();
338
        try {
339
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
340
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
341
 
342
            List<in.shop2020.model.v1.catalog.Warehouse> warehouses = catalogClient.getAllWarehouses(true);
343
 
344
            for(in.shop2020.model.v1.catalog.Warehouse w : warehouses) {
345
                warehouseMap.put(w.getId(), w.getDisplayName());
346
            }
347
        } catch (Exception e) {
348
            e.printStackTrace();
349
        }
350
        return warehouseMap;
351
    }
2105 ankur.sing 352
 
353
    @Override
354
    public void phaseoutItem(long itemId) {
355
        try {
356
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
357
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
358
 
359
            catalogClient.changeItemStatus(itemId, Calendar.getInstance().getTimeInMillis(), status.PHASED_OUT);
360
        } catch (Exception e) {
361
            e.printStackTrace();
362
        }
363
    }
364
 
365
    @Override
366
    public void activateItem(long itemId) {
367
        try {
368
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
369
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
370
 
371
            catalogClient.changeItemStatus(itemId, Calendar.getInstance().getTimeInMillis(), status.ACTIVE);
372
        } catch (Exception e) {
373
            e.printStackTrace();
374
        }
375
    }
376
 
377
 
378
 
379
    @Override
380
    public long addItem(Item item) {
381
        long itemId = 0;
382
        try {
383
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
384
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
385
 
386
            in.shop2020.model.v1.catalog.Item tItem = new in.shop2020.model.v1.catalog.Item();
387
 
388
            tItem.setProductGroup(item.getProductGroup());
389
            tItem.setBrand(item.getBrand());
390
            tItem.setModelNumber(item.getModelNumber());
391
            tItem.setModelName(item.getModelName());
392
            tItem.setColor(item.getColor());
393
            tItem.setComments(item.getComments());
394
            tItem.setMrp(item.getMrp());
395
            tItem.setSellingPrice(item.getSellingPrice());
396
            tItem.setWeight(item.getWeight());
397
            tItem.setAddedOn(Calendar.getInstance().getTimeInMillis());
398
            tItem.setUpdatedOn(Calendar.getInstance().getTimeInMillis());
399
            tItem.setRetireDate(item.getRetireDate());
400
            tItem.setStartDate(item.getStartDate());
401
            tItem.setBestDealText(item.getBestDealsText());
402
            tItem.setBestDealValue(item.getBestDealsValue());
403
            tItem.setBestSellingRank(item.getBestSellingRank());
404
            tItem.setDefaultForEntity(item.isDefaultForEntity());
405
            tItem.setHotspotCategory(item.getVendorCategory());
406
 
407
            itemId = catalogClient.addItem(tItem);
408
 
2119 ankur.sing 409
            Map<Long, VendorPricings> vendorPricings = item.getVendorPricesMap();
410
            if(vendorPricings != null && !vendorPricings.isEmpty()) {
2105 ankur.sing 411
                in.shop2020.model.v1.catalog.VendorItemPricing tVendorPricing;
2119 ankur.sing 412
                for(VendorPricings v : vendorPricings.values()) {
413
                    tVendorPricing = new in.shop2020.model.v1.catalog.VendorItemPricing();
414
                    tVendorPricing.setVendorId(v.getVendorId());
415
                    tVendorPricing.setItemId(itemId);
416
                    tVendorPricing.setMop(v.getMop());
417
                    tVendorPricing.setTransferPrice(v.getTransferPrice());
418
                    tVendorPricing.setDealerPrice(v.getDealerPrice());
419
                    catalogClient.addVendorItemPricing(tVendorPricing);
420
                }
421
            }
422
 
423
            Map<Long, VendorItemMapping> vendorKeysMap = item.getVendorMappingsMap();
424
            if(vendorKeysMap != null && !vendorKeysMap.isEmpty()) {
2105 ankur.sing 425
                in.shop2020.model.v1.catalog.VendorItemMapping tVendorMapping;
2119 ankur.sing 426
                for(VendorItemMapping v : vendorKeysMap.values()) {
427
                    tVendorMapping = new in.shop2020.model.v1.catalog.VendorItemMapping();
2105 ankur.sing 428
                    tVendorMapping.setVendorId(v.getVendorId());
429
                    tVendorMapping.setItemKey(v.getItemKey());
430
                    tVendorMapping.setItemId(itemId);
431
                    tVendorMapping.setVendorCategory(item.getVendorCategory());
432
                    catalogClient.addVendorItemMapping(tVendorMapping);
433
                }
434
            }
2119 ankur.sing 435
 
436
 
437
 
2105 ankur.sing 438
            /*Map<Long, double[]> vendors = item.getVendorPricings();
439
            List<VendorItemPricing> vPricesList;
440
            if(vendors != null && !vendors.isEmpty()) {
441
                vPricesList = new ArrayList<VendorItemPricing>();
442
                VendorItemPricing vendorPrices = null;
443
                for(Entry<Long, double[]> v : vendors.entrySet()) {
444
                    vendorPrices = new VendorItemPricing(v.getKey(), item.getId(), 
445
                            v.getValue()[Item.INDEX_TP], v.getValue()[Item.INDEX_MOP], v.getValue()[Item.INDEX_DP]);
446
                    vPricesList.add(vendorPrices);
447
                }
448
                boolean itemExists = catalogClient.itemExists(item.getProductGroup(), item.getHbrand(), item.getHmodelNumber(), 
449
                        item.getHcolor(), vendorPrices.getVendorId(), item.getVendorCategory());
450
                if(itemExists) {
451
                    return itemId;
452
                }
453
            } else {
454
                return 0;
455
            }
456
            catalogClient.addVendorItemPricing(vendorItemPricing)
457
            */
458
 
459
        } catch (Exception e) {
460
            e.printStackTrace();
461
        }
462
        return itemId;
463
    }
2119 ankur.sing 464
 
465
    @Override
466
    public long checkSimilarItem(String productGroup, String brand, String modelNumber, String color) {
467
 
468
        try {
469
            CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
470
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
471
            return catalogClient.checkSimilarItem(productGroup, brand, modelNumber, color);
472
        } catch (Exception e) {
473
            // TODO Auto-generated catch block
474
            e.printStackTrace();
475
        }
476
        return 0;
477
    }
1961 ankur.sing 478
}