aboutsummaryrefslogtreecommitdiffstats
path: root/models/src/main
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2023-02-10 23:39:41 +0000
committerGerrit Code Review <gerrit@onap.org>2023-02-10 23:39:41 +0000
commit1191f992ddf1f6bcc94e7fa246ee3efbc71a3a8f (patch)
treef4c81f8a866baf452b56edcd9b847d7d3373d31e /models/src/main
parent5ef4739c785579d6edfdb5e192ec6168a5ef90c7 (diff)
parentd65aa6abc70ad9dff9c74984f2a600607892f831 (diff)
Merge "Initial support for Implement recording of Operational State"
Diffstat (limited to 'models/src/main')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java1
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java36
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java38
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java2
4 files changed, 11 insertions, 66 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java
index 1694b257b..64102e607 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java
@@ -64,5 +64,6 @@ public class AutomationCompositionStateChange extends ParticipantMessage {
this.deployOrderedState = source.deployOrderedState;
this.lockOrderedState = source.lockOrderedState;
this.startPhase = source.startPhase;
+ this.firstStartPhase = source.firstStartPhase;
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
index 2aacc74b6..33ec649f4 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java
@@ -41,8 +41,6 @@ import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.common.parameters.annotations.NotNull;
@@ -83,14 +81,6 @@ public class JpaAutomationComposition extends Validated
@Column
@NotNull
- private AutomationCompositionState state;
-
- @Column
- @NotNull
- private AutomationCompositionOrderedState orderedState;
-
- @Column
- @NotNull
private DeployState deployState;
@Column
@@ -110,7 +100,7 @@ public class JpaAutomationComposition extends Validated
*/
public JpaAutomationComposition() {
this(UUID.randomUUID().toString(), new PfConceptKey(), UUID.randomUUID().toString(),
- AutomationCompositionState.UNINITIALISED, new ArrayList<>(), DeployState.UNDEPLOYED, LockState.LOCKED);
+ new ArrayList<>(), DeployState.UNDEPLOYED, LockState.LOCKED);
}
/**
@@ -119,18 +109,18 @@ public class JpaAutomationComposition extends Validated
* @param instanceId The UUID of the automation composition instance
* @param key the key
* @param compositionId the TOSCA compositionId of the automation composition definition
- * @param state the state of the automation composition
* @param elements the elements of the automation composition in participants
+ * @param deployState the Deploy State
+ * @param lockState the Lock State
*/
public JpaAutomationComposition(@NonNull final String instanceId, @NonNull final PfConceptKey key,
- @NonNull final String compositionId, @NonNull final AutomationCompositionState state,
+ @NonNull final String compositionId,
@NonNull final List<JpaAutomationCompositionElement> elements,
- @NonNull final DeployState deployState, @NonNull final LockState lockState) {
+ @NonNull final DeployState deployState, @NonNull final LockState lockState) {
this.instanceId = instanceId;
this.name = key.getName();
this.version = key.getVersion();
this.compositionId = compositionId;
- this.state = state;
this.deployState = deployState;
this.lockState = lockState;
this.elements = elements;
@@ -146,8 +136,6 @@ public class JpaAutomationComposition extends Validated
this.name = copyConcept.name;
this.version = copyConcept.version;
this.compositionId = copyConcept.compositionId;
- this.state = copyConcept.state;
- this.orderedState = copyConcept.orderedState;
this.deployState = copyConcept.deployState;
this.lockState = copyConcept.lockState;
this.description = copyConcept.description;
@@ -171,8 +159,6 @@ public class JpaAutomationComposition extends Validated
automationComposition.setName(name);
automationComposition.setVersion(version);
automationComposition.setCompositionId(UUID.fromString(compositionId));
- automationComposition.setState(state);
- automationComposition.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
automationComposition.setDeployState(deployState);
automationComposition.setLockState(lockState);
automationComposition.setDescription(description);
@@ -190,8 +176,6 @@ public class JpaAutomationComposition extends Validated
this.name = automationComposition.getName();
this.version = automationComposition.getVersion();
this.compositionId = automationComposition.getCompositionId().toString();
- this.state = automationComposition.getState();
- this.orderedState = automationComposition.getOrderedState();
this.deployState = automationComposition.getDeployState();
this.lockState = automationComposition.getLockState();
this.description = automationComposition.getDescription();
@@ -234,16 +218,6 @@ public class JpaAutomationComposition extends Validated
return result;
}
- result = ObjectUtils.compare(state, other.state);
- if (result != 0) {
- return result;
- }
-
- result = ObjectUtils.compare(orderedState, other.orderedState);
- if (result != 0) {
- return result;
- }
-
result = ObjectUtils.compare(deployState, other.deployState);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
index d0dcd797f..4c3a6a3be 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
@@ -41,8 +41,6 @@ import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.common.parameters.annotations.NotNull;
@@ -75,7 +73,6 @@ public class JpaAutomationCompositionElement extends Validated
@NotNull
private String instanceId;
- // @formatter:off
@VerifyKey
@NotNull
@AttributeOverrides({
@@ -89,14 +86,6 @@ public class JpaAutomationCompositionElement extends Validated
@Column
@NotNull
- private AutomationCompositionState state;
-
- @Column
- @NotNull
- private AutomationCompositionOrderedState orderedState;
-
- @Column
- @NotNull
private DeployState deployState;
@Column
@@ -127,7 +116,7 @@ public class JpaAutomationCompositionElement extends Validated
*/
public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId) {
this(elementId, instanceId, new PfConceptKey(),
- AutomationCompositionState.UNINITIALISED, DeployState.UNDEPLOYED, LockState.LOCKED);
+ DeployState.UNDEPLOYED, LockState.LOCKED);
}
/**
@@ -136,16 +125,15 @@ public class JpaAutomationCompositionElement extends Validated
* @param elementId The id of the automation composition instance Element
* @param instanceId The id of the automation composition instance
* @param definition the TOSCA definition of the automation composition element
- * @param state the state of the automation composition
+ * @param deployState the Deploy State of the automation composition
+ * @param lockState the Lock State of the automation composition
*/
public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId,
@NonNull final PfConceptKey definition,
- @NonNull final AutomationCompositionState state,
- @NonNull final DeployState deployState, @NonNull final LockState lockState) {
+ @NonNull final DeployState deployState, @NonNull final LockState lockState) {
this.elementId = elementId;
this.instanceId = instanceId;
this.definition = definition;
- this.state = state;
this.deployState = deployState;
this.lockState = lockState;
}
@@ -160,8 +148,6 @@ public class JpaAutomationCompositionElement extends Validated
this.instanceId = copyConcept.instanceId;
this.definition = new PfConceptKey(copyConcept.definition);
this.participantId = copyConcept.participantId;
- this.state = copyConcept.state;
- this.orderedState = copyConcept.orderedState;
this.description = copyConcept.description;
this.properties = (copyConcept.properties != null ? new LinkedHashMap<>(copyConcept.properties) : null);
this.deployState = copyConcept.deployState;
@@ -184,8 +170,6 @@ public class JpaAutomationCompositionElement extends Validated
element.setId(UUID.fromString(elementId));
element.setDefinition(new ToscaConceptIdentifier(definition));
element.setParticipantId(UUID.fromString(participantId));
- element.setState(state);
- element.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
element.setDescription(description);
element.setProperties(PfUtils.mapMap(properties, UnaryOperator.identity()));
element.setDeployState(deployState);
@@ -198,10 +182,8 @@ public class JpaAutomationCompositionElement extends Validated
public void fromAuthorative(@NonNull final AutomationCompositionElement element) {
this.definition = element.getDefinition().asConceptKey();
this.participantId = element.getParticipantId().toString();
- this.state = element.getState();
- this.orderedState = element.getOrderedState();
this.description = element.getDescription();
- properties = PfUtils.mapMap(element.getProperties(), UnaryOperator.identity());
+ this.properties = PfUtils.mapMap(element.getProperties(), UnaryOperator.identity());
this.deployState = element.getDeployState();
this.lockState = element.getLockState();
}
@@ -235,16 +217,6 @@ public class JpaAutomationCompositionElement extends Validated
return result;
}
- result = ObjectUtils.compare(state, other.state);
- if (result != 0) {
- return result;
- }
-
- result = ObjectUtils.compare(orderedState, other.orderedState);
- if (result != 0) {
- return result;
- }
-
result = ObjectUtils.compare(deployState, other.deployState);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
index 197955d3a..058feae76 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
@@ -116,7 +116,6 @@ public class AutomationCompositionProvider {
*/
public AutomationComposition updateAutomationComposition(
@NonNull final AutomationComposition automationComposition) {
- AcmUtils.setCascadedState(automationComposition, DeployState.UNDEPLOYED, LockState.NONE);
var result = automationCompositionRepository.save(ProviderUtils.getJpaAndValidate(automationComposition,
JpaAutomationComposition::new, "automation composition"));
@@ -159,7 +158,6 @@ public class AutomationCompositionProvider {
example.setVersion(version);
example.setInstanceId(null);
example.setElements(null);
- example.setState(null);
example.setDeployState(null);
example.setLockState(null);