Subversion Repositories SmartDukaan

Rev

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

Rev 21357 Rev 21358
Line 110... Line 110...
110
		String response = null;
110
		String response = null;
111
		String uri = ProfitMandiConstants.URL_BRANDS;
111
		String uri = ProfitMandiConstants.URL_BRANDS;
112
		RestClient rc = new RestClient(SchemeType.HTTP, host , port);
112
		RestClient rc = new RestClient(SchemeType.HTTP, host , port);
113
		Map<String, String> params = new HashMap<>();
113
		Map<String, String> params = new HashMap<>();
114
		params.put("category_id", category_id);
114
		params.put("category_id", category_id);
-
 
115
		List<DealBrands> dealBrandsResponse = null;
115
		try {
116
		try {
116
			response = rc.get(uri, params);
117
			response = rc.get(uri, params);
117
		} catch (Exception | ProfitMandiBusinessException e) {
118
		} catch (Exception | ProfitMandiBusinessException e) {
118
			logger.error("Unable to get deals",e);
119
			logger.error("Unable to get deals",e);
119
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, new DealBrands());
120
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, dealBrandsResponse);
120
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
121
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
121
		}
122
		}
122
		List<DealBrands> dealBrandsResponse = new Gson().fromJson(response, new TypeToken<List<DealBrands>>(){}.getType());
123
		dealBrandsResponse = new Gson().fromJson(response, new TypeToken<List<DealBrands>>(){}.getType());
123
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, dealBrandsResponse);
124
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, dealBrandsResponse);
124
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
125
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
125
	}
126
	}
126
	
127
	
127
 
128