Author: Grid.Qian
Date: 2008-12-19 02:57:47 -0500 (Fri, 19 Dec 2008)
New Revision: 12701
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/.project
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java
Log:
JBIDE-3364: BPMN -> jPDL wizard hangs on certain input
Modified: trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/.project
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/.project 2008-12-19 05:50:08 UTC (rev
12700)
+++ trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/.project 2008-12-19 07:57:47 UTC (rev
12701)
@@ -1,28 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.jboss.tools.jbpm.convert</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jbpm.convert</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.stp.bpmn.validation.BatchValidationBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.stp.bpmn.validation.BatchValidationBuildAbleNature</nature>
+ </natures>
+</projectDescription>
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties 2008-12-19
05:50:08 UTC (rev 12700)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2J.properties 2008-12-19
07:57:47 UTC (rev 12701)
@@ -24,6 +24,8 @@
Bpmn_FlowSource_Attribute_Name=source
Bpmn_FlowTarget_Attribute_Name=target
Bpmn_FlowDefault_Attribute_Name=isDefault
+Bpmn_FlowOutgoings_Attribute_Name=outgoingEdges
+Bpmn_FlowIncomings_Attribute_Name=incomingEdges
Bpmn_Element_ID=iD
Bpmn_Wizard_Title=BPMN to jPDL Conversion
Bpmn_File_Choose_WizardPage_Name=FileChoosePage
@@ -70,10 +72,10 @@
Gpd_Process_Diagram_Name=process-diagram
Gpd_Label_Element_Name=label
Translate_Error_GpdFile_CanNotGenerate=Errror: Couldn't write gpd.xml:
-Translate_Error_GpdFile_CanNotWrite=Errror: Couldn't write gpd definition to a
gpd.xml:
+Translate_Error_GpdFile_CanNotWrite=Errror\: Couldn't write gpd definition to a
gpd.xml\:
Translate_Error_JpdlProcess_Definition_Null=Errror: The JPDL process definition is null.
-Translate_Error_JpdlFile_CanNotGenerate=Errror: Couldn't write process definition
xml:
-Translate_Error_JpdlFile_CanNotWrite=Errror: Couldn't write process definition to a
jpdl file:
-Translate_Error_File_CanNotRead=Error: Couldn't read or parse {0} file to a DOM
document:
+Translate_Error_JpdlFile_CanNotGenerate=Errror\: Couldn't write process definition
xml\:
+Translate_Error_JpdlFile_CanNotWrite=Errror\: Couldn't write process definition to a
jpdl file\:
+Translate_Error_File_CanNotRead=Error\: Couldn't read or parse {0} file to a DOM
document\:
Translate_Warning_Bpmn_Element_Name=Warning: The bpmn element's name is null or same
to another element's name:
-Translate_Warning_Bpmn_Element_Type=Warning: The type of this bpmn element is not
translated to corresponding jpdl element:
\ No newline at end of file
+Translate_Warning_Bpmn_Element_Type=Warning\: The type of this bpmn element is not
translated to corresponding jpdl element\:
\ No newline at end of file
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java 2008-12-19
05:50:08 UTC (rev 12700)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/messages/B2JMessages.java 2008-12-19
07:57:47 UTC (rev 12701)
@@ -50,6 +50,8 @@
public static String Bpmn_FlowSource_Attribute_Name;
public static String Bpmn_FlowTarget_Attribute_Name;
public static String Bpmn_FlowDefault_Attribute_Name;
+ public static String Bpmn_FlowOutgoings_Attribute_Name;
+ public static String Bpmn_FlowIncomings_Attribute_Name;
public static String Bpmn_Wizard_Title;
public static String Bpmn_File_Choose_WizardPage_Name;
public static String Bpmn_File_Choose_WizardPage_Title;
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java 2008-12-19
05:50:08 UTC (rev 12700)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/BPMN2JPDL.java 2008-12-19
07:57:47 UTC (rev 12701)
@@ -28,13 +28,19 @@
/**
* @author Grid Qian
*
- * this is a translator for bpmn ->jpdl
+ * this is a translator for bpmn -> jpdl
*/
public class BPMN2JPDL extends BPMNTranslator {
private Document bpmnDocument;
private List<Document> processDefs = new ArrayList<Document>();
+
+ // map: bpmn element's(activity) id to jpdl element
private Map<String, Element> map = new HashMap<String, Element>();
+ // map: bpmn outgoingEdges element's(sequenceEdges) id to bpmn
element's(activity) id
+ private Map<String, String> sourceMap = new HashMap<String, String>();
+ // map: bpmn incomingEdges element's(sequenceEdges) id to bpmn
element's(activity) id
+ private Map<String, String> targetMap = new HashMap<String, String>();
public BPMN2JPDL() {
}
@@ -150,7 +156,8 @@
for (Object activity : graph.elements()) {
if (B2JMessages.Bpmn_Vertice_Element_Name
.equals(((Element) activity).getName())) {
- translateActivity(((Element) activity), processRoot);
+ translateActivity((Element) activity, processRoot);
+ getSequenceFlowInfo((Element)activity);
}
}
translateSequenceFlows(graph, processRoot);
@@ -160,6 +167,29 @@
}
/*
+ * get Incomingedges and Outgoingedges Map from the activity element
+ */
+ private void getSequenceFlowInfo(Element activity) {
+ String id = activity.attributeValue(B2JMessages.Dom_Element_ID);
+ String ins = activity.attributeValue(B2JMessages.Bpmn_FlowIncomings_Attribute_Name);
+ String outs = activity.attributeValue(B2JMessages.Bpmn_FlowOutgoings_Attribute_Name);
+ String[] inArray = null;
+ String[] outArray = null;
+ if(ins != null){
+ inArray = ins.split(" ");
+ for(String in : inArray){
+ targetMap.put(in, id);
+ }
+ }
+ if(outs != null){
+ outArray = outs.split(" ");
+ for(String out : outArray){
+ sourceMap.put(out, id);
+ }
+ }
+ }
+
+ /*
* Translate a bpmn activity to a jpdl node according to activity type
*/
private void translateActivity(Element activity, Element processRoot) {
@@ -380,8 +410,7 @@
*/
private void translateSequenceFlow(Element edge, Element processRoot) {
- Element source = map.get(edge
- .attributeValue(B2JMessages.Bpmn_FlowSource_Attribute_Name));
+ Element source =
map.get(sourceMap.get(edge.attributeValue(B2JMessages.Dom_Element_ID)));
Element transition = null;
if ("true".equals(edge
@@ -399,7 +428,7 @@
warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
+ edge.attributeValue(B2JMessages.Bpmn_Element_ID));
}
- transition.addAttribute(B2JMessages.To,map.get(edge.attributeValue(B2JMessages.Bpmn_FlowTarget_Attribute_Name)).attributeValue(B2JMessages.Dom_Element_Name));
+ transition.addAttribute(B2JMessages.To,map.get(targetMap.get(edge.attributeValue(B2JMessages.Dom_Element_ID))).attributeValue(B2JMessages.Dom_Element_Name));
}
/*
Show replies by date