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