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
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.utils;
22 import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.ADDITIONAL_PARAMS;
23 import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.EXT_VIRTUAL_LINKS;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27 import org.springframework.stereotype.Service;
30 * @author Waqas Ikram (waqas.ikram@ericsson.com)
34 public class UserParamInputParametersProvider extends AbstractInputParametersProvider<Map<String, Object>> {
35 private static final Logger LOGGER = LoggerFactory.getLogger(UserParamInputParametersProvider.class);
38 public InputParameter getInputParameter(final Map<String, Object> userParams) {
39 if (userParams != null) {
40 final InputParameter inputParameter = new InputParameter();
41 final Object additionalParams = userParams.get(ADDITIONAL_PARAMS);
43 if (additionalParams != null && additionalParams instanceof String) {
44 inputParameter.setAdditionalParams(parseAdditionalParameters(additionalParams.toString()));
47 final Object extVirtualLinks = userParams.get(EXT_VIRTUAL_LINKS);
48 if (extVirtualLinks != null && extVirtualLinks instanceof String) {
49 inputParameter.setExtVirtualLinks(parseExternalVirtualLinks(extVirtualLinks.toString()));
51 LOGGER.info("InputParameter found in userParams : {}", inputParameter);
52 return inputParameter;
54 LOGGER.warn("No input parameters found ...");
55 return NullInputParameter.NULL_INSTANCE;