Declare properties as policies

Change-Id: I54dc7b444e08117097c314cf5f51bd356ac5287d
Issue-ID: SDC-2240
Signed-off-by: talio <tali.orenbach@amdocs.com>
diff --git a/common-be/pom.xml b/common-be/pom.xml
index 3ae7db2..c02de89 100644
--- a/common-be/pom.xml
+++ b/common-be/pom.xml
@@ -60,8 +60,18 @@
 			<version>${junit.version}</version>
 			<scope>test</scope>
 		</dependency>
+        <dependency>
+            <groupId>org.onap.sdc.common</groupId>
+            <artifactId>onap-tosca-datatype</artifactId>
+            <version>${tosca.datatype.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+			<version>${lombok.version}</version>
+        </dependency>
 
-	</dependencies>
+    </dependencies>
 	<build>
 		<plugins>
 			<plugin>
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java
new file mode 100644
index 0000000..bf55274
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java
@@ -0,0 +1,17 @@
+package org.openecomp.sdc.be.datatypes.elements;
+
+import java.util.Objects;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
+
+@Getter
+@Setter
+@EqualsAndHashCode
+public class GetPolicyValueDataDefinition {
+    private String policyId;
+    private String propertyName;
+    private String origPropertyValue;
+
+}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java
index 1e0d593..64efe8f 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java
@@ -1,12 +1,10 @@
 package org.openecomp.sdc.be.datatypes.elements;
 
-import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import static java.util.Collections.emptyList;
 
 import java.util.List;
 import java.util.Map;
-
-import static java.util.Collections.emptyList;
+import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
 
 /**
  * public class representing the component policy,
@@ -27,7 +25,7 @@
  * targets
  * isFromCsar
  */
-public class PolicyDataDefinition extends ToscaDataDefinition {
+public class PolicyDataDefinition extends PropertyDataDefinition {
 
     /**
      * public constructor by default
@@ -36,6 +34,10 @@
         super();
     }
 
+    public PolicyDataDefinition(PropertyDataDefinition propertyDataDefinition) {
+        super(propertyDataDefinition);
+    }
+
     /**
      * public constructor from superclass
      *
@@ -51,6 +53,7 @@
      * @param other
      */
     public PolicyDataDefinition(PolicyDataDefinition other) {
+        super(other);
         this.setName(other.getName());
         this.setUniqueId(other.getUniqueId());
         this.setPolicyTypeName(other.getPolicyTypeName());
@@ -63,6 +66,11 @@
         this.setInvariantName(other.getInvariantName());
         this.setComponentName(other.getComponentName());
         this.setIsFromCsar(other.getIsFromCsar());
+        this.setValue(other.getValue());
+        this.setOwnerId(other.getOwnerId());
+        this.setType(other.getType());
+        this.setInstanceUniqueId(other.getInstanceUniqueId());
+        this.setInputPath(other.getInputPath());
         if (other.getProperties() != null) {
             this.setProperties(other.getProperties());
         }
@@ -100,22 +108,6 @@
         setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName);
     }
 
-    public String getName() {
-        return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
-    }
-
-    public void setName(String name) {
-        setToscaPresentationValue(JsonPresentationFields.NAME, name);
-    }
-
-    public String getUniqueId() {
-        return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID);
-    }
-
-    public void setUniqueId(String uniqueId) {
-        setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId);
-    }
-
     public String getPolicyTypeName() {
         return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
     }
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 88863b2..fed728d 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
@@ -20,13 +20,18 @@
 
 package org.openecomp.sdc.be.datatypes.elements;
 
+import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import org.apache.commons.collections.CollectionUtils;
 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
 
-import java.util.*;
-
-import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
-
 public class PropertyDataDefinition extends ToscaDataDefinition {
 
 	private String uniqueId;
@@ -59,8 +64,8 @@
 	private String inputId;
 	private String instanceUniqueId;
 	private String propertyId;
-	private String parentPropertyType;
-	private String subPropertyInputPath;
+    private String parentPropertyType;
+    private String subPropertyInputPath;
 
 	private List<Annotation> annotations;
 	/**
@@ -70,6 +75,8 @@
 
 	private List<GetInputValueDataDefinition> getInputValues;
 
+	private List<GetPolicyValueDataDefinition> getPolicyValues;
+
 	public PropertyDataDefinition() {
 		super();
 	}
@@ -97,32 +104,33 @@
 		this.setParentUniqueId(p.getParentUniqueId());
 		this.setOwnerId(p.getOwnerId());
 		this.setGetInputValues(p.getGetInputValues());
+		this.setGetPolicyValues(p.getGetPolicyValues());
 		this.setInputPath(p.getInputPath());
 		this.setStatus(p.getStatus());
 		this.setInputId(p.getInputId());
 		this.setInstanceUniqueId(p.getInstanceUniqueId());
 		this.setPropertyId(p.getPropertyId());
-		this.setParentPropertyType(p.getParentPropertyType());
-		this.setSubPropertyInputPath(p.getSubPropertyInputPath());
+		this.parentPropertyType = p.getParentPropertyType();
+		this.subPropertyInputPath = p.getSubPropertyInputPath();
 		if(isNotEmpty(p.annotations)){
 		    this.setAnnotations(p.annotations);
         }
 	}
 
 	public String getParentPropertyType() {
-		return parentPropertyType;
+	    return parentPropertyType;
 	}
 
 	public void setParentPropertyType(String parentPropertyType) {
-		this.parentPropertyType = parentPropertyType;
+	    this.parentPropertyType = parentPropertyType;
 	}
 
 	public String getSubPropertyInputPath() {
-		return subPropertyInputPath;
+	    return subPropertyInputPath;
 	}
 
 	public void setSubPropertyInputPath(String subPropertyInputPath) {
-		this.subPropertyInputPath = subPropertyInputPath;
+	    this.subPropertyInputPath = subPropertyInputPath;
 	}
 
 	public String getInputPath() {
@@ -269,6 +277,18 @@
 		this.getInputValues = getInputValues;
 	}
 
+	public List<GetPolicyValueDataDefinition> safeGetGetPolicyValues() {
+		return CollectionUtils.isEmpty(getPolicyValues) ? new ArrayList<>() : getPolicyValues;
+	}
+
+	public List<GetPolicyValueDataDefinition> getGetPolicyValues() {
+		return getPolicyValues;
+	}
+
+	public void setGetPolicyValues(List<GetPolicyValueDataDefinition> getPolicyValues) {
+		this.getPolicyValues = getPolicyValues;
+	}
+
 	public String getStatus() {
 		return status;
 	}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java
new file mode 100644
index 0000000..7b78ff9
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java
@@ -0,0 +1,6 @@
+package org.openecomp.sdc.be.datatypes.enums;
+
+public enum  DeclarationTypeEnum {
+    INPUT,
+    POLICY;
+}