/*-
* ============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.
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-type-version")
+ private String policyTypeVersion;
@SerializedName("policy-id")
- private ToscaPolicyIdentifier policy;
+ private String policyId;
+
+ @SerializedName("policy-version")
+ private String policyVersion;
/**
* Number of PDPs that have successfully added/deleted the policy.
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);
}
}