Create SVG in UI
[clamp.git] / src / main / java / org / onap / clamp / loop / template / LoopTemplate.java
index 54096cb..6f896f3 100644 (file)
@@ -68,22 +68,19 @@ public class LoopTemplate extends AuditEntity implements Serializable {
     @Column(columnDefinition = "MEDIUMTEXT", name = "blueprint_yaml")
     private String blueprint;
 
-    @Column(columnDefinition = "MEDIUMTEXT", name = "svg_representation")
-    private String svgRepresentation;
-
     @Expose
     @OneToMany(
-        cascade = CascadeType.ALL,
-        fetch = FetchType.EAGER,
-        mappedBy = "loopTemplate",
-        orphanRemoval = true)
+            cascade = CascadeType.ALL,
+            fetch = FetchType.EAGER,
+            mappedBy = "loopTemplate",
+            orphanRemoval = true)
     @SortNatural
     private SortedSet<LoopTemplateLoopElementModel> loopElementModelsUsed = new TreeSet<>();
 
     @Expose
     @ManyToOne(
-        fetch = FetchType.EAGER,
-        cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH})
+            fetch = FetchType.EAGER,
+            cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH})
     @JoinColumn(name = "service_uuid")
     private Service modelService;
 
@@ -162,24 +159,6 @@ public class LoopTemplate extends AuditEntity implements Serializable {
         }
     }
 
-    /**
-     * svgRepresentation getter.
-     *
-     * @return the svgRepresentation
-     */
-    public String getSvgRepresentation() {
-        return svgRepresentation;
-    }
-
-    /**
-     * svgRepresentation setter.
-     *
-     * @param svgRepresentation the svgRepresentation to set
-     */
-    public void setSvgRepresentation(String svgRepresentation) {
-        this.svgRepresentation = svgRepresentation;
-    }
-
     /**
      * loopElementModelsUsed getter.
      *
@@ -244,10 +223,7 @@ public class LoopTemplate extends AuditEntity implements Serializable {
      * @param loopElementModel The loopElementModel to add
      */
     public void addLoopElementModel(LoopElementModel loopElementModel) {
-        LoopTemplateLoopElementModel jointEntry = new LoopTemplateLoopElementModel(this,
-            loopElementModel, this.loopElementModelsUsed.size());
-        this.loopElementModelsUsed.add(jointEntry);
-        loopElementModel.getUsedByLoopTemplates().add(jointEntry);
+        this.addLoopElementModel(loopElementModel,this.loopElementModelsUsed.size());
     }
 
     /**
@@ -255,11 +231,11 @@ public class LoopTemplate extends AuditEntity implements Serializable {
      * specified manually.
      *
      * @param loopElementModel The loopElementModel to add
-     * @param listPosition The position in the flow
+     * @param listPosition     The position in the flow
      */
     public void addLoopElementModel(LoopElementModel loopElementModel, Integer listPosition) {
         LoopTemplateLoopElementModel jointEntry =
-            new LoopTemplateLoopElementModel(this, loopElementModel, listPosition);
+                new LoopTemplateLoopElementModel(this, loopElementModel, listPosition);
         this.loopElementModelsUsed.add(jointEntry);
         loopElementModel.getUsedByLoopTemplates().add(jointEntry);
     }
@@ -301,19 +277,16 @@ public class LoopTemplate extends AuditEntity implements Serializable {
     /**
      * Constructor.
      *
-     * @param name The loop template name id
-     * @param blueprint The blueprint containing all microservices (legacy
-     *        case)
-     * @param svgRepresentation The svg representation of that loop template
+     * @param name                The loop template name id
+     * @param blueprint           The blueprint containing all microservices (legacy
+     *                            case)
      * @param maxInstancesAllowed The maximum number of instances that can be
-     *        created from that template
-     * @param service The service associated to that loop template
+     *                            created from that template
+     * @param service             The service associated to that loop template
      */
-    public LoopTemplate(String name, String blueprint, String svgRepresentation,
-        Integer maxInstancesAllowed, Service service) {
+    public LoopTemplate(String name, String blueprint, Integer maxInstancesAllowed, Service service) {
         this.name = name;
         this.setBlueprint(blueprint);
-        this.svgRepresentation = svgRepresentation;
 
         this.maximumInstancesAllowed = maxInstancesAllowed;
         this.modelService = service;
@@ -352,17 +325,17 @@ public class LoopTemplate extends AuditEntity implements Serializable {
     /**
      * Generate the loop template name.
      *
-     * @param serviceName The service name
-     * @param serviceVersion The service version
-     * @param resourceName The resource 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) {
+                                                  String resourceName, String blueprintFileName) {
         StringBuilder buffer = new StringBuilder("LOOP_TEMPLATE_").append(serviceName).append("_v")
-            .append(serviceVersion).append("_").append(resourceName).append("_")
-            .append(blueprintFileName.replaceAll(".yaml", ""));
+                .append(serviceVersion).append("_").append(resourceName).append("_")
+                .append(blueprintFileName.replaceAll(".yaml", ""));
         return buffer.toString().replace('.', '_').replaceAll(" ", "");
     }
 }