Subversion Repositories SmartDukaan

Rev

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

Rev 4993 Rev 5118
Line 29... Line 29...
29
import java.util.Arrays;
29
import java.util.Arrays;
30
import java.util.Calendar;
30
import java.util.Calendar;
31
import java.util.Collections;
31
import java.util.Collections;
32
import java.util.Date;
32
import java.util.Date;
33
import java.util.HashMap;
33
import java.util.HashMap;
-
 
34
import java.util.HashSet;
34
import java.util.List;
35
import java.util.List;
35
import java.util.Map;
36
import java.util.Map;
36
import java.util.Map.Entry;
37
import java.util.Map.Entry;
-
 
38
import java.util.Set;
37
 
39
 
38
import org.apache.log4j.Logger;
40
import org.apache.log4j.Logger;
39
import org.apache.thrift.TException;
41
import org.apache.thrift.TException;
40
import org.apache.thrift.transport.TTransportException;
42
import org.apache.thrift.transport.TTransportException;
41
 
43
 
Line 349... Line 351...
349
        }
351
        }
350
        return sourceMap;
352
        return sourceMap;
351
    }
353
    }
352
 
354
 
353
    @Override
355
    @Override
-
 
356
    public Map<Long, String> getShippingWarehouses() {
-
 
357
        Map<Long, String> warehouseMap = new HashMap<Long, String>();
-
 
358
        Set<Long> shippingLocations = new HashSet<Long>();
-
 
359
        try {
-
 
360
            CatalogClient catalogServiceClient = new CatalogClient();
-
 
361
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
-
 
362
 
-
 
363
            List<in.shop2020.model.v1.catalog.Warehouse> warehouses = catalogClient.getAllWarehouses(true);
-
 
364
 
-
 
365
            for(in.shop2020.model.v1.catalog.Warehouse warehouse : warehouses) {
-
 
366
                shippingLocations.add(warehouse.getShippingWarehouseId());
-
 
367
            }
-
 
368
            
-
 
369
            for(in.shop2020.model.v1.catalog.Warehouse warehouse : warehouses) {
-
 
370
                if (shippingLocations.contains(warehouse.getId())) {
-
 
371
                    warehouseMap.put(warehouse.getId(), warehouse.getDisplayName());
-
 
372
                }                
-
 
373
            }
-
 
374
        } catch (Exception e) {
-
 
375
            logger.error("Error while getting all the warehouses:", e );
-
 
376
        }
-
 
377
        return warehouseMap;
-
 
378
    }
-
 
379
 
-
 
380
    @Override
354
    public Map<Long, String> getAllWarehouses() {
381
    public Map<Long, String> getAllWarehouses() {
355
        Map<Long, String> warehouseMap = new HashMap<Long, String>();
382
        Map<Long, String> warehouseMap = new HashMap<Long, String>();
356
        try {
383
        try {
357
            CatalogClient catalogServiceClient = new CatalogClient();
384
            CatalogClient catalogServiceClient = new CatalogClient();
358
            InventoryService.Client catalogClient = catalogServiceClient.getClient();
385
            InventoryService.Client catalogClient = catalogServiceClient.getClient();