package org.openecomp.sdc.be.datatypes.elements;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
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 org.openecomp.sdc.common.util.ValidationUtils;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
public class ComponentInstanceDataDefinition extends ToscaDataDefinition {
public ComponentInstanceDataDefinition() {
setDescription(dataDefinition.getDescription());
setPosX(dataDefinition.getPosX());
setPosY(dataDefinition.getPosY());
+ setMinOccurrences(dataDefinition.getMinOccurrences());
+ setMaxOccurrences(dataDefinition.getMaxOccurrences());
setPropertyValueCounter(dataDefinition.getPropertyValueCounter());
setNormalizedName(dataDefinition.getNormalizedName());
setOriginType(dataDefinition.getOriginType());
public void setModificationTime(Long modificationTime) {
setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime);
- }
+ }
- public CreatedFrom getCreatedFrom() {
- String createdFrom = (String) getToscaPresentationValue(JsonPresentationFields.CREATED_FROM);
- return Objects.nonNull(createdFrom) ? CreatedFrom.valueOf(createdFrom) : null;
- }
+ public CreatedFrom getCreatedFrom() {
+ String createdFrom = (String) getToscaPresentationValue(JsonPresentationFields.CREATED_FROM);
+ return Objects.nonNull(createdFrom) ? CreatedFrom.valueOf(createdFrom) : null;
+ }
- public void setCreatedFrom(CreatedFrom createdFrom) {
- if (Objects.nonNull(createdFrom)) {
- setToscaPresentationValue(JsonPresentationFields.CREATED_FROM, createdFrom.name());
- }
+ public void setCreatedFrom(CreatedFrom createdFrom) {
+ if (Objects.nonNull(createdFrom)){
+ setToscaPresentationValue(JsonPresentationFields.CREATED_FROM, createdFrom.name());
+ }
}
public String getDescription() {
setToscaPresentationValue(JsonPresentationFields.CI_POS_Y, posY);
}
+ public String getMinOccurrences() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_MIN_OCCURRENCES);
+ }
+
+ public void setMinOccurrences(String minOccurrences) {
+ setToscaPresentationValue(JsonPresentationFields.CI_MIN_OCCURRENCES, minOccurrences);
+ }
+
+ public String getMaxOccurrences() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_MAX_OCCURRENCES);
+ }
+
+ public void setMaxOccurrences(String maxOccurrences) {
+ setToscaPresentationValue(JsonPresentationFields.CI_MAX_OCCURRENCES, maxOccurrences);
+ }
+
public String getComponentUid() {
return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID);
}
setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, resourceUid);
}
+ public String getName() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
+ }
+
public void setName(String name) {
if (this.getInvariantName() == null && name != null) {
this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name));
return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION);
}
- public void setComponentVersion(String resourceVersion) {
- setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion);
- }
-
public String getToscaComponentName() {
return (String) getToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME);
}
setToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME, toscaComponentName);
}
- public String getSourceModelUuid() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID);
+ public void setComponentVersion(String resourceVersion) {
+ setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion);
}
public void setSourceModelUuid(String targetModelUuid) {
setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid);
}
- public String getSourceModelUid() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID);
- }
-
public void setSourceModelUid(String targetModelUid) {
setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid);
}
- public String getSourceModelName() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME);
- }
-
public void setSourceModelName(String targetModelName) {
setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName);
}
- public String getSourceModelInvariant() {
- return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT);
- }
-
public void setSourceModelInvariant(String targetModelInvariant) {
setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant);
}
- public Boolean getIsProxy() {
- Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY);
- return (isProxy != null) ? isProxy : false;
+ public String getSourceModelUuid() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID);
+ }
+
+ public String getSourceModelUid() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID);
+ }
+
+ public String getSourceModelName() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME);
+ }
+
+ public String getSourceModelInvariant() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT);
}
public void setIsProxy(Boolean isProxy) {
}
}
+ public Boolean getIsProxy() {
+ Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY);
+ return (isProxy != null) ? isProxy : false;
+ }
+
public Boolean isServiceSubstitution() {
return getOriginType() == OriginTypeEnum.ServiceSubstitution;
}
setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives);
}
- public Map<String, ToscaArtifactDataDefinition> getToscaArtifacts() {
- return (Map<String, ToscaArtifactDataDefinition>) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS);
+ public Map<String, ToscaArtifactDataDefinition> getToscaArtifacts() {
+ return ( Map<String, ToscaArtifactDataDefinition>) getToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS);
}
- public void setToscaArtifacts(Map<String, ToscaArtifactDataDefinition> artifacts) {
- if (artifacts == null) {
+ public void setToscaArtifacts(Map<String, ToscaArtifactDataDefinition> artifacts) {
+ if (artifacts == null){
artifacts = new HashMap<>();
}
setToscaPresentationValue(JsonPresentationFields.CI_ARTIFACTS, artifacts);
@Override
public String toString() {
return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name="
- + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid()
- + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime()
- + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY()
- + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter="
- + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType="
- + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName="
- + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName="
- + getToscaComponentName() + ", directives =" + getDirectivesString() + "]";
+ + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid()
+ + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime()
+ + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY()
+ + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter="
+ + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType="
+ + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName="
+ + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName="
+ + getToscaComponentName() + ", directives =" + getDirectivesString() + ", minOccurrences ="
+ + getMinOccurrences() + ", maxOccurrences =" + getMaxOccurrences() +"]";
}
}