| Line 40... |
Line 40... |
| 40 |
request.removeAttribute(ProfitMandiConstants.API);
|
40 |
request.removeAttribute(ProfitMandiConstants.API);
|
| 41 |
try {
|
41 |
try {
|
| 42 |
apiRepository.persist(api);
|
42 |
apiRepository.persist(api);
|
| 43 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1000"));
|
43 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1000"));
|
| 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 |
|
| Line 61... |
Line 61... |
| 61 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
61 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 62 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
62 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 63 |
try {
|
63 |
try {
|
| 64 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, apiRepository.selectById(id));
|
64 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, apiRepository.selectById(id));
|
| 65 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
65 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 66 |
}catch (ProfitMandiBusinessException pmbe) {
|
66 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 67 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
67 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 68 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
68 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 69 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
69 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 70 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
70 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 71 |
}
|
71 |
}
|
| 72 |
}
|
72 |
}
|
| 73 |
|
73 |
|
| Line 75... |
Line 75... |
| 75 |
public ResponseEntity<?> getByName(HttpServletRequest request, @RequestParam(name = "name") String name){
|
75 |
public ResponseEntity<?> getByName(HttpServletRequest request, @RequestParam(name = "name") String name){
|
| 76 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
76 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 77 |
try {
|
77 |
try {
|
| 78 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, apiRepository.selectByName(name));
|
78 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, apiRepository.selectByName(name));
|
| 79 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
79 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 80 |
}catch (ProfitMandiBusinessException pmbe) {
|
80 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 81 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
81 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 82 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
82 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 83 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
83 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 84 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
84 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 85 |
}
|
85 |
}
|
| 86 |
}
|
86 |
}
|
| 87 |
|
87 |
|
| Line 98... |
Line 98... |
| 98 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
98 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 99 |
try {
|
99 |
try {
|
| 100 |
apiRepository.deleteById(id);
|
100 |
apiRepository.deleteById(id);
|
| 101 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
101 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
|
| 102 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
102 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 103 |
}catch (ProfitMandiBusinessException pmbe) {
|
103 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 104 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
104 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 105 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
105 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 106 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
106 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 107 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
107 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 108 |
}
|
108 |
}
|
| 109 |
}
|
109 |
}
|
| 110 |
|
110 |
|
| Line 116... |
Line 116... |
| 116 |
request.removeAttribute(ProfitMandiConstants.UPDATE_API_MAP);
|
116 |
request.removeAttribute(ProfitMandiConstants.UPDATE_API_MAP);
|
| 117 |
try {
|
117 |
try {
|
| 118 |
apiRepository.updateNameById(updateApiMap.get(ProfitMandiConstants.NAME).toString(), updateApiMap.get(ProfitMandiConstants.URI).toString(),(Method)updateApiMap.get(ProfitMandiConstants.METHOD), (Integer)updateApiMap.get(ProfitMandiConstants.ID));
|
118 |
apiRepository.updateNameById(updateApiMap.get(ProfitMandiConstants.NAME).toString(), updateApiMap.get(ProfitMandiConstants.URI).toString(),(Method)updateApiMap.get(ProfitMandiConstants.METHOD), (Integer)updateApiMap.get(ProfitMandiConstants.ID));
|
| 119 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1002"));
|
119 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1002"));
|
| 120 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
120 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 121 |
}catch (ProfitMandiBusinessException pmbe) {
|
121 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 122 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
122 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 123 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
123 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 124 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
124 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 125 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
125 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 126 |
}
|
126 |
}
|
| 127 |
}
|
127 |
}
|
| 128 |
|
128 |
|