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.datatypes.elements;
23 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
24 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
26 import java.io.Serializable;
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
33 public class GroupDataDefinition extends ToscaDataDefinition implements Serializable {
38 private static final long serialVersionUID = 1565606165279109427L;
40 private String typeUid;
42 private Integer propertyValueCounter = 0;
44 public GroupDataDefinition() {
49 public GroupDataDefinition(Map<String, Object> gr) {
51 propertyValueCounter = 0;
54 public GroupDataDefinition(GroupDataDefinition other) {
55 this.setName(other.getName());
56 this.setUniqueId(other.getUniqueId());
57 this.setType(other.getType());
58 this.setVersion(other.getVersion());
59 this.setInvariantUUID(other.getInvariantUUID());
60 this.setDescription(other.getDescription());
61 this.propertyValueCounter = other.propertyValueCounter;
62 this.setGroupUUID(other.getGroupUUID());
64 if (other.getMembers() != null) {
65 this.setMembers(new HashMap<String, String>(other.getMembers()));
67 if (other.getArtifacts() != null) {
68 this.setArtifacts(new ArrayList<String>(other.getArtifacts()));
71 if (other.getArtifactsUuid() != null) {
72 this.setArtifactsUuid( new ArrayList<String>(other.getArtifactsUuid()));
74 this.setTypeUid(other.typeUid);
75 this.setProperties(other.getProperties());
79 public String getName() {
80 return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
83 public void setName(String name) {
84 setToscaPresentationValue(JsonPresentationFields.NAME, name);
87 public String getUniqueId() {
88 return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID);
91 public void setUniqueId(String uniqueId) {
92 setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId);
95 public String getType() {
96 return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
99 public void setType(String type) {
100 setToscaPresentationValue(JsonPresentationFields.TYPE, type);
103 public String getVersion() {
104 return (String) getToscaPresentationValue(JsonPresentationFields.VERSION);
107 public void setVersion(String version) {
108 setToscaPresentationValue(JsonPresentationFields.VERSION, version);
111 public String getInvariantUUID() {
112 return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID);
115 public void setInvariantUUID(String invariantUUID) {
116 setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID);
119 public String getDescription() {
120 return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION);
123 public void setDescription(String description) {
124 setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description);
127 public Integer getPropertyValueCounter() {
128 return propertyValueCounter;
131 public void setPropertyValueCounter(Integer propertyValueCounter) {
132 this.propertyValueCounter = propertyValueCounter;
135 public String getGroupUUID() {
136 return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID);
139 public void setGroupUUID(String groupUUID) {
140 setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, groupUUID);
143 public Map<String, String> getMembers() {
144 return (Map<String, String>) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER);
147 public void setMembers(Map<String, String> members) {
148 setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members);
151 public List<String> getArtifacts() {
152 return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS);
155 public void setArtifacts(List<String> artifacts) {
156 setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS, artifacts);
159 public List<String> getArtifactsUuid() {
160 return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID);
163 public void setArtifactsUuid(List<String> artifactsUuid) {
164 setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID, artifactsUuid);
167 public List<PropertyDataDefinition> getProperties() {
168 return (List<PropertyDataDefinition> ) getToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES);
171 public void setProperties(List<PropertyDataDefinition> properties) {
172 setToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES, properties);
175 public String getTypeUid() {
179 public void setTypeUid(String typeUid) {
180 this.typeUid = typeUid;
184 public String toString() {
185 return "GroupDataDefinition [propertyValueCounter=" + propertyValueCounter + ", toscaPresentation=" + toscaPresentation + ", getName()=" + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()="
186 + getVersion() + ", getInvariantUUID()=" + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()=" + getPropertyValueCounter() + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()="
187 + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()=" + getArtifactsUuid() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()="
188 + super.toString() + "]";
192 public boolean containsInstanceAsMember(String instanceId) {
193 return getMembers() != null && getMembers().values().contains(instanceId);