Subversion Repositories SmartDukaan

Rev

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

Rev 615 Rev 620
Line 345... Line 345...
345
		return htmlString;
345
		return htmlString;
346
	}
346
	}
347
 
347
 
348
 
348
 
349
 
349
 
350
	private String getAccessoriesHtml(long productId) {
350
	public String getAccessoriesHtml(long productId) {
351
		return getWidgetDiv(0, WidgetType.ACCESSORIES, "accessories.vm");
351
		return getWidgetDiv(0, WidgetType.ACCESSORIES, "accessories.vm");
352
	}
352
	}
353
 
353
 
354
 
354
 
355
 
355
 
356
	private String getSimilarProductsHtml(long productId) {
356
	public String getSimilarProductsHtml(long productId) {
357
		return getWidgetDiv(0, WidgetType.SIMILAR_ITEMS, "similaritems.vm");
357
		return getWidgetDiv(0, WidgetType.SIMILAR_ITEMS, "similaritems.vm");
358
	}
358
	}
359
 
359
 
360
 
360
 
361
 
361
 
362
	private String getRecommendationsHtml() {
362
	public String getRecommendationsHtml() {
363
		return getWidgetDiv( 0, WidgetType.RECOMMENDED_ITEMS, "recommendations.vm");
363
		return getWidgetDiv( 0, WidgetType.RECOMMENDED_ITEMS, "recommendations.vm");
364
	}
364
	}
365
 
365
 
366
 
366
 
367
 
367
 
Line 387... Line 387...
387
		return htmlString;
387
		return htmlString;
388
	}
388
	}
389
 
389
 
390
 
390
 
391
 
391
 
392
	private String getReviewsHtml(long productId) {
392
	public String getReviewsHtml(long productId) {
393
		String htmlString = "";
393
		String htmlString = "";
394
		VelocityContext context = new VelocityContext();
394
		VelocityContext context = new VelocityContext();
395
		Map<String, String> params = new HashMap<String, String>();
395
		Map<String, String> params = new HashMap<String, String>();
396
		params.put("PRODUCT_ID", productId+"");
396
		params.put("PRODUCT_ID", productId+"");
397
		context.put("params", params);
397
		context.put("params", params);
Line 400... Line 400...
400
		return htmlString;
400
		return htmlString;
401
	}
401
	}
402
 
402
 
403
 
403
 
404
 
404
 
405
	private String getLocatorHtml() {
405
	public String getLocatorHtml() {
406
		String htmlString = "";
406
		String htmlString = "";
407
		VelocityContext context = new VelocityContext();
407
		VelocityContext context = new VelocityContext();
408
		String templateFile = "templates/locator.vm";
408
		String templateFile = "templates/locator.vm";
409
		htmlString = getHtmlFromVelocity(templateFile, context);
409
		htmlString = getHtmlFromVelocity(templateFile, context);
410
		return htmlString;
410
		return htmlString;
Line 427... Line 427...
427
//				e.printStackTrace();
427
//				e.printStackTrace();
428
//			}
428
//			}
429
//		return htmlString;
429
//		return htmlString;
430
//	}
430
//	}
431
 
431
 
432
	private String getSlideGuideHtml(long productId) {
432
	public String getSlideGuideHtml(long productId) {
433
		StringBuilder htmlString = new StringBuilder();
433
		StringBuilder htmlString = new StringBuilder();
434
		String filename = Utils.EXPORT_ENTITIES_PATH + productId + File.separator + "SlideGuide.html";
434
		String filename = Utils.EXPORT_ENTITIES_PATH + productId + File.separator + "SlideGuide.html";
435
		File f = new File(filename);
435
		File f = new File(filename);
436
		
436
		
437
		
437
		
Line 498... Line 498...
498
		
498
		
499
		return htmlString.toString();
499
		return htmlString.toString();
500
	}
500
	}
501
 
501
 
502
 
502
 
503
	private String getSocialUtilsHtml(long productId) {
503
	public String getSocialUtilsHtml(long productId) {
504
		String htmlString = "";
504
		String htmlString = "";
505
		VelocityContext context = new VelocityContext();
505
		VelocityContext context = new VelocityContext();
506
		Map<String, String> params = new HashMap<String, String>();
506
		Map<String, String> params = new HashMap<String, String>();
507
		params.put("PRODUCT_ID", productId+"");
507
		params.put("PRODUCT_ID", productId+"");
508
		String templateFile = "templates/socialutils.vm";
508
		String templateFile = "templates/socialutils.vm";
Line 511... Line 511...
511
		return htmlString;
511
		return htmlString;
512
	}
512
	}
513
 
513
 
514
 
514
 
515
 
515
 
516
	private String getProductSummaryHtml(long productId, boolean toBeDecided) {
516
	public String getProductSummaryHtml(long productId, boolean toBeDecided) {
517
		CatalogServiceClient catalogServiceClient = null;
517
		CatalogServiceClient catalogServiceClient = null;
518
		Client client = null;
518
		Client client = null;
519
		String htmlString = "";
519
		String htmlString = "";
520
 
520
 
521
		UserContextServiceClient userServiceClient = null;
521
		UserContextServiceClient userServiceClient = null;
Line 899... Line 899...
899
		}else{
899
		}else{
900
			System.out.println("widget not found");
900
			System.out.println("widget not found");
901
		}
901
		}
902
		
902
		
903
		VelocityContext context = new VelocityContext();
903
		VelocityContext context = new VelocityContext();
-
 
904
		context.put("userId", userId);
904
		context.put("itemDetails", itemDetails);
905
		context.put("itemDetails", itemDetails);
905
		
906
		
906
		return getHtmlFromVelocity("templates/"+templateFile, context);
907
		return getHtmlFromVelocity("templates/"+templateFile, context);
907
	}
908
	}
908
 
909
 
Line 976... Line 977...
976
		htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
977
		htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
977
		System.out.println("CUSTOMER_SERVICE Snippet generated");
978
		System.out.println("CUSTOMER_SERVICE Snippet generated");
978
 
979
 
979
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
980
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
980
		System.out.println("MY_RESEARCH Snippet generated");
981
		System.out.println("MY_RESEARCH Snippet generated");
-
 
982
 
-
 
983
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, false));
-
 
984
		System.out.println("BROWSE_HISTORY Snippet generated");
981
		
985
 
982
		htmlSnippet.put("FOOTER", getFooterHtml());
986
		htmlSnippet.put("FOOTER", getFooterHtml());
983
		System.out.println("Footer Snippet generated");
987
		System.out.println("Footer Snippet generated");
984
	
988
	
985
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
-
 
986
	//	System.out.println("ACCESSORIES Snippet generated")
-
 
987
		
-
 
988
		htmlSnippet.put("JS_FILES", "");
989
		htmlSnippet.put("JS_FILES", "");
989
		htmlSnippet.put("CSS_FILES", "");
990
		htmlSnippet.put("CSS_FILES", "");
990
		
991
		
991
		System.out.println("Returning Generated Responce");
992
		System.out.println("Returning Generated Responce");
992
		
993
		
Line 1019... Line 1020...
1019
		htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
1020
		htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
1020
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1021
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1021
 
1022
 
1022
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1023
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1023
		System.out.println("MY_RESEARCH Snippet generated");
1024
		System.out.println("MY_RESEARCH Snippet generated");
-
 
1025
 
-
 
1026
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, false));
-
 
1027
		System.out.println("BROWSE_HISTORY Snippet generated");
1024
		
1028
		
1025
		htmlSnippet.put("FOOTER", getFooterHtml());
1029
		htmlSnippet.put("FOOTER", getFooterHtml());
1026
		System.out.println("Footer Snippet generated");
1030
		System.out.println("Footer Snippet generated");
1027
	
1031
	
1028
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1032
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
Line 1060... Line 1064...
1060
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1064
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1061
 
1065
 
1062
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1066
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1063
		System.out.println("MY_RESEARCH Snippet generated");
1067
		System.out.println("MY_RESEARCH Snippet generated");
1064
		
1068
		
-
 
1069
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, false));
-
 
1070
		System.out.println("BROWSE_HISTORY Snippet generated");
-
 
1071
		
1065
		htmlSnippet.put("FOOTER", getFooterHtml());
1072
		htmlSnippet.put("FOOTER", getFooterHtml());
1066
		System.out.println("Footer Snippet generated");
1073
		System.out.println("Footer Snippet generated");
1067
	
1074
	
1068
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1075
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1069
	//	System.out.println("ACCESSORIES Snippet generated")
1076
	//	System.out.println("ACCESSORIES Snippet generated")
Line 1100... Line 1107...
1100
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1107
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1101
 
1108
 
1102
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1109
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1103
		System.out.println("MY_RESEARCH Snippet generated");
1110
		System.out.println("MY_RESEARCH Snippet generated");
1104
		
1111
		
-
 
1112
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, false));
-
 
1113
		System.out.println("BROWSE_HISTORY Snippet generated");
-
 
1114
		
1105
		htmlSnippet.put("FOOTER", getFooterHtml());
1115
		htmlSnippet.put("FOOTER", getFooterHtml());
1106
		System.out.println("Footer Snippet generated");
1116
		System.out.println("Footer Snippet generated");
1107
	
1117
	
1108
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1118
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1109
	//	System.out.println("ACCESSORIES Snippet generated")
1119
	//	System.out.println("ACCESSORIES Snippet generated")
Line 1144... Line 1154...
1144
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1154
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1145
 
1155
 
1146
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1156
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1147
		System.out.println("MY_RESEARCH Snippet generated");
1157
		System.out.println("MY_RESEARCH Snippet generated");
1148
		
1158
		
-
 
1159
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, false));
-
 
1160
		System.out.println("BROWSE_HISTORY Snippet generated");
-
 
1161
		
1149
		htmlSnippet.put("FOOTER", getFooterHtml());
1162
		htmlSnippet.put("FOOTER", getFooterHtml());
1150
		System.out.println("Footer Snippet generated");
1163
		System.out.println("Footer Snippet generated");
1151
	
1164
	
1152
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1165
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1153
	//	System.out.println("ACCESSORIES Snippet generated")
1166
	//	System.out.println("ACCESSORIES Snippet generated")
Line 1264... Line 1277...
1264
		context.put("sex", sex);
1277
		context.put("sex", sex);
1265
		htmlString = getHtmlFromVelocity(templateFile, context);
1278
		htmlString = getHtmlFromVelocity(templateFile, context);
1266
		return htmlString;
1279
		return htmlString;
1267
	}
1280
	}
1268
	
1281
	
1269
	private String getCompletedOrdersHtml(long userId) {
1282
	public String getCompletedOrdersHtml(long userId) {
1270
		String htmlString = "";
1283
		String htmlString = "";
1271
		VelocityContext context = new VelocityContext();
1284
		VelocityContext context = new VelocityContext();
1272
		String templateFile = "templates/completedorders.vm";
1285
		String templateFile = "templates/completedorders.vm";
1273
		TransactionServiceClient transactionServiceClient = null;
1286
		TransactionServiceClient transactionServiceClient = null;
1274
		in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
1287
		in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
Line 1353... Line 1366...
1353
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1366
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1354
		
1367
		
1355
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1368
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1356
		System.out.println("MY_RESEARCH Snippet generated");
1369
		System.out.println("MY_RESEARCH Snippet generated");
1357
 
1370
 
-
 
1371
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, isLoggedIn));
-
 
1372
		System.out.println("BROWSE_HISTORY Snippet generated");
-
 
1373
 
1358
		htmlSnippet.put("FOOTER", getFooterHtml());
1374
		htmlSnippet.put("FOOTER", getFooterHtml());
1359
		System.out.println("Footer Snippet generated");
1375
		System.out.println("Footer Snippet generated");
1360
	
1376
	
1361
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1377
	//	htmlSnippet.put("WIDGET_DIV", getWidgetDiv(productId,"", WidgetType.ACCESSORIES));
1362
	//	System.out.println("ACCESSORIES Snippet generated")
1378
	//	System.out.println("ACCESSORIES Snippet generated")
Line 1388... Line 1404...
1388
		UserContextServiceClient userContextServiceClient = null;
1404
		UserContextServiceClient userContextServiceClient = null;
1389
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
1405
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
1390
		try {
1406
		try {
1391
			userContextServiceClient = new UserContextServiceClient();
1407
			userContextServiceClient = new UserContextServiceClient();
1392
			userClient = userContextServiceClient.getClient();
1408
			userClient = userContextServiceClient.getClient();
-
 
1409
			
1393
			User user = userClient.getUserById(userId);
1410
			addresses = userClient.getAllAddressesForUser(userId);
1394
			addresses = user.getAddresses();
-
 
1395
			defaultAddressId = user.getDefaultAddressId();
1411
			defaultAddressId = userClient.getDefaultAddressId(userId);
1396
		} catch (Exception e) {
1412
		} catch (Exception e) {
1397
			e.printStackTrace();
1413
			e.printStackTrace();
1398
		}
1414
		}
1399
		context.put("defaultAddressId", defaultAddressId+"");
1415
		context.put("defaultAddressId", defaultAddressId+"");
1400
		context.put("addresses", addresses);
1416
		context.put("addresses", addresses);