aboutsummaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-07-18 11:35:18 +0100
committerMichael Morris <michael.morris@est.tech>2023-09-22 07:41:02 +0000
commit629837b3f7a282c74604987fd531ff4523f98a0c (patch)
treed1afa021ef1342c72dd0a6ea016084651680caa7 /common-be
parent615f2405b8d2dee1d91cf20188a180591ec84ab3 (diff)
Backend support for operation milestones with activities
Issue-ID: SDC-4577 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: I6a8dab0e48da542424faa017a1dea384ebb2376f
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ActivityDataDefinition.java53
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MilestoneDataDefinition.java44
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java12
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ActivityTypeEnum.java46
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java3
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MilestoneTypeEnum.java46
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java3
7 files changed, 207 insertions, 0 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ActivityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ActivityDataDefinition.java
new file mode 100644
index 0000000000..8d76f68a67
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ActivityDataDefinition.java
@@ -0,0 +1,53 @@
+/*
+ *
+ * ============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.openecomp.sdc.be.datatypes.elements;
+
+import java.io.Serializable;
+import lombok.NoArgsConstructor;
+import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+
+@NoArgsConstructor
+public class ActivityDataDefinition extends ToscaDataDefinition implements Serializable {
+
+ public ActivityDataDefinition(ActivityDataDefinition activity) {
+ setType(activity.getType());
+ setWorkflow(getWorkflow());
+ }
+
+ public String getType() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
+ }
+
+ public void setType(String type) {
+ setToscaPresentationValue(JsonPresentationFields.TYPE, type);
+ }
+
+ public String getWorkflow() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.OPERATION_ACTIVITIES_WORKFLOW);
+ }
+
+ public void setWorkflow(String workflow) {
+ setToscaPresentationValue(JsonPresentationFields.OPERATION_ACTIVITIES_WORKFLOW, workflow);
+ }
+
+}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MilestoneDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MilestoneDataDefinition.java
new file mode 100644
index 0000000000..78681e1434
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MilestoneDataDefinition.java
@@ -0,0 +1,44 @@
+/*
+ *
+ * ============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.openecomp.sdc.be.datatypes.elements;
+
+import java.io.Serializable;
+import lombok.NoArgsConstructor;
+import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+
+@NoArgsConstructor
+public class MilestoneDataDefinition extends ToscaDataDefinition implements Serializable {
+
+ public MilestoneDataDefinition(MilestoneDataDefinition milestone) {
+ setActivities(milestone.getActivities());
+ }
+
+ public ListDataDefinition<ActivityDataDefinition> getActivities() {
+ return (ListDataDefinition<ActivityDataDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATION_ACTIVITIES);
+ }
+
+ public void setActivities(ListDataDefinition<ActivityDataDefinition> activities) {
+ setToscaPresentationValue(JsonPresentationFields.OPERATION_ACTIVITIES, activities);
+ }
+
+}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
index f93e41cf51..a4bc7f1e0f 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
@@ -21,7 +21,9 @@
package org.openecomp.sdc.be.datatypes.elements;
import com.fasterxml.jackson.annotation.JsonCreator;
+import java.util.Map;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
+import org.openecomp.sdc.be.datatypes.enums.MilestoneTypeEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import java.io.Serializable;
@@ -46,6 +48,7 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri
}
public OperationDataDefinition(OperationDataDefinition p) {
+ setMilestones(p.getMilestones());
setDescription(p.getDescription());
setImplementation(p.getImplementation());
setInputs(p.getInputs());
@@ -59,6 +62,15 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri
setWorkflowVersion(p.getWorkflowVersion());
}
+ public void setMilestones(Map<String, MilestoneDataDefinition> milestones) {
+ setToscaPresentationValue(JsonPresentationFields.OPERATION_MILESTONES, milestones);
+ }
+
+ public Map<String, MilestoneDataDefinition> getMilestones() {
+ return (Map<String, MilestoneDataDefinition> ) getToscaPresentationValue(
+ JsonPresentationFields.OPERATION_MILESTONES);
+ }
+
public String getDescription() {
return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION);
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ActivityTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ActivityTypeEnum.java
new file mode 100644
index 0000000000..b3594f3029
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ActivityTypeEnum.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * ============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.openecomp.sdc.be.datatypes.enums;
+
+import java.util.Optional;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum ActivityTypeEnum {
+ DELEGATE("delegate"),
+ INLINE("inline"),
+ CALL_OPERATION("call_operation"),
+ SET_STATE("set_state");
+
+ private final String value;
+
+ public static Optional<ActivityTypeEnum> getEnum(String name) {
+ for (ActivityTypeEnum activityType : values()) {
+ if (activityType.getValue().equals(name)) {
+ return Optional.of(activityType);
+ }
+ }
+ return Optional.empty();
+ }
+}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
index 638d23b0bb..c4d22a037f 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
@@ -257,6 +257,9 @@ public enum JsonPresentationFields {
OPERATION_IMPLEMENTATION("implementation", null),
OPERATION_INPUTS("inputs", null),
OPERATION_OUTPUTS("outputs", null),
+ OPERATION_MILESTONES("milestones", null),
+ OPERATION_ACTIVITIES("activities", null),
+ OPERATION_ACTIVITIES_WORKFLOW("workflow", null),
INPUTS("inputs", null),
GET_PROPERTY("get_property", null),
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MilestoneTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MilestoneTypeEnum.java
new file mode 100644
index 0000000000..1fa96b25d5
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MilestoneTypeEnum.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * ============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.openecomp.sdc.be.datatypes.enums;
+
+import java.util.Optional;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum MilestoneTypeEnum {
+ ON_ENTRY("on_entry"),
+ ON_SUCCESS("on_success"),
+ ON_FAILURE("on_failure"),
+ ON_TIMEOUT("on_timeout");
+
+ private final String value;
+
+ public static Optional<MilestoneTypeEnum> getEnum(String name) {
+ for (MilestoneTypeEnum milestoneType : values()) {
+ if (milestoneType.getValue().equals(name)) {
+ return Optional.of(milestoneType);
+ }
+ }
+ return Optional.empty();
+ }
+}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java
index a7e6975347..d4076aee5c 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java
@@ -77,6 +77,9 @@ public class TypeUtils {
DATA_TYPES("data_types"), NODE_TYPES("node_types"), POLICY_TYPES("policy_types"), IMPORTS("imports"),
//Operations
IMPLEMENTATION("implementation"),
+ MILESTONES("milestones"),
+ ACTIVITIES("activities"),
+ WORKFLOW("workflow"),
SUBSTITUTION_FILTERS("substitution_filter"),
DERIVED_FROM_NAME("derivedFromName"),
INTERFACE_TYPES("interface_types"),