2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 Nokia Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.infrastructure.workflow.tasks.utils;
23 import org.camunda.bpm.engine.delegate.DelegateExecution;
24 import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
25 import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
27 public final class WorkflowResourceIdsUtils {
29 private WorkflowResourceIdsUtils() {
30 throw new IllegalStateException("Utility class");
33 public static void setResourceIdByWorkflowType(WorkflowResourceIds workflowResourceIds, WorkflowType resourceType,
35 switch (resourceType) {
37 workflowResourceIds.setServiceInstanceId(resourceId);
40 workflowResourceIds.setVnfId(resourceId);
43 workflowResourceIds.setPnfId(resourceId);
46 workflowResourceIds.setVfModuleId(resourceId);
49 workflowResourceIds.setVolumeGroupId(resourceId);
52 workflowResourceIds.setNetworkId(resourceId);
54 case NETWORKCOLLECTION:
55 workflowResourceIds.setNetworkCollectionId(resourceId);
58 workflowResourceIds.setConfigurationId(resourceId);
61 workflowResourceIds.setInstanceGroupId(resourceId);
66 public static WorkflowResourceIds getWorkflowResourceIdsFromExecution(DelegateExecution execution) {
67 WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
68 workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
69 workflowResourceIds.setNetworkId((String) execution.getVariable("networkId"));
70 workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId"));
71 workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
72 workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
73 workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
74 return workflowResourceIds;