diff options
author | Rob Daugherty <rd472p@att.com> | 2018-12-10 13:58:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-10 13:58:58 +0000 |
commit | a081c91038c6631fedda6c164093f580a91e9607 (patch) | |
tree | 05b0bfc44a5aa1728190504eac1a972dfa0db88a | |
parent | fc360bb4bf78fe5d7c14fe98c0bbbefff87dae66 (diff) | |
parent | 92a456e6e6ba6fc7f3689ced0b86d8b526cfd389 (diff) |
Merge "APIH should not update db unless on error"
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index 79d2a867e8..32693c356e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -692,7 +692,7 @@ public class ServiceInstances { sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest, requestId, requestUri); String requestScope = deriveRequestScope(action, sir, requestUri); - InfraActiveRequests currentActiveReq = msoRequest.createRequestObject (sir, action, requestId, Status.PENDING, requestJSON, requestScope); + InfraActiveRequests currentActiveReq = msoRequest.createRequestObject (sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope); if(sir.getRequestDetails().getRequestParameters() != null){ aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte(); } @@ -864,7 +864,7 @@ public class ServiceInstances { sir.setInstanceGroupId(instanceGroupId); String requestScope = ModelType.instanceGroup.toString(); - InfraActiveRequests currentActiveReq = msoRequest.createRequestObject (sir, action, requestId, Status.PENDING, null, requestScope); + InfraActiveRequests currentActiveReq = msoRequest.createRequestObject (sir, action, requestId, Status.IN_PROGRESS, null, requestScope); setInstanceId(currentActiveReq, requestScope, null, instanceIdMap); try { validateHeaders(requestContext); @@ -1018,19 +1018,7 @@ public class ServiceInstances { .errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage()); throw validateException; - } - - currentActiveReq.setRequestStatus(Status.IN_PROGRESS.name()); - setInstanceId(currentActiveReq, requestScope, jsonResponse.getRequestReferences().getInstanceId(), new HashMap<>()); - - try{ - infraActiveRequestsClient.save(currentActiveReq); - }catch(Exception e){ - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.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(); - } - + } return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestClientParameter.getRequestId(), jsonResponse, requestClientParameter.getApiVersion()); } } |