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