| Line 39... |
Line 39... |
| 39 |
import in.shop2020.model.v1.catalog.Item;
|
39 |
import in.shop2020.model.v1.catalog.Item;
|
| 40 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
40 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 41 |
import in.shop2020.model.v1.order.Order;
|
41 |
import in.shop2020.model.v1.order.Order;
|
| 42 |
import in.shop2020.model.v1.order.OrderStatus;
|
42 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 43 |
import in.shop2020.model.v1.order.Transaction;
|
43 |
import in.shop2020.model.v1.order.Transaction;
|
| 44 |
import in.shop2020.model.v1.shoppingcart.Cart;
|
44 |
import in.shop2020.model.v1.user.Cart;
|
| 45 |
import in.shop2020.model.v1.shoppingcart.Line;
|
45 |
import in.shop2020.model.v1.user.Line;
|
| 46 |
import in.shop2020.model.v1.shoppingcart.LineStatus;
|
46 |
import in.shop2020.model.v1.user.LineStatus;
|
| 47 |
import in.shop2020.model.v1.shoppingcart.ShoppingCartException;
|
47 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
| 48 |
import in.shop2020.model.v1.user.Address;
|
48 |
import in.shop2020.model.v1.user.Address;
|
| - |
|
49 |
import in.shop2020.model.v1.user.User;
|
| 49 |
import in.shop2020.model.v1.user.UserContextException;
|
50 |
import in.shop2020.model.v1.user.UserContextException;
|
| 50 |
import in.shop2020.model.v1.user.UserPrimaryInfo;
|
- |
|
| 51 |
import in.shop2020.model.v1.widgets.RatingType;
|
51 |
import in.shop2020.model.v1.user.RatingType;
|
| 52 |
import in.shop2020.model.v1.widgets.RatingsWidget;
|
52 |
import in.shop2020.model.v1.user.RatingsWidget;
|
| 53 |
import in.shop2020.model.v1.widgets.Widget;
|
53 |
import in.shop2020.model.v1.user.Widget;
|
| 54 |
import in.shop2020.model.v1.widgets.WidgetItem;
|
54 |
import in.shop2020.model.v1.user.WidgetItem;
|
| 55 |
import in.shop2020.model.v1.widgets.WidgetType;
|
55 |
import in.shop2020.model.v1.user.WidgetType;
|
| 56 |
import in.shop2020.serving.page.CategoryPage;
|
56 |
import in.shop2020.serving.page.CategoryPage;
|
| 57 |
import in.shop2020.serving.page.MyAccountPage;
|
57 |
import in.shop2020.serving.page.MyAccountPage;
|
| 58 |
import in.shop2020.serving.page.ProductPage;
|
58 |
import in.shop2020.serving.page.ProductPage;
|
| 59 |
import in.shop2020.serving.page.ShoppingCartPage;
|
59 |
import in.shop2020.serving.page.ShoppingCartPage;
|
| 60 |
import in.shop2020.serving.utils.*;
|
60 |
import in.shop2020.serving.utils.*;
|
| 61 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
61 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
| 62 |
import in.shop2020.thrift.clients.ShoppingCartClient;
|
- |
|
| 63 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
62 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
| 64 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
63 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 65 |
import in.shop2020.thrift.clients.WidgetServiceClient;
|
64 |
import in.shop2020.thrift.clients.WidgetServiceClient;
|
| 66 |
|
65 |
|
| 67 |
|
66 |
|
| Line 69... |
Line 68... |
| 69 |
|
68 |
|
| 70 |
public Map<String,String> getProductPage(long productId, Map<String, String> params) throws TException {
|
69 |
public Map<String,String> getProductPage(long productId, Map<String, String> params) throws TException {
|
| 71 |
|
70 |
|
| 72 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
71 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| 73 |
|
72 |
|
| 74 |
boolean isSessionId = false;
|
73 |
boolean isLoggedIn = Boolean.parseBoolean(params.get("IS_LOGGED_IN"));
|
| 75 |
long userId = Long.parseLong(params.get("USER_ID"));
|
74 |
long userId = Long.parseLong(params.get("USER_ID"));
|
| 76 |
if(userId == -1){
|
- |
|
| 77 |
isSessionId = true;
|
- |
|
| 78 |
}
|
- |
|
| 79 |
long cartId = Long.parseLong(params.get("CART_ID"));
|
75 |
long cartId = Long.parseLong(params.get("CART_ID"));
|
| 80 |
String userName = params.get("USER_NAME");
|
76 |
String userName = params.get("USER_NAME");
|
| 81 |
|
77 |
|
| 82 |
long categoryId = 100000;
|
78 |
long categoryId = 100000;
|
| 83 |
long itemCount = Long.parseLong(params.get("ITEM_COUNT"));
|
79 |
long itemCount = Long.parseLong(params.get("ITEM_COUNT"));
|
| 84 |
//product.setCategoryId(categoryId);
|
80 |
//product.setCategoryId(categoryId);
|
| 85 |
|
81 |
|
| 86 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, isSessionId, userName));
|
82 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 87 |
System.out.println("HEADER Snippet generated");
|
83 |
System.out.println("HEADER Snippet generated");
|
| 88 |
|
84 |
|
| 89 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
85 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 90 |
System.out.println("MAIN_MENU Snippet generated");
|
86 |
System.out.println("MAIN_MENU Snippet generated");
|
| 91 |
|
87 |
|
| Line 108... |
Line 104... |
| 108 |
System.out.println("REVIEWS Snippet generated");
|
104 |
System.out.println("REVIEWS Snippet generated");
|
| 109 |
|
105 |
|
| 110 |
htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
|
106 |
htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
|
| 111 |
System.out.println("CUSTOMER_SERVICE Snippet generated");
|
107 |
System.out.println("CUSTOMER_SERVICE Snippet generated");
|
| 112 |
|
108 |
|
| 113 |
htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, isSessionId));
|
109 |
htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, isLoggedIn));
|
| 114 |
System.out.println("MY_RESEARCH Snippet generated");
|
110 |
System.out.println("MY_RESEARCH Snippet generated");
|
| 115 |
|
111 |
|
| 116 |
htmlSnippet.put("RECOMMENDATIONS", getRecommendationsHtml());
|
112 |
htmlSnippet.put("RECOMMENDATIONS", getRecommendationsHtml());
|
| 117 |
System.out.println("RECOMMENDATIONS Snippet generated");
|
113 |
System.out.println("RECOMMENDATIONS Snippet generated");
|
| 118 |
|
114 |
|
| Line 137... |
Line 133... |
| 137 |
}
|
133 |
}
|
| 138 |
|
134 |
|
| 139 |
|
135 |
|
| 140 |
public Map<String, String> getRegisterPage(Map<String, String> parameters) {
|
136 |
public Map<String, String> getRegisterPage(Map<String, String> parameters) {
|
| 141 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
137 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| 142 |
boolean isSessionId = false;
|
138 |
boolean isLoggedIn = Boolean.parseBoolean(parameters.get("IS_LOGGED_IN"));
|
| 143 |
long userId = Long.parseLong(parameters.get("USER_ID"));
|
139 |
long userId = Long.parseLong(parameters.get("USER_ID"));
|
| 144 |
if(userId == -1){
|
- |
|
| 145 |
isSessionId = true;
|
- |
|
| 146 |
}
|
- |
|
| 147 |
long cartId = Long.parseLong(parameters.get("CART_ID"));
|
140 |
long cartId = Long.parseLong(parameters.get("CART_ID"));
|
| 148 |
String userName = parameters.get("USER_NAME");
|
141 |
String userName = parameters.get("USER_NAME");
|
| 149 |
long itemCount = Long.parseLong(parameters.get("ITEM_COUNT"));
|
142 |
long itemCount = Long.parseLong(parameters.get("ITEM_COUNT"));
|
| 150 |
|
143 |
|
| 151 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, isSessionId, userName));
|
144 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 152 |
System.out.println("HEADER Snippet generated");
|
145 |
System.out.println("HEADER Snippet generated");
|
| 153 |
|
146 |
|
| 154 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
147 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 155 |
System.out.println("MAIN_MENU Snippet generated");
|
148 |
System.out.println("MAIN_MENU Snippet generated");
|
| 156 |
|
149 |
|
| Line 192... |
Line 185... |
| 192 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
185 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
| 193 |
return htmlString;
|
186 |
return htmlString;
|
| 194 |
}
|
187 |
}
|
| 195 |
|
188 |
|
| 196 |
|
189 |
|
| 197 |
public Map<String,String> getHomePage(Map<String, String> params) throws TException {
|
190 |
public Map<String,String> getHomePage(Map<String, String> parameters) throws TException {
|
| 198 |
|
191 |
|
| 199 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
192 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| 200 |
|
- |
|
| 201 |
boolean isSessionId = false;
|
193 |
boolean isLoggedIn = Boolean.parseBoolean(parameters.get("IS_LOGGED_IN"));
|
| 202 |
long userId = Long.parseLong(params.get("USER_ID"));
|
194 |
long userId = Long.parseLong(parameters.get("USER_ID"));
|
| 203 |
if(userId == -1){
|
- |
|
| 204 |
isSessionId = true;
|
- |
|
| 205 |
}
|
- |
|
| 206 |
long cartId = Long.parseLong(params.get("CART_ID"));
|
195 |
long cartId = Long.parseLong(parameters.get("CART_ID"));
|
| 207 |
String userName = params.get("USER_NAME");
|
196 |
String userName = parameters.get("USER_NAME");
|
| - |
|
197 |
long itemCount = Long.parseLong(parameters.get("ITEM_COUNT"));
|
| 208 |
|
198 |
|
| 209 |
long categoryId = 100000;
|
199 |
long categoryId = 100000;
|
| 210 |
long itemCount = Long.parseLong(params.get("ITEM_COUNT"));
|
- |
|
| 211 |
//product.setCategoryId(categoryId);
|
200 |
//product.setCategoryId(categoryId);
|
| 212 |
|
201 |
|
| 213 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, isSessionId, userName));
|
202 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 214 |
System.out.println("HEADER Snippet generated");
|
203 |
System.out.println("HEADER Snippet generated");
|
| 215 |
|
204 |
|
| - |
|
205 |
|
| 216 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
206 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 217 |
System.out.println("MAIN_MENU Snippet generated");
|
207 |
System.out.println("MAIN_MENU Snippet generated");
|
| 218 |
|
208 |
|
| 219 |
htmlSnippet.put("SEARCH_BAR", getSearchBarHtml(itemCount, categoryId));
|
209 |
htmlSnippet.put("SEARCH_BAR", getSearchBarHtml(itemCount, categoryId));
|
| 220 |
System.out.println("SEARCH_BAR Snippet generated");
|
210 |
System.out.println("SEARCH_BAR Snippet generated");
|
| Line 232... |
Line 222... |
| 232 |
System.out.println("BEST_SELLERS Snippet generated");
|
222 |
System.out.println("BEST_SELLERS Snippet generated");
|
| 233 |
|
223 |
|
| 234 |
htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
|
224 |
htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
|
| 235 |
System.out.println("CUSTOMER_SERVICE Snippet generated");
|
225 |
System.out.println("CUSTOMER_SERVICE Snippet generated");
|
| 236 |
|
226 |
|
| 237 |
htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, isSessionId));
|
227 |
htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, isLoggedIn));
|
| 238 |
System.out.println("MY_RESEARCH Snippet generated");
|
228 |
System.out.println("MY_RESEARCH Snippet generated");
|
| 239 |
|
229 |
|
| 240 |
htmlSnippet.put("RECOMMENDATIONS", getRecommendationsHtml());
|
230 |
htmlSnippet.put("RECOMMENDATIONS", getRecommendationsHtml());
|
| 241 |
System.out.println("RECOMMENDATIONS Snippet generated");
|
231 |
System.out.println("RECOMMENDATIONS Snippet generated");
|
| 242 |
|
232 |
|
| 243 |
htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, isSessionId));
|
233 |
htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, isLoggedIn));
|
| 244 |
System.out.println("RECOMMENDATIONS Snippet generated");
|
234 |
System.out.println("RECOMMENDATIONS Snippet generated");
|
| 245 |
|
235 |
|
| 246 |
htmlSnippet.put("FOOTER", getFooterHtml());
|
236 |
htmlSnippet.put("FOOTER", getFooterHtml());
|
| 247 |
System.out.println("Footer Snippet generated");
|
237 |
System.out.println("Footer Snippet generated");
|
| 248 |
|
238 |
|
| Line 359... |
Line 349... |
| 359 |
}
|
349 |
}
|
| 360 |
|
350 |
|
| 361 |
|
351 |
|
| 362 |
|
352 |
|
| 363 |
private String getAccessoriesHtml(long productId) {
|
353 |
private String getAccessoriesHtml(long productId) {
|
| 364 |
return getWidgetDiv("", WidgetType.ACCESSORIES, "accessories.vm");
|
354 |
return getWidgetDiv(0, WidgetType.ACCESSORIES, "accessories.vm");
|
| 365 |
}
|
355 |
}
|
| 366 |
|
356 |
|
| 367 |
|
357 |
|
| 368 |
|
358 |
|
| 369 |
private String getSimilarProductsHtml(long productId) {
|
359 |
private String getSimilarProductsHtml(long productId) {
|
| 370 |
return getWidgetDiv("", WidgetType.SIMILAR_ITEMS, "similaritems.vm");
|
360 |
return getWidgetDiv(0, WidgetType.SIMILAR_ITEMS, "similaritems.vm");
|
| 371 |
}
|
361 |
}
|
| 372 |
|
362 |
|
| 373 |
|
363 |
|
| 374 |
|
364 |
|
| 375 |
private String getRecommendationsHtml() {
|
365 |
private String getRecommendationsHtml() {
|
| 376 |
return getWidgetDiv( "", WidgetType.RECOMMENDED_ITEMS, "recommendations.vm");
|
366 |
return getWidgetDiv( 0, WidgetType.RECOMMENDED_ITEMS, "recommendations.vm");
|
| 377 |
}
|
367 |
}
|
| 378 |
|
368 |
|
| 379 |
|
369 |
|
| 380 |
|
370 |
|
| 381 |
public String getMyResearchHtml(long userId, boolean isSessionId) {
|
371 |
public String getMyResearchHtml(long userId, boolean isLoggedIn) {
|
| - |
|
372 |
if(isLoggedIn)
|
| 382 |
return getWidgetDiv(userId+"", WidgetType.MY_RESEARCH, "myresearch.vm");
|
373 |
return getWidgetDiv(userId, WidgetType.MY_RESEARCH, "myresearch.vm");
|
| - |
|
374 |
else
|
| - |
|
375 |
return getWidgetDiv(0, WidgetType.MY_RESEARCH, "myresearch.vm");
|
| 383 |
}
|
376 |
}
|
| 384 |
|
377 |
|
| 385 |
private String getBrowseHistoryHtml(long userId, boolean isSessionId) {
|
378 |
private String getBrowseHistoryHtml(long userId, boolean isLoggedIn) {
|
| - |
|
379 |
if(isLoggedIn)
|
| 386 |
return getWidgetDiv(userId+"", WidgetType.BROWSE_HISTORY, "browsehistory.vm");
|
380 |
return getWidgetDiv(userId, WidgetType.BROWSE_HISTORY, "browsehistory.vm");
|
| - |
|
381 |
else
|
| - |
|
382 |
return getWidgetDiv(0, WidgetType.BROWSE_HISTORY, "browsehistory.vm");
|
| 387 |
}
|
383 |
}
|
| 388 |
|
384 |
|
| 389 |
public String getCustomerServiceHtml() {
|
385 |
public String getCustomerServiceHtml() {
|
| 390 |
String htmlString = "";
|
386 |
String htmlString = "";
|
| 391 |
VelocityContext context = new VelocityContext();
|
387 |
VelocityContext context = new VelocityContext();
|
| Line 523... |
Line 519... |
| 523 |
private String getProductSummaryHtml(long productId, boolean toBeDecided) {
|
519 |
private String getProductSummaryHtml(long productId, boolean toBeDecided) {
|
| 524 |
CatalogServiceClient catalogServiceClient = null;
|
520 |
CatalogServiceClient catalogServiceClient = null;
|
| 525 |
Client client = null;
|
521 |
Client client = null;
|
| 526 |
String htmlString = "";
|
522 |
String htmlString = "";
|
| 527 |
|
523 |
|
| 528 |
WidgetServiceClient widgetServiceClient = null;
|
524 |
UserContextServiceClient userServiceClient = null;
|
| 529 |
in.shop2020.model.v1.widgets.WidgetService.Client widgetClient = null;
|
525 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 530 |
try {
|
526 |
try {
|
| 531 |
catalogServiceClient = new CatalogServiceClient();
|
527 |
catalogServiceClient = new CatalogServiceClient();
|
| 532 |
client = catalogServiceClient.getClient();
|
528 |
client = catalogServiceClient.getClient();
|
| 533 |
|
529 |
|
| 534 |
widgetServiceClient = new WidgetServiceClient();
|
530 |
userServiceClient = new UserContextServiceClient();
|
| 535 |
widgetClient = widgetServiceClient.getClient();
|
531 |
userClient = userServiceClient.getClient();
|
| 536 |
|
532 |
|
| 537 |
RatingsWidget ratingsWidget = widgetClient.getRatings(productId, 0);
|
533 |
RatingsWidget ratingsWidget = userClient.getRatings(productId, 0);
|
| 538 |
Map<RatingType,Double> ratings = ratingsWidget.getRatings();
|
534 |
Map<RatingType,Double> ratings = ratingsWidget.getRatings();
|
| 539 |
//double rating_amazon = ratings.get(RatingType.AMAZON);
|
535 |
//double rating_amazon = ratings.get(RatingType.AMAZON);
|
| 540 |
double rating_all = 0.0;
|
536 |
double rating_all = 0.0;
|
| 541 |
if(ratings != null){
|
537 |
if(ratings != null){
|
| 542 |
if( ratings.get(RatingType.USER_ALL) != null){
|
538 |
if( ratings.get(RatingType.USER_ALL) != null){
|
| Line 599... |
Line 595... |
| 599 |
return htmlString;
|
595 |
return htmlString;
|
| 600 |
}
|
596 |
}
|
| 601 |
|
597 |
|
| 602 |
|
598 |
|
| 603 |
|
599 |
|
| 604 |
public String getHeaderHtml(long userId, boolean isSessionId, String userName) {
|
600 |
public String getHeaderHtml(boolean isLoggedIn, String userName) {
|
| 605 |
String htmlString = "";
|
601 |
String htmlString = "";
|
| 606 |
Map<String,String> params = new HashMap<String, String>();
|
602 |
Map<String,String> params = new HashMap<String, String>();
|
| 607 |
VelocityContext context = new VelocityContext();
|
603 |
VelocityContext context = new VelocityContext();
|
| 608 |
if(isSessionId){
|
604 |
if (isLoggedIn) {
|
| - |
|
605 |
context.put("LOGGED_IN", "TRUE");
|
| - |
|
606 |
context.put("WELCOME_MESSAGE", "Hi, " + userName);
|
| - |
|
607 |
} else {
|
| 609 |
context.put("LOGGED_IN", "FALSE");
|
608 |
context.put("LOGGED_IN", "FALSE");
|
| 610 |
context.put("WELCOME_MESSAGE", "Hi, Welcome to Shop2020");
|
609 |
context.put("WELCOME_MESSAGE", "Hi, Welcome to Shop2020");
|
| 611 |
}else
|
- |
|
| 612 |
{
|
- |
|
| 613 |
context.put("LOGGED_IN", "TRUE");
|
- |
|
| 614 |
context.put("WELCOME_MESSAGE", "Hi, userName");
|
- |
|
| 615 |
}
|
610 |
}
|
| 616 |
|
- |
|
| 617 |
|
611 |
|
| 618 |
String templateFile = "templates/header.vm";
|
612 |
String templateFile = "templates/header.vm";
|
| 619 |
|
613 |
|
| 620 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
614 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
| 621 |
return htmlString;
|
615 |
return htmlString;
|
| Line 704... |
Line 698... |
| 704 |
private String getPriceDiv(long productId){
|
698 |
private String getPriceDiv(long productId){
|
| 705 |
CatalogServiceClient catalogServiceClient = null;
|
699 |
CatalogServiceClient catalogServiceClient = null;
|
| 706 |
Client client = null;
|
700 |
Client client = null;
|
| 707 |
String htmlString = new String();
|
701 |
String htmlString = new String();
|
| 708 |
|
702 |
|
| 709 |
WidgetServiceClient widgetServiceClient = null;
|
703 |
UserContextServiceClient userServiceClient = null;
|
| 710 |
in.shop2020.model.v1.widgets.WidgetService.Client widgetClient = null;
|
704 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 711 |
try {
|
705 |
try {
|
| 712 |
catalogServiceClient = new CatalogServiceClient();
|
706 |
catalogServiceClient = new CatalogServiceClient();
|
| 713 |
client = catalogServiceClient.getClient();
|
707 |
client = catalogServiceClient.getClient();
|
| 714 |
|
708 |
|
| 715 |
widgetServiceClient = new WidgetServiceClient();
|
709 |
userServiceClient = new UserContextServiceClient();
|
| 716 |
widgetClient = widgetServiceClient.getClient();
|
710 |
userClient = userServiceClient.getClient();
|
| 717 |
|
711 |
|
| 718 |
RatingsWidget ratingsWidget = widgetClient.getRatings(productId, 0);
|
712 |
RatingsWidget ratingsWidget = userClient.getRatings(productId, 0);
|
| 719 |
Map<RatingType,Double> ratings = ratingsWidget.getRatings();
|
713 |
Map<RatingType,Double> ratings = ratingsWidget.getRatings();
|
| 720 |
//double rating_amazon = ratings.get(RatingType.AMAZON);
|
714 |
//double rating_amazon = ratings.get(RatingType.AMAZON);
|
| 721 |
double rating_all = 0.0;
|
715 |
double rating_all = 0.0;
|
| 722 |
if(ratings != null){
|
716 |
if(ratings != null){
|
| 723 |
if( ratings.get(RatingType.USER_ALL) != null){
|
717 |
if( ratings.get(RatingType.USER_ALL) != null){
|
| Line 796... |
Line 790... |
| 796 |
|
790 |
|
| 797 |
return "Price";
|
791 |
return "Price";
|
| 798 |
}
|
792 |
}
|
| 799 |
|
793 |
|
| 800 |
private String getWidgetDiv(long productId, String userId, WidgetType widgetType, String velocityFileName, Boolean tobeusedLater){
|
794 |
private String getWidgetDiv(long productId, String userId, WidgetType widgetType, String velocityFileName, Boolean tobeusedLater){
|
| 801 |
WidgetServiceClient widgetServiceClient = null;
|
795 |
UserContextServiceClient userServiceClient = null;
|
| 802 |
in.shop2020.model.v1.widgets.WidgetService.Client client = null;
|
796 |
in.shop2020.model.v1.user.UserContextService.Client client = null;
|
| 803 |
|
797 |
|
| 804 |
String htmlString = new String();
|
798 |
String htmlString = new String();
|
| 805 |
try {
|
799 |
try {
|
| 806 |
widgetServiceClient = new WidgetServiceClient();
|
800 |
userServiceClient = new UserContextServiceClient();
|
| 807 |
client = widgetServiceClient.getClient();
|
801 |
client = userServiceClient.getClient();
|
| 808 |
long userID;
|
802 |
long userID;
|
| 809 |
if(userId.compareTo("") == 0){
|
803 |
if(userId.compareTo("") == 0){
|
| 810 |
userID = 0;
|
804 |
userID = 0;
|
| 811 |
}else{
|
805 |
}else{
|
| 812 |
userID = Long.parseLong(userId);
|
806 |
userID = Long.parseLong(userId);
|
| Line 877... |
Line 871... |
| 877 |
return "";
|
871 |
return "";
|
| 878 |
}
|
872 |
}
|
| 879 |
|
873 |
|
| 880 |
|
874 |
|
| 881 |
|
875 |
|
| 882 |
private String getWidgetDiv(String userId, WidgetType widgetType, String templateFile){
|
876 |
private String getWidgetDiv(long userId, WidgetType widgetType, String templateFile){
|
| 883 |
long userID;
|
- |
|
| 884 |
if(userId.compareTo("") == 0){
|
- |
|
| 885 |
userID = 0;
|
- |
|
| 886 |
}else{
|
- |
|
| 887 |
userID = Long.parseLong(userId);
|
- |
|
| 888 |
}
|
- |
|
| 889 |
|
877 |
|
| 890 |
WidgetServiceClient widgetServiceClient = null;
|
878 |
UserContextServiceClient userServiceClient = null;
|
| 891 |
in.shop2020.model.v1.widgets.WidgetService.Client client = null;
|
879 |
in.shop2020.model.v1.user.UserContextService.Client client = null;
|
| 892 |
Widget widget = null;
|
880 |
Widget widget = null;
|
| 893 |
try {
|
881 |
try {
|
| 894 |
widgetServiceClient = new WidgetServiceClient();
|
882 |
userServiceClient = new UserContextServiceClient();
|
| 895 |
client = widgetServiceClient.getClient();
|
883 |
client = userServiceClient.getClient();
|
| 896 |
widget = client.getWidget(widgetType, userID, true);
|
884 |
widget = client.getWidget(widgetType, userId, true);
|
| 897 |
} catch (Exception e) {
|
885 |
} catch (Exception e) {
|
| 898 |
e.printStackTrace();
|
886 |
e.printStackTrace();
|
| 899 |
}
|
887 |
}
|
| 900 |
|
888 |
|
| 901 |
|
889 |
|
| Line 976... |
Line 964... |
| 976 |
|
964 |
|
| 977 |
|
965 |
|
| 978 |
public Map<String, String> getCompletedOrdersPage(long userId, long itemCount,
|
966 |
public Map<String, String> getCompletedOrdersPage(long userId, long itemCount,
|
| 979 |
Map<String, String> params) {
|
967 |
Map<String, String> params) {
|
| 980 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
968 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| - |
|
969 |
|
| 981 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, false, ""));
|
970 |
htmlSnippet.put("HEADER", getHeaderHtml(false, ""));
|
| 982 |
System.out.println("HEADER Snippet generated");
|
971 |
System.out.println("HEADER Snippet generated");
|
| 983 |
|
972 |
|
| 984 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
973 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 985 |
System.out.println("MAIN_MENU Snippet generated");
|
974 |
System.out.println("MAIN_MENU Snippet generated");
|
| 986 |
|
975 |
|
| Line 1014... |
Line 1003... |
| 1014 |
return htmlSnippet;
|
1003 |
return htmlSnippet;
|
| 1015 |
|
1004 |
|
| 1016 |
}
|
1005 |
}
|
| 1017 |
|
1006 |
|
| 1018 |
|
1007 |
|
| 1019 |
public Map<String, String> getMyAccountPage(long userId, long itemCount,
|
1008 |
public Map<String, String> getMyAccountPage(long userId, long itemCount, String userName, boolean isLoggedIn)
|
| - |
|
1009 |
{
|
| 1020 |
Map<String, String> params) {
|
1010 |
|
| 1021 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
1011 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| - |
|
1012 |
|
| 1022 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, false, ""));
|
1013 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 1023 |
System.out.println("HEADER Snippet generated");
|
1014 |
System.out.println("HEADER Snippet generated");
|
| 1024 |
|
1015 |
|
| 1025 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
1016 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 1026 |
System.out.println("MAIN_MENU Snippet generated");
|
1017 |
System.out.println("MAIN_MENU Snippet generated");
|
| 1027 |
|
1018 |
|
| Line 1048... |
Line 1039... |
| 1048 |
|
1039 |
|
| 1049 |
htmlSnippet.put("JS_FILES", "");
|
1040 |
htmlSnippet.put("JS_FILES", "");
|
| 1050 |
htmlSnippet.put("CSS_FILES", "");
|
1041 |
htmlSnippet.put("CSS_FILES", "");
|
| 1051 |
|
1042 |
|
| 1052 |
System.out.println("Returning Generated Responce");
|
1043 |
System.out.println("Returning Generated Responce");
|
| 1053 |
|
- |
|
| 1054 |
|
1044 |
|
| 1055 |
return htmlSnippet;
|
1045 |
return htmlSnippet;
|
| 1056 |
}
|
1046 |
}
|
| 1057 |
|
1047 |
|
| 1058 |
|
1048 |
|
| 1059 |
public Map<String, String> getPersonalDetailsPage(long userId, long itemCount,
|
1049 |
public Map<String, String> getPersonalDetailsPage(long userId, long itemCount, String userName, boolean isLoggedIn)
|
| 1060 |
Map<String, String> params) {
|
1050 |
{
|
| 1061 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
1051 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| - |
|
1052 |
|
| 1062 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, false, ""));
|
1053 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 1063 |
System.out.println("HEADER Snippet generated");
|
1054 |
System.out.println("HEADER Snippet generated");
|
| 1064 |
|
1055 |
|
| 1065 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
1056 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 1066 |
System.out.println("MAIN_MENU Snippet generated");
|
1057 |
System.out.println("MAIN_MENU Snippet generated");
|
| 1067 |
|
1058 |
|
| Line 1093... |
Line 1084... |
| 1093 |
|
1084 |
|
| 1094 |
|
1085 |
|
| 1095 |
return htmlSnippet;
|
1086 |
return htmlSnippet;
|
| 1096 |
}
|
1087 |
}
|
| 1097 |
|
1088 |
|
| 1098 |
public Map<String, String> getLoginDetailsPage(long userId, long itemCount,
|
1089 |
public Map<String, String> getLoginDetailsPage(long userId, long itemCount, String userName, boolean isLoggedIn)
|
| 1099 |
Map<String, String> params) {
|
1090 |
{
|
| 1100 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
1091 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| - |
|
1092 |
|
| 1101 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, false, ""));
|
1093 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 1102 |
System.out.println("HEADER Snippet generated");
|
1094 |
System.out.println("HEADER Snippet generated");
|
| 1103 |
|
1095 |
|
| 1104 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
1096 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 1105 |
System.out.println("MAIN_MENU Snippet generated");
|
1097 |
System.out.println("MAIN_MENU Snippet generated");
|
| 1106 |
|
1098 |
|
| Line 1135... |
Line 1127... |
| 1135 |
}
|
1127 |
}
|
| 1136 |
|
1128 |
|
| 1137 |
|
1129 |
|
| 1138 |
|
1130 |
|
| 1139 |
public Map<String, String> getOrderDetailsPage(long userId, long itemCount, long orderId,
|
1131 |
public Map<String, String> getOrderDetailsPage(long userId, long itemCount, long orderId,
|
| 1140 |
Map<String, String> params) {
|
1132 |
Map<String, String> parameters) {
|
| 1141 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
1133 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| - |
|
1134 |
boolean isLoggedIn = Boolean.parseBoolean(parameters.get("IS_LOGGED_IN"));
|
| - |
|
1135 |
String userName = parameters.get("USER_NAME");
|
| - |
|
1136 |
|
| 1142 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, false, ""));
|
1137 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 1143 |
System.out.println("HEADER Snippet generated");
|
1138 |
System.out.println("HEADER Snippet generated");
|
| 1144 |
|
1139 |
|
| 1145 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
1140 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 1146 |
System.out.println("MAIN_MENU Snippet generated");
|
1141 |
System.out.println("MAIN_MENU Snippet generated");
|
| 1147 |
|
1142 |
|
| Line 1235... |
Line 1230... |
| 1235 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
1230 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 1236 |
|
1231 |
|
| 1237 |
try{
|
1232 |
try{
|
| 1238 |
userContextServiceClient = new UserContextServiceClient();
|
1233 |
userContextServiceClient = new UserContextServiceClient();
|
| 1239 |
userClient = userContextServiceClient.getClient();
|
1234 |
userClient = userContextServiceClient.getClient();
|
| 1240 |
UserPrimaryInfo primaryInfo = userClient.getPrimaryInfo(userId, false);
|
- |
|
| 1241 |
email = primaryInfo.getEmail();
|
1235 |
email = in.shop2020.serving.utils.Utils.getEmailId(userId);
|
| 1242 |
}catch (Exception e){
|
1236 |
}catch (Exception e){
|
| 1243 |
|
1237 |
|
| 1244 |
}
|
1238 |
}
|
| 1245 |
context.put("email", email);
|
1239 |
context.put("email", email);
|
| 1246 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
1240 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
| Line 1256... |
Line 1250... |
| 1256 |
int year = 0, month = 0, day = 0;
|
1250 |
int year = 0, month = 0, day = 0;
|
| 1257 |
String sex = "";
|
1251 |
String sex = "";
|
| 1258 |
String subscribe = "false";
|
1252 |
String subscribe = "false";
|
| 1259 |
UserContextServiceClient userContextServiceClient = null;
|
1253 |
UserContextServiceClient userContextServiceClient = null;
|
| 1260 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
1254 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 1261 |
UserPrimaryInfo primaryInfo = null;
|
- |
|
| 1262 |
try{
|
1255 |
try{
|
| - |
|
1256 |
User user = null;
|
| 1263 |
userContextServiceClient = new UserContextServiceClient();
|
1257 |
userContextServiceClient = new UserContextServiceClient();
|
| 1264 |
userClient = userContextServiceClient.getClient();
|
1258 |
userClient = userContextServiceClient.getClient();
|
| 1265 |
primaryInfo = userClient.getPrimaryInfo(userId, false);
|
1259 |
user = userClient.getUserById(userId);
|
| 1266 |
|
1260 |
|
| 1267 |
email = primaryInfo.getCommunicationEmail();
|
1261 |
email = user.getCommunicationEmail();
|
| 1268 |
name = primaryInfo.getFirstName();
|
1262 |
name = user.getName();
|
| 1269 |
|
1263 |
|
| 1270 |
Calendar calendar = Calendar.getInstance();
|
1264 |
Calendar calendar = Calendar.getInstance();
|
| 1271 |
calendar.setTimeInMillis(primaryInfo.getDateOfBirth());
|
1265 |
calendar.setTimeInMillis(user.getDateOfBirth());
|
| 1272 |
month = calendar.get(Calendar.MONTH);
|
1266 |
month = calendar.get(Calendar.MONTH);
|
| 1273 |
year = calendar.get(Calendar.YEAR);
|
1267 |
year = calendar.get(Calendar.YEAR);
|
| 1274 |
day = calendar.get(Calendar.DAY_OF_MONTH);
|
1268 |
day = calendar.get(Calendar.DAY_OF_MONTH);
|
| 1275 |
|
- |
|
| 1276 |
}catch (Exception e){
|
1269 |
}catch (Exception e){
|
| 1277 |
|
1270 |
e.printStackTrace();
|
| 1278 |
}
|
1271 |
}
|
| 1279 |
context.put("name", name);
|
1272 |
context.put("name", name);
|
| 1280 |
context.put("email", email);
|
1273 |
context.put("email", email);
|
| 1281 |
context.put("month", month+"");
|
1274 |
context.put("month", month+"");
|
| 1282 |
context.put("day", day+"");
|
1275 |
context.put("day", day+"");
|
| Line 1312... |
Line 1305... |
| 1312 |
String templateFile = "templates/myaccountheader.vm";
|
1305 |
String templateFile = "templates/myaccountheader.vm";
|
| 1313 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
1306 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
| 1314 |
return htmlString;
|
1307 |
return htmlString;
|
| 1315 |
}
|
1308 |
}
|
| 1316 |
|
1309 |
|
| 1317 |
|
- |
|
| 1318 |
public Map<String, String> getMyAccountPage_old(long userId,
|
- |
|
| 1319 |
Map<String, String> params) {
|
- |
|
| 1320 |
|
- |
|
| 1321 |
UserContextServiceClient userContextServiceClient = null;
|
- |
|
| 1322 |
in.shop2020.model.v1.user.UserContextService.Client client = null;
|
- |
|
| 1323 |
String htmlString = new String();
|
- |
|
| 1324 |
|
- |
|
| 1325 |
UserPrimaryInfo userPrimaryInfo;
|
- |
|
| 1326 |
try {
|
- |
|
| 1327 |
userContextServiceClient = new UserContextServiceClient();
|
- |
|
| 1328 |
client = userContextServiceClient.getClient();
|
- |
|
| 1329 |
userPrimaryInfo = client.getPrimaryInfo(userId, false);
|
- |
|
| 1330 |
|
- |
|
| 1331 |
String templateFile = "templates/myaccounts.vm";
|
- |
|
| 1332 |
VelocityContext context = new VelocityContext();
|
- |
|
| 1333 |
context.put("userPrimaryInfo", userPrimaryInfo);
|
- |
|
| 1334 |
|
- |
|
| 1335 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
- |
|
| 1336 |
System.out.println("My Accounts Snippet generated" + htmlString);
|
- |
|
| 1337 |
} catch (UserContextException e) {
|
- |
|
| 1338 |
// TODO Auto-generated catch block
|
- |
|
| 1339 |
e.printStackTrace();
|
- |
|
| 1340 |
} catch (Exception e) {
|
- |
|
| 1341 |
// TODO Auto-generated catch block
|
- |
|
| 1342 |
e.printStackTrace();
|
- |
|
| 1343 |
}
|
- |
|
| 1344 |
|
- |
|
| 1345 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
- |
|
| 1346 |
htmlSnippet.put("My_ACCOUNT", htmlString);
|
- |
|
| 1347 |
|
- |
|
| 1348 |
htmlSnippet.put("My_ORDERS", getMyOrdersDiv(userId));
|
- |
|
| 1349 |
|
- |
|
| 1350 |
return htmlSnippet;
|
- |
|
| 1351 |
}
|
- |
|
| 1352 |
|
- |
|
| 1353 |
//ShippingPage
|
1310 |
//ShippingPage
|
| 1354 |
public Map<String, String> getShippingPage(long userId, boolean isSessionId, long cartId, long itemCount, Map<String, String> params){
|
1311 |
public Map<String, String> getShippingPage(long userId, boolean isLoggedIn, long cartId, long itemCount, String userName){
|
| 1355 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
1312 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| 1356 |
|
1313 |
|
| 1357 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, isSessionId, ""));
|
1314 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 1358 |
System.out.println("HEADER Snippet generated");
|
1315 |
System.out.println("HEADER Snippet generated");
|
| 1359 |
|
1316 |
|
| 1360 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
1317 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 1361 |
System.out.println("MAIN_MENU Snippet generated");
|
1318 |
System.out.println("MAIN_MENU Snippet generated");
|
| 1362 |
|
1319 |
|
| Line 1386... |
Line 1343... |
| 1386 |
return htmlSnippet;
|
1343 |
return htmlSnippet;
|
| 1387 |
|
1344 |
|
| 1388 |
}
|
1345 |
}
|
| 1389 |
|
1346 |
|
| 1390 |
//ShippingPage
|
1347 |
//ShippingPage
|
| 1391 |
public Map<String, String> getShippingAddressPage(long userId, boolean isSessionId, long cartId, long itemCount, Map<String, String> params){
|
1348 |
public Map<String, String> getShippingAddressPage(long userId, boolean isLoggedIn, long cartId, long itemCount, String userName){
|
| 1392 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
1349 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| 1393 |
|
1350 |
|
| 1394 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, isSessionId, ""));
|
1351 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 1395 |
System.out.println("HEADER Snippet generated");
|
1352 |
System.out.println("HEADER Snippet generated");
|
| 1396 |
|
1353 |
|
| 1397 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
1354 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 1398 |
System.out.println("MAIN_MENU Snippet generated");
|
1355 |
System.out.println("MAIN_MENU Snippet generated");
|
| 1399 |
|
1356 |
|
| Line 1445... |
Line 1402... |
| 1445 |
UserContextServiceClient userContextServiceClient = null;
|
1402 |
UserContextServiceClient userContextServiceClient = null;
|
| 1446 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
1403 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 1447 |
try {
|
1404 |
try {
|
| 1448 |
userContextServiceClient = new UserContextServiceClient();
|
1405 |
userContextServiceClient = new UserContextServiceClient();
|
| 1449 |
userClient = userContextServiceClient.getClient();
|
1406 |
userClient = userContextServiceClient.getClient();
|
| 1450 |
UserPrimaryInfo primaryInfo = userClient.getPrimaryInfo(userId, false);
|
1407 |
User user = userClient.getUserById(userId);
|
| 1451 |
addresses = primaryInfo.getAddresses();
|
1408 |
addresses = user.getAddresses();
|
| 1452 |
defaultAddressId = primaryInfo.getDefaultAddressId();
|
1409 |
defaultAddressId = user.getDefaultAddressId();
|
| 1453 |
} catch (Exception e) {
|
1410 |
} catch (Exception e) {
|
| 1454 |
// TODO Auto-generated catch block
|
- |
|
| 1455 |
e.printStackTrace();
|
1411 |
e.printStackTrace();
|
| 1456 |
}
|
1412 |
}
|
| 1457 |
context.put("defaultAddressId", defaultAddressId+"");
|
1413 |
context.put("defaultAddressId", defaultAddressId+"");
|
| 1458 |
context.put("addresses", addresses);
|
1414 |
context.put("addresses", addresses);
|
| 1459 |
|
1415 |
|
| Line 1467... |
Line 1423... |
| 1467 |
String templateFile = "templates/shippingdetails.vm";
|
1423 |
String templateFile = "templates/shippingdetails.vm";
|
| 1468 |
List<Map<String,String>> items = null;
|
1424 |
List<Map<String,String>> items = null;
|
| 1469 |
double totalamount= 0.0;
|
1425 |
double totalamount= 0.0;
|
| 1470 |
List<Address> addresses = null;
|
1426 |
List<Address> addresses = null;
|
| 1471 |
long defaultAddressId = 0;
|
1427 |
long defaultAddressId = 0;
|
| 1472 |
ShoppingCartClient shoppingCartClient = null;
|
- |
|
| 1473 |
in.shop2020.model.v1.shoppingcart.ShoppingCartService.Client cartClient = null;
|
- |
|
| - |
|
1428 |
|
| 1474 |
CatalogServiceClient catalogServiceClient = null;
|
1429 |
CatalogServiceClient catalogServiceClient = null;
|
| 1475 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
|
1430 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
|
| 1476 |
UserContextServiceClient userContextServiceClient = null;
|
1431 |
UserContextServiceClient userContextServiceClient = null;
|
| 1477 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
1432 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 1478 |
|
1433 |
|
| 1479 |
try {
|
1434 |
try {
|
| 1480 |
shoppingCartClient = new ShoppingCartClient();
|
- |
|
| 1481 |
cartClient = shoppingCartClient.getClient();
|
- |
|
| 1482 |
catalogServiceClient = new CatalogServiceClient();
|
1435 |
catalogServiceClient = new CatalogServiceClient();
|
| 1483 |
catalogClient = catalogServiceClient.getClient();
|
1436 |
catalogClient = catalogServiceClient.getClient();
|
| 1484 |
userContextServiceClient = new UserContextServiceClient();
|
1437 |
userContextServiceClient = new UserContextServiceClient();
|
| 1485 |
userClient = userContextServiceClient.getClient();
|
1438 |
userClient = userContextServiceClient.getClient();
|
| 1486 |
|
1439 |
|
| 1487 |
|
1440 |
|
| 1488 |
Cart cart = cartClient.getCart(cartId);
|
1441 |
Cart cart = userClient.getCart(cartId);
|
| 1489 |
List<Line> lineItems = cart.getLines();
|
1442 |
List<Line> lineItems = cart.getLines();
|
| 1490 |
|
1443 |
|
| 1491 |
if( ! lineItems.isEmpty())
|
1444 |
if( ! lineItems.isEmpty())
|
| 1492 |
{
|
1445 |
{
|
| 1493 |
items = new ArrayList<Map<String,String>>();
|
1446 |
items = new ArrayList<Map<String,String>>();
|
| Line 1509... |
Line 1462... |
| 1509 |
totalamount = totalamount + line.getQuantity()*item.getSellingPrice();
|
1462 |
totalamount = totalamount + line.getQuantity()*item.getSellingPrice();
|
| 1510 |
items.add(itemdetail);
|
1463 |
items.add(itemdetail);
|
| 1511 |
}
|
1464 |
}
|
| 1512 |
}
|
1465 |
}
|
| 1513 |
|
1466 |
|
| 1514 |
UserPrimaryInfo primaryInfo = userClient.getPrimaryInfo(cart.getUserId(), false);
|
1467 |
User user = userClient.getUserById(cart.getUserId());
|
| 1515 |
addresses = primaryInfo.getAddresses();
|
1468 |
addresses = user.getAddresses();
|
| 1516 |
defaultAddressId = primaryInfo.getDefaultAddressId();
|
1469 |
defaultAddressId = user.getDefaultAddressId();
|
| 1517 |
|
1470 |
|
| 1518 |
}catch (Exception e){
|
1471 |
}catch (Exception e){
|
| 1519 |
e.printStackTrace();
|
1472 |
e.printStackTrace();
|
| 1520 |
}
|
1473 |
}
|
| 1521 |
|
1474 |
|
| Line 1527... |
Line 1480... |
| 1527 |
return htmlString;
|
1480 |
return htmlString;
|
| 1528 |
}
|
1481 |
}
|
| 1529 |
|
1482 |
|
| 1530 |
|
1483 |
|
| 1531 |
//ShoppingCartPage
|
1484 |
//ShoppingCartPage
|
| 1532 |
public Map<String, String> getShoppingCartPage(long userId, boolean isSessionId, long cartId, long itemCount, Map<String, String> params){
|
1485 |
public Map<String, String> getShoppingCartPage(long userId, boolean isLoggedIn, long cartId, long itemCount, String userName){
|
| 1533 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
1486 |
Map<String,String> htmlSnippet = new HashMap<String, String>();
|
| 1534 |
|
1487 |
|
| 1535 |
htmlSnippet.put("HEADER", getHeaderHtml(userId, isSessionId, ""));
|
1488 |
htmlSnippet.put("HEADER", getHeaderHtml(isLoggedIn, userName));
|
| 1536 |
System.out.println("HEADER Snippet generated");
|
1489 |
System.out.println("HEADER Snippet generated");
|
| 1537 |
|
1490 |
|
| 1538 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
1491 |
htmlSnippet.put("MAIN_MENU", getMainMenuHtml());
|
| 1539 |
System.out.println("MAIN_MENU Snippet generated");
|
1492 |
System.out.println("MAIN_MENU Snippet generated");
|
| 1540 |
|
1493 |
|
| Line 1548... |
Line 1501... |
| 1548 |
System.out.println("SEARCH_BAR Snippet generated");
|
1501 |
System.out.println("SEARCH_BAR Snippet generated");
|
| 1549 |
|
1502 |
|
| 1550 |
htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
|
1503 |
htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
|
| 1551 |
System.out.println("CUSTOMER_SERVICE Snippet generated");
|
1504 |
System.out.println("CUSTOMER_SERVICE Snippet generated");
|
| 1552 |
|
1505 |
|
| 1553 |
htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, isSessionId));
|
1506 |
htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, isLoggedIn));
|
| 1554 |
System.out.println("MY_RESEARCH Snippet generated");
|
1507 |
System.out.println("MY_RESEARCH Snippet generated");
|
| 1555 |
|
1508 |
|
| 1556 |
htmlSnippet.put("FOOTER", getFooterHtml());
|
1509 |
htmlSnippet.put("FOOTER", getFooterHtml());
|
| 1557 |
System.out.println("Footer Snippet generated");
|
1510 |
System.out.println("Footer Snippet generated");
|
| 1558 |
|
1511 |
|
| Line 1582... |
Line 1535... |
| 1582 |
VelocityContext context = new VelocityContext();
|
1535 |
VelocityContext context = new VelocityContext();
|
| 1583 |
String templateFile = "templates/cartdetails.vm";
|
1536 |
String templateFile = "templates/cartdetails.vm";
|
| 1584 |
List<Map<String,String>> items = null;
|
1537 |
List<Map<String,String>> items = null;
|
| 1585 |
double totalamount= 0.0;
|
1538 |
double totalamount= 0.0;
|
| 1586 |
|
1539 |
|
| 1587 |
ShoppingCartClient shoppingCartClient = null;
|
1540 |
UserContextServiceClient userServiceClient = null;
|
| 1588 |
in.shop2020.model.v1.shoppingcart.ShoppingCartService.Client cartClient = null;
|
1541 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 1589 |
CatalogServiceClient catalogServiceClient = null;
|
1542 |
CatalogServiceClient catalogServiceClient = null;
|
| 1590 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
|
1543 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
|
| 1591 |
|
1544 |
|
| 1592 |
try {
|
1545 |
try {
|
| 1593 |
shoppingCartClient = new ShoppingCartClient();
|
- |
|
| 1594 |
cartClient = shoppingCartClient.getClient();
|
- |
|
| 1595 |
catalogServiceClient = new CatalogServiceClient();
|
1546 |
catalogServiceClient = new CatalogServiceClient();
|
| 1596 |
catalogClient = catalogServiceClient.getClient();
|
1547 |
catalogClient = catalogServiceClient.getClient();
|
| - |
|
1548 |
userServiceClient = new UserContextServiceClient();
|
| - |
|
1549 |
userClient = userServiceClient.getClient();
|
| 1597 |
|
1550 |
|
| 1598 |
Cart cart = cartClient.getCart(cartId);
|
1551 |
Cart cart = userClient.getCart(cartId);
|
| 1599 |
List<Line> lineItems = cart.getLines();
|
1552 |
List<Line> lineItems = cart.getLines();
|
| 1600 |
if(lineItems.size() != 0){
|
1553 |
if(lineItems.size() != 0){
|
| 1601 |
items = new ArrayList<Map<String,String>>();
|
1554 |
items = new ArrayList<Map<String,String>>();
|
| 1602 |
for (Line line : lineItems) {
|
1555 |
for (Line line : lineItems) {
|
| 1603 |
|
1556 |
|
| Line 1632... |
Line 1585... |
| 1632 |
}
|
1585 |
}
|
| 1633 |
|
1586 |
|
| 1634 |
|
1587 |
|
| 1635 |
public Map<String, String> getShoppingCartPage_Old(long userId, boolean isSessionId, Map<String, String> params)
|
1588 |
public Map<String, String> getShoppingCartPage_Old(long userId, boolean isSessionId, Map<String, String> params)
|
| 1636 |
{
|
1589 |
{
|
| 1637 |
ShoppingCartClient shoppingCartClient = null;
|
1590 |
UserContextServiceClient userServiceClient = null;
|
| 1638 |
in.shop2020.model.v1.shoppingcart.ShoppingCartService.Client cartClient = null;
|
1591 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 1639 |
|
1592 |
|
| 1640 |
try {
|
1593 |
try {
|
| 1641 |
shoppingCartClient = new ShoppingCartClient();
|
1594 |
userServiceClient = new UserContextServiceClient();
|
| 1642 |
cartClient = shoppingCartClient.getClient();
|
1595 |
userClient = userServiceClient.getClient();
|
| 1643 |
|
1596 |
|
| 1644 |
Cart cart = cartClient.getCurrentCart(userId, isSessionId);
|
1597 |
Cart cart = userClient.getCurrentCart(userId);
|
| 1645 |
|
1598 |
|
| 1646 |
List<Line> lineItems = cart.getLines();
|
1599 |
List<Line> lineItems = cart.getLines();
|
| 1647 |
List<Map<String,String>> items = new ArrayList<Map<String,String>>();
|
1600 |
List<Map<String,String>> items = new ArrayList<Map<String,String>>();
|
| 1648 |
|
1601 |
|
| 1649 |
for (Line line : lineItems) {
|
1602 |
for (Line line : lineItems) {
|
| Line 1737... |
Line 1690... |
| 1737 |
|
1690 |
|
| 1738 |
// TransactionServiceClient transactionServiceClient = null;
|
1691 |
// TransactionServiceClient transactionServiceClient = null;
|
| 1739 |
// in.shop2020.model.v1.order.TransactionService.Client client = null;
|
1692 |
// in.shop2020.model.v1.order.TransactionService.Client client = null;
|
| 1740 |
//
|
1693 |
//
|
| 1741 |
// Cart cart = cartClient.getCurrentCart(userId);
|
1694 |
// Cart cart = cartClient.getCurrentCart(userId);
|
| 1742 |
// List<Line> lineItems = cart.getLines();
|
1695 |
// List<LineItem> lineItems = cart.getLines();
|
| 1743 |
//
|
1696 |
//
|
| 1744 |
// Line ln = lineItems.get(0);
|
1697 |
// LineItem ln = lineItems.get(0);
|
| 1745 |
// ln.getItemId();
|
1698 |
// ln.getItemId();
|
| 1746 |
// ln.getId();
|
1699 |
// ln.getId();
|
| 1747 |
// ln.getQuantity();
|
1700 |
// ln.getQuantity();
|
| 1748 |
// ln.getStatusMessage();
|
1701 |
// ln.getStatusMessage();
|
| 1749 |
// long productId = 10;
|
1702 |
// long productId = 10;
|
| 1750 |
//
|
1703 |
//
|
| 1751 |
// Cart cart = cartClient.getCurrentCart(0);
|
1704 |
// Cart cart = cartClient.getCurrentCart(0);
|
| 1752 |
// List<Line> lineItems = cart.getLines();
|
1705 |
// List<LineItem> lineItems = cart.getLines();
|
| 1753 |
// Line ln = lineItems.get(0);
|
1706 |
// LineItem ln = lineItems.get(0);
|
| 1754 |
// ln.getItemId();
|
1707 |
// ln.getItemId();
|
| 1755 |
// ln.getId();
|
1708 |
// ln.getId();
|
| 1756 |
//
|
1709 |
//
|
| 1757 |
// ln.getStatusMessage();
|
1710 |
// ln.getStatusMessage();
|
| 1758 |
//
|
1711 |
//
|