From 4891eedd15cff1e582d052843eb8c11a14c5d836 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Tue, 24 Sep 2019 14:57:51 -0400 Subject: Update Resume Logic and Add Workflow Listeners Updated with the error log messages Changed the code to do string compare for eventName update workflowaction to only persist if not resume Issue-ID: SO-2363 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I139f2427ae0f0253a15cc51003318686568cb514 --- .../so/apihandler/camundabeans/CamundaVIDRequest.java | 9 +++++++++ .../org/onap/so/apihandler/common/CamundaClient.java | 9 +++++++-- .../org/onap/so/apihandler/common/CommonConstants.java | 1 + .../so/apihandler/common/RequestClientParameter.java | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java/org') diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java index 3880bd43b1..0f51341a61 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java @@ -116,6 +116,9 @@ public class CamundaVIDRequest { return serviceInput; } + @JsonProperty(CommonConstants.GENERATE_IDS) + private CamundaBooleanInput generateIds; + @JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT) public void setServiceInput(CamundaInput serviceInput) { this.serviceInput = serviceInput; @@ -347,6 +350,12 @@ public class CamundaVIDRequest { return "CamundaRequest"; } + public CamundaBooleanInput getGenerateIds() { + return generateIds; + } + public void setGenerateIds(CamundaBooleanInput generateIds) { + this.generateIds = generateIds; + } } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index 5dd99f51cd..bc8af6e690 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -99,6 +99,7 @@ public class CamundaClient extends RequestClient { return response; } + @Override public HttpResponse post(RequestClientParameter parameterObject) throws IOException { HttpPost post = new HttpPost(url); logger.debug(CAMUNDA_URL_MESAGE + url); @@ -110,7 +111,7 @@ public class CamundaClient extends RequestClient { parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(), - parameterObject.getInstanceGroupId()); + parameterObject.getInstanceGroupId(), parameterObject.isGenerateIdsOnly()); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); @@ -169,7 +170,7 @@ public class CamundaClient extends RequestClient { String serviceInstanceId, String pnfCorrelationId, String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, String serviceType, String vnfType, String vfModuleType, String networkType, String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, - String paramXsd, String instanceGroupId) { + String paramXsd, String instanceGroupId, boolean generateIdsOnly) { String jsonReq = null; try { @@ -196,6 +197,8 @@ public class CamundaClient extends RequestClient { CamundaInput requestUriInput = new CamundaInput(); CamundaInput recipeParamsInput = new CamundaInput(); CamundaInput instanceGroupIdInput = new CamundaInput(); + CamundaBooleanInput generateIds = new CamundaBooleanInput(); + requestIdInput.setValue(StringUtils.defaultString(requestId)); isBaseVfModuleInput.setValue(isBaseVfModule); @@ -217,6 +220,7 @@ public class CamundaClient extends RequestClient { requestUriInput.setValue(StringUtils.defaultString(requestUri)); recipeParamsInput.setValue(paramXsd); instanceGroupIdInput.setValue(StringUtils.defaultString(instanceGroupId)); + generateIds.setValue(generateIdsOnly); serviceInput.setValue(requestDetails); camundaRequest.setServiceInput(serviceInput); @@ -242,6 +246,7 @@ public class CamundaClient extends RequestClient { camundaRequest.setRequestUri(requestUriInput); camundaRequest.setRecipeParams(recipeParamsInput); camundaRequest.setInstanceGroupId(instanceGroupIdInput); + camundaRequest.setGenerateIds(generateIds); ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java index e48c98a395..6d2bbfc613 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java @@ -81,6 +81,7 @@ public final class CommonConstants { public static final String X_LATEST_VERSION = "X-LatestVersion"; public static final String INSTANCE_GROUP_ID = "instanceGroupId"; public static final String INSTANCE_GROUP_INSTANCE_ID = "instanceGroupInstanceId"; + public static final String GENERATE_IDS = "generateIdsOnly"; private CommonConstants() { // prevent creating an instance of this class diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java index 20c512af37..e098ea4354 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java @@ -44,6 +44,7 @@ public class RequestClientParameter { private String recipeParamXsd; private String requestUri; private String instanceGroupId; + private boolean generateIdsOnly; private RequestClientParameter(Builder builder) { requestId = builder.requestId; @@ -67,7 +68,7 @@ public class RequestClientParameter { aLaCarte = builder.aLaCarte; requestUri = builder.requestUri; instanceGroupId = builder.instanceGroupId; - + generateIdsOnly = builder.generateIdsOnly; } public String getRequestId() { @@ -154,6 +155,14 @@ public class RequestClientParameter { return instanceGroupId; } + public boolean isGenerateIdsOnly() { + return generateIdsOnly; + } + + public void setGenerateIdsOnly(boolean generateIdsOnly) { + this.generateIdsOnly = generateIdsOnly; + } + public static class Builder { private String requestId; private boolean isBaseVfModule = false; @@ -176,6 +185,7 @@ public class RequestClientParameter { private String recipeParamXsd; private String requestUri; private String instanceGroupId; + private boolean generateIdsOnly; public Builder setRequestId(String requestId) { this.requestId = requestId; @@ -282,6 +292,11 @@ public class RequestClientParameter { return this; } + public Builder setGenerateIds(boolean generateIdsOnly) { + this.generateIdsOnly = generateIdsOnly; + return this; + } + public RequestClientParameter build() { return new RequestClientParameter(this); } -- cgit 1.2.3-korg