| 9269 |
amit.gupta |
1 |
package in.shop2020.mobileapi.serving.utils;
|
| 9133 |
anupam.sin |
2 |
|
| 9220 |
amit.gupta |
3 |
import in.shop2020.metamodel.util.ContentPojo;
|
| 9269 |
amit.gupta |
4 |
import in.shop2020.storage.mongo.StorageManager;
|
| 9220 |
amit.gupta |
5 |
import in.shop2020.metamodel.util.ProductPojo;
|
| 9269 |
amit.gupta |
6 |
import in.shop2020.mobileapi.serving.pojos.MenuPojo;
|
| 9133 |
anupam.sin |
7 |
|
|
|
8 |
import java.util.ArrayList;
|
|
|
9 |
import java.util.List;
|
|
|
10 |
|
| 9220 |
amit.gupta |
11 |
import org.apache.commons.lang.StringUtils;
|
|
|
12 |
|
| 9281 |
amit.gupta |
13 |
import com.google.gson.Gson;
|
|
|
14 |
|
| 9133 |
anupam.sin |
15 |
public class PojoPopulator {
|
| 9281 |
amit.gupta |
16 |
|
|
|
17 |
public static Gson gson = new Gson();
|
| 9133 |
anupam.sin |
18 |
|
|
|
19 |
public static List<MenuPojo> getCurrentMenu() {
|
|
|
20 |
List<MenuPojo> finalList = new ArrayList<MenuPojo>();
|
|
|
21 |
List<MenuPojo> children = new ArrayList<MenuPojo>();
|
|
|
22 |
|
|
|
23 |
// Mobile Menu start
|
|
|
24 |
children.clear();
|
|
|
25 |
children.add(getMenuPojoObject("Android Phones", "/android", "", null));
|
|
|
26 |
children.add(getMenuPojoObject("Business Phones", "/business", "", null));
|
|
|
27 |
children.add(getMenuPojoObject("Windows Phones", "/windows", "", null));
|
|
|
28 |
children.add(getMenuPojoObject("Samsung Phones", "/samsung", "", null));
|
| 9220 |
amit.gupta |
29 |
finalList.add(getMenuPojoObject("Mobiles", "/mobile", "images/menu/mobile.PNG", children));
|
| 9133 |
anupam.sin |
30 |
// Mobile Menu end
|
|
|
31 |
|
|
|
32 |
// Tablet Menu start
|
|
|
33 |
children.clear();
|
|
|
34 |
children.add(getMenuPojoObject("With call facility", "/tablets-with-calling", "", null));
|
|
|
35 |
children.add(getMenuPojoObject("Without call facility", "/tablets-without-calling", "", null));
|
|
|
36 |
children.add(getMenuPojoObject("Apple", "/apple-tablets", "", null));
|
|
|
37 |
children.add(getMenuPojoObject("Samsung", "/samsung-tablets", "", null));
|
|
|
38 |
children.add(getMenuPojoObject("Spice", "/spice-tablets", "", null));
|
| 9220 |
amit.gupta |
39 |
finalList.add(getMenuPojoObject("Tablets", "/all-tablets/10010", "images/menu/tablet.PNG", children));
|
| 9133 |
anupam.sin |
40 |
// Tablet Menu end
|
|
|
41 |
|
|
|
42 |
// Laptop Menu start
|
|
|
43 |
children.clear();
|
|
|
44 |
children.add(getMenuPojoObject("Windows Laptop", "/windows-laptop", "", null));
|
|
|
45 |
children.add(getMenuPojoObject("Apple Macbook", "/mac-laptops", "", null));
|
|
|
46 |
children.add(getMenuPojoObject("Linux/DOS Laptops", "/cheap-laptops", "", null));
|
| 9220 |
amit.gupta |
47 |
finalList.add(getMenuPojoObject("Laptops", "/all-laptops/10050", "images/menu/laptop.PNG", children));
|
| 9133 |
anupam.sin |
48 |
// Laptop Menu end
|
|
|
49 |
|
|
|
50 |
// Accessories Menu start
|
|
|
51 |
children.clear();
|
|
|
52 |
children.add(getMenuPojoObject("Carrying case", "/carrying-case/10018", "", null));
|
|
|
53 |
children.add(getMenuPojoObject("Headphones", "//headphones/10082", "", null));
|
|
|
54 |
children.add(getMenuPojoObject("Headsets", "/headset/10015", "", null));
|
|
|
55 |
children.add(getMenuPojoObject("Chargers", "/charger/10016", "", null));
|
|
|
56 |
children.add(getMenuPojoObject("Music Players", "/portable-music-players/12001", "", null));
|
|
|
57 |
children.add(getMenuPojoObject("Headsets", "/headset/10015", "", null));
|
| 9220 |
amit.gupta |
58 |
finalList.add(getMenuPojoObject("Accessories", "//all-mobile-accessories/10011", "images/menu/accessories.PNG", children));
|
| 9133 |
anupam.sin |
59 |
/*
|
|
|
60 |
<a class="link-menu-secondary menu-secondary-brand" href="/battery/10014">Battery</a>
|
|
|
61 |
<a class="link-menu-secondary menu-secondary-brand" href="/memory-card/10013">Memory Card</a>
|
|
|
62 |
<a class="link-menu-secondary menu-secondary-brand" href="/bluetooth-headset/10012">Bluetooth Headset</a>
|
|
|
63 |
<a class="link-menu-secondary menu-secondary-brand" href="/pen-drive/10017">Pen Drive</a>
|
|
|
64 |
<a class="link-menu-secondary menu-secondary-brand" href="/speaker/10026">Speaker</a>
|
|
|
65 |
<a class="link-menu-secondary menu-secondary-brand" href="/laptop-bags/10085">Laptop Bags</a>
|
|
|
66 |
<a class="link-menu-secondary menu-secondary-brand" href="/mouse/10081">Mouse</a>
|
|
|
67 |
<a class="link-menu-secondary menu-secondary-brand" href="/laptop-batteries/10077">Laptop Batteries</a>
|
|
|
68 |
<a class="link-menu-secondary menu-secondary-brand" href="/data-cards/10083">Data Cards</a>
|
|
|
69 |
<a class="link-menu-secondary menu-secondary-brand" href="/external-hard-disks/10073">External Hard disk</a>
|
|
|
70 |
<a class="link-menu-secondary menu-secondary-brand" href="/mouse-pads/10084">Mouse Pads</a>
|
|
|
71 |
*/
|
|
|
72 |
// Accessories Menu end
|
|
|
73 |
|
|
|
74 |
// Camera Menu start
|
|
|
75 |
children.clear();
|
|
|
76 |
children.add(getMenuPojoObject("DSLR Camera", "/dslr-camera/11003", "", null));
|
|
|
77 |
children.add(getMenuPojoObject("Compact Camera", "/compact-camera/11002", "", null));
|
| 9220 |
amit.gupta |
78 |
finalList.add(getMenuPojoObject("Cameras", "/all-cameras/11001", "images/menu/camera.PNG", children));
|
| 9133 |
anupam.sin |
79 |
// Camera Menu end
|
|
|
80 |
|
|
|
81 |
// Recharge Menu start
|
|
|
82 |
children.clear();
|
|
|
83 |
children.add(getMenuPojoObject("My Wallet", "/my-wallet", "", null));
|
|
|
84 |
children.add(getMenuPojoObject("My Recharges", "/my-recharges", "", null));
|
|
|
85 |
children.add(getMenuPojoObject("Learn More", "/recharge-faq", "", null));
|
|
|
86 |
finalList.add(getMenuPojoObject("Recharge", "/recharge", "//static.saholic.com/images/tabletMenuIcon.png", children));
|
|
|
87 |
// Recharge Menu end
|
|
|
88 |
|
|
|
89 |
return finalList;
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
private static MenuPojo getMenuPojoObject(String name, String url, String iconUrl, List<MenuPojo> children) {
|
|
|
93 |
MenuPojo menuObject = new MenuPojo();
|
|
|
94 |
menuObject.setName(name);
|
|
|
95 |
menuObject.setUrl(url);
|
|
|
96 |
menuObject.setIcon_url(iconUrl);
|
|
|
97 |
menuObject.setChildren(children);
|
|
|
98 |
return menuObject;
|
|
|
99 |
}
|
|
|
100 |
|
| 9220 |
amit.gupta |
101 |
|
|
|
102 |
public static ProductPojo getShortContent(long entityId){
|
|
|
103 |
ContentPojo cp = StorageManager.getById(StorageManager.views.siteContent, entityId, ContentPojo.class);
|
| 9269 |
amit.gupta |
104 |
ProductPojo pp = null;
|
|
|
105 |
if(cp!=null){
|
|
|
106 |
pp = new ProductPojo();
|
|
|
107 |
pp.setOfferText(cp.getOfferText());
|
|
|
108 |
pp.setDescription(StringUtils.join(cp.getKeySpecs().subList(0, 3),", "));
|
|
|
109 |
pp.setImageUrl(cp.getThumbnailImageUrl());
|
|
|
110 |
pp.setUrl(cp.getUrl());
|
|
|
111 |
|
| 9314 |
amit.gupta |
112 |
pp.setMrp(cp.getItems().get(0).getMrp());
|
|
|
113 |
pp.setPrice(cp.getItems().get(0).getSellingPrice());
|
| 9269 |
amit.gupta |
114 |
pp.setTitle(cp.getTitle());
|
|
|
115 |
}
|
| 9220 |
amit.gupta |
116 |
return pp;
|
|
|
117 |
}
|
|
|
118 |
|
| 9133 |
anupam.sin |
119 |
}
|