[jboss-cvs] jboss-seam/src/main/org/jboss/seam/pageflow ...
Gavin King
gavin.king at jboss.com
Tue Jun 19 00:21:46 EDT 2007
User: gavin
Date: 07/06/19 00:21:46
Modified: src/main/org/jboss/seam/pageflow PageflowHelper.java
PageflowParser.java
Log:
JBSEAM-157, pageflow composition, finally
Revision Changes Path
1.3 +51 -35 jboss-seam/src/main/org/jboss/seam/pageflow/PageflowHelper.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PageflowHelper.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/pageflow/PageflowHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- PageflowHelper.java 16 Dec 2006 02:58:12 -0000 1.2
+++ PageflowHelper.java 19 Jun 2007 04:21:46 -0000 1.3
@@ -12,53 +12,69 @@
import org.jbpm.util.ClassLoaderUtil;
import org.xml.sax.InputSource;
-public abstract class PageflowHelper {
+public abstract class PageflowHelper
+{
static JbpmConfiguration pageflowConfiguration = JbpmConfiguration.parseResource("org/jboss/seam/pageflow/jbpm.pageflow.cfg.xml");
+ private static LogProvider log = Logging.getLogProvider(PageflowHelper.class);
- public static JbpmContext createPageflowContext() {
+ public static JbpmContext createPageflowContext()
+ {
return pageflowConfiguration.createJbpmContext();
}
- public static ProcessDefinition parseXmlString(String xml) {
+ public static ProcessDefinition parseXmlString(String xml)
+ {
StringReader stringReader = new StringReader(xml);
return parseInputSource(new InputSource(stringReader));
}
- public static ProcessDefinition parseXmlResource(String xmlResource) {
+ public static ProcessDefinition parseXmlResource(String xmlResource)
+ {
InputStream resourceStream = ClassLoaderUtil.getStream(xmlResource);
return parseInputSource(new InputSource(resourceStream));
}
- public static ProcessDefinition parseInputSource(InputSource inputSource) {
+ public static ProcessDefinition parseInputSource(InputSource inputSource)
+ {
JbpmContext jbpmContext = createPageflowContext();
- try {
+ try
+ {
PageflowParser pageflowParser = new PageflowParser(inputSource);
return pageflowParser.readProcessDefinition();
- } finally {
+ }
+ finally
+ {
jbpmContext.close();
}
}
- public static void signal(ProcessInstance processInstance, String outcome) {
+ public static void signal(ProcessInstance processInstance, String outcome)
+ {
JbpmContext jbpmContext = createPageflowContext();
- try {
+ try
+ {
log.debug("performing pageflow nagivation for outcome "+outcome);
processInstance.signal(outcome);
- } finally {
+ }
+ finally
+ {
jbpmContext.close();
}
}
- public static ProcessInstance newPageflowInstance(ProcessDefinition processDefinition) {
+ public static ProcessInstance newPageflowInstance(ProcessDefinition processDefinition)
+ {
JbpmContext jbpmContext = createPageflowContext();
- try {
+ try
+ {
log.debug("new pageflow instance for "+processDefinition.getName());
return processDefinition.createProcessInstance();
- } finally {
+ }
+ finally
+ {
jbpmContext.close();
}
}
- private static LogProvider log = Logging.getLogProvider(PageflowHelper.class);
}
1.3 +33 -22 jboss-seam/src/main/org/jboss/seam/pageflow/PageflowParser.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PageflowParser.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/pageflow/PageflowParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- PageflowParser.java 25 Oct 2006 15:14:36 -0000 1.2
+++ PageflowParser.java 19 Jun 2007 04:21:46 -0000 1.3
@@ -9,40 +9,51 @@
import org.jbpm.jpdl.xml.ProblemListener;
import org.xml.sax.InputSource;
-public class PageflowParser extends JpdlXmlReader {
+public class PageflowParser extends JpdlXmlReader
+{
private static final long serialVersionUID = 1L;
- public PageflowParser(InputSource inputSource, ProblemListener problemListener) {
+ public PageflowParser(InputSource inputSource, ProblemListener problemListener)
+ {
super(inputSource, problemListener);
}
- public PageflowParser(InputSource inputSource) {
+ public PageflowParser(InputSource inputSource)
+ {
super(inputSource);
}
- public PageflowParser(Reader reader) {
+ public PageflowParser(Reader reader)
+ {
super(reader);
}
@Override
- public void readNodes(Element nodeCollectionElement, NodeCollection nodeCollection) {
+ public void readNodes(Element nodeCollectionElement, NodeCollection nodeCollection)
+ {
super.readNodes(nodeCollectionElement, nodeCollection);
- if ("pageflow-definition".equals(nodeCollectionElement.getName())) {
+ if ( "pageflow-definition".equals( nodeCollectionElement.getName() ) )
+ {
String startPageName = nodeCollectionElement.attributeValue("start-page");
- if (startPageName==null) {
+ if (startPageName==null)
+ {
Element startPageElement = nodeCollectionElement.element("start-page");
- if (startPageElement!=null) {
+ if (startPageElement!=null)
+ {
startPageName = startPageElement.attributeValue("name");
}
}
- if (startPageName!=null) {
+ if (startPageName!=null)
+ {
Node startPage = getProcessDefinition().getNode(startPageName);
- if (startPage!=null) {
+ if (startPage!=null)
+ {
getProcessDefinition().setStartState(startPage);
}
}
}
}
+
}
More information about the jboss-cvs-commits
mailing list