2 * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
3 * Foundation. ================================================================================ Licensed under the
4 * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
9 * either express or implied. See the License for the specific language governing permissions and limitations under the
12 * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
15 package org.onap.so.bpmn.infrastructure.pnf.delegate;
17 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MODEL_UUID;
18 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
19 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
20 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
21 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
22 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
23 import org.camunda.bpm.engine.delegate.DelegateExecution;
24 import org.camunda.bpm.engine.delegate.JavaDelegate;
25 import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
26 import org.onap.so.client.cds.beans.ConfigAssignPropertiesForPnf;
27 import org.onap.so.client.cds.beans.ConfigAssignRequestPnf;
28 import org.springframework.stereotype.Component;
31 * This implementation of {@link JavaDelegate} is used to prepare for config Assign.
33 * It queries the PNF resource customization table and construct the {@link AbstractCDSPropertiesBean} as
37 public class PrepareConfigAssignDelegate extends PrepareCdsCallDelegate {
39 public PrepareConfigAssignDelegate() {
40 this.actionName = "config-assign";
45 protected String getRequestObject(final DelegateExecution delegateExecution) {
47 ConfigAssignPropertiesForPnf configAssignProperties = new ConfigAssignPropertiesForPnf();
48 configAssignProperties.setServiceInstanceId((String) delegateExecution.getVariable(SERVICE_INSTANCE_ID));
51 * PNF Name matches the name in AAI, i.e., correlationID as in customized workflow.
53 configAssignProperties.setPnfName((String) delegateExecution.getVariable(PNF_CORRELATION_ID));
56 * PNF id match AAI entry, i.e, PNF UUID.
58 configAssignProperties.setPnfId((String) delegateExecution.getVariable(PNF_UUID));
59 configAssignProperties.setPnfCustomizationUuid((String) delegateExecution.getVariable(PRC_CUSTOMIZATION_UUID));
60 configAssignProperties.setServiceModelUuid((String) delegateExecution.getVariable(MODEL_UUID));
62 ConfigAssignRequestPnf configAssignRequest = new ConfigAssignRequestPnf();
63 configAssignRequest.setConfigAssignPropertiesForPnf(configAssignProperties);
66 * resolution key is the same as PNF name.
68 configAssignRequest.setResolutionKey((String) delegateExecution.getVariable(PNF_CORRELATION_ID));
70 return configAssignRequest.toString();