Merge "Add correlationId to ServiceInstancesRequest"
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java
index a894ffc..d06c532 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java
@@ -41,6 +41,8 @@
private String vfModuleInstanceId;
@JsonProperty("configurationId")
private String configurationId;
+ @JsonProperty("correlationId")
+ private String correlationId;
public RequestDetails getRequestDetails() {
return requestDetails;
@@ -98,15 +100,26 @@
this.configurationId = configurationId;
}
- @Override
- public String toString() {
- return "ServiceInstancesRequest [requestDetails=" + requestDetails
- + ", serviceInstanceId=" + serviceInstanceId
- + ", vnfInstanceId=" + vnfInstanceId + ", networkInstanceId="
- + networkInstanceId + ", volumeGroupInstanceId="
- + volumeGroupInstanceId + ", vfModuleInstanceId="
- + vfModuleInstanceId + ", configurationId="
- + configurationId + ",]";
+ public String getCorrelationId() {
+ return correlationId;
}
+ public void setCorrelationId(String correlationId) {
+ this.correlationId = correlationId;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("ServiceInstancesRequest{");
+ sb.append("requestDetails=").append(requestDetails);
+ sb.append(", serviceInstanceId='").append(serviceInstanceId).append('\'');
+ sb.append(", vnfInstanceId='").append(vnfInstanceId).append('\'');
+ sb.append(", networkInstanceId='").append(networkInstanceId).append('\'');
+ sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\'');
+ sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\'');
+ sb.append(", configurationId='").append(configurationId).append('\'');
+ sb.append(", correlationId='").append(correlationId).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
index fc8e8d9..7c3a3df 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
@@ -77,7 +77,6 @@
@Api(value="/serviceInstances",description="API Requests for Service Instances")
public class ServiceInstances {
- private HashMap<String, String> instanceIdMap = new HashMap<>();
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
@@ -508,7 +507,7 @@
MsoRequest msoRequest = new MsoRequest (requestId);
try {
- sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest);
+ sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, msoRequest);
} catch(Exception e) {
msoLogger.debug("Exception occurred while mapping of request to JSON object ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
@@ -907,11 +906,10 @@
}
private ServiceInstancesRequest convertJsonToServiceInstanceRequest(String requestJSON, Action action, long startTime,
- ServiceInstancesRequest sir, MsoRequest msoRequest) throws Exception {
+ MsoRequest msoRequest) throws Exception {
try{
ObjectMapper mapper = new ObjectMapper();
- sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
-
+ return mapper.readValue(requestJSON, ServiceInstancesRequest.class);
} catch(Exception e){
msoLogger.debug ("Mapping of request to JSON object failed : ", e);
if (msoRequest.getRequestId () != null) {
@@ -922,7 +920,6 @@
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed");
throw new Exception(e);
}
- return sir;
}
private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception {
@@ -1233,7 +1230,7 @@
MsoRequest msoRequest = new MsoRequest (requestId);
try {
- sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest);
+ sir = convertJsonToServiceInstanceRequest(requestJSON, action, startTime, msoRequest);
} catch(Exception e) {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException,
"Mapping of request to JSON object failed. " + e.getMessage(),