import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
+import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor;
+import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.clamp.loop.Loop;
import org.onap.clamp.policy.Policy;
@Column(name = "shared", nullable = false)
private Boolean shared;
- @Column(name = "policy_tosca", nullable = false)
+ @Column(columnDefinition = "MEDIUMTEXT", name = "policy_tosca", nullable = false)
private String policyTosca;
@Expose
// serialization
}
+ public MicroServicePolicy(String name, String policyTosca, Boolean shared, Set<Loop> usedByLoops) {
+ this.name = name;
+ this.policyTosca = policyTosca;
+ this.shared = shared;
+ this.jsonRepresentation = JsonUtils.GSON_JPA_MODEL
+ .fromJson(new ToscaYamlToJsonConvertor(null).parseToscaYaml(policyTosca), JsonObject.class);
+ this.usedByLoops = usedByLoops;
+ }
+
public MicroServicePolicy(String name, String policyTosca, Boolean shared, JsonObject jsonRepresentation,
Set<Loop> usedByLoops) {
this.name = name;
this.policyTosca = policyTosca;
this.shared = shared;
- this.jsonRepresentation = jsonRepresentation;
this.usedByLoops = usedByLoops;
+ this.jsonRepresentation = jsonRepresentation;
}
@Override