Subversion Repositories SmartDukaan

Rev

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

Rev 21431 Rev 21440
Line 40... Line 40...
40
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
40
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
41
		LOGGER.info("requested url : "+request.getRequestURL().toString());
41
		LOGGER.info("requested url : "+request.getRequestURL().toString());
42
		try {
42
		try {
43
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, addressRepository.selectById(id));
43
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, addressRepository.selectById(id));
44
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
44
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
45
		}catch (ProfitMandiBusinessException pmbe) {
45
		}catch (ProfitMandiBusinessException profitMandiBusinessException) {
46
			LOGGER.error("ProfitMandi error: ", pmbe);
46
			LOGGER.error("ProfitMandi error: ",  profitMandiBusinessException);
47
			final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
47
			final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
48
			final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
48
			final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
49
			return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
49
			return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
50
		}
50
		}
51
	}
51
	}
52
	
52