*
*/
-package org.onap.clamp.dao.model;
+package org.onap.clamp.loop;
import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
+import org.onap.clamp.loop.log.LoopLog;
+import org.onap.clamp.policy.microservice.MicroServicePolicy;
+import org.onap.clamp.policy.operational.OperationalPolicy;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
@Entity
@Column(name = "dcae_blueprint_id")
private String dcaeBlueprintId;
- @Expose
@Column(name = "svg_representation")
private String svgRepresentation;
@Column(columnDefinition = "json", name = "global_properties_json")
private JsonObject globalPropertiesJson;
- @Expose
@Column(nullable = false, name = "blueprint_yaml")
private String blueprint;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "loop")
private Set<LoopLog> loopLogs = new HashSet<>();
+ public Loop() {
+ }
+
+ public Loop(String name, String blueprint, String svgRepresentation) {
+ this.name = name;
+ this.svgRepresentation = svgRepresentation;
+ this.blueprint = blueprint;
+ this.lastComputedState = LoopState.DESIGN;
+ this.globalPropertiesJson = new JsonObject();
+ }
+
public String getName() {
return name;
}
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
return dcaeDeploymentId;
}
- public void setDcaeDeploymentId(String dcaeDeploymentId) {
+ void setDcaeDeploymentId(String dcaeDeploymentId) {
this.dcaeDeploymentId = dcaeDeploymentId;
}
return dcaeDeploymentStatusUrl;
}
- public void setDcaeDeploymentStatusUrl(String dcaeDeploymentStatusUrl) {
+ void setDcaeDeploymentStatusUrl(String dcaeDeploymentStatusUrl) {
this.dcaeDeploymentStatusUrl = dcaeDeploymentStatusUrl;
}
return svgRepresentation;
}
- public void setSvgRepresentation(String svgRepresentation) {
+ void setSvgRepresentation(String svgRepresentation) {
this.svgRepresentation = svgRepresentation;
}
return blueprint;
}
- public void setBlueprint(String blueprint) {
+ void setBlueprint(String blueprint) {
this.blueprint = blueprint;
}
- public LoopState getLastComputedState() {
+ LoopState getLastComputedState() {
return lastComputedState;
}
- public void setLastComputedState(LoopState lastComputedState) {
+ void setLastComputedState(LoopState lastComputedState) {
this.lastComputedState = lastComputedState;
}
- public Set<OperationalPolicy> getOperationalPolicies() {
+ Set<OperationalPolicy> getOperationalPolicies() {
return operationalPolicies;
}
- public void setOperationalPolicies(Set<OperationalPolicy> operationalPolicies) {
+ void setOperationalPolicies(Set<OperationalPolicy> operationalPolicies) {
this.operationalPolicies = operationalPolicies;
}
- public Set<MicroServicePolicy> getMicroServicePolicies() {
+ Set<MicroServicePolicy> getMicroServicePolicies() {
return microServicePolicies;
}
- public void setMicroServicePolicies(Set<MicroServicePolicy> microServicePolicies) {
+ void setMicroServicePolicies(Set<MicroServicePolicy> microServicePolicies) {
this.microServicePolicies = microServicePolicies;
}
- public JsonObject getGlobalPropertiesJson() {
+ JsonObject getGlobalPropertiesJson() {
return globalPropertiesJson;
}
- public void setGlobalPropertiesJson(JsonObject globalPropertiesJson) {
+ void setGlobalPropertiesJson(JsonObject globalPropertiesJson) {
this.globalPropertiesJson = globalPropertiesJson;
}
- public Set<LoopLog> getLoopLogs() {
+ Set<LoopLog> getLoopLogs() {
return loopLogs;
}
- public void setLoopLogs(Set<LoopLog> loopLogs) {
+ void setLoopLogs(Set<LoopLog> loopLogs) {
this.loopLogs = loopLogs;
}
- public void addOperationalPolicy(OperationalPolicy opPolicy) {
- opPolicy.setLoop(this);
+ void addOperationalPolicy(OperationalPolicy opPolicy) {
operationalPolicies.add(opPolicy);
+ opPolicy.setLoop(this);
}
- public void addMicroServicePolicy(MicroServicePolicy microServicePolicy) {
+ void addMicroServicePolicy(MicroServicePolicy microServicePolicy) {
microServicePolicies.add(microServicePolicy);
microServicePolicy.getUsedByLoops().add(this);
}
- public void addLog(LoopLog log) {
+ void addLog(LoopLog log) {
loopLogs.add(log);
log.setLoop(this);
}