Resource.java
@RequestMapping(value = "/updateDetails", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('" + ROLE_BPM_EAUTH_WF_CLIENT + "')")
public ResponseEntity<UpdateStatus> updateDetails(@RequestBody updateRequest updateRequest) throws ServiceException {
UpdateStatus response = null;
try{
response = controlService.updateDetails(updateRequest);
}catch (ControlServiceException controlServiceException) {
if(ErrorCodes.ERROR_CODE.FAILED_TO_UPDATE_DETAILS.getCode().equals(controlServiceException.getErrorCode())
|| ErrorCodes.ERROR_CODE.FAILED_TO_UPDATE_DETAILS_STALE_DATA_ISSUE.getCode().equals(controlServiceException.getErrorCode())) {
final int maxRetryCount = controlService.getMaxRetryCountFromConfig();
response = retryUpdateDetails(updateRequest, 1, maxRetryCount);
} else{
throw controlServiceException;
}
}
return new ResponseEntity<>(response, HttpStatus.OK);
}
Service.java
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { ServiceException.class })
public UpdateStatus updateDetails(UpdateRequest updateRequest) throws ServiceException {
Object object = updateRequest.getObject();
updateDetailActions(updateRequest);
return InformationTransformer.transformStatus(object, true);
}
private void updateDetailActions(updateRequest updateRequest) throws ServiceException {
DefaultDetails defaultDetails = null;
if (updateRequest.getEventType().equals(EventTypeEnum.A.getValue())) {
updateStatusToA(updateRequest);
}
动漫人物
慕仙森
相关分类