| Line 47... |
Line 47... |
| 47 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
47 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 48 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
48 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 49 |
try {
|
49 |
try {
|
| 50 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, roleRepository.selectById(id));
|
50 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, roleRepository.selectById(id));
|
| 51 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
51 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 52 |
}catch (ProfitMandiBusinessException pmbe) {
|
52 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 53 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
53 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 54 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
54 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 55 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
55 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 56 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
56 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 57 |
}
|
57 |
}
|
| 58 |
}
|
58 |
}
|
| 59 |
|
59 |
|
| Line 62... |
Line 62... |
| 62 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
62 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 63 |
try {
|
63 |
try {
|
| 64 |
RoleType roleType = StringUtils.toRoleType(typeName);
|
64 |
RoleType roleType = StringUtils.toRoleType(typeName);
|
| 65 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, roleRepository.selectByType(roleType));
|
65 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, roleRepository.selectByType(roleType));
|
| 66 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
66 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 67 |
}catch (ProfitMandiBusinessException pmbe) {
|
67 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 68 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
68 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 69 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
69 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 70 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
70 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 71 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
71 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 72 |
}
|
72 |
}
|
| 73 |
}
|
73 |
}
|
| 74 |
|
74 |
|
| Line 77... |
Line 77... |
| 77 |
public ResponseEntity<?> getByName(HttpServletRequest request, @RequestParam(name = "name") String name){
|
77 |
public ResponseEntity<?> getByName(HttpServletRequest request, @RequestParam(name = "name") String name){
|
| 78 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
78 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 79 |
try {
|
79 |
try {
|
| 80 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, roleRepository.selectByName(name));
|
80 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, roleRepository.selectByName(name));
|
| 81 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
81 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 82 |
}catch (ProfitMandiBusinessException pmbe) {
|
82 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 83 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
83 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 84 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
84 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 85 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
85 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 86 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
86 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 87 |
}
|
87 |
}
|
| 88 |
}
|
88 |
}
|
| 89 |
|
89 |
|
| Line 92... |
Line 92... |
| 92 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
92 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 93 |
try {
|
93 |
try {
|
| 94 |
roleRepository.deleteById(id);
|
94 |
roleRepository.deleteById(id);
|
| 95 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("ROL_OK_1001"));
|
95 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("ROL_OK_1001"));
|
| 96 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
96 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 97 |
}catch (ProfitMandiBusinessException pmbe) {
|
97 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 98 |
LOGGER.error("ProfitMandi error: ", pmbe);
|
98 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 99 |
final Response response=new Response(pmbe.getRejectedType(), pmbe.getRejectedValue(),pmbe.getCode(), pmbe.getMessage());
|
99 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
| 100 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
100 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
| 101 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
101 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
| 102 |
}
|
102 |
}
|
| 103 |
}
|
103 |
}
|
| 104 |
|
104 |
|