Fix op policy

Fix op policy so that when UI sends empty string the targetResourceId is
set to null

Issue-ID: CLAMP-153
Change-Id: I0b6680106548111d59f2170f8f7c42414e0644c8
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java
index bb14b23..337a976 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java
@@ -48,17 +48,17 @@
  * "targetResourceId","value":["Eace933104d443b496b8.nodes.heat.vpg"]}]]}]
  */
 public class PolicyItem implements Cloneable {
-    protected static final EELFLogger logger      = EELFManager.getInstance().getLogger(PolicyItem.class);
-    protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
 
-    private String                    id;
-    private String                    recipe;
-    private int                       maxRetries;
-    private int                       retryTimeLimit;
-    private String                    parentPolicy;
-    private List<String>              parentPolicyConditions;
-    private String                    actor;
-    private String                    targetResourceId;
+    protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyItem.class);
+    protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+    private String id;
+    private String recipe;
+    private int maxRetries;
+    private int retryTimeLimit;
+    private String parentPolicy;
+    private List<String> parentPolicyConditions;
+    private String actor;
+    private String targetResourceId;
 
     /**
      * Parse Policy given json node.
@@ -73,7 +73,9 @@
         parentPolicy = AbstractModelElement.getValueByName(node, "parentPolicy");
         parentPolicyConditions = AbstractModelElement.getValuesByName(node, "parentPolicyConditions");
         targetResourceId = AbstractModelElement.getValueByName(node, "targetResourceId");
-
+        if (targetResourceId != null && targetResourceId.isEmpty()) {
+            this.setTargetResourceId(null);
+        }
     }
 
     /**
diff --git a/src/test/resources/example/model-properties/policy/modelBpmnProperties.json b/src/test/resources/example/model-properties/policy/modelBpmnProperties.json
index 5c2214e..0ef3875 100644
--- a/src/test/resources/example/model-properties/policy/modelBpmnProperties.json
+++ b/src/test/resources/example/model-properties/policy/modelBpmnProperties.json
@@ -100,7 +100,14 @@
                             "name": "targetResourceId",
                             "value":
                             [
-                                "resource-id"
+                                ""
+                            ]
+                        },
+                        {
+                            "name": "targetResourceIdOther",
+                            "value":
+                            [
+                                ""
                             ]
                         }
                     ],
@@ -162,6 +169,13 @@
                             [
                                 "resource-id"
                             ]
+                        },
+                        {
+                            "name": "targetResourceIdOther",
+                            "value":
+                            [
+                                "resource-idOther"
+                            ]
                         }
                     ]
                 ]
@@ -227,13 +241,6 @@
                             [
                                 ""
                             ]
-                        },
-                        {
-                            "name": "targetResourceId",
-                            "value":
-                            [
-                                "resource-id"
-                            ]
                         }
                     ],
 
@@ -294,6 +301,13 @@
                             [
                                 "resource-id"
                             ]
+                        },
+                        {
+                            "name": "targetResourceIdOther",
+                            "value":
+                            [
+                                "resource-idOther"
+                            ]
                         }
                     ]
                 ]
diff --git a/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml b/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml
index fec0e1e..3d0252a 100644
--- a/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml
+++ b/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml
@@ -31,7 +31,7 @@
   retry: 3
   success: <generatedId>
   target:
-    resourceID: resource-id
+    resourceID: null
     type: VM
   timeout: 180
 - actor: APPC
diff --git a/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml b/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml
index fec0e1e..3d0252a 100644
--- a/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml
+++ b/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml
@@ -31,7 +31,7 @@
   retry: 3
   success: <generatedId>
   target:
-    resourceID: resource-id
+    resourceID: null
     type: VM
   timeout: 180
 - actor: APPC