aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/clamp/loop/template/LoopTemplate.java')
-rw-r--r--src/main/java/org/onap/clamp/loop/template/LoopTemplate.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java b/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java
index 7c059e19..b8adebae 100644
--- a/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java
+++ b/src/main/java/org/onap/clamp/loop/template/LoopTemplate.java
@@ -26,6 +26,7 @@ package org.onap.clamp.loop.template;
import com.google.gson.annotations.Expose;
import java.io.Serializable;
+import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -57,6 +58,10 @@ public class LoopTemplate extends AuditEntity implements Serializable {
@Column(nullable = false, name = "name", unique = true)
private String name;
+ @Expose
+ @Column(name = "dcae_blueprint_id")
+ private String dcaeBlueprintId;
+
/**
* This field is used when we have a blueprint defining all microservices. The
* other option would be to have independent blueprint for each microservices.
@@ -111,6 +116,24 @@ public class LoopTemplate extends AuditEntity implements Serializable {
}
/**
+ * dcaeBlueprintId getter.
+ *
+ * @return the dcaeBlueprintId
+ */
+ public String getDcaeBlueprintId() {
+ return dcaeBlueprintId;
+ }
+
+ /**
+ * dcaeBlueprintId setter.
+ *
+ * @param dcaeBlueprintId the dcaeBlueprintId to set
+ */
+ public void setDcaeBlueprintId(String dcaeBlueprintId) {
+ this.dcaeBlueprintId = dcaeBlueprintId;
+ }
+
+ /**
* blueprint setter.
*
* @param blueprint the blueprint to set
@@ -165,6 +188,18 @@ public class LoopTemplate extends AuditEntity implements Serializable {
}
/**
+ * Add list of loopElements to the current template, each loopElementModel is
+ * added at the end of the list so the flowOrder is computed automatically.
+ *
+ * @param loopElementModels The loopElementModel set to add
+ */
+ public void addLoopElementModels(Set<LoopElementModel> loopElementModels) {
+ for (LoopElementModel loopElementModel : loopElementModels) {
+ addLoopElementModel(loopElementModel);
+ }
+ }
+
+ /**
* Add a loopElement to the current template, the loopElementModel is added at
* the end of the list so the flowOrder is computed automatically.
*
@@ -266,4 +301,21 @@ public class LoopTemplate extends AuditEntity implements Serializable {
}
return true;
}
+
+ /**
+ * Generate the loop template name.
+ *
+ * @param serviceName The service name
+ * @param serviceVersion The service version
+ * @param resourceName The resource name
+ * @param blueprintFileName The blueprint file name
+ * @return The generated loop template name
+ */
+ public static String generateLoopTemplateName(String serviceName, String serviceVersion, String resourceName,
+ String blueprintFilename) {
+ StringBuilder buffer = new StringBuilder("LOOP_TEMPLATE_").append(serviceName).append("_v")
+ .append(serviceVersion).append("_").append(resourceName).append("_")
+ .append(blueprintFilename.replaceAll(".yaml", ""));
+ return buffer.toString().replace('.', '_').replaceAll(" ", "");
+ }
}