Catalog alignment
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / info / GroupDefinitionInfo.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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  * ================================================================================
21  */
22 package org.openecomp.sdc.be.info;
23
24 import org.openecomp.sdc.be.model.GroupDefinition;
25 import org.openecomp.sdc.be.model.GroupInstance;
26 import org.openecomp.sdc.be.model.GroupProperty;
27
28 import java.util.ArrayList;
29 import java.util.HashMap;
30 import java.util.List;
31 import java.util.Map;
32 public class GroupDefinitionInfo {
33     private String name;
34
35     private String description;
36
37     // the id is unique per group instance on graph.
38     private String uniqueId;
39
40     // the id is unique per group instance on graph.
41     private String groupInstanceUniqueId;
42
43     // the group UUID should be changed when one of the artifacts/component
44     // instances has been changed.
45     private String groupUUID;
46
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
50     // updated by user
51     private String version;
52
53     private String invariantUUID;
54     private String customizationUUID;
55
56     private Boolean isBase = null;
57
58     // artifacts - list of artifact uid. All artifacts in the group must already
59     // be uploaded to the VF
60     private List<ArtifactDefinitionInfo> artifacts;
61
62     private Map<String, String> members;
63
64     private List<? extends GroupProperty> properties;
65
66     public GroupDefinitionInfo() {}
67
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());
78         }
79     }
80
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());
91     }
92
93     public String getInvariantUUID() {
94         return invariantUUID;
95     }
96
97     public void setInvariantUUID(String invariantUUID) {
98         this.invariantUUID = invariantUUID;
99     }
100
101     public String getName() {
102         return name;
103     }
104
105     public void setName(String name) {
106         this.name = name;
107     }
108
109     public String getDescription() {
110         return description;
111     }
112
113     public void setDescription(String description) {
114         this.description = description;
115     }
116
117     public String getUniqueId() {
118         return uniqueId;
119     }
120
121     public void setUniqueId(String uniqueId) {
122         this.uniqueId = uniqueId;
123     }
124
125     public String getGroupUUID() {
126         return groupUUID;
127     }
128
129     public void setGroupUUID(String groupUUID) {
130         this.groupUUID = groupUUID;
131     }
132
133     public String getVersion() {
134         return version;
135     }
136
137     public void setVersion(String version) {
138         this.version = version;
139     }
140
141     public String getCustomizationUUID() {
142         return customizationUUID;
143     }
144
145     public void setCustomizationUUID(String customizationUUID) {
146         this.customizationUUID = customizationUUID;
147     }
148
149     public Boolean getIsBase() {
150         return isBase;
151     }
152
153     public void setIsBase(Boolean isBase) {
154         this.isBase = isBase;
155     }
156
157     public List<ArtifactDefinitionInfo> getArtifacts() {
158         return (artifacts==null) ? null : new ArrayList<>(artifacts);
159     }
160
161     public void setArtifacts(List<ArtifactDefinitionInfo> artifacts) {
162         this.artifacts = (artifacts==null) ? null : new ArrayList<>(artifacts);
163     }
164
165     public List<GroupProperty> getProperties() {
166         return (properties==null) ? null : new ArrayList<>(properties);
167     }
168
169     public void setProperties(List<? extends GroupProperty> properties) {
170         this.properties = (properties==null) ? null : new ArrayList<>(properties);
171     }
172
173     public String getGroupInstanceUniqueId() {
174         return groupInstanceUniqueId;
175     }
176
177     public void setGroupInstanceUniqueId(String groupInstanceUniqueId) {
178         this.groupInstanceUniqueId = groupInstanceUniqueId;
179     }
180
181     public Map<String, String> getMembers() {
182         return members;
183     }
184
185     public void setMembers(Map<String, String> members) {
186         this.members = members;
187     }
188
189     @Override
190     public String toString() {
191         return "GroupDefinitionInfo [" + super.toString() + ", isBase=" + isBase + ", artifacts=" + artifacts + "]";
192     }
193
194 }