2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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=========================================================
19 * Modifications copyright (c) 2019 Nokia
20 * ================================================================================
22 package org.openecomp.sdc.be.info;
24 import org.openecomp.sdc.be.model.GroupDefinition;
25 import org.openecomp.sdc.be.model.GroupInstance;
26 import org.openecomp.sdc.be.model.GroupProperty;
28 import java.util.ArrayList;
29 import java.util.HashMap;
30 import java.util.List;
32 public class GroupDefinitionInfo {
35 private String description;
37 // the id is unique per group instance on graph.
38 private String uniqueId;
40 // the id is unique per group instance on graph.
41 private String groupInstanceUniqueId;
43 // the group UUID should be changed when one of the artifacts/component
44 // instances has been changed.
45 private String groupUUID;
47 // version should be changed when there is a change to the group's metadata
48 // or to the groups members
49 // (not necessarily when the VF version is changed). This field cannot be
51 private String version;
53 private String invariantUUID;
54 private String customizationUUID;
56 private Boolean isBase = null;
58 // artifacts - list of artifact uid. All artifacts in the group must already
59 // be uploaded to the VF
60 private List<ArtifactDefinitionInfo> artifacts;
62 private Map<String, String> members;
64 private List<? extends GroupProperty> properties;
66 public GroupDefinitionInfo() {}
68 public GroupDefinitionInfo(GroupDefinition other) {
69 this.setName(other.getName());
70 this.setDescription(other.getDescription());
71 this.setUniqueId(other.getUniqueId());
72 this.setVersion(other.getVersion());
73 this.setGroupUUID(other.getGroupUUID());
74 this.setInvariantUUID(other.getInvariantUUID());
75 this.setProperties(other.convertToGroupProperties());
76 if (other.getMembers() != null) {
77 this.members = new HashMap<>(other.getMembers());
81 public GroupDefinitionInfo(GroupInstance other) {
82 this.setName(other.getGroupName());
83 this.setDescription(other.getDescription());
84 this.setUniqueId(other.getGroupUid());
85 this.setGroupInstanceUniqueId(other.getUniqueId());
86 this.setVersion(other.getVersion());
87 this.setGroupUUID(other.getGroupUUID());
88 this.setCustomizationUUID(other.getCustomizationUUID());
89 this.setInvariantUUID(other.getInvariantUUID());
90 this.setProperties(other.convertToGroupInstancesProperties());
93 public String getInvariantUUID() {
97 public void setInvariantUUID(String invariantUUID) {
98 this.invariantUUID = invariantUUID;
101 public String getName() {
105 public void setName(String name) {
109 public String getDescription() {
113 public void setDescription(String description) {
114 this.description = description;
117 public String getUniqueId() {
121 public void setUniqueId(String uniqueId) {
122 this.uniqueId = uniqueId;
125 public String getGroupUUID() {
129 public void setGroupUUID(String groupUUID) {
130 this.groupUUID = groupUUID;
133 public String getVersion() {
137 public void setVersion(String version) {
138 this.version = version;
141 public String getCustomizationUUID() {
142 return customizationUUID;
145 public void setCustomizationUUID(String customizationUUID) {
146 this.customizationUUID = customizationUUID;
149 public Boolean getIsBase() {
153 public void setIsBase(Boolean isBase) {
154 this.isBase = isBase;
157 public List<ArtifactDefinitionInfo> getArtifacts() {
158 return (artifacts==null) ? null : new ArrayList<>(artifacts);
161 public void setArtifacts(List<ArtifactDefinitionInfo> artifacts) {
162 this.artifacts = (artifacts==null) ? null : new ArrayList<>(artifacts);
165 public List<GroupProperty> getProperties() {
166 return (properties==null) ? null : new ArrayList<>(properties);
169 public void setProperties(List<? extends GroupProperty> properties) {
170 this.properties = (properties==null) ? null : new ArrayList<>(properties);
173 public String getGroupInstanceUniqueId() {
174 return groupInstanceUniqueId;
177 public void setGroupInstanceUniqueId(String groupInstanceUniqueId) {
178 this.groupInstanceUniqueId = groupInstanceUniqueId;
181 public Map<String, String> getMembers() {
185 public void setMembers(Map<String, String> members) {
186 this.members = members;
190 public String toString() {
191 return "GroupDefinitionInfo [" + super.toString() + ", isBase=" + isBase + ", artifacts=" + artifacts + "]";