summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java147
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java50
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java7
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java41
5 files changed, 171 insertions, 148 deletions
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index 431e9db87b..ea24a0ce3e 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -11,9 +11,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,6 +27,8 @@ package org.onap.so.adapters.sdnc.sdncrest;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
+import java.util.Arrays;
+import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.bind.DatatypeConverter;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -71,7 +73,6 @@ import org.springframework.core.env.Environment;
public abstract class SDNCConnector {
private static final Logger logger = LoggerFactory.getLogger(SDNCConnector.class);
- private static final String MSO_INTERNAL_ERROR = "MsoInternalError";
private static final String XPATH_EXCEPTION = "XPath Exception";
@Autowired
private Environment env;
@@ -84,32 +85,10 @@ public abstract class SDNCConnector {
HttpResponse httpResponse = null;
try {
- int timeout = Integer.parseInt(rt.getTimeout());
-
- RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
- .setConnectionRequestTimeout(timeout).build();
HttpClient client = HttpClientBuilder.create().build();
- if ("POST".equals(rt.getReqMethod())) {
- HttpPost httpPost = new HttpPost(rt.getSdncUrl());
- httpPost.setConfig(requestConfig);
- httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
- method = httpPost;
- } else if ("PUT".equals(rt.getReqMethod())) {
- HttpPut httpPut = new HttpPut(rt.getSdncUrl());
- httpPut.setConfig(requestConfig);
- httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
- method = httpPut;
- } else if ("GET".equals(rt.getReqMethod())) {
- HttpGet httpGet = new HttpGet(rt.getSdncUrl());
- httpGet.setConfig(requestConfig);
- method = httpGet;
- } else if ("DELETE".equals(rt.getReqMethod())) {
- HttpDelete httpDelete = new HttpDelete(rt.getSdncUrl());
- httpDelete.setConfig(requestConfig);
- method = httpDelete;
- }
+ method = getHttpRequestMethod(content, rt);
String userCredentials = CryptoUtils.decrypt(env.getProperty(Constants.SDNC_AUTH_PROP),
@@ -122,8 +101,6 @@ public abstract class SDNCConnector {
logger.debug("method is NULL:");
}
-
-
httpResponse = client.execute(method);
String responseContent = null;
@@ -141,7 +118,7 @@ public abstract class SDNCConnector {
String errMsg = "SDNC returned " + statusCode + " " + statusMessage;
String errors = analyzeErrors(responseContent);
- if (errors != null) {
+ if (errors != null && !errors.isEmpty()) {
errMsg += " " + errors;
}
@@ -192,6 +169,36 @@ public abstract class SDNCConnector {
}
}
+ private HttpRequestBase getHttpRequestMethod(String content, TypedRequestTunables rt) {
+
+ int timeout = Integer.parseInt(rt.getTimeout());
+ HttpRequestBase method = null;
+
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
+ .setConnectionRequestTimeout(timeout).build();
+
+ if ("POST".equals(rt.getReqMethod())) {
+ HttpPost httpPost = new HttpPost(rt.getSdncUrl());
+ httpPost.setConfig(requestConfig);
+ httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
+ method = httpPost;
+ } else if ("PUT".equals(rt.getReqMethod())) {
+ HttpPut httpPut = new HttpPut(rt.getSdncUrl());
+ httpPut.setConfig(requestConfig);
+ httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
+ method = httpPut;
+ } else if ("GET".equals(rt.getReqMethod())) {
+ HttpGet httpGet = new HttpGet(rt.getSdncUrl());
+ httpGet.setConfig(requestConfig);
+ method = httpGet;
+ } else if ("DELETE".equals(rt.getReqMethod())) {
+ HttpDelete httpDelete = new HttpDelete(rt.getSdncUrl());
+ httpDelete.setConfig(requestConfig);
+ method = httpDelete;
+ }
+ return method;
+ }
+
protected void logError(String errMsg) {
logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg);
@@ -205,7 +212,7 @@ public abstract class SDNCConnector {
/**
* Generates a response object from content received from SDNC. The response object may be a success response object
* or an error response object. This method must be overridden by the subclass to return the correct object type.
- *
+ *
* @param statusCode the response status code from SDNC (e.g. 200)
* @param statusMessage the response status message from SDNC (e.g. "OK")
* @param responseContent the body of the response from SDNC (possibly null)
@@ -218,7 +225,7 @@ public abstract class SDNCConnector {
/**
* Generates an error response object. This method must be overridden by the subclass to return the correct object
* type.
- *
+ *
* @param statusCode the response status code (from SDNC, or internally generated)
* @param errMsg the error message (normally a verbose explanation of the error)
* @param rt request tunables
@@ -229,17 +236,17 @@ public abstract class SDNCConnector {
/**
* Called by the send() method to analyze errors that may be encoded in the content of non-2XX responses. By
* default, this method tries to parse the content as a restconf error.
- *
+ *
* <pre>
* xmlns = "urn:ietf:params:xml:ns:yang:ietf-restconf"
* </pre>
- *
+ *
* If an error (or errors) can be obtained from the content, then the result is a string in this format:
- *
+ *
* <pre>
* [error-type:TYPE, error-tag:TAG, error-message:MESSAGE] ...
* </pre>
- *
+ *
* If no error could be obtained from the content, then the result is null.
* <p>
* The subclass can override this method to provide another implementation.
@@ -262,7 +269,7 @@ public abstract class SDNCConnector {
// </error>
// </errors>
- StringBuilder output = null;
+ String output = null;
try {
XPathFactory xpathFactory = XPathFactory.newInstance();
@@ -274,55 +281,47 @@ public abstract class SDNCConnector {
InputSource source = new InputSource(new StringReader(content));
Document doc = documentBuilderFactory.newDocumentBuilder().parse(source);
NodeList errors = (NodeList) xpath.evaluate("errors/error", doc, XPathConstants.NODESET);
+ StringBuilder errorDetails = getErrorDetails(xpath, errors);
+ if (errorDetails != null) {
+ output = errorDetails.toString();
+ }
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
+ }
- for (int i = 0; i < errors.getLength(); i++) {
- Element error = (Element) errors.item(i);
+ return output;
+ }
- String info = "";
+ private StringBuilder getErrorDetails(XPath xpath, NodeList errors) {
- try {
- String errorType = xpath.evaluate("error-type", error);
- info += "error-type:" + errorType;
- } catch (XPathExpressionException e) {
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
- error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
- }
+ StringBuilder output = null;
- try {
- String errorTag = xpath.evaluate("error-tag", error);
- if (!info.isEmpty()) {
- info += ", ";
- }
- info += "error-tag:" + errorTag;
- } catch (XPathExpressionException e) {
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
- error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
- }
+ for (int i = 0; i < errors.getLength(); i++) {
+ Element error = (Element) errors.item(i);
+
+ StringBuilder info = new StringBuilder();
+ List<String> errorAttributesList = Arrays.asList("error-type", "error-tag", "error-message");
+
+ for (String errorAttrib : errorAttributesList) {
try {
- String errorMessage = xpath.evaluate("error-message", error);
- if (!info.isEmpty()) {
- info += ", ";
- }
- info += "error-message:" + errorMessage;
- } catch (Exception e) {
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
+ String errorAttribValue = xpath.evaluate(errorAttrib, error);
+ info.append(errorAttrib).append(":").append(errorAttribValue);
+ } catch (XPathExpressionException e) {
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), errorAttrib,
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
+ }
- if (!info.isEmpty()) {
- if (output == null) {
- output = new StringBuilder("[" + info + "]");
- } else {
- output.append(" [").append(info).append("]");
- }
+ if (!info.toString().isEmpty()) {
+ if (output == null) {
+ output = new StringBuilder("[" + info + "]");
+ } else {
+ output.append(" [").append(info).append("]");
}
}
- } catch (Exception e) {
- logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
- ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
-
- return output.toString();
+ return output;
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
index 6f76ea1eab..9dd95c6713 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
@@ -11,9 +11,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -59,9 +59,6 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
TypedRequestTunables rt) {
try {
return parseResponseContent(responseContent);
- } catch (ParseException e) {
- logger.error("Error occured:", e);
- return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
} catch (Exception e) {
logger.error("Error occured:", e);
return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
@@ -79,10 +76,10 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
* response code contained in the content. For 2XX response codes, an SDNCServiceResponse is returned. Otherwise, an
* SDNCServiceError is returned. If the content cannot be parsed, or if the content does not contain all required
* elements, a parse exception is thrown. This method performs no logging or alarming.
- *
+ *
* @throws ParseException on error
*/
- public static SDNCResponseCommon parseResponseContent(String responseContent)
+ public SDNCResponseCommon parseResponseContent(String responseContent)
throws ParseException, ParserConfigurationException, SAXException, IOException {
// Note: this document builder is not namespace-aware, so namespaces are ignored.
@@ -119,16 +116,24 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
List<Element> responseParameters = new ArrayList<>();
for (Element child : SDNCAdapterUtils.childElements(configurationResponseCommon)) {
- if ("response-code".equals(child.getNodeName())) {
- responseCode = child.getTextContent();
- } else if ("response-message".equals(child.getNodeName())) {
- responseMessage = child.getTextContent();
- } else if ("svc-request-id".equals(child.getNodeName())) {
- svcRequestId = child.getTextContent();
- } else if ("ack-final-indicator".equals(child.getNodeName())) {
- ackFinalIndicator = child.getTextContent();
- } else if ("response-parameters".equals(child.getNodeName())) {
- responseParameters.add(child);
+
+ switch (child.getNodeName()) {
+ case "response-code":
+ responseCode = child.getTextContent();
+ break;
+ case "response-message":
+ responseMessage = child.getTextContent();
+ break;
+ case "svc-request-id":
+ svcRequestId = child.getTextContent();
+ break;
+ case "ack-final-indicator":
+ ackFinalIndicator = child.getTextContent();
+ break;
+ case "response-parameters":
+ responseParameters.add(child);
+ break;
+ default:
}
}
@@ -167,8 +172,15 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
return new SDNCServiceError(svcRequestId, responseCode, responseMessage, ackFinalIndicator);
}
- // Create a success response object.
+ return createSDNCServiceResponse(responseCode, responseMessage, svcRequestId, ackFinalIndicator,
+ responseParameters);
+
+ }
+
+ private SDNCServiceResponse createSDNCServiceResponse(String responseCode, String responseMessage,
+ String svcRequestId, String ackFinalIndicator, List<Element> responseParameters) throws ParseException {
+ // Create a success response object.
SDNCServiceResponse response =
new SDNCServiceResponse(svcRequestId, responseCode, responseMessage, ackFinalIndicator);
@@ -201,8 +213,6 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
response.addParam(tagName, tagValue);
}
-
return response;
-
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java
index 9911cae677..9adc6c52f5 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,8 @@ public class SDNCServiceRequestConnectorTest {
public void parseResponseContentTest() throws Exception {
String content = FileUtil.readResourceFile("SdncServiceResponse.xml");
- SDNCResponseCommon responseCommon = SDNCServiceRequestConnector.parseResponseContent(content);
+ SDNCServiceRequestConnector sdncServiceRequestConnector = new SDNCServiceRequestConnector();
+ SDNCResponseCommon responseCommon = sdncServiceRequestConnector.parseResponseContent(content);
assertNotNull(responseCommon);
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 3632d187c9..70c78472ba 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -23,10 +23,6 @@
package org.onap.so.bpmn.core.domain;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -35,6 +31,10 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil;
import org.onap.so.bpmn.core.json.JsonDecomposingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
@@ -71,6 +71,10 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
private List<AllottedResource> allottedResources;
@JsonProperty("configResource")
private List<ConfigResource> configResources;
+ @JsonProperty("serviceInfo")
+ private ServiceInfo serviceInfo;
+ @JsonProperty("serviceProxy")
+ private List<ServiceProxy> serviceProxy;
public ServiceDecomposition() {
super();
@@ -85,6 +89,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.serviceRole = serviceDecomposition.getServiceRole();
this.serviceType = serviceDecomposition.getServiceType();
this.configResources = serviceDecomposition.getConfigResources();
+ this.serviceProxy = serviceDecomposition.getServiceProxy();
+ this.serviceInfo = serviceDecomposition.getServiceInfo();
}
/**
@@ -109,11 +115,13 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.project = serviceDecomposition.getProject();
this.owningEntity = serviceDecomposition.getOwningEntity();
+ this.serviceProxy = serviceDecomposition.getServiceProxy();
+ this.serviceInfo = serviceDecomposition.getServiceInfo();
}
/**
* Constructor taking a Service Decomposition JSON serialization
- *
+ *
* @param catalogRestOutput
* @param serviceInstanceId
*/
@@ -128,7 +136,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Return just the service model portion of the Service Decomposition as a Java object. The service model object
* should support retrieval as JSON string that is formatted correctly for sending serviceModelInfo to Building
* Blocks.
- *
+ *
* @return
*/
public ModelInfo getModelInfo() {
@@ -235,6 +243,22 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.sdncVersion = sdncVersion;
}
+ public ServiceInfo getServiceInfo() {
+ return serviceInfo;
+ }
+
+ public void setServiceInfo(ServiceInfo serviceInfo) {
+ this.serviceInfo = serviceInfo;
+ }
+
+ public List<ServiceProxy> getServiceProxy() {
+ return serviceProxy;
+ }
+
+ public void setServiceProxy(List<ServiceProxy> serviceProxy) {
+ this.serviceProxy = serviceProxy;
+ }
+
// *****
// *****
@@ -243,7 +267,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* This method returns one combined list of Resources of All Types
- *
+ *
* @return
*/
@JsonIgnore
@@ -275,7 +299,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Network Resource structures (i.e. the serialized NetworkDecomposition objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -285,7 +309,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all VnfResource structures (i.e. the serialized VnfResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -295,7 +319,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Allotted Resource structures (i.e. the serialized AllottedResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -305,7 +329,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Config Resource structures (i.e. the serialized ConfigResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -328,7 +352,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
// Methods to add Resource to the list
/**
* Add VNF resource to the list
- *
+ *
* @param vnfResource
*/
public void addVnfResource(Resource vnfResource) {
@@ -340,7 +364,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Network resource to the list
- *
+ *
* @param networkResource
*/
public void addNetworkResource(Resource networkResource) {
@@ -352,7 +376,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Allotted resource to the list
- *
+ *
* @param allottedResource
*/
public void addAllottedResource(Resource allottedResource) {
@@ -364,7 +388,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Config resource to the list
- *
+ *
* @param allottedResource
*/
public void addConfigResource(Resource configResource) {
@@ -378,7 +402,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Add resource to the list Given a ResourceDecomposition (subclass) object, add it to the Service Decomposition (in
* the appropriate category, e.g. as a VNF, Network, or Allotted Resource). As dependencies are not currently
* supported, add it to the end of any ordered lists.
- *
+ *
* @param resource
*/
public void addResource(Resource resource) {
@@ -403,7 +427,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param jsonResource
*/
public void addVnfResource(String jsonResource) throws JsonDecomposingException {
@@ -414,7 +438,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param jsonResource
*/
public void addNetworkResource(String jsonResource) throws JsonDecomposingException {
@@ -425,7 +449,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param Resource
*/
public void addAllottedResource(String jsonResource) throws JsonDecomposingException {
@@ -436,7 +460,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param Resource
*/
public void addConfigResource(String jsonResource) throws JsonDecomposingException {
@@ -449,7 +473,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Given a ResourceDecomposition (subclass) object, locate it in the Service Decomposition by its unique ID, and
* replace the current version with the new one. This method should support concurrency control via an
* auto-incrementing field in the ResourceDecomposition class.
- *
+ *
* @param newResource
* @return TRUE if replacement was a success
*/
@@ -474,7 +498,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Given a ResourceDecomposition as a JSON string, locate it in the Service Decomposition by its unique ID, and
* replace the current version with the new one.
- *
+ *
* @param jsonString
* @return
*/
@@ -485,7 +509,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Given a resource object ID, locate it in the Service Decomposition by its unique ID, and delete it.
- *
+ *
* @param resource
* @return TRUE if delete was a success
*/
@@ -503,7 +527,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Generic method to get List of Resource objects based on input resource's resourceType
- *
+ *
* @param resource
* @return List matching the resourceType of resource
*/
@@ -530,7 +554,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Generic method to set List of ResourceDecomposition objects
- *
+ *
* @param resources
* @return
*/
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index f8a4d910f4..eead1761ea 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -169,12 +169,7 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
- final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
- final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
- final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
- String uri = (String) execution.getVariable(BBConstants.G_URI);
final String vnfType = (String) execution.getVariable(VNF_TYPE);
String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
final String createInstanceAction = "createInstance";
@@ -183,40 +178,34 @@ public class WorkflowAction {
List<OrchestrationFlow> orchFlows =
(List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
try {
- ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
+ ServiceInstancesRequest sIRequest =
+ new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- boolean suppressRollback = false;
- try {
- suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
- } catch (Exception ex) {
- logger.warn("Exception in getSuppressRollback", ex);
- suppressRollback = false;
- }
- execution.setVariable("suppressRollback", suppressRollback);
- boolean isResume = false;
- if (isUriResume(uri)) {
- isResume = true;
- if (!aLaCarte) {
- logger.debug("replacing URI {}", uri);
- uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
- logger.debug("for RESUME with original value {}", uri);
- }
+ execution.setVariable("suppressRollback", requestDetails.getRequestInfo().getSuppressRollback());
+ String uri = (String) execution.getVariable(BBConstants.G_URI);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ boolean isResume = isUriResume(uri);
+ if (!aLaCarte && isResume) {
+ logger.debug("replacing URI {}", uri);
+ uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
+ logger.debug("for RESUME with original value {}", uri);
}
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
+ final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
&& sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
@@ -230,7 +219,7 @@ public class WorkflowAction {
}
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);
-
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {