diff options
Diffstat (limited to 'bpmn')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 34 |
1 files changed, 19 insertions, 15 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 11c6455474..c3f5a98ce7 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 @@ -71,11 +71,13 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; import org.onap.so.serviceinstancebeans.RelatedInstance; import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestInfo; import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.serviceinstancebeans.VfModules; @@ -182,21 +184,7 @@ public class WorkflowAction { execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true); ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); RequestDetails requestDetails = sIRequest.getRequestDetails(); - String cloudOwner = ""; - try { - cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner(); - } catch (Exception ex) { - logger.error("Exception in getCloundOwner", ex); - cloudOwner = environment.getProperty(defaultCloudOwner); - } - boolean suppressRollback = false; - try { - suppressRollback = requestDetails.getRequestInfo().getSuppressRollback(); - } catch (Exception ex) { - logger.error("Exception in getSuppressRollback", ex); - suppressRollback = false; - } - execution.setVariable("suppressRollback", suppressRollback); + execution.setVariable("suppressRollback", isSuppressRollback(requestDetails.getRequestInfo())); boolean isResume = false; if (isUriResume(uri)) { isResume = true; @@ -234,6 +222,7 @@ public class WorkflowAction { "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found"); } } else { + String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration()); if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, @@ -410,6 +399,21 @@ public class WorkflowAction { } } + private String getCloudOwner(CloudConfiguration cloudConfiguration) { + if (cloudConfiguration != null && cloudConfiguration.getCloudOwner() != null) { + return cloudConfiguration.getCloudOwner(); + } + logger.warn("cloud owner value not found in request details, it will be set as default"); + return environment.getProperty(defaultCloudOwner); + } + + private boolean isSuppressRollback(RequestInfo requestInfo) { + if (requestInfo != null) { + return requestInfo.getSuppressRollback(); + } + return false; + } + protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectType type) { List<T> vnfcs = new ArrayList<>(); |