Changed identifiers to concept identifiers
[policy/models.git] / models-pap / src / main / java / org / onap / policy / models / pap / concepts / PolicyStatus.java
index 56d6c69..b05af92 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,18 +22,23 @@ package org.onap.policy.models.pap.concepts;
 import com.google.gson.annotations.SerializedName;
 import lombok.Data;
 import lombok.NoArgsConstructor;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
 
 @Data
 @NoArgsConstructor
 public class PolicyStatus {
 
     @SerializedName("policy-type")
-    private ToscaPolicyTypeIdentifier policyType;
+    private String policyTypeId;
 
-    @SerializedName("policy")
-    private ToscaPolicyIdentifier policy;
+    @SerializedName("policy-type-version")
+    private String policyTypeVersion;
+
+    @SerializedName("policy-id")
+    private String policyId;
+
+    @SerializedName("policy-version")
+    private String policyVersion;
 
     /**
      * Number of PDPs that have successfully added/deleted the policy.
@@ -53,8 +59,25 @@ public class PolicyStatus {
     private int incompleteCount = 0;
 
 
-    public PolicyStatus(ToscaPolicyTypeIdentifier policyType, ToscaPolicyIdentifier policy) {
-        this.policyType = policyType;
-        this.policy = policy;
+    /**
+     * Constructs the object.
+     *
+     * @param policyType policy type, from which the name and version are to be extracted
+     * @param policy policy identifier, from which the name and version are to be
+     *        extracted
+     */
+    public PolicyStatus(ToscaConceptIdentifier policyType, ToscaConceptIdentifier policy) {
+        this.policyTypeId = policyType.getName();
+        this.policyTypeVersion = policyType.getVersion();
+        this.policyId = policy.getName();
+        this.policyVersion = policy.getVersion();
+    }
+
+    public ToscaConceptIdentifier getPolicyType() {
+        return new ToscaConceptIdentifier(policyTypeId, policyTypeVersion);
+    }
+
+    public ToscaConceptIdentifier getPolicy() {
+        return new ToscaConceptIdentifier(policyId, policyVersion);
     }
 }