Subversion Repositories SmartDukaan

Rev

Rev 773 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 773 Rev 786
Line 169... Line 169...
169
			for(Long item: items){
169
			for(Long item: items){
170
				itemList.add(FileUtils.read( Utils.EXPORT_ENTITIES_PATH + item + File.separator +"HomeSnippet.html"));
170
				itemList.add(FileUtils.read( Utils.EXPORT_ENTITIES_PATH + item + File.separator +"HomeSnippet.html"));
171
			}
171
			}
172
			context.put("itemList", itemList);
172
			context.put("itemList", itemList);
173
			
173
			
-
 
174
		} catch (InventoryServiceException e) {
-
 
175
			// TODO Auto-generated catch block
-
 
176
			e.printStackTrace();
-
 
177
		} catch (TException e) {
-
 
178
			// TODO Auto-generated catch block
-
 
179
			e.printStackTrace();
174
		} catch(Exception e){
180
		} catch (Exception e) {
-
 
181
			// TODO Auto-generated catch block
175
			
182
			e.printStackTrace();
176
		}finally{
183
		} finally{
177
			catalogServiceClient.closeConnection();
184
			catalogServiceClient.closeConnection();
178
		}
185
		}
179
		
186
		
180
		htmlString = getHtmlFromVelocity(templateFile, context);
187
		htmlString = getHtmlFromVelocity(templateFile, context);
181
		return htmlString;
188
		return htmlString;
Line 700... Line 707...
700
		htmlString = getHtmlFromVelocity(templateFile, context);
707
		htmlString = getHtmlFromVelocity(templateFile, context);
701
		return htmlString;
708
		return htmlString;
702
	}
709
	}
703
 
710
 
704
 
711
 
705
	public String getCartDetailsHtml(long cartId, String errorMsg) {
712
	public String getCartDetailsHtml(long userId, long cartId, String errorMsg) {
706
		String htmlString = "";
713
		String htmlString = "";
707
		VelocityContext context = new VelocityContext();
714
		VelocityContext context = new VelocityContext();
708
		String templateFile = "templates/cartdetails.vm";
715
		String templateFile = "templates/cartdetails.vm";
709
		List<Map<String,String>> items = null;
716
		List<Map<String,String>> items = null;
710
		double totalamount= 0.0;
717
		double totalamount= 0.0;
711
		
718
		
712
		UserContextServiceClient userServiceClient = null;
719
		UserContextServiceClient userServiceClient = null;
713
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
720
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
714
		CatalogServiceClient catalogServiceClient  = null;
721
		CatalogServiceClient catalogServiceClient  = null;
715
		in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
722
		in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
716
		
723
		String pincode = "110001";
717
		try {
724
		try {
718
			catalogServiceClient = new CatalogServiceClient();
725
			catalogServiceClient = new CatalogServiceClient();
719
			catalogClient = catalogServiceClient.getClient();
726
			catalogClient = catalogServiceClient.getClient();
720
			userServiceClient = new UserContextServiceClient();
727
			userServiceClient = new UserContextServiceClient();
721
			userClient = userServiceClient.getClient();
728
			userClient = userServiceClient.getClient();
722
			
729
			
-
 
730
			pincode = userClient.getDefaultPincode(userId);
723
			Cart cart = userClient.getCart(cartId);
731
			Cart cart = userClient.getCart(cartId);
724
			List<Line> lineItems = cart.getLines();
732
			List<Line> lineItems = cart.getLines();
725
			if(lineItems.size() != 0){
733
			if(lineItems.size() != 0){
726
				items = new ArrayList<Map<String,String>>();
734
				items = new ArrayList<Map<String,String>>();
727
				for (Line line : lineItems) {
735
				for (Line line : lineItems) {
Line 752... Line 760...
752
		}
760
		}
753
			
761
			
754
		context.put("items", items);
762
		context.put("items", items);
755
		context.put("totalamount", ((int)totalamount)+"");
763
		context.put("totalamount", ((int)totalamount)+"");
756
		context.put("errorMsg", errorMsg);
764
		context.put("errorMsg", errorMsg);
-
 
765
		context.put("pincode", pincode);
757
		htmlString = getHtmlFromVelocity(templateFile, context);
766
		htmlString = getHtmlFromVelocity(templateFile, context);
758
		return htmlString;
767
		return htmlString;
759
	}
768
	}
760
 
769
 
761
	public String getHtmlFromVelocity(String templateFile, VelocityContext context){
770
	public String getHtmlFromVelocity(String templateFile, VelocityContext context){