aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-07 14:38:09 -0500
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-07 14:38:53 -0500
commit92a456e6e6ba6fc7f3689ced0b86d8b526cfd389 (patch)
tree1489ecbbf5bff23b66350476cb8b6b92667cb8d2 /mso-api-handlers
parent3b56cf0c1763c45b7673a087107c5e1553dd4f40 (diff)
APIH should not update db unless on error
Updated logic so APIH doesn't update db unless on error Change-Id: I530ee95e90df457996af0fe2e679a9f31ad762a5 Issue-ID: SO-1305 Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java18
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());
}
}