Subversion Repositories SmartDukaan

Rev

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

Rev 21339 Rev 21359
Line 52... Line 52...
52
		logger.info("Entity Id "+entityId);
52
		logger.info("Entity Id "+entityId);
53
		RestClient rc = new RestClient(SchemeType.HTTP, host , port);
53
		RestClient rc = new RestClient(SchemeType.HTTP, host , port);
54
		Map<String, String> params = new HashMap<String, String>();
54
		Map<String, String> params = new HashMap<String, String>();
55
		String response = null;
55
		String response = null;
56
		String uri = webapp+"/entity/"+entityId;
56
		String uri = webapp+"/entity/"+entityId;
-
 
57
		EntityResponse entityResponse=null;
57
		try {
58
		try {
58
			response = rc.get(uri, params);
59
			response = rc.get(uri, params);
59
			logger.info("Response is "+response);
60
			logger.info("Response is "+response);
60
		} catch (Exception | ProfitMandiBusinessException e) {
61
		} catch (Exception | ProfitMandiBusinessException e) {
61
			logger.error("Unable to get entity "+entityId,e);
62
			logger.error("Unable to get entity "+entityId,e);
62
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, new EntityResponse());
63
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, entityResponse);
63
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
64
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
64
		}
65
		}
65
		Gson gson = new Gson();
66
		Gson gson = new Gson();
66
		EntityResponse entityResponse = gson.fromJson(response, EntityResponse.class);
67
		entityResponse = gson.fromJson(response, EntityResponse.class);
67
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, entityResponse);
68
		final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, entityResponse);
68
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
69
		return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
69
	}
70
	}
70
 
71
 
71
 
72