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 {
|
} else {
|
||||||
result = mapJabatanProfesiService.add(vo);
|
result = mapJabatanProfesiService.add(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CommonUtil.isNotNullOrEmpty(result)) {
|
if (CommonUtil.isNotNullOrEmpty(result)) {
|
||||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||||
} else {
|
} else {
|
||||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.MESSAGE, "Mapping jabatan sudah tersedia");
|
||||||
getMessage(MessageResource.LABEL_ERROR, request));
|
return RestUtil.getJsonResponse(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||||
return RestUtil.getJsonHttptatus(HttpStatus.BAD_REQUEST, mapHeaderMessage);
|
|
||||||
}
|
}
|
||||||
} catch (ServiceVOException sve) {
|
} catch (ServiceVOException sve) {
|
||||||
LOGGER.error("Got exception {} when add/update mapping jabatan ke profesi", sve.getMessage());
|
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);
|
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||||
} catch (JpaSystemException jse) {
|
} catch (JpaSystemException jse) {
|
||||||
LOGGER.error("Got exception {} when add/update mapping jabatan ke profesi", jse.getMessage());
|
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);
|
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user