Subversion Repositories SmartDukaan

Rev

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

Rev 2943 Rev 2949
Line 42... Line 42...
42
	public LatestArrivalsController() {
42
	public LatestArrivalsController() {
43
		super();
43
		super();
44
		try {
44
		try {
45
			catalogClientService = new CatalogServiceClient();
45
			catalogClientService = new CatalogServiceClient();
46
		} catch (Exception e) {
46
		} catch (Exception e) {
47
			log.error("Unable to get catalog service client.");
47
			log.error("Unable to get catalog service client.", e);
48
			e.printStackTrace();
-
 
49
		}
48
		}
50
	}
49
	}
51
    
50
    
52
    // GET /index
51
    // GET /index
53
    public HttpHeaders index() throws Exception {
52
    public HttpHeaders index() throws Exception {
Line 67... Line 66...
67
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
66
    	in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
68
    	try {
67
    	try {
69
			this.setTotalItems(client.getLatestArrivalsCount());
68
			this.setTotalItems(client.getLatestArrivalsCount());
70
			this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, null, -1);
69
			this.items = client.getLatestArrivalsCatalogIds(beginIndex, windowSize, null, -1);
71
		} catch (InventoryServiceException e) {
70
		} catch (InventoryServiceException e) {
72
			log.error("Unable to get latest arrivals from inventory service.");
71
			log.error("Unable to get latest arrivals from inventory service.", e);
73
			log.error("Exception id is:"  + e.getId() + " Exception message is:" + e.getMessage());
-
 
74
			e.printStackTrace();
-
 
75
		} catch (TException e) {
72
		} catch (TException e) {
76
			log.error("Unable to get latest arrivals from inventory service.");
73
			log.error("Unable to get latest arrivals from inventory service.", e);
77
			log.error(" Exception message is:" + e.getMessage());
-
 
78
			e.printStackTrace();
-
 
79
		}
74
		}
80
    	return new DefaultHttpHeaders("show");
75
    	return new DefaultHttpHeaders("show");
81
    }
76
    }
82
    
77
    
83
    public List<String> getItems(){
78
    public List<String> getItems(){
Line 85... Line 80...
85
    	if(items != null){
80
    	if(items != null){
86
    		for(long item: items){
81
    		for(long item: items){
87
    			try{
82
    			try{
88
    				snippets.add(FileUtils.read( Utils.EXPORT_ENTITIES_PATH + item + File.separator +"CategorySnippet.html"));
83
    				snippets.add(FileUtils.read( Utils.EXPORT_ENTITIES_PATH + item + File.separator +"CategorySnippet.html"));
89
    			}catch(IOException ioex){
84
    			}catch(IOException ioex){
90
    				ioex.printStackTrace();
-
 
91
    				log.error(ioex);
85
    				log.error("Unable to read snippet for " + item, ioex);
92
    			}
86
    			}
93
			}
87
			}
94
    	}
88
    	}
95
		
89
		
96
    	return snippets;
90
    	return snippets;