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=========================================================
21 package org.openecomp.sdc.be.info;
23 import org.openecomp.sdc.be.model.GroupDefinition;
24 import org.openecomp.sdc.be.model.GroupInstance;
25 import org.openecomp.sdc.be.model.GroupProperty;
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
31 public class GroupDefinitionInfo {
34 private String description;
36 // the id is unique per group instance on graph.
37 private String uniqueId;
39 // the id is unique per group instance on graph.
40 private String groupInstanceUniqueId;
42 // the group UUID should be changed when one of the artifacts/component
43 // instances has been changed.
44 private String groupUUID;
46 // version should be changed when there is a change to the group's metadata
47 // or to the groups members
48 // (not necessarily when the VF version is changed). This field cannot be
50 private String version;
52 private String invariantUUID;
53 private String customizationUUID;
55 private Boolean isBase = null;
57 // artifacts - list of artifact uid. All artifacts in the group must already
58 // be uploaded to the VF
59 private List<ArtifactDefinitionInfo> artifacts;
61 private Map<String, String> members;
63 private List<? extends GroupProperty> properties;
65 public GroupDefinitionInfo() {
69 public GroupDefinitionInfo(GroupDefinition other) {
70 this.setName(other.getName());
71 this.setDescription(other.getDescription());
72 this.setUniqueId(other.getUniqueId());
73 this.setVersion(other.getVersion());
74 this.setGroupUUID(other.getGroupUUID());
75 this.setInvariantUUID(other.getInvariantUUID());
76 this.setProperties(other.convertToGroupProperties());
77 if (other.getMembers() != null) {
78 this.members = new HashMap<>(other.getMembers());
82 public GroupDefinitionInfo(GroupInstance other) {
83 this.setName(other.getGroupName());
84 this.setDescription(other.getDescription());
85 this.setUniqueId(other.getGroupUid());
86 this.setGroupInstanceUniqueId(other.getUniqueId());
87 this.setVersion(other.getVersion());
88 this.setGroupUUID(other.getGroupUUID());
89 this.setCustomizationUUID(other.getCustomizationUUID());
90 this.setInvariantUUID(other.getInvariantUUID());
91 this.setProperties(other.convertToGroupInstancesProperties());
94 public String getInvariantUUID() {
98 public void setInvariantUUID(String invariantUUID) {
99 this.invariantUUID = invariantUUID;
102 public String getName() {
106 public void setName(String name) {
110 public String getDescription() {
114 public void setDescription(String description) {
115 this.description = description;
118 public String getUniqueId() {
122 public void setUniqueId(String uniqueId) {
123 this.uniqueId = uniqueId;
126 public String getGroupUUID() {
130 public void setGroupUUID(String groupUUID) {
131 this.groupUUID = groupUUID;
134 public String getVersion() {
138 public void setVersion(String version) {
139 this.version = version;
143 public String getCustomizationUUID() {
144 return customizationUUID;
147 public void setCustomizationUUID(String customizationUUID) {
148 this.customizationUUID = customizationUUID;
151 public Boolean getIsBase() {
155 public void setIsBase(Boolean isBase) {
156 this.isBase = isBase;
159 public List<ArtifactDefinitionInfo> getArtifacts() {
160 return (artifacts==null) ? null : new ArrayList<>(artifacts);
163 public void setArtifacts(List<ArtifactDefinitionInfo> artifacts) {
164 this.artifacts = (artifacts==null) ? null : new ArrayList<>(artifacts);
167 public List<GroupProperty> getProperties() {
168 return (properties==null) ? null : new ArrayList<>(properties);
171 public void setProperties(List<? extends GroupProperty> properties) {
172 this.properties = (properties==null) ? null : new ArrayList<>(properties);
177 public String getGroupInstanceUniqueId() {
178 return groupInstanceUniqueId;
181 public void setGroupInstanceUniqueId(String groupInstanceUniqueId) {
182 this.groupInstanceUniqueId = groupInstanceUniqueId;
185 public Map<String, String> getMembers() {
189 public void setMembers(Map<String, String> members) {
190 this.members = members;
194 public String toString() {
195 return "GroupDefinitionInfo [" + super.toString() + ", isBase=" + isBase + ", artifacts=" + artifacts + "]";