X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=common-be%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fsdc%2Fbe%2Fdatatypes%2Felements%2FPropertyDataDefinition.java;h=ee5cd0ec962177efd6421c49b7ed886d56830716;hb=1f7c6cccdd3a9544a7760db9a305403def4e5365;hp=6b17c419e4755377feef109a5dc2761b5d982d10;hpb=a2313b70009cae09db66ccc7b542ec4679e6a23a;p=sdc.git diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index 6b17c419e4..ee5cd0ec96 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -22,7 +22,9 @@ package org.openecomp.sdc.be.datatypes.elements; import static org.apache.commons.collections.CollectionUtils.isNotEmpty; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -56,11 +58,17 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private Boolean immutable = Boolean.FALSE; private Boolean mappedToComponentProperty = Boolean.TRUE; /** - * @deprecated use {@link #toscaGetFunction#functionType} instead + * @deprecated use {@link #toscaFunction} instead */ @Deprecated private ToscaGetFunctionType toscaGetFunctionType; + /** + * @deprecated use {@link #toscaFunction} instead + */ + @Deprecated private ToscaGetFunctionDataDefinition toscaGetFunction; + private ToscaFunction toscaFunction; + private Collection subPropertyToscaFunctions; private String inputPath; private String status; @@ -71,10 +79,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private String parentPropertyType; private String subPropertyInputPath; private List annotations; - /** - * The resource id which this property belongs to - */ - private String parentUniqueId; private List getInputValues; private Boolean isDeclaredListInput = Boolean.FALSE; private List getPolicyValues; @@ -104,7 +108,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.setType(propertyDataDefinition.getType()); this.setName(propertyDataDefinition.getName()); this.setValue(propertyDataDefinition.getValue()); - this.setRequired(propertyDataDefinition.isRequired()); this.setHidden(propertyDataDefinition.isHidden()); this.setLabel(propertyDataDefinition.getLabel()); this.setImmutable(propertyDataDefinition.isImmutable()); @@ -119,10 +122,12 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.setInstanceUniqueId(propertyDataDefinition.getInstanceUniqueId()); this.setModel(propertyDataDefinition.getModel()); this.setPropertyId(propertyDataDefinition.getPropertyId()); - this.setToscaGetFunctionType(propertyDataDefinition.getToscaGetFunctionType()); this.setToscaGetFunction(propertyDataDefinition.getToscaGetFunction()); + this.setToscaGetFunctionType(propertyDataDefinition.getToscaGetFunctionType()); + this.setToscaFunction(propertyDataDefinition.getToscaFunction()); this.parentPropertyType = propertyDataDefinition.getParentPropertyType(); this.subPropertyInputPath = propertyDataDefinition.getSubPropertyInputPath(); + this.subPropertyToscaFunctions = propertyDataDefinition.getSubPropertyToscaFunctions(); if (isNotEmpty(propertyDataDefinition.annotations)) { this.setAnnotations(propertyDataDefinition.annotations); } @@ -136,7 +141,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.setUserCreated(propertyDataDefinition.isUserCreated()); } - // @Override public boolean isDefinition() { return true; } @@ -170,10 +174,11 @@ public class PropertyDataDefinition extends ToscaDataDefinition { } public ToscaGetFunctionType getToscaGetFunctionType() { - if (toscaGetFunction != null) { - return toscaGetFunction.getFunctionType(); + if (isToscaGetFunction() && toscaFunction != null) { + return ((ToscaGetFunctionDataDefinition) toscaFunction).getFunctionType(); } - return toscaGetFunctionType; + + return null; } public Boolean isHidden() { @@ -188,6 +193,9 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return mappedToComponentProperty; } + /** + * The resource id which this property belongs to + */ public String getParentUniqueId() { return getOwnerId(); } @@ -319,12 +327,22 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return (List) getToscaPresentationValue(JsonPresentationFields.ANNOTATIONS); } - public boolean isGetFunction() { - return this.toscaGetFunctionType != null || this.toscaGetFunction != null; + @JsonIgnoreProperties + public boolean isToscaFunction() { + return this.toscaGetFunctionType != null || this.toscaFunction != null; + } + + @JsonIgnoreProperties + public boolean isToscaGetFunction() { + return this.toscaFunction != null + && (this.toscaFunction.getType() == ToscaFunctionType.GET_ATTRIBUTE + || this.toscaFunction.getType() == ToscaFunctionType.GET_INPUT + || this.toscaFunction.getType() == ToscaFunctionType.GET_PROPERTY); } - public boolean hasGetFunction() { - return this.toscaGetFunction != null; + @JsonIgnoreProperties + public boolean hasToscaFunction() { + return this.toscaFunction != null; } }