Search in sources :

Example 1 with RequestDbFailureException

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();
        }
    }
}
Also used : ErrorLoggerInfo(org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo) ResponseBuilder(org.onap.so.apihandler.common.ResponseBuilder) Timestamp(java.sql.Timestamp) ApiException(org.onap.so.apihandlerinfra.exceptions.ApiException) BPMNFailureException(org.onap.so.apihandlerinfra.exceptions.BPMNFailureException) RestClientException(org.springframework.web.client.RestClientException) DuplicateRequestException(org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException) ValidateException(org.onap.so.apihandlerinfra.exceptions.ValidateException) RequestDbFailureException(org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException) ContactCamundaException(org.onap.so.apihandlerinfra.exceptions.ContactCamundaException) IOException(java.io.IOException) VfModuleNotFoundException(org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException) RecipeNotFoundException(org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException) ValidationException(org.onap.so.exceptions.ValidationException)

Example 2 with RequestDbFailureException

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);
        }
    }
}
Also used : Timestamp(java.sql.Timestamp) ApiException(org.onap.so.apihandlerinfra.exceptions.ApiException) RequestConflictedException(org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException) ValidateException(org.onap.so.apihandlerinfra.exceptions.ValidateException) WorkflowEngineConnectionException(org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException) RequestDbFailureException(org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException)

Aggregations

Timestamp (java.sql.Timestamp)2 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)2 RequestDbFailureException (org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException)2 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)2 IOException (java.io.IOException)1 ResponseBuilder (org.onap.so.apihandler.common.ResponseBuilder)1 BPMNFailureException (org.onap.so.apihandlerinfra.exceptions.BPMNFailureException)1 ContactCamundaException (org.onap.so.apihandlerinfra.exceptions.ContactCamundaException)1 DuplicateRequestException (org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException)1 RecipeNotFoundException (org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException)1 VfModuleNotFoundException (org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException)1 RequestConflictedException (org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException)1 WorkflowEngineConnectionException (org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException)1 ErrorLoggerInfo (org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo)1 ValidationException (org.onap.so.exceptions.ValidationException)1 RestClientException (org.springframework.web.client.RestClientException)1