diff options
author | 2017-12-14 14:43:59 +0800 | |
---|---|---|
committer | 2017-12-14 14:43:59 +0800 | |
commit | c4e228b35d31f095f82eef54e8391762d59a3d3d (patch) | |
tree | 8d7a781b6f3871192e5f2422721da9218eeabf2c /sdc-workflow-designer-server/src | |
parent | 6730f94e26a84c78c3225d05f66b5347c19c613f (diff) |
code format
code format for workflow converter
Issue-ID: SDC-753
Change-Id: If1a128265c263761d0fa5030c0a96a74912a3a6a
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server/src')
10 files changed, 45 insertions, 28 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java index efa36c3f..0b4f2edb 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java @@ -11,7 +11,6 @@ */
package org.onap.sdc.workflowdesigner.converter;
-import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -49,12 +48,9 @@ public class Bpmn4Tosca2Bpmn { String workflowString = writer.completePlanTemplate();
// write bpmn to file
- writeStringToFile(workflowString, Paths.get(targetBpmnArchive));
+ Path targetPath = Paths.get(targetBpmnArchive);
+ Files.write(targetPath, workflowString.getBytes(), StandardOpenOption.CREATE);
log.info("transform end");
}
- public static Path writeStringToFile(String content, Path targetPath) throws IOException {
- return Files.write(targetPath, content.getBytes(), StandardOpenOption.CREATE);
- }
-
}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Element.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Element.java index ea22dfb4..6420a160 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Element.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/Element.java @@ -14,9 +14,13 @@ package org.onap.sdc.workflowdesigner.model; import java.util.List;
public class Element {
+ public enum TYPE {
+ startEvent, endEvent, errorStartEvent, errorEndEvent, serviceTask, scriptTask, exclusiveGateway, parallelGateway, restTask, intermediateCatchEvent
+ };
+
private String id;
private String name;
- private String type;
+ private TYPE type;
private String documentation;
private Position position;
private List<String> connections;
@@ -61,11 +65,11 @@ public class Element { this.documentation = documentation;
}
- public String getType() {
+ public TYPE getType() {
return type;
}
- public void setType(String type) {
+ public void setType(TYPE type) {
this.type = type;
}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java index 82e48d26..52818e74 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/EndEvent.java @@ -12,4 +12,5 @@ package org.onap.sdc.workflowdesigner.model;
public class EndEvent extends Element {
+ public static String type = "endEvent";
}
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorEndEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorEndEvent.java index 4ab9fd3a..0fda8c27 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorEndEvent.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorEndEvent.java @@ -14,15 +14,15 @@ package org.onap.sdc.workflowdesigner.model; import com.fasterxml.jackson.annotation.JsonProperty; public class ErrorEndEvent extends Element { - @JsonProperty("parameter") - private Parameter parameter; + @JsonProperty("parameter") + private Parameter parameter; - public Parameter getParameter() { - return parameter; - } + public Parameter getParameter() { + return parameter; + } - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } + public void setParameter(Parameter parameter) { + this.parameter = parameter; + } } diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorStartEvent.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorStartEvent.java index 8e4fcd44..b4cf96c0 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorStartEvent.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/model/ErrorStartEvent.java @@ -14,15 +14,15 @@ package org.onap.sdc.workflowdesigner.model; import com.fasterxml.jackson.annotation.JsonProperty; public class ErrorStartEvent extends Element { - @JsonProperty("parameter") - private Parameter parameter; + @JsonProperty("parameter") + private Parameter parameter; - public Parameter getParameter() { - return parameter; - } + public Parameter getParameter() { + return parameter; + } - public void setParameter(Parameter parameter) { - this.parameter = parameter; - } + public void setParameter(Parameter parameter) { + this.parameter = parameter; + } } diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/JsonKeys.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/JsonKeys.java index 8c7c62f3..2237d8dd 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/JsonKeys.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/parser/JsonKeys.java @@ -11,7 +11,7 @@ */
package org.onap.sdc.workflowdesigner.parser;
-public class JsonKeys {
+public interface JsonKeys {
// workflow keys
public static final String NODES = "nodes";
public static final String CONFIGS = "configs";
diff --git a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_endEvent_template.xml b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_endEvent_template.xml index 3735709c..223542c4 100644 --- a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_endEvent_template.xml +++ b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_endEvent_template.xml @@ -1,2 +1,3 @@ +
<endEvent id="${element.id}" name="${element.name}">
</endEvent>
diff --git a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_intermediateCatchEvent_template.xml b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_intermediateCatchEvent_template.xml index ee2365ec..cb952098 100644 --- a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_intermediateCatchEvent_template.xml +++ b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_intermediateCatchEvent_template.xml @@ -1,6 +1,14 @@ <intermediateCatchEvent id="${element.id}" name="${element.name}">
<timerEventDefinition>
- <timeDuration><![CDATA[${element.timerEventDefinition.timeDuration}]]></timeDuration>
- </timerEventDefinition>
+ #if (${element.timerEventDefinition.timeDuration})
+ <timeDuration><![CDATA[${element.timerEventDefinition.timeDuration}]]></timeDuration>
+ #end
+ #if (${element.timerEventDefinition.timeDate})
+ <timeDate><![CDATA[${element.timerEventDefinition.timeDate}]]></timeDate>
+ #end
+ #if (${element.timerEventDefinition.timeCycle})
+ <timeCycle><![CDATA[${element.timerEventDefinition.timeCycle}]]></timeCycle>
+ #end
+ </timerEventDefinition>
</intermediateCatchEvent>
diff --git a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_startEvent_template.xml b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_startEvent_template.xml index 38489b0e..18053155 100644 --- a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_startEvent_template.xml +++ b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_element_startEvent_template.xml @@ -1,3 +1,4 @@ +
<startEvent id="${element.id}" name="${element.name}">
<extensionElements>
#foreach( $param in ${element.parameters} )
diff --git a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_template.xml b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_template.xml index 3cb11250..66a5f1a7 100644 --- a/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_template.xml +++ b/sdc-workflow-designer-server/src/main/resources/bpmn-templates/bpmn_template.xml @@ -20,6 +20,12 @@ )
#end
+ <!-- Perform bpmn sequence flow -->
+ #foreach( $sequenceFlow in $process.sequenceFlowList)
+ #parse(
+ "${templatePath}bpmn_sequenceFlow_template.xml"
+ )
+ #end
</process>
</definitions>
|