2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Ericsson. All rights reserved.
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
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
22 import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
23 import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
24 import org.onap.so.bpmn.common.BuildingBlockExecution;
25 import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
26 import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
27 import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
28 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
29 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.stereotype.Component;
36 * This class retrieve input parameters
38 * @author waqas.ikram@est.tech
41 public class InputParameterRetrieverTask {
43 private static final Logger LOGGER = LoggerFactory.getLogger(InputParameterRetrieverTask.class);
45 private final InputParametersProvider inputParametersProvider;
47 private final ExtractPojosForBB extractPojosForBB;
50 public InputParameterRetrieverTask(final InputParametersProvider inputParametersProvider,
51 final ExtractPojosForBB extractPojosForBB) {
52 this.inputParametersProvider = inputParametersProvider;
53 this.extractPojosForBB = extractPojosForBB;
56 public void getInputParameters(final BuildingBlockExecution execution) {
58 LOGGER.debug("Executing getInputParameters ...");
60 final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
61 final InputParameter inputParameter = inputParametersProvider.getInputParameter(vnf);
63 LOGGER.debug("inputParameter: {}", inputParameter);
64 execution.setVariable(INPUT_PARAMETER, inputParameter);
66 LOGGER.debug("Finished executing getInputParameters ...");
67 } catch (final Exception exception) {
68 LOGGER.error("Unable to invoke create and instantiation request", exception);
69 execution.setVariable(INPUT_PARAMETER, NullInputParameter.NULL_INSTANCE);