Subversion Repositories SmartDukaan

Rev

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

Rev 29351 Rev 31720
Line 164... Line 164...
164
		obj.append("_id", id);
164
		obj.append("_id", id);
165
		DBObject result = collection.findOne(obj);
165
		DBObject result = collection.findOne(obj);
166
		if (result == null) {
166
		if (result == null) {
167
			throw new Exception();
167
			throw new Exception();
168
		}
168
		}
169
		LOGGER.info(result.toMap());
169
		//LOGGER.info(result.toMap());
170
		ContentPojo cp = gson.fromJson(new BasicDBObject(result.toMap()).toJson(), ContentPojo.class);
170
		ContentPojo cp = gson.fromJson(new BasicDBObject(result.toMap()).toJson(), ContentPojo.class);
171
		if (cp.getDefaultImageUrl() != null) {
171
		if (cp.getDefaultImageUrl() != null) {
172
			cp.setDefaultImageUrl(cp.getDefaultImageUrl().replaceAll("saholic", "smartdukaan"));
172
			cp.setDefaultImageUrl(cp.getDefaultImageUrl().replaceAll("saholic", "smartdukaan"));
173
		}
173
		}
174
 
174
 
175
		LOGGER.info("cp" + cp);
175
		//LOGGER.info("cp" + cp);
176
 
176
 
177
		return cp;
177
		return cp;
178
	}
178
	}
179
 
179
 
180
	public List<DBObject> getMongoBrands(int fofoId, String email, int categoryId) {
180
	public List<DBObject> getMongoBrands(int fofoId, String email, int categoryId) {
Line 182... Line 182...
182
		if (fofoId == Utils.SYSTEM_PARTNER_ID) {
182
		if (fofoId == Utils.SYSTEM_PARTNER_ID) {
183
			return brandsDisplay;
183
			return brandsDisplay;
184
		}
184
		}
185
		List<String> blockedBrands = retailerBlockBrandsRepository.selectAllByRetailer(fofoId).stream()
185
		List<String> blockedBrands = retailerBlockBrandsRepository.selectAllByRetailer(fofoId).stream()
186
				.map(x -> x.getBlockBrands()).collect(Collectors.toList());
186
				.map(x -> x.getBlockBrands()).collect(Collectors.toList());
187
		LOGGER.info("blockedBrands" + blockedBrands);
187
		//LOGGER.info("blockedBrands" + blockedBrands);
188
		brandsDisplay = brandsDisplay.stream().filter(x -> !blockedBrands.contains(x.get("name")))
188
		brandsDisplay = brandsDisplay.stream().filter(x -> !blockedBrands.contains(x.get("name")))
189
				.collect(Collectors.toList());
189
				.collect(Collectors.toList());
190
 
190
 
191
		LOGGER.info("brandsDisplay" + brandsDisplay);
191
		//LOGGER.info("brandsDisplay" + brandsDisplay);
192
		return brandsDisplay;
192
		return brandsDisplay;
193
	}
193
	}
194
 
194
 
195
	public ContentPojo getEntityByName(String name) throws Exception {
195
	public ContentPojo getEntityByName(String name) throws Exception {
196
		LOGGER.info("Name --- {}", name);
196
		//LOGGER.info("Name --- {}", name);
197
		DB db = contentMongoClient.getDB(CONTENT);
197
		DB db = contentMongoClient.getDB(CONTENT);
198
		DBCollection collection = db.getCollection(SITE_CONTENT);
198
		DBCollection collection = db.getCollection(SITE_CONTENT);
199
		BasicDBObject obj = new BasicDBObject();
199
		BasicDBObject obj = new BasicDBObject();
200
		obj.append("title", name);
200
		obj.append("title", name);
201
		DBObject result = collection.findOne();
201
		DBObject result = collection.findOne();