summaryrefslogtreecommitdiffstats
path: root/models-pdp/src/main/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-03-29 10:31:22 +0000
committerliamfallon <liam.fallon@est.tech>2019-03-29 10:31:22 +0000
commitcc5b96bfd33cd7d91fe6994d348e8d6a0ebb54fa (patch)
tree2fee38b739094176421927052b65ce6d9ffd5098 /models-pdp/src/main/java
parent6ccec5265d3431a1ca3265876b3df7bb422d9b62 (diff)
Restructure for authorative models
Use authorative models instead of the JPA stored models as the venacular models in the Policy Framework. The next step is to pass the authorative objects over the provider interface rather than the JPA obejcts. This change will be made in the next review. Minor changes to pdp objects to remove JPA things from them. These object will be the authorative in-memory obejcts on the PDP side and new JPA entity object will be introduced in a future review to persist them. Issue-ID: POLICY-1095 Change-Id: I40e7b713903980cb41bb315417111b67a9b17307 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-pdp/src/main/java')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/Pdp.java (renamed from models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetails.java)4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java20
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java9
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java5
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java (renamed from models-pdp/src/main/java/org/onap/policy/models/pdp/provider/PdpProvider.java)2
7 files changed, 22 insertions, 22 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetails.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/Pdp.java
index 6cf122e19..1eaa41547 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetails.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/Pdp.java
@@ -38,7 +38,7 @@ import org.onap.policy.models.pdp.enums.PdpState;
@Setter
@ToString
@NoArgsConstructor
-public class PdpInstanceDetails {
+public class Pdp {
@NonNull
private String instanceId;
@@ -54,7 +54,7 @@ public class PdpInstanceDetails {
*
* @param source source from which to copy the fields
*/
- public PdpInstanceDetails(PdpInstanceDetails source) {
+ public Pdp(Pdp source) {
this.instanceId = source.instanceId;
this.pdpState = source.pdpState;
this.healthy = source.healthy;
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
index 4a26b16dd..c69679416 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
@@ -25,13 +25,10 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import lombok.Getter;
+import lombok.Data;
import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.simple.concepts.ToscaEntityType;
/**
* Class to represent a PDPGroup, which groups multiple PDPSubGroup entities together for
@@ -39,13 +36,12 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaEntityType;
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
-@Getter
-@Setter
-@ToString
+@Data
@NoArgsConstructor
-public class PdpGroup extends ToscaEntityType {
- private static final long serialVersionUID = 1L;
-
+public class PdpGroup {
+ private String name;
+ private String version;
+ private String description;
private PdpState pdpGroupState;
private Map<String, String> properties;
private List<PdpSubGroup> pdpSubgroups;
@@ -62,7 +58,9 @@ public class PdpGroup extends ToscaEntityType {
* @param source source from which to copy fields
*/
public PdpGroup(PdpGroup source) {
- super(source);
+ this.name = source.name;
+ this.version = source.version;
+ this.description = source.description;
this.pdpGroupState = source.pdpGroupState;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
this.pdpSubgroups = PfUtils.mapList(source.pdpSubgroups, PdpSubGroup::new);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
index 814d35732..eb0758e61 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
@@ -28,7 +28,7 @@ import lombok.ToString;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Class to represent the PDP_STATUS message that all the PDP's will send to PAP.
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
index 0466c6300..b4539ec3e 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
@@ -29,7 +29,7 @@ import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Class to represent a group of all PDP's of the same pdp type running for a particular
@@ -41,16 +41,13 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
@Setter
@ToString
public class PdpSubGroup {
-
- // TODO subclass from ToscaEntityType
-
private String pdpType;
private List<PolicyTypeIdent> supportedPolicyTypes;
private List<ToscaPolicy> policies;
private int currentInstanceCount;
private int desiredInstanceCount;
private Map<String, String> properties;
- private List<PdpInstanceDetails> pdpInstances;
+ private List<Pdp> pdpInstances;
/**
* Constructs the object.
@@ -71,6 +68,6 @@ public class PdpSubGroup {
this.currentInstanceCount = source.currentInstanceCount;
this.desiredInstanceCount = source.desiredInstanceCount;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
- this.pdpInstances = PfUtils.mapList(source.pdpInstances, PdpInstanceDetails::new);
+ this.pdpInstances = PfUtils.mapList(source.pdpInstances, Pdp::new);
}
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
index a048cde48..5c99a56f5 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
@@ -27,7 +27,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.onap.policy.models.pdp.enums.PdpMessageType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Class to represent the PDP_UPDATE message that PAP will send to a PDP.
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java
index 7d31c3344..e8bbb2c30 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java
@@ -42,4 +42,9 @@ public enum PdpHealthStatus {
* PDP is currently under test state and performing tests.
*/
TEST_IN_PROGRESS,
+
+ /**
+ * The health status of the PDP is unknown.
+ */
+ UNKNOWN
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
index 57feba620..fe0576dfe 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/provider/PdpProvider.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.models.pdp.provider;
+package org.onap.policy.models.pdp.persistence.provider;
import lombok.NonNull;