use of org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException in project so by onap.
the class RequestHandlerUtils method updateStatus.
@Override
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage) throws RequestDbFailureException {
if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
aq.setStatusMessage(errorMessage);
aq.setProgress(new Long(100));
aq.setRequestStatus(status.toString());
Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
aq.setEndTime(endTimeStamp);
try {
infraActiveRequestsClient.save(aq);
} catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
}
}
}
use of org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException in project so by onap.
the class AbstractRestHandler method updateStatus.
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage) throws RequestDbFailureException {
if ((aq != null) && ((status == Status.FAILED) || (status == Status.COMPLETE))) {
aq.setStatusMessage(errorMessage);
aq.setProgress(100L);
aq.setRequestStatus(status.toString());
Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
aq.setEndTime(endTimeStamp);
try {
infraActiveRequestsClient.updateInfraActiveRequests(aq);
} catch (Exception e) {
logger.error("Error updating status", e);
}
}
}
Aggregations