org.jbpm.jpdl.internal.convert
Class Jpdl3Converter

java.lang.Object
  extended by org.jbpm.jpdl.internal.convert.Jpdl3Converter
All Implemented Interfaces:
java.io.Serializable, ProblemListener

public class Jpdl3Converter
extends java.lang.Object
implements ProblemListener

Trimmed down version JpdlXmlReader (jBPM3 code base), to have exactly the same parsing as in jBPM3. Note that the foremost requirement for this class is readability and extensibility. People who want to adapt the conversion logic for their own processes are advised to adapt this class.

Author:
Jim Ma, jbarrez
See Also:
Serialized Form

Field Summary
protected  org.xml.sax.InputSource inputSource
           
protected  org.dom4j.Document jpdl3Document
           
protected  org.dom4j.Document jpdl4Document
           
protected  java.util.Map<java.lang.String,org.dom4j.Element> nodeCollection
           
protected  ProblemListener problemListener
           
protected  java.util.List<Problem> problems
           
protected  java.util.Map<java.lang.String,org.dom4j.Element> swimlanesCollection
           
protected  java.util.Collection<java.lang.Object[]> unresolvedActionReferences
           
protected  java.util.Collection<java.lang.Object[]> unresolvedTransitionDestinations
           
 
Constructor Summary
Jpdl3Converter(org.xml.sax.InputSource inputSource)
          Constructor using an InputSource pointing to a jpdl3 process file.
Jpdl3Converter(java.io.Reader reader)
          Constructor using a Reader pointing to a jpdl3 process file.
Jpdl3Converter(java.net.URL url)
          Constructor using an URL pointing to a jpdl3 process file.
 
Method Summary
 void addError(java.lang.String description)
           
 void addError(java.lang.String description, java.lang.Throwable exception)
           
 void addProblem(Problem problem)
           
 void addUnresolvedActionReference(org.dom4j.Element actionElemen)
           
 void addUnresolvedTransitionDestination(org.dom4j.Element nodeElement, org.dom4j.Element jpdl4Element)
           
 void addWarning(java.lang.String description)
           
 void close()
           
 void convertActions(org.dom4j.Element jpdl3Element, org.dom4j.Element jpdl4Element, java.lang.String eventType)
           
protected  void convertAssignmentDelegation(org.dom4j.Element jpdl3AssignmentElement, org.dom4j.Element jpdl4Task)
           
 void convertEvents(org.dom4j.Element jpdl3Element, org.dom4j.Element jpdl4Element)
           
protected  void convertExceptionHandlers(org.dom4j.Element jpdl3Element, org.dom4j.Element jpdl4Element)
           
 void convertNode(org.dom4j.Element jpdl3Element, org.dom4j.Element jpdl4Element)
           
 void convertNodes(org.dom4j.Element jpdl3Element, org.dom4j.Element jpdl4Element)
           
protected  void convertNodeTimer(org.dom4j.Element timerElement, org.dom4j.Element jpdl4Element)
           
protected  void convertNodeTimers(org.dom4j.Element nodeElement, org.dom4j.Element jpdl4Element)
           
 org.dom4j.Element convertSingleAction(org.dom4j.Element jpdl3NodeElement, org.dom4j.Element jpdl4Element)
           
protected  void convertSwimlanes(org.dom4j.Element jpdl3Element, org.dom4j.Element jpdl4Element)
           
 org.dom4j.Element convertTask(org.dom4j.Element taskElement, org.dom4j.Element jpdlElement)
           
 void convertTasks(org.dom4j.Element jpdl3Element, org.dom4j.Element jpdl4Element)
           
protected  void convertTaskTimer(org.dom4j.Element timerElement, org.dom4j.Element jpdl4Element)
           
protected  void convertTaskTimers(org.dom4j.Element taskElement, org.dom4j.Element jdpl4Element)
           
 java.util.List<VariableAccess> convertVariableAccesses(org.dom4j.Element element)
           
 org.dom4j.Element createAction(org.dom4j.Element actionElement, org.dom4j.Element jpdl4Element)
           
 void createMailDelegation(java.lang.String template, java.lang.String actors, java.lang.String to, java.lang.String subject, java.lang.String text)
           
 org.dom4j.Document getJpdl4Document()
           
 java.lang.String getProperty(java.lang.String property, org.dom4j.Element element)
           
protected  org.dom4j.Element parseProcessDefinitionAttributes(org.dom4j.Element root)
           
 org.dom4j.Document readAndConvert()
          Call this method to convert the jpdl3 process.
 void resolveActionReferences()
           
 void resolveTransitionDestination(org.dom4j.Element transitionElement, org.dom4j.Element jpdl4Element)
           
 void resolveTransitionDestinations()
           
 void resolveTransitionDestinations(java.util.List<?> transitionElements, org.dom4j.Element jpdl4Element)
           
 void verifySwimlaneAssignments()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputSource

protected org.xml.sax.InputSource inputSource

jpdl3Document

protected org.dom4j.Document jpdl3Document

problems

protected java.util.List<Problem> problems

problemListener

protected ProblemListener problemListener

jpdl4Document

protected org.dom4j.Document jpdl4Document

unresolvedTransitionDestinations

protected java.util.Collection<java.lang.Object[]> unresolvedTransitionDestinations

unresolvedActionReferences

protected java.util.Collection<java.lang.Object[]> unresolvedActionReferences

nodeCollection

protected java.util.Map<java.lang.String,org.dom4j.Element> nodeCollection

swimlanesCollection

protected java.util.Map<java.lang.String,org.dom4j.Element> swimlanesCollection
Constructor Detail

Jpdl3Converter

public Jpdl3Converter(java.net.URL url)
Constructor using an URL pointing to a jpdl3 process file.


Jpdl3Converter

public Jpdl3Converter(org.xml.sax.InputSource inputSource)
Constructor using an InputSource pointing to a jpdl3 process file.


Jpdl3Converter

public Jpdl3Converter(java.io.Reader reader)
Constructor using a Reader pointing to a jpdl3 process file.

Method Detail

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

addProblem

public void addProblem(Problem problem)
Specified by:
addProblem in interface ProblemListener

addError

public void addError(java.lang.String description)

addError

public void addError(java.lang.String description,
                     java.lang.Throwable exception)

addWarning

public void addWarning(java.lang.String description)

readAndConvert

public org.dom4j.Document readAndConvert()
Call this method to convert the jpdl3 process. The return value will be a converted jpdl4 XML model.


parseProcessDefinitionAttributes

protected org.dom4j.Element parseProcessDefinitionAttributes(org.dom4j.Element root)

convertSwimlanes

protected void convertSwimlanes(org.dom4j.Element jpdl3Element,
                                org.dom4j.Element jpdl4Element)

convertActions

public void convertActions(org.dom4j.Element jpdl3Element,
                           org.dom4j.Element jpdl4Element,
                           java.lang.String eventType)

convertNodes

public void convertNodes(org.dom4j.Element jpdl3Element,
                         org.dom4j.Element jpdl4Element)

convertEvents

public void convertEvents(org.dom4j.Element jpdl3Element,
                          org.dom4j.Element jpdl4Element)

convertTasks

public void convertTasks(org.dom4j.Element jpdl3Element,
                         org.dom4j.Element jpdl4Element)

convertTask

public org.dom4j.Element convertTask(org.dom4j.Element taskElement,
                                     org.dom4j.Element jpdlElement)

convertAssignmentDelegation

protected void convertAssignmentDelegation(org.dom4j.Element jpdl3AssignmentElement,
                                           org.dom4j.Element jpdl4Task)

convertVariableAccesses

public java.util.List<VariableAccess> convertVariableAccesses(org.dom4j.Element element)

convertNode

public void convertNode(org.dom4j.Element jpdl3Element,
                        org.dom4j.Element jpdl4Element)

convertNodeTimers

protected void convertNodeTimers(org.dom4j.Element nodeElement,
                                 org.dom4j.Element jpdl4Element)

convertNodeTimer

protected void convertNodeTimer(org.dom4j.Element timerElement,
                                org.dom4j.Element jpdl4Element)

convertTaskTimers

protected void convertTaskTimers(org.dom4j.Element taskElement,
                                 org.dom4j.Element jdpl4Element)

convertTaskTimer

protected void convertTaskTimer(org.dom4j.Element timerElement,
                                org.dom4j.Element jpdl4Element)

convertSingleAction

public org.dom4j.Element convertSingleAction(org.dom4j.Element jpdl3NodeElement,
                                             org.dom4j.Element jpdl4Element)

createAction

public org.dom4j.Element createAction(org.dom4j.Element actionElement,
                                      org.dom4j.Element jpdl4Element)

convertExceptionHandlers

protected void convertExceptionHandlers(org.dom4j.Element jpdl3Element,
                                        org.dom4j.Element jpdl4Element)

addUnresolvedTransitionDestination

public void addUnresolvedTransitionDestination(org.dom4j.Element nodeElement,
                                               org.dom4j.Element jpdl4Element)

resolveTransitionDestinations

public void resolveTransitionDestinations()

resolveTransitionDestinations

public void resolveTransitionDestinations(java.util.List<?> transitionElements,
                                          org.dom4j.Element jpdl4Element)

resolveTransitionDestination

public void resolveTransitionDestination(org.dom4j.Element transitionElement,
                                         org.dom4j.Element jpdl4Element)

addUnresolvedActionReference

public void addUnresolvedActionReference(org.dom4j.Element actionElemen)

resolveActionReferences

public void resolveActionReferences()

verifySwimlaneAssignments

public void verifySwimlaneAssignments()

createMailDelegation

public void createMailDelegation(java.lang.String template,
                                 java.lang.String actors,
                                 java.lang.String to,
                                 java.lang.String subject,
                                 java.lang.String text)

getProperty

public java.lang.String getProperty(java.lang.String property,
                                    org.dom4j.Element element)

getJpdl4Document

public org.dom4j.Document getJpdl4Document()


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.