2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T 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.sdc.toscaparser.api.functions;
23 import org.onap.sdc.toscaparser.api.TopologyTemplate;
24 import org.onap.sdc.toscaparser.api.common.JToscaValidationIssue;
25 import org.onap.sdc.toscaparser.api.utils.ThreadLocalsHolder;
27 import java.util.ArrayList;
29 public class Concat extends Function {
30 // Validate the function and provide an instance of the function
32 // Concatenation of values are supposed to be produced at runtime and
33 // therefore its the responsibility of the TOSCA engine to implement the
34 // evaluation of Concat functions.
38 // * List of strings that needs to be concatenated
43 // get_attribute: [ server, public_address ],
45 // get_attribute: [ server, port ] ]
48 public Concat(TopologyTemplate ttpl, Object context, String name, ArrayList<Object> args) {
49 super(ttpl, context, name, args);
53 public Object result() {
59 if (args.size() < 1) {
60 ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE145",
61 "ValueError: Invalid arguments for function \"concat\". " +
62 "Expected at least one argument"));
70 class Concat(Function):
71 """Validate the function and provide an instance of the function
73 Concatenation of values are supposed to be produced at runtime and
74 therefore its the responsibility of the TOSCA engine to implement the
75 evaluation of Concat functions.
79 * List of strings that needs to be concatenated
84 get_attribute: [ server, public_address ],
86 get_attribute: [ server, port ] ]
90 if len(self.args) < 1:
91 ValidationIsshueCollector.appendException(
92 ValueError(_('Invalid arguments for function "{0}". Expected '
93 'at least one arguments.').format(CONCAT)))