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 java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
28 import lombok.AccessLevel;
31 import org.openecomp.sdc.be.model.GroupDefinition;
32 import org.openecomp.sdc.be.model.GroupInstance;
33 import org.openecomp.sdc.be.model.GroupProperty;
37 public class GroupDefinitionInfo {
40 private String description;
41 // the id is unique per group instance on graph.
42 private String uniqueId;
43 // the id is unique per group instance on graph.
44 private String groupInstanceUniqueId;
45 // the group UUID should be changed when one of the artifacts/component
47 // instances has been changed.
48 private String groupUUID;
49 // version should be changed when there is a change to the group's metadata
51 // or to the groups members
53 // (not necessarily when the VF version is changed). This field cannot be
56 private String version;
57 private String invariantUUID;
58 private String customizationUUID;
59 private Boolean isBase = null;
60 // artifacts - list of artifact uid. All artifacts in the group must already
62 // be uploaded to the VF
63 @Getter(AccessLevel.NONE)
64 @Setter(AccessLevel.NONE)
65 private List<ArtifactDefinitionInfo> artifacts;
66 private Map<String, String> members;
67 @Getter(AccessLevel.NONE)
68 @Setter(AccessLevel.NONE)
69 private List<? extends GroupProperty> properties;
71 public GroupDefinitionInfo(GroupDefinition other) {
72 this.setName(other.getName());
73 this.setDescription(other.getDescription());
74 this.setUniqueId(other.getUniqueId());
75 this.setVersion(other.getVersion());
76 this.setGroupUUID(other.getGroupUUID());
77 this.setInvariantUUID(other.getInvariantUUID());
78 this.setProperties(other.convertToGroupProperties());
79 if (other.getMembers() != null) {
80 this.members = new HashMap<>(other.getMembers());
84 public GroupDefinitionInfo(GroupInstance other) {
85 this.setName(other.getGroupName());
86 this.setDescription(other.getDescription());
87 this.setUniqueId(other.getGroupUid());
88 this.setGroupInstanceUniqueId(other.getUniqueId());
89 this.setVersion(other.getVersion());
90 this.setGroupUUID(other.getGroupUUID());
91 this.setCustomizationUUID(other.getCustomizationUUID());
92 this.setInvariantUUID(other.getInvariantUUID());
93 this.setProperties(other.convertToGroupInstancesProperties());
96 public List<ArtifactDefinitionInfo> getArtifacts() {
97 return (artifacts == null) ? null : new ArrayList<>(artifacts);
100 public void setArtifacts(List<ArtifactDefinitionInfo> artifacts) {
101 this.artifacts = (artifacts == null) ? null : new ArrayList<>(artifacts);
104 public List<GroupProperty> getProperties() {
105 return (properties == null) ? null : new ArrayList<>(properties);
108 public void setProperties(List<? extends GroupProperty> properties) {
109 this.properties = (properties == null) ? null : new ArrayList<>(properties);
113 public String toString() {
114 return "GroupDefinitionInfo [" + super.toString() + ", isBase=" + isBase + ", artifacts=" + artifacts + "]";