Update UI to define Pdp Group
[clamp.git] / src / main / java / org / onap / clamp / policy / Policy.java
index c656820..47dee1a 100644 (file)
@@ -42,7 +42,7 @@ import org.onap.clamp.loop.common.AuditEntity;
 import org.onap.clamp.loop.template.LoopElementModel;
 
 @MappedSuperclass
-@TypeDefs({ @TypeDef(name = "json", typeClass = StringJsonUserType.class) })
+@TypeDefs({@TypeDef(name = "json", typeClass = StringJsonUserType.class)})
 public abstract class Policy extends AuditEntity {
 
     @Expose
@@ -55,6 +55,10 @@ public abstract class Policy extends AuditEntity {
     @Column(columnDefinition = "json", name = "configurations_json")
     private JsonObject configurationsJson;
 
+    /**
+     * This attribute can be null when the user add a policy on the loop instance, not the template.
+     * When null, It therefore indicates that this policy is not by default in the loop template.
+     */
     @Expose
     @ManyToOne(fetch = FetchType.EAGER)
     @JoinColumn(name = "loop_element_model_id")
@@ -64,24 +68,27 @@ public abstract class Policy extends AuditEntity {
     @Column(name = "pdp_group")
     private String pdpGroup;
 
+    @Expose
+    @Column(name = "pdp_sub_group")
+    private String pdpSubgroup;
+
     public abstract String createPolicyPayload() throws UnsupportedEncodingException;
 
     /**
      * Name getter.
-     * 
+     *
      * @return the name
      */
     public abstract String getName();
 
     /**
      * Name setter.
-     * 
      */
     public abstract void setName(String name);
 
     /**
      * jsonRepresentation getter.
-     * 
+     *
      * @return the jsonRepresentation
      */
     public JsonObject getJsonRepresentation() {
@@ -90,7 +97,7 @@ public abstract class Policy extends AuditEntity {
 
     /**
      * jsonRepresentation setter.
-     * 
+     *
      * @param jsonRepresentation The jsonRepresentation to set
      */
     public void setJsonRepresentation(JsonObject jsonRepresentation) {
@@ -99,7 +106,7 @@ public abstract class Policy extends AuditEntity {
 
     /**
      * configurationsJson getter.
-     * 
+     *
      * @return The configurationsJson
      */
     public JsonObject getConfigurationsJson() {
@@ -108,7 +115,7 @@ public abstract class Policy extends AuditEntity {
 
     /**
      * configurationsJson setter.
-     * 
+     *
      * @param configurationsJson the configurationsJson to set
      */
     public void setConfigurationsJson(JsonObject configurationsJson) {
@@ -117,7 +124,7 @@ public abstract class Policy extends AuditEntity {
 
     /**
      * loopElementModel getter.
-     * 
+     *
      * @return the loopElementModel
      */
     public LoopElementModel getLoopElementModel() {
@@ -126,7 +133,7 @@ public abstract class Policy extends AuditEntity {
 
     /**
      * loopElementModel setter.
-     * 
+     *
      * @param loopElementModel the loopElementModel to set
      */
     public void setLoopElementModel(LoopElementModel loopElementModel) {
@@ -135,7 +142,7 @@ public abstract class Policy extends AuditEntity {
 
     /**
      * pdpGroup getter.
-     * 
+     *
      * @return the pdpGroup
      */
     public String getPdpGroup() {
@@ -144,13 +151,31 @@ public abstract class Policy extends AuditEntity {
 
     /**
      * pdpGroup setter.
-     * 
+     *
      * @param pdpGroup the pdpGroup to set
      */
     public void setPdpGroup(String pdpGroup) {
         this.pdpGroup = pdpGroup;
     }
 
+    /**
+     * pdpSubgroup getter.
+     * 
+     * @return the pdpSubgroup
+     */
+    public String getPdpSubgroup() {
+        return pdpSubgroup;
+    }
+
+    /**
+     * pdpSubgroup setter.
+     * 
+     * @param pdpSubgroup the pdpSubgroup to set
+     */
+    public void setPdpSubgroup(String pdpSubgroup) {
+        this.pdpSubgroup = pdpSubgroup;
+    }
+
     /**
      * Generate the policy name.
      *
@@ -162,7 +187,7 @@ public abstract class Policy extends AuditEntity {
      * @return The generated policy name
      */
     public static String generatePolicyName(String policyType, String serviceName, String serviceVersion,
-            String resourceName, String blueprintFilename) {
+                                            String resourceName, String blueprintFilename) {
         StringBuilder buffer = new StringBuilder(policyType).append("_").append(serviceName).append("_v")
                 .append(serviceVersion).append("_").append(resourceName).append("_")
                 .append(blueprintFilename.replaceAll(".yaml", ""));