aboutsummaryrefslogtreecommitdiffstats
path: root/models/src/main
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2023-01-27 14:58:05 +0000
committersaul.gill <saul.gill@est.tech>2023-01-31 09:58:41 +0000
commit777a186248a2bcef1ab9ffc8b16a7190860302e2 (patch)
tree19adf958820a36d45aadc1850b1dd7d720086ab2 /models/src/main
parent934f7bd443225a6945b0542fa5cb7c043deac426 (diff)
Add element and definition map to ppnt endpoints
Add element instance map Add node template state map Issue-ID: POLICY-4540 Change-Id: I6e7c2b27db78a090b0a1303c49e57d8675316f9b Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'models/src/main')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantInformation.java7
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java31
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java33
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/NodeTemplateStateRepository.java34
4 files changed, 103 insertions, 2 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantInformation.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantInformation.java
index a6a65fec5..8d7d391f8 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantInformation.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantInformation.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public class ParticipantInformation {
@NonNull
private Participant participant;
- private Map<UUID, AutomationCompositionElementDefinition> acElementDefinitionMap = new HashMap<>();
+ private Map<UUID, NodeTemplateState> acNodeTemplateStateDefinitionMap = new HashMap<>();
private Map<UUID, AutomationCompositionElement> acElementInstanceMap = new HashMap<>();
/**
@@ -47,6 +47,9 @@ public class ParticipantInformation {
* @param otherInfo the participant information to copy from
*/
public ParticipantInformation(ParticipantInformation otherInfo) {
+
this.participant = otherInfo.participant;
+ this.acNodeTemplateStateDefinitionMap = otherInfo.getAcNodeTemplateStateDefinitionMap();
+ this.acElementInstanceMap = otherInfo.getAcElementInstanceMap();
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
index 8e45c770b..65b72c436 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
@@ -28,8 +28,12 @@ import java.util.UUID;
import javax.ws.rs.core.Response.Status;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.NodeTemplateState;
import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
+import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionElementRepository;
+import org.onap.policy.clamp.models.acm.persistence.repository.NodeTemplateStateRepository;
import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantRepository;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -46,6 +50,11 @@ public class ParticipantProvider {
private final ParticipantRepository participantRepository;
+ private final AutomationCompositionElementRepository automationCompositionElementRepository;
+
+ private final NodeTemplateStateRepository nodeTemplateStateRepository;
+
+
/**
* Get all participants.
*
@@ -149,4 +158,26 @@ public class ParticipantProvider {
return map;
}
+
+ /**
+ * Retrieve a list of automation composition elements associated with a participantId.
+ *
+ * @param participantId the participant id associated with the automation composition elements
+ * @return the list of associated elements
+ */
+ public List<AutomationCompositionElement> getAutomationCompositionElements(@NonNull final UUID participantId) {
+ return ProviderUtils.asEntityList(automationCompositionElementRepository
+ .findByParticipantId(participantId.toString()));
+ }
+
+ /**
+ * Retrieve a list of node template states elements associated with a participantId from ac definitions.
+ *
+ * @param participantId the participant id associated with the automation composition elements
+ * @return the list of associated elements
+ */
+ public List<NodeTemplateState> getAcNodeTemplateStates(@NonNull final UUID participantId) {
+ return ProviderUtils.asEntityList(nodeTemplateStateRepository
+ .findByParticipantId(participantId.toString()));
+ }
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java
new file mode 100644
index 000000000..19d791e6c
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionElementRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.repository;
+
+import java.util.List;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationCompositionElement;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+public interface AutomationCompositionElementRepository extends
+ JpaRepository<JpaAutomationCompositionElement, String>,
+ QueryByExampleExecutor<JpaAutomationCompositionElement> {
+
+ List<JpaAutomationCompositionElement> findByParticipantId(String participantId);
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/NodeTemplateStateRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/NodeTemplateStateRepository.java
new file mode 100644
index 000000000..3a879a78b
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/NodeTemplateStateRepository.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.repository;
+
+import java.util.List;
+import org.onap.policy.clamp.models.acm.persistence.concepts.JpaNodeTemplateState;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+public interface NodeTemplateStateRepository extends
+ JpaRepository<JpaNodeTemplateState, String>,
+ QueryByExampleExecutor<JpaNodeTemplateState> {
+
+ List<JpaNodeTemplateState> findByParticipantId(String participantId);
+}
+