Update get Dcae Status flow
[clamp.git] / src / main / java / org / onap / clamp / loop / template / LoopTemplate.java
index b8adeba..3e90c1e 100644 (file)
@@ -70,7 +70,6 @@ public class LoopTemplate extends AuditEntity implements Serializable {
     @Column(columnDefinition = "MEDIUMTEXT", name = "blueprint_yaml")
     private String blueprint;
 
-    @Expose
     @Column(columnDefinition = "MEDIUMTEXT", name = "svg_representation")
     private String svgRepresentation;
 
@@ -88,6 +87,10 @@ public class LoopTemplate extends AuditEntity implements Serializable {
     @Column(name = "maximum_instances_allowed")
     private Integer maximumInstancesAllowed;
 
+    @Expose
+    @Column(name = "unique_blueprint", columnDefinition = "boolean default false")
+    private boolean uniqueBlueprint;
+
     /**
      * name getter.
      * 
@@ -140,6 +143,11 @@ public class LoopTemplate extends AuditEntity implements Serializable {
      */
     public void setBlueprint(String blueprint) {
         this.blueprint = blueprint;
+        if (blueprint == null) {
+            this.uniqueBlueprint = false;
+        } else {
+            this.uniqueBlueprint = true;
+        }
     }
 
     /**
@@ -244,6 +252,15 @@ public class LoopTemplate extends AuditEntity implements Serializable {
         this.modelService = modelService;
     }
 
+    /**
+     * uniqueBlueprint getter.
+     * 
+     * @return the uniqueBlueprint
+     */
+    public boolean getUniqueBlueprint() {
+        return uniqueBlueprint;
+    }
+
     /**
      * Default constructor for serialization.
      */
@@ -265,7 +282,7 @@ public class LoopTemplate extends AuditEntity implements Serializable {
     public LoopTemplate(String name, String blueprint, String svgRepresentation, Integer maxInstancesAllowed,
             Service service) {
         this.name = name;
-        this.blueprint = blueprint;
+        this.setBlueprint(blueprint);
         this.svgRepresentation = svgRepresentation;
 
         this.maximumInstancesAllowed = maxInstancesAllowed;
@@ -312,10 +329,10 @@ public class LoopTemplate extends AuditEntity implements Serializable {
      * @return The generated loop template name
      */
     public static String generateLoopTemplateName(String serviceName, String serviceVersion, String resourceName,
-            String blueprintFilename) {
+            String blueprintFileName) {
         StringBuilder buffer = new StringBuilder("LOOP_TEMPLATE_").append(serviceName).append("_v")
                 .append(serviceVersion).append("_").append(resourceName).append("_")
-                .append(blueprintFilename.replaceAll(".yaml", ""));
+                .append(blueprintFileName.replaceAll(".yaml", ""));
         return buffer.toString().replace('.', '_').replaceAll(" ", "");
     }
 }