blob: 30de2a8e754af5b7b60f575d385902d59806abb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package org.openecomp.sdc.toscaparser.api;
import static com.google.common.collect.ImmutableList.toImmutableList;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.openecomp.sdc.toscaparser.api.elements.NodeType;
import org.openecomp.sdc.toscaparser.api.parameters.Input;
import org.openecomp.sdc.toscaparser.jython.JyGroup;
import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings;
import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
import com.google.common.base.MoreObjects;
public class SubstitutionMappings {
private final JySubstitutionMappings jySubstitutionMappings;
public SubstitutionMappings(JySubstitutionMappings jySubstitutionMappings) {
this.jySubstitutionMappings = Objects.requireNonNull(jySubstitutionMappings);
}
public List<NodeTemplate> getNodeTemplates() {
return jySubstitutionMappings.getJyNodeTemplates()
.stream()
.map(NodeTemplate::new)
.collect(toImmutableList());
}
public List<Group> getGroups() {
List<JyGroup> jyGroups = jySubstitutionMappings.getJyGroups();
return jyGroups != null ? jyGroups
.stream()
.map(Group::new)
.collect(toImmutableList()) : new ArrayList<>();
}
public List<Input> getInputs() {
List<JyInput> jyInputs = jySubstitutionMappings.getJyInputs();
return jyInputs != null ? jyInputs
.stream()
.map(Input::new)
.collect(toImmutableList()) : new ArrayList<>();
}
public NodeType getNodeDefinition() {
return new NodeType(jySubstitutionMappings.getJyNodeDefinition());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("nodeTemplates", getNodeTemplates())
.add("inputs", getInputs())
.add("nodeDefinition", getNodeDefinition())
.toString();
}
}
|