summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java
diff options
context:
space:
mode:
authorKULESHOV, ELENA <evn@att.com>2021-03-24 09:46:59 -0400
committerAT&T Open Source <g22940@att.com>2021-03-24 09:46:59 -0400
commit82358726fc0c37adcd426a41cdca4f3b4ddf2c56 (patch)
tree4672b358077c90d2447f785ef97b37d1bc7a6762 /bpmn/so-bpmn-tasks/src/main/java
parent7eb4f55f7cd81e25557e97e82049e6a3be137fd2 (diff)
request db endpoint and bpmn cleanup
added new request db adapter endpoint use bpmn constants when available allow bpmn input setup parameter to be extended Issue-ID: SO-3606 Signed-off-by: AT&T Open Source <g22940@att.com> Change-Id: Ibde4d82cc7432ea3cdd9a75aef0dc695ebbf9a1b
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java44
2 files changed, 43 insertions, 45 deletions
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 ee4e56bc18..bc8f8cc822 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
@@ -26,9 +26,27 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.SerializationUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
@@ -79,26 +97,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowAction {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index ec2ca74fa7..cd151bafea 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -37,6 +37,7 @@ import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aaiclient.client.aai.entities.Configuration;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
@@ -68,10 +69,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowActionBBTasks {
- private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
- private static final String G_REQUEST_ID = "mso-request-id";
- private static final String G_ALACARTE = "aLaCarte";
- private static final String G_ACTION = "requestAction";
private static final String RETRY_COUNT = "retryCount";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
private static final String ADD_FABRIC_CONFIGURATION_BB = "AddFabricConfigurationBB";
@@ -112,14 +109,15 @@ public class WorkflowActionBBTasks {
} catch (NullPointerException ex) {
workflowAction.buildAndThrowException(execution, "Error in FlowManipulator Modify Flows", ex);
}
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
execution.setVariable("buildingBlock", ebb);
currentSequence++;
execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size());
- execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence);
+
} catch (Exception e) {
workflowAction.buildAndThrowException(execution, "Internal Error occured during selectBB", e);
}
@@ -127,7 +125,7 @@ public class WorkflowActionBBTasks {
public void updateFlowStatistics(DelegateExecution execution) {
try {
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
if (currentSequence > 1) {
InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
requestDbclient.updateInfraActiveRequests(request);
@@ -142,7 +140,7 @@ public class WorkflowActionBBTasks {
protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
@@ -171,7 +169,7 @@ public class WorkflowActionBBTasks {
}
public void sendSyncAck(DelegateExecution execution) {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
final String resourceId = (String) execution.getVariable("resourceId");
ServiceInstancesResponse serviceInstancesResponse = new ServiceInstancesResponse();
RequestReferences requestRef = new RequestReferences();
@@ -199,7 +197,7 @@ public class WorkflowActionBBTasks {
}
public void sendErrorSyncAck(DelegateExecution execution) {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
try {
ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
String errorMsg = (String) execution.getVariable("WorkflowActionErrorMessage");
@@ -225,10 +223,10 @@ public class WorkflowActionBBTasks {
public void updateRequestStatusToComplete(DelegateExecution execution) {
try {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- final String action = (String) execution.getVariable(G_ACTION);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String action = (String) execution.getVariable(BBConstants.G_ACTION);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
final String resourceName = (String) execution.getVariable("resourceName");
String statusMessage = (String) execution.getVariable("StatusMessage");
String macroAction;
@@ -258,7 +256,7 @@ public class WorkflowActionBBTasks {
public void checkRetryStatus(DelegateExecution execution) {
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
int envMaxRetries;
@@ -280,8 +278,8 @@ public class WorkflowActionBBTasks {
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
if (retryCount < envMaxRetries) {
- int currSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- execution.setVariable(G_CURRENT_SEQUENCE, currSequence - 1);
+ int currSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currSequence - 1);
execution.setVariable(RETRY_COUNT, nextCount);
} else {
workflowAction.buildAndThrowException(execution,
@@ -297,7 +295,7 @@ public class WorkflowActionBBTasks {
* working on.
*/
public void rollbackExecutionPath(DelegateExecution execution) {
- final String action = (String) execution.getVariable(G_ACTION);
+ final String action = (String) execution.getVariable(BBConstants.G_ACTION);
final String resourceName = (String) execution.getVariable("resourceName");
if (!(boolean) execution.getVariable("isRollback")) {
List<ExecuteBuildingBlock> flowsToExecute =
@@ -308,7 +306,7 @@ public class WorkflowActionBBTasks {
.collect(Collectors.toList());
List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>();
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
int listSize = flowsToExecute.size();
for (int i = listSize - 1; i >= 0; i--) {
@@ -381,7 +379,7 @@ public class WorkflowActionBBTasks {
execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
execution.setVariable(HANDLINGCODE, "PreformingRollback");
execution.setVariable("isRollback", true);
- execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
execution.setVariable(RETRY_COUNT, 0);
} else {
workflowAction.buildAndThrowException(execution,
@@ -391,7 +389,7 @@ public class WorkflowActionBBTasks {
protected void updateInstanceId(DelegateExecution execution) {
try {
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
String resourceId = (String) execution.getVariable("resourceId");
WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType");
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
@@ -424,8 +422,8 @@ public class WorkflowActionBBTasks {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
logger.debug("Current Sequence: {}", currentSequence);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
@@ -444,7 +442,7 @@ public class WorkflowActionBBTasks {
protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb,
List<ExecuteBuildingBlock> flowsToExecute) {
try {
- String requestAction = (String) execution.getVariable(G_ACTION);
+ String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
String vnfId = ebb.getWorkflowResourceIds().getVnfId();
String vfModuleId = ebb.getResourceId();