Update SdmController
Penerapan HttpHeaderInfo untuk error message pada service simpan mapping jabatan-profesi
This commit is contained in:
parent
a39ea3a70f
commit
81f098c596
@ -5950,22 +5950,22 @@ public class SdmController extends LocaleController<AkunVO> {
|
||||
} else {
|
||||
result = mapJabatanProfesiService.add(vo);
|
||||
}
|
||||
|
||||
if (CommonUtil.isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.BAD_REQUEST, mapHeaderMessage);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.MESSAGE, "Mapping jabatan sudah tersedia");
|
||||
return RestUtil.getJsonResponse(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException sve) {
|
||||
LOGGER.error("Got exception {} when add/update mapping jabatan ke profesi", sve.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, sve.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add/update mapping jabatan ke profesi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user