diff options
author | KrupaNagabhushan <krupa.nagabhushan@est.tech> | 2021-01-12 13:41:59 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-04-09 06:46:27 +0000 |
commit | 6d65fde29c1859a7099d91ed0e8911bcb1823a38 (patch) | |
tree | a570de61d7bc39ccfdc2590d4813c97c2d58c18a /common-be | |
parent | 74f9a13c4211c5d75bbcff1ceb794bd060c6a49f (diff) |
Allow property to take its value from defined input list
Issue-ID: SDC-3547
Change-Id: Ic438e8f8943d0f1c656e386611b88b25f879e83b
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'common-be')
3 files changed, 49 insertions, 117 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java index 010840eaee..f4171b29b9 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java @@ -20,14 +20,24 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import java.util.Map; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +@Getter +@Setter +@EqualsAndHashCode +@ToString public class GetInputValueDataDefinition extends ToscaDataDefinition { private String propName; private String inputName; + private String inputType; + @EqualsAndHashCode.Exclude + @ToString.Exclude private String inputId; private Integer indexValue; private GetInputValueDataDefinition getInputIndex; @@ -49,120 +59,5 @@ public class GetInputValueDataDefinition extends ToscaDataDefinition { this.setIndexValue(p.getIndexValue()); this.setGetInputIndex(p.getGetInputIndex()); this.setList(p.isList()); - - - } - - public String getPropName() { - return propName; - } - - public void setPropName(String propName) { - this.propName = propName; - } - - public String getInputName() { - return inputName; - } - - public void setInputName(String inputName) { - this.inputName = inputName; - } - - public Integer getIndexValue() { - return indexValue; - } - - public void setIndexValue(Integer indexValue) { - this.indexValue = indexValue; - } - - public GetInputValueDataDefinition getGetInputIndex() { - return getInputIndex; } - - public void setGetInputIndex(GetInputValueDataDefinition getInputIndex) { - this.getInputIndex = getInputIndex; - } - - public boolean isList() { - return isList; - } - - public void setList(boolean isList) { - this.isList = isList; - } - - - public String getInputId() { - return inputId; - } - - public void setInputId(String inputId) { - this.inputId = inputId; - } - - @Override - public String toString() { - return "GetInputValueDataDefinition [propName=" + propName + ", inputName=" + inputName + ", indexValue=" + indexValue + ", getInputIndex=" + getInputIndex + ", isList=" + isList + "]"; - } - - @Override - public int hashCode() { - final int hashingNumerList = 1231; - final int hashingNumerNoList = 1237; - final int prime = 31; - int result = 1; - result = prime * result + ((getInputIndex == null) ? 0 : getInputIndex.hashCode()); - result = prime * result + ((indexValue == null) ? 0 : indexValue.hashCode()); - result = prime * result + ((inputName == null) ? 0 : inputName.hashCode()); - result = prime * result + (isList ? hashingNumerList : hashingNumerNoList); - result = prime * result + ((propName == null) ? 0 : propName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - GetInputValueDataDefinition other = (GetInputValueDataDefinition) obj; - if (getInputIndex == null) { - if (other.getInputIndex != null) { - return false; - } - } else if (!getInputIndex.equals(other.getInputIndex)) { - return false; - } - if (indexValue == null) { - if (other.indexValue != null) { - return false; - } - } else if (!indexValue.equals(other.indexValue)) { - return false; - } - if (inputName == null) { - if (other.inputName != null) { - return false; - } - } else if (!inputName.equals(other.inputName)) { - return false; - } - if (isList != other.isList) { - return false; - } - if (propName == null) { - return other.propName == null; - } else { - return propName.equals(other.propName); - } - } - - } 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 fdd3b585f6..871492c4bd 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 @@ -35,6 +35,7 @@ import lombok.EqualsAndHashCode; import org.apache.commons.collections.MapUtils; import static org.apache.commons.collections.CollectionUtils.isNotEmpty; +import org.openecomp.sdc.be.datatypes.tosca.ToscaGetFunctionType; @EqualsAndHashCode(callSuper = false) @Data @@ -55,6 +56,8 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private String label; private Boolean immutable = Boolean.FALSE; private Boolean mappedToComponentProperty = Boolean.TRUE; + private ToscaGetFunctionType toscaGetFunctionType; + private String inputPath; private String status; private String inputId; @@ -107,6 +110,7 @@ public class PropertyDataDefinition extends ToscaDataDefinition { this.setInputId(propertyDataDefinition.getInputId()); this.setInstanceUniqueId(propertyDataDefinition.getInstanceUniqueId()); this.setPropertyId(propertyDataDefinition.getPropertyId()); + this.setToscaGetFunctionType(propertyDataDefinition.getToscaGetFunctionType()); this.parentPropertyType = propertyDataDefinition.getParentPropertyType(); this.subPropertyInputPath = propertyDataDefinition.getSubPropertyInputPath(); if (isNotEmpty(propertyDataDefinition.annotations)) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java new file mode 100644 index 0000000000..7e4299c73a --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java @@ -0,0 +1,33 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.tosca; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +public enum ToscaGetFunctionType { + GET_INPUT("get_input"), + GET_PROPERTY("get_property"), + GET_ATTRIBUTE("get_attribute"); + + @Getter + private final String toscaGetFunctionName; +} |