Subversion Repositories SmartDukaan

Rev

Rev 35795 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21545 ashik.ali 1
package com.spice.profitmandi.dao.model;
2
 
3
import java.util.List;
4
 
25380 amit.gupta 5
public class ContentPojo extends HeaderInfoPojo {
21545 ashik.ali 6
 
25380 amit.gupta 7
	public ContentPojo(String title, List<String> keySpecs, List<SpecificationGroup> detailedSpecs, String warranty) {
21545 ashik.ali 8
		super();
9
		super.setTitle(title);
10
		this.keySpecs = keySpecs;
11
		this.detailedSpecs = detailedSpecs;
12
		this.warranty = warranty;
13
	}
25380 amit.gupta 14
 
21545 ashik.ali 15
	public ContentPojo(Long id) {
16
		this.id = id;
17
	}
25380 amit.gupta 18
 
19
	// Content
21545 ashik.ali 20
	private Long id;
21
	private String introduction;
25380 amit.gupta 22
 
21545 ashik.ali 23
	public String getIntroduction() {
24
		return introduction;
25
	}
26
 
27
	public void setIntroduction(String introduction) {
28
		this.introduction = introduction;
29
	}
25380 amit.gupta 30
 
21545 ashik.ali 31
	private String url;
32
	private List<String> keySpecs;
33
	private List<SpecificationGroup> detailedSpecs;
34
	private String warranty;
35
	private String name;
36
	private String categoryName;
37
	private String categoryUrl;
38
	private String breadCrumb;
27583 tejbeer 39
	private float price;
35503 vikas 40
    private String description;
37204 amit 41
	// Integer, never Long: legacy Mongo driver renders NumberLong as
42
	// {"$numberLong":...} which Gson cannot map. Stamped from catalog.catalog.
43
	private Integer categoryId;
44
	private List<CategorySpecPojo> categorySpecs;
25380 amit.gupta 45
 
27583 tejbeer 46
	public float getPrice() {
47
		return price;
48
	}
49
 
50
	public void setPrice(float price) {
51
		this.price = price;
52
	}
53
 
37204 amit 54
	public Integer getCategoryId() {
55
		return categoryId;
56
	}
57
 
58
	public void setCategoryId(Integer categoryId) {
59
		this.categoryId = categoryId;
60
	}
61
 
62
	public List<CategorySpecPojo> getCategorySpecs() {
63
		return categorySpecs;
64
	}
65
 
66
	public void setCategorySpecs(List<CategorySpecPojo> categorySpecs) {
67
		this.categorySpecs = categorySpecs;
68
	}
69
 
25380 amit.gupta 70
	// To be set at runtime
21545 ashik.ali 71
	private List<ProductPojo> reocmmendedAccessories;
25380 amit.gupta 72
 
21545 ashik.ali 73
	public String getDefaultImageUrl() {
74
		return defaultImageUrl;
75
	}
76
 
77
	public void setDefaultImageUrl(String defaultImageUrl) {
78
		this.defaultImageUrl = defaultImageUrl;
79
	}
80
 
81
	public String getIconImageUrl() {
82
		return iconImageUrl;
83
	}
84
 
85
	public void setIconImageUrl(String iconImageUrl) {
86
		this.iconImageUrl = iconImageUrl;
87
	}
88
 
89
	private String defaultImageUrl;
90
	private String iconImageUrl;
91
	private String thumbnailImageUrl;
92
	private List<MediaPojo> images;
35346 ranu 93
	private List<VideoUrlsContentPojo> videoUrls;
21545 ashik.ali 94
	private List<String> packageContents;
25380 amit.gupta 95
 
21545 ashik.ali 96
	private String offerText;
25380 amit.gupta 97
	// private EmiPojo bankEmis;
98
 
21545 ashik.ali 99
	public List<String> getKeySpecs() {
100
		return keySpecs;
101
	}
25380 amit.gupta 102
 
21545 ashik.ali 103
	public void setKeySpecs(List<String> keySpecs) {
104
		this.keySpecs = keySpecs;
105
	}
25380 amit.gupta 106
 
21545 ashik.ali 107
	public List<SpecificationGroup> getDetailedSpecs() {
108
		return detailedSpecs;
109
	}
25380 amit.gupta 110
 
21545 ashik.ali 111
	public void setDetailedSpecs(List<SpecificationGroup> detailedSpecs) {
112
		this.detailedSpecs = detailedSpecs;
113
	}
25380 amit.gupta 114
 
21545 ashik.ali 115
	public String getWarranty() {
116
		return warranty;
117
	}
25380 amit.gupta 118
 
21545 ashik.ali 119
	public void setWarranty(String warranty) {
120
		this.warranty = warranty;
121
	}
25380 amit.gupta 122
 
21545 ashik.ali 123
	public List<MediaPojo> getImages() {
124
		return images;
125
	}
25380 amit.gupta 126
 
21545 ashik.ali 127
	public void setImages(List<MediaPojo> images) {
128
		this.images = images;
129
	}
25380 amit.gupta 130
 
21545 ashik.ali 131
	public void setId(Long id) {
132
		this.id = id;
133
	}
25380 amit.gupta 134
 
21545 ashik.ali 135
	public Long getId() {
136
		return id;
137
	}
25380 amit.gupta 138
 
21545 ashik.ali 139
	public String getOfferText() {
140
		return offerText;
141
	}
25380 amit.gupta 142
 
21545 ashik.ali 143
	public void setOfferText(String offerText) {
144
		this.offerText = offerText;
145
	}
25380 amit.gupta 146
 
21545 ashik.ali 147
	public void setPackageContents(List<String> packageContents) {
148
		this.packageContents = packageContents;
149
	}
25380 amit.gupta 150
 
21545 ashik.ali 151
	public List<String> getPackageContents() {
152
		return packageContents;
153
	}
25380 amit.gupta 154
 
21545 ashik.ali 155
	public String getThumbnailImageUrl() {
156
		return thumbnailImageUrl;
157
	}
25380 amit.gupta 158
 
21545 ashik.ali 159
	public void setThumbnailImageUrl(String thumbnailImageUrl) {
160
		this.thumbnailImageUrl = thumbnailImageUrl;
161
	}
162
 
163
	public void setUrl(String url) {
164
		this.url = url;
165
	}
166
 
167
	public String getUrl() {
168
		return url;
169
	}
170
 
171
	public void setReocmmendedAccessories(List<ProductPojo> reocmmendedAccessories) {
172
		this.reocmmendedAccessories = reocmmendedAccessories;
173
	}
174
 
175
	public List<ProductPojo> getReocmmendedAccessories() {
176
		return reocmmendedAccessories;
177
	}
178
 
179
	public void setCategoryName(String categoryName) {
180
		this.categoryName = categoryName;
181
	}
182
 
183
	public String getCategoryName() {
184
		return categoryName;
185
	}
186
 
187
	public void setCategoryUrl(String categoryUrl) {
188
		this.categoryUrl = categoryUrl;
189
	}
190
 
191
	public String getCategoryUrl() {
192
		return categoryUrl;
193
	}
194
 
195
	public void setBreadCrumb(String breadCrumb) {
196
		this.breadCrumb = breadCrumb;
197
	}
198
 
199
	public String getBreadCrumb() {
200
		return breadCrumb;
201
	}
202
 
203
	public void setName(String name) {
204
		this.name = name;
205
	}
206
 
207
	public String getName() {
208
		return name;
209
	}
29352 tejbeer 210
 
35346 ranu 211
	public List<VideoUrlsContentPojo> getVideoUrls() {
212
		return videoUrls;
213
	}
214
 
215
	public void setVideoUrls(List<VideoUrlsContentPojo> videoUrls) {
216
		this.videoUrls = videoUrls;
217
	}
218
 
35529 ranu 219
	public String getDescription() {
35503 vikas 220
        return description;
221
    }
222
 
223
    public void generateDescription() {
224
        StringBuilder desc = new StringBuilder();
225
 
226
        if (this.introduction != null && !this.introduction.trim().isEmpty()) {
227
            desc.append(this.introduction.trim()).append("<br><br>");
228
        }
229
 
230
        if (keySpecs != null && !keySpecs.isEmpty()) {
231
            desc.append("Key Specifications: <br>");
232
            for (String spec : keySpecs) {
233
                if (spec != null && !spec.trim().isEmpty()) {
234
                    desc.append("• ").append(spec.trim()).append(" <br>");
235
                }
236
            }
237
            desc.append(" <br>");
238
        }
239
 
240
        if (detailedSpecs != null && !detailedSpecs.isEmpty()) {
241
            desc.append("Detailed Specifications: <br>");
242
            for (SpecificationGroup group : detailedSpecs) {
243
                if (group == null || group.getTitle() == null) continue;
35795 vikas 244
                desc.append(" <br><strong>").append(group.getTitle().toUpperCase().replace(" N ", " & ").replace(" AND ", " & ")).append(":</strong> <br>");
35503 vikas 245
 
246
                List<Specification> specs = group.getSpecs();
247
                if (specs != null && !specs.isEmpty()) {
248
                    for (Specification spec : specs) {
249
                        if (spec == null) continue;
250
                        String name = spec.getName() != null ? spec.getName().trim() : "";
251
                        String value = spec.getString() != null ? spec.getString().trim() : "";
252
                        if (!name.isEmpty() && !value.isEmpty()) {
253
                            desc.append(" - ").append(name).append(": ").append(value).append(" <br>");
254
                        }
255
                    }
256
                }
257
            }
258
            desc.append(" <br>");
259
        }
260
 
261
        if (packageContents != null && !packageContents.isEmpty()) {
35795 vikas 262
            desc.append("<strong>Package Contents:</strong> <br>");
35503 vikas 263
            for (String item : packageContents) {
264
                if (item != null && !item.trim().isEmpty()) {
265
                    desc.append("• ").append(item.trim()).append(" <br>");
266
                }
267
            }
268
            desc.append(" <br>");
269
        }
270
 
271
        if (this.offerText != null && !this.offerText.trim().isEmpty()) {
35795 vikas 272
            desc.append("<strong>Offers: </strong>").append(this.offerText.trim()).append("<br><br>");
35503 vikas 273
        }
274
 
275
        if (this.warranty != null && !this.warranty.trim().isEmpty()) {
35795 vikas 276
            desc.append("<strong>Warranty:</strong> ").append(this.warranty.trim()).append(" <br>");
35503 vikas 277
        }
278
 
279
        this.description = desc.toString().trim();
35529 ranu 280
	}
35503 vikas 281
 
282
    @Override
29352 tejbeer 283
	public String toString() {
284
		return "ContentPojo [id=" + id + ", introduction=" + introduction + ", url=" + url + ", keySpecs=" + keySpecs
285
				+ ", detailedSpecs=" + detailedSpecs + ", warranty=" + warranty + ", name=" + name + ", categoryName="
286
				+ categoryName + ", categoryUrl=" + categoryUrl + ", breadCrumb=" + breadCrumb + ", price=" + price
287
				+ ", reocmmendedAccessories=" + reocmmendedAccessories + ", defaultImageUrl=" + defaultImageUrl
288
				+ ", iconImageUrl=" + iconImageUrl + ", thumbnailImageUrl=" + thumbnailImageUrl + ", images=" + images
35346 ranu 289
				+ ", videoUrls=" + videoUrls + ", packageContents=" + packageContents + ", offerText=" + offerText + "]";
29352 tejbeer 290
	}
291
 
21545 ashik.ali 292
}