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 79... Line 79...
79
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
79
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
80
		LOGGER.info("requested url : "+request.getRequestURL().toString());
80
		LOGGER.info("requested url : "+request.getRequestURL().toString());
81
		try {
81
		try {
82
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, brandRepository.selectById(id));
82
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, brandRepository.selectById(id));
83
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
83
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
84
		}catch (ProfitMandiBusinessException pmbe) {
84
		}catch (ProfitMandiBusinessException profitMandiBusinessException) {
85
			LOGGER.error("ProfitMandi error: ", pmbe);
85
			LOGGER.error("ProfitMandi error: ",  profitMandiBusinessException);
86
			final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
86
			final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
87
			final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
87
			final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
88
			return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
88
			return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
89
		}
89
		}
90
	}
90
	}
91
	
91