aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-02-06 16:50:56 +0100
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-02-06 16:50:56 +0100
commit8520e52a00d52dc5db202268668ed88389b3bc0d (patch)
tree07e8feec1c1b02c906cf488931f82a8a3b603d02 /src/main/java/org/onap
parentd2cb8a156597c082e50953a255a58fcb868ab1e0 (diff)
Add Policy Type to PolicyChain.
Add Policy Type to PolicyChain as needed by future elements. Issue-ID: CLAMP-85 Change-Id: Id12d71e378319cf93220520cc51ef4cc57e5ff39 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java b/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java
index 5264629f2..217f7fd2d 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -63,21 +63,26 @@ public class PolicyChain {
private String policyId;
private Integer timeout;
private List<PolicyItem> policyItems;
+ private String policyType;
public PolicyChain(JsonNode node) {
policyId = AbstractModelElement.getValueByName(node, "pid");
timeout = AbstractModelElement.getIntValueByName(node, "timeout");
-
- // process policy configurations
- JsonNode policyNode = node.get(node.size() - 1).get("policyConfigurations");
- Iterator<JsonNode> itr = policyNode.elements();
- policyItems = new ArrayList<>();
- while (itr.hasNext()) {
- policyItems.add(new PolicyItem(itr.next()));
- }
+ policyType = AbstractModelElement.getValueByName(node, "policyType");
+
+ if(node != null && node.size() > 0) {
+ JsonNode policyNode = node.get(node.size() - 1).get("policyConfigurations");
+ if(policyNode != null) {
+ Iterator<JsonNode> itr = policyNode.elements();
+ policyItems = new ArrayList<>();
+ while (itr.hasNext()) {
+ policyItems.add(new PolicyItem(itr.next()));
+ }
+
+ }
+ }
}
-
/**
* @return the policyId
*/
@@ -98,5 +103,12 @@ public class PolicyChain {
public List<PolicyItem> getPolicyItems() {
return policyItems;
}
+
+ /**
+ * @return the policyType
+ */
+ public String getPolicyType() {
+ return policyType;
+ }
}