Subversion Repositories SmartDukaan

Rev

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

Rev 30267 Rev 31238
Line 92... Line 92...
92
			throws Exception {
92
			throws Exception {
93
		List<ContentPojo> contentPojos = readFile(file);
93
		List<ContentPojo> contentPojos = readFile(file);
94
		for (ContentPojo contentPojo : contentPojos) {
94
		for (ContentPojo contentPojo : contentPojos) {
95
			mongoClient.persistEntity(contentPojo);
95
			mongoClient.persistEntity(contentPojo);
96
		}
96
		}
97
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
97
		model.addAttribute("response1", mvcResponseSender.createResponseString(true));
98
		return "response";
98
		return "response";
99
	}
99
	}
100
 
100
 
101
	@PostMapping(value = "/content/media/upload")
101
	@PostMapping(value = "/content/media/upload")
102
	public String uploadMediaContent(HttpServletRequest request, @RequestBody EntityMediaPojo entityMediaPojo,
102
	public String uploadMediaContent(HttpServletRequest request, @RequestBody EntityMediaPojo entityMediaPojo,
Line 104... Line 104...
104
		ContentPojo contentPojo = mongoClient.getEntityById(entityMediaPojo.getEntityId());
104
		ContentPojo contentPojo = mongoClient.getEntityById(entityMediaPojo.getEntityId());
105
		Map<String, InputStream> fileStreamsMap = getStreamFileMap(contentPojo, entityMediaPojo);
105
		Map<String, InputStream> fileStreamsMap = getStreamFileMap(contentPojo, entityMediaPojo);
106
		LOGGER.info("fileStreamsMap {}, " + fileStreamsMap.keySet());
106
		LOGGER.info("fileStreamsMap {}, " + fileStreamsMap.keySet());
107
		uploadContentFiles(fileStreamsMap, entityMediaPojo.getEntityId());
107
		uploadContentFiles(fileStreamsMap, entityMediaPojo.getEntityId());
108
		mongoClient.persistEntity(contentPojo);
108
		mongoClient.persistEntity(contentPojo);
109
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
109
		model.addAttribute("response1", mvcResponseSender.createResponseString(true));
110
		return "response";
110
		return "response";
111
	}
111
	}
112
 
112
 
113
	@PostMapping(value = "/image/media/upload")
113
	@PostMapping(value = "/image/media/upload")
114
	public String uploadImageMediaContent(HttpServletRequest request, @RequestBody MediaPojo mediaPojo, Model model)
114
	public String uploadImageMediaContent(HttpServletRequest request, @RequestBody MediaPojo mediaPojo, Model model)
Line 199... Line 199...
199
		ContentPojo contentPojo = mongoClient.getEntityById(entityId);
199
		ContentPojo contentPojo = mongoClient.getEntityById(entityId);
200
		if (contentPojo == null) {
200
		if (contentPojo == null) {
201
			throw new Exception("Please add content first");
201
			throw new Exception("Please add content first");
202
		}
202
		}
203
		EntityMediaPojo empojo = getEntityMediaPojo(contentPojo);
203
		EntityMediaPojo empojo = getEntityMediaPojo(contentPojo);
204
		model.addAttribute("response", mvcResponseSender.createResponseString(empojo));
204
		model.addAttribute("response1", mvcResponseSender.createResponseString(empojo));
205
		return "response";
205
		return "response";
206
	}
206
	}
207
 
207
 
208
	@GetMapping(value = "/catalog-item")
208
	@GetMapping(value = "/catalog-item")
209
	public String catalogItem(HttpServletRequest request, Model model) throws Exception {
209
	public String catalogItem(HttpServletRequest request, Model model) throws Exception {
Line 234... Line 234...
234
	public String searchEntity(HttpServletRequest request, @RequestParam(defaultValue = "null") String query,
234
	public String searchEntity(HttpServletRequest request, @RequestParam(defaultValue = "null") String query,
235
							   @RequestParam(defaultValue = "0") int categoryId, @RequestParam(defaultValue = "") List<String> brands,
235
							   @RequestParam(defaultValue = "0") int categoryId, @RequestParam(defaultValue = "") List<String> brands,
236
							   @RequestParam(defaultValue = "30") int limit,
236
							   @RequestParam(defaultValue = "30") int limit,
237
							   @RequestParam(defaultValue = "true") boolean activeOnly,
237
							   @RequestParam(defaultValue = "true") boolean activeOnly,
238
							   Model model) throws Exception {
238
							   Model model) throws Exception {
239
		model.addAttribute("response", solrService.getContent(query, categoryId > 0 ? Arrays.asList(categoryId) : null, brands, limit, activeOnly));
239
		model.addAttribute("response1", solrService.getContent(query, categoryId > 0 ? Arrays.asList(categoryId) : null, brands, limit, activeOnly));
240
		return "response";
240
		return "response";
241
	}
241
	}
242
 
242
 
243
	@GetMapping(value = "/content/index")
243
	@GetMapping(value = "/content/index")
244
	public String index(HttpServletRequest request, Model model) throws Exception {
244
	public String index(HttpServletRequest request, Model model) throws Exception {