package org.onap.clamp.loop.template;
+import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
import java.io.Serializable;
import java.util.HashSet;
import javax.persistence.IdClass;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
+
+import org.hibernate.annotations.Type;
+import org.hibernate.annotations.TypeDef;
+import org.hibernate.annotations.TypeDefs;
+import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.clamp.loop.common.AuditEntity;
import org.onap.clamp.util.SemanticVersioning;
@Entity
@Table(name = "policy_models")
@IdClass(PolicyModelId.class)
+@TypeDefs({@TypeDef(name = "json", typeClass = StringJsonUserType.class)})
public class PolicyModel extends AuditEntity implements Serializable, Comparable<PolicyModel> {
/**
*/
@Id
@Expose
- @Column(name = "version")
+ @Column(name = "version",nullable = false)
private String version;
@Column(columnDefinition = "MEDIUMTEXT", name = "policy_tosca")
@ManyToMany(mappedBy = "policyModels", fetch = FetchType.EAGER)
private Set<LoopElementModel> usedByElementModels = new HashSet<>();
+ @Type(type = "json")
+ @Column(columnDefinition = "json", name = "policy_pdp_group")
+ private JsonObject policyPdpGroup;
+
/**
* usedByElementModels getter.
*
return usedByElementModels;
}
+ /**
+ * policyPdpGroup getter.
+ *
+ * @return the policyPdpGroup
+ */
+ public JsonObject getPolicyPdpGroup() {
+ return policyPdpGroup;
+ }
+
+ /**
+ * policyPdpGroup setter.
+ *
+ * @param policyPdpGroup the policyPdpGroup to set
+ */
+ public void setPolicyPdpGroup(JsonObject policyPdpGroup) {
+ this.policyPdpGroup = policyPdpGroup;
+ }
+
/**
* policyModelTosca getter.
*
this.policyModelType = policyType;
this.policyModelTosca = policyModelTosca;
this.version = version;
- this.policyAcronym = policyAcronym;
+ this.policyAcronym=policyAcronym;
+ if (this.policyAcronym == null) {
+ this.policyAcronym = createDefaultPolicyAcronym(policyType);
+ }
}
/**
* @param version the version like 1.0.0
*/
public PolicyModel(String policyType, String policyModelTosca, String version) {
- this(policyType, policyModelTosca, version, createDefaultPolicyAcronym(policyType));
+ this(policyType, policyModelTosca, version, null);
}
public static String createDefaultPolicyAcronym(String policyType) {