diff options
Diffstat (limited to 'common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java')
-rw-r--r-- | common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java | 72 |
1 files changed, 48 insertions, 24 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java index ec92ae6bf0..ad61426583 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java @@ -17,32 +17,31 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.be.datatypes.elements; -import static java.util.Collections.emptyMap; +package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonInclude; +import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -@Getter -@Setter -@NoArgsConstructor -public class GroupDataDefinition extends ToscaDataDefinition { +import static java.util.Collections.emptyMap; + +public class GroupDataDefinition extends ToscaDataDefinition { @JsonInclude private String typeUid; @JsonInclude private Integer propertyValueCounter = 0; + public GroupDataDefinition() { + } + public GroupDataDefinition(Map<String, Object> gr) { super(gr); propertyValueCounter = 0; @@ -59,12 +58,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { this.setGroupUUID(other.getGroupUUID()); this.setInvariantName(other.getInvariantName()); this.setCreatedFrom(other.getCreatedFrom()); + if (other.getMembers() != null) { this.setMembers(new HashMap<>(other.getMembers())); } if (other.getArtifacts() != null) { this.setArtifacts(new ArrayList<>(other.getArtifacts())); } + if (other.getArtifactsUuid() != null) { this.setArtifactsUuid(new ArrayList<>(other.getArtifactsUuid())); } @@ -74,6 +75,15 @@ public class GroupDataDefinition extends ToscaDataDefinition { this.setTypeUid(other.typeUid); } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + public String getInvariantName() { String invariantName = (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); return invariantName == null ? getName() : invariantName; @@ -100,17 +110,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } - @Override public String getType() { return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } - @Override public void setType(String type) { setToscaPresentationValue(JsonPresentationFields.TYPE, type); } - @Override public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } @@ -135,6 +142,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } + public Integer getPropertyValueCounter() { + return propertyValueCounter; + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + this.propertyValueCounter = propertyValueCounter; + } + public String getGroupUUID() { return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID); } @@ -147,10 +162,6 @@ public class GroupDataDefinition extends ToscaDataDefinition { return (Map<String, String>) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER); } - public void setMembers(Map<String, String> members) { - setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); - } - //this is used by GroupCompositionMixin public Map<String, String> resolveMembersList() { Map<String, String> members = getMembers(); @@ -158,6 +169,11 @@ public class GroupDataDefinition extends ToscaDataDefinition { return members; } return emptyMap(); + + } + + public void setMembers(Map<String, String> members) { + setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); } public List<String> getArtifacts() { @@ -184,6 +200,14 @@ public class GroupDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES, properties); } + public String getTypeUid() { + return typeUid; + } + + public void setTypeUid(String typeUid) { + this.typeUid = typeUid; + } + public boolean isUserDefined() { return CreatedFrom.UI.equals(getCreatedFrom()); } @@ -194,13 +218,13 @@ public class GroupDataDefinition extends ToscaDataDefinition { @Override public String toString() { - return "GroupDataDefinition [propertyValueCounter=" + propertyValueCounter + ", toscaPresentation=" + toscaPresentation + ", getName()=" - + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()=" + getVersion() + ", getInvariantUUID()=" - + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()=" + getPropertyValueCounter() - + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()=" + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()=" - + getArtifactsUuid() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + super.toString() + "]"; + return "GroupDataDefinition [propertyValueCounter=" + propertyValueCounter + ", toscaPresentation=" + toscaPresentation + ", getName()=" + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()=" + + getVersion() + ", getInvariantUUID()=" + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()=" + getPropertyValueCounter() + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()=" + + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()=" + getArtifactsUuid() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + + super.toString() + "]"; } + public boolean containsInstanceAsMember(String instanceId) { return getMembers() != null && getMembers().values().contains(instanceId); } |