Subversion Repositories SmartDukaan

Rev

Rev 22162 | Rev 22925 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22162 Rev 22384
Line 39... Line 39...
39
			e.printStackTrace();
39
			e.printStackTrace();
40
			pp = null;
40
			pp = null;
41
		}
41
		}
42
		return pp;
42
		return pp;
43
	}
43
	}
-
 
44
	
-
 
45
	public ProductPojo getShortContent(String brand, String modelName, String modelNumber) {
-
 
46
		String name = getProductName(brand, modelName, modelNumber);
-
 
47
		return getShortContent(name);
-
 
48
	}
-
 
49
	
-
 
50
	private String getProductName(String brand, String modelName, String modelNumber){
-
 
51
		StringBuilder sb = new StringBuilder();
-
 
52
		
-
 
53
		sb.append(((brand != null) ? brand + " " : ""))
-
 
54
		.append(((modelName != null) ? modelName + " " : ""))
-
 
55
		.append((( modelNumber != null ) ? modelNumber : "" ));	
-
 
56
		return sb.toString();
-
 
57
	}
-
 
58
	
-
 
59
	
-
 
60
	public ProductPojo getShortContent(String name) {
-
 
61
		ContentPojo cp=null;
-
 
62
		ProductPojo pp = null;
-
 
63
		
-
 
64
		try {
-
 
65
			cp = gs.fromJson(mongoClient.getEntityByName(name).toString(), ContentPojo.class);
-
 
66
		} catch (Exception e) {
-
 
67
			e.printStackTrace();
-
 
68
			return null;
-
 
69
		}
-
 
70
		try {
-
 
71
			pp = new ProductPojo();
-
 
72
			pp.setId(cp.getId());
-
 
73
			pp.setDefaultImgUrl(cp.getDefaultImageUrl());
-
 
74
			pp.setDescription(String.join(", ", cp.getKeySpecs().subList(0, Math.min(cp.getKeySpecs().size(), 3))));
-
 
75
			pp.setTitle(pp.getTitle());
-
 
76
			pp.setImageUrl(cp.getIconImageUrl());
-
 
77
			pp.setUrl(cp.getUrl());
-
 
78
			pp.setTitle(cp.getTitle());
-
 
79
			pp.setThumbnailImageUrl(cp.getThumbnailImageUrl());
-
 
80
		} catch (Exception e) {
-
 
81
			e.printStackTrace();
-
 
82
			pp = null;
-
 
83
		}
-
 
84
		return pp;
-
 
85
	}
44
 
86
 
45
}
87
}