1 package org.onap.vid.model;
3 import org.onap.vid.asdc.beans.tosca.Input;
4 import org.onap.vid.asdc.parser.ToscaParserImpl2.Constants;
8 import static org.onap.vid.asdc.parser.ToscaParserImpl2.isModuleTypeIsBaseObjectSafe;
10 public class Group implements MinimalNode {
16 /** The invariant uuid. */
17 private String invariantUuid;
19 /** The customization uuid. */
20 private String customizationUuid;
22 /** The description. */
23 private String description;
29 private String version;
31 /** The model customization name. */
32 private String modelCustomizationName;
34 /** The group properties. */
35 private GroupProperties properties;
37 private Map<String, Input> inputs;
41 * Gets the model customization name.
43 * @return the model customization name
45 public String getModelCustomizationName() {
46 return modelCustomizationName;
53 public String getUuid() {
58 * Gets the invariant uuid.
60 * @return the invariant uuid
62 public String getInvariantUuid() {
66 * Gets the customization uuid.
68 * @return the invariant uuid
70 public String getCustomizationUuid() {
71 return customizationUuid;
74 * Gets the description.
76 * @return the description
78 public String getDescription() {
86 public String getName() {
95 public String getVersion() {
100 * Gets the properties.
102 * @return the properties
104 public GroupProperties getProperties() {
110 * @param uuid the new uuid
112 public void setUuid(String uuid) {
117 * Sets the invariant uuid.
119 * @param invariantUuid the new invariant uuid
121 public void setInvariantUuid(String invariantUuid) {
122 this.invariantUuid = invariantUuid;
125 * Sets the customization uuid.
127 * @param customizationUuid the new customization uuid
129 public void setCustomizationUuid(String customizationUuid) {
130 this.customizationUuid = customizationUuid;
133 * Sets the description.
135 * @param description the new description
137 public void setDescription(String description) {
138 this.description = description;
144 * @param name the new name
146 public void setName(String name) {
153 * @param version the new version
155 public void setVersion(String version) {
156 this.version = version;
159 public Map<String, Input> getInputs() {
163 public void setInputs(Map<String, Input> inputs) {
164 this.inputs = inputs;
168 * Sets the model customization name.
170 * @param modelCustomizationName the new model customization name
172 public void setModelCustomizationName(String modelCustomizationName) {
173 this.modelCustomizationName = modelCustomizationName;
176 * Sets the group properties.
178 * @param properties the new model customization name
180 public void setProperties(GroupProperties properties) {
181 this.properties = properties;
186 protected static GroupProperties extractPropertiesForGroup(org.onap.vid.asdc.beans.tosca.Group group){
187 String [] propertyKeys = {
188 Constants.MIN_VF_MODULE_INSTANCES,
189 Constants.MAX_VF_MODULE_INSTANCES,
190 Constants.INITIAL_COUNT,
192 GroupProperties groupProperties = new GroupProperties();
194 for(String propertyKey : propertyKeys){
195 Object val = group.getProperties().get(propertyKey);
196 if (val != null && val instanceof Integer) {
197 setInGroupProperties(groupProperties, propertyKey, (Integer) val);
201 groupProperties.setBaseModule(isModuleTypeIsBaseObjectSafe(group.getProperties().get(Constants.VF_MODULE_TYPE)));
203 return groupProperties;
206 private static void setInGroupProperties(GroupProperties groupProperties, String propertyKey, Integer propertyValue){
207 switch (propertyKey) {
208 case Constants.MIN_VF_MODULE_INSTANCES:
209 groupProperties.setMinCountInstances(propertyValue);
211 case Constants.MAX_VF_MODULE_INSTANCES:
212 groupProperties.setMaxCountInstances(propertyValue);
214 case Constants.INITIAL_COUNT:
215 groupProperties.setInitialCount(propertyValue);