Subversion Repositories SmartDukaan

Rev

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

Rev 31483 Rev 31485
Line 238... Line 238...
238
	public String addBrands(HttpServletRequest request, Model model) throws Exception {
238
	public String addBrands(HttpServletRequest request, Model model) throws Exception {
239
 
239
 
240
		List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
240
		List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
241
		for (DBObject mobileBrand : mobileBrands) {
241
		for (DBObject mobileBrand : mobileBrands) {
242
			String brandName = (String) mobileBrand.get("name");
242
			String brandName = (String) mobileBrand.get("name");
243
			Brand brand = brandsRepository.selectByBrand(brandName);
243
			// Brand brand = brandsRepository.selectByBrand(brandName);
244
 
244
 
245
			if (brand == null) {
-
 
246
 
-
 
247
				brand = new Brand();
245
			Brand brand = new Brand();
248
				brand.setName(brandName);
246
			brand.setName(brandName);
249
				brand.setLogoUrl((String) mobileBrand.get("url"));
247
			brand.setLogoUrl((String) mobileBrand.get("url"));
250
				brandsRepository.persist(brand);
248
			brandsRepository.persist(brand);
251
			}
-
 
252
 
249
 
253
			BrandCategory brandCategory = new BrandCategory();
250
			BrandCategory brandCategory = new BrandCategory();
254
			brandCategory.setActive((Boolean) mobileBrand.get("active"));
251
			brandCategory.setActive((Boolean) mobileBrand.get("active"));
255
			brandCategory.setCategoryId((int) mobileBrand.get("categoryId"));
252
			brandCategory.setCategoryId((int) mobileBrand.get("categoryId"));
256
			brandCategory.setBrandId(brand.getId());
253
			brandCategory.setBrandId(brand.getId());