aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java85
1 files changed, 45 insertions, 40 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
index cdb4ab96aa..b5957b3009 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
@@ -22,7 +22,6 @@ package org.onap.so.client.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
-
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@@ -40,45 +39,51 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
-public class ServiceTopologyOperationMapper{
+public class ServiceTopologyOperationMapper {
+
+ @Autowired
+ public GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ public GenericResourceApiServiceOperationInformation reqMapper(SDNCSvcOperation svcOperation,
+ SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
+
+ String sdncReqId = UUID.randomUUID().toString();
+ String msoRequestId = UUID.randomUUID().toString();
+ if (requestContext != null && requestContext.getMsoRequestId() != null) {
+ msoRequestId = requestContext.getMsoRequestId();
+ }
+ GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper
+ .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
+ GenericResourceApiServiceinformationServiceInformation servInfo =
+ generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
+ GenericResourceApiServicerequestinputServiceRequestInput servReqInfo =
+ new GenericResourceApiServicerequestinputServiceRequestInput();
+
+ servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
- @Autowired
- public GeneralTopologyObjectMapper generalTopologyObjectMapper;
-
- public GenericResourceApiServiceOperationInformation reqMapper (SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
+ servOpInput.setSdncRequestHeader(sdncRequestHeader);
+ servOpInput.setRequestInformation(reqInfo);
+ servOpInput.setServiceInformation(servInfo);
+ servOpInput.setServiceRequestInput(servReqInfo);
- String sdncReqId = UUID.randomUUID().toString();
- String msoRequestId = UUID.randomUUID().toString();
- if (requestContext != null && requestContext.getMsoRequestId() != null) {
- msoRequestId = requestContext.getMsoRequestId();
- }
- GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
- GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
- GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
- GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
-
- servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
-
- servOpInput.setSdncRequestHeader(sdncRequestHeader);
- servOpInput.setRequestInformation(reqInfo);
- servOpInput.setServiceInformation(servInfo);
- servOpInput.setServiceRequestInput(servReqInfo);
-
- if(requestContext != null && requestContext.getUserParams()!=null){
- for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
- GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
- serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
- GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
- GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
- paramItem.setName(entry.getKey());
- paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
- serviceInputParameters.addParamItem(paramItem );
- serviceRequestInput.serviceInputParameters(serviceInputParameters);
- servOpInput.setServiceRequestInput(serviceRequestInput );
- }
- }
- return servOpInput;
- }
+ if (requestContext != null && requestContext.getUserParams() != null) {
+ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
+ GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput =
+ new GenericResourceApiServicerequestinputServiceRequestInput();
+ serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
+ GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
+ GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
+ paramItem.setName(entry.getKey());
+ paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
+ serviceInputParameters.addParamItem(paramItem);
+ serviceRequestInput.serviceInputParameters(serviceInputParameters);
+ servOpInput.setServiceRequestInput(serviceRequestInput);
+ }
+ }
+ return servOpInput;
+ }
}