JBoss JBPM SVN: r4504 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-08 16:27:20 -0400 (Wed, 08 Apr 2009)
New Revision: 4504
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java
Log:
Added comments.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java 2009-04-08 20:20:16 UTC (rev 4503)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java 2009-04-08 20:27:20 UTC (rev 4504)
@@ -52,19 +52,26 @@
email.setTextMsg(this.body);
email.setSubject(this.subject);
-
+ //Keep track of the CIDs that have replaced SRCs to reduce
+ //calls to replace. Should improve efficiency.
Set<String> cidSet = new HashSet<String>();
+ //Create a matcher based on our regex.
Matcher imgMatcher = imgSrcPattern.matcher(html);
+
+ //While there are matches, loop through them.
while(imgMatcher.find())
{
+ //Embed the SRC image, and get a reference to the embedded CID.
String replace = embedImage(email,imgMatcher.group(2));
if(replace==null)
{
log.warn("The image source is not provided. Skipping: "+imgMatcher.group());
continue;
}
+ //If this CID has not replaced a URL in the past, replace it now.
if(cidSet.add(replace))
{
+ //Replace the original SRC URL with the CID SRC URL.
this.html=this.html.replace(imgMatcher.group(2), replace);
}
else
@@ -73,7 +80,6 @@
{
log.debug("Skipped replace as the image has been handled before: "+imgMatcher.group(2));
}
-
}
}
@@ -113,6 +119,8 @@
{
return imageSrc;
}
+
+ //If the image hasn't been embedded yet, embed it.
String src = imageSrc;
String hashName = Integer.toString(src.hashCode());
String cid = null;
@@ -124,6 +132,7 @@
log.error("Error fetching image.",e);
return imageSrc;
}
+ //Return the embedded name to replace the src.
return "cid:"+cid;
}
17 years
JBoss JBPM SVN: r4503 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-08 16:20:16 -0400 (Wed, 08 Apr 2009)
New Revision: 4503
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java
Log:
Improved the regex and replace methods.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java 2009-04-08 18:52:42 UTC (rev 4502)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java 2009-04-08 20:20:16 UTC (rev 4503)
@@ -3,6 +3,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -25,7 +26,7 @@
*/
public class HtmlScriptMailProducer extends ScriptMailProducer {
- private static final Pattern imgSrcPattern = Pattern.compile("<img [.]*src=['\"]\\S+['\"]");
+ private static final Pattern imgSrcPattern = Pattern.compile("<img[^>]*(src=['\"](\\S+)['\"])[^>]*",Pattern.CASE_INSENSITIVE);
private static final Log log = LogFactory.getLog(HtmlScriptMailProducer.class);
protected String html;
@@ -51,27 +52,39 @@
email.setTextMsg(this.body);
email.setSubject(this.subject);
- //Run through the HTML, download images, and embed images within HTML message.
+
+ Set<String> cidSet = new HashSet<String>();
Matcher imgMatcher = imgSrcPattern.matcher(html);
- StringBuffer htmlBuffer = new StringBuffer();
while(imgMatcher.find())
{
- String replace = embedImage(email,imgMatcher.group());
- if(log.isDebugEnabled())
+ String replace = embedImage(email,imgMatcher.group(2));
+ if(replace==null)
{
- log.debug("Group: "+imgMatcher.group());
- log.debug("Replacement: "+replace);
+ log.warn("The image source is not provided. Skipping: "+imgMatcher.group());
+ continue;
}
- imgMatcher.appendReplacement(htmlBuffer, replace);
+ if(cidSet.add(replace))
+ {
+ this.html=this.html.replace(imgMatcher.group(2), replace);
+ }
+ else
+ {
+ if(log.isDebugEnabled())
+ {
+ log.debug("Skipped replace as the image has been handled before: "+imgMatcher.group(2));
+ }
+
+ }
+
}
- imgMatcher.appendTail(htmlBuffer);
+
if(log.isDebugEnabled())
{
- log.debug("Embedded HTML: "+htmlBuffer.toString());
+ log.debug("Embedded HTML: "+this.html);
}
try {
//Set the embedded HTML to the Email Message.
- email.setHtmlMsg(htmlBuffer.toString());
+ email.setHtmlMsg(this.html);
}
catch(Exception e)
{
@@ -89,16 +102,18 @@
}
- protected String embedImage(HtmlEmail email, String imageTag)
+
+ public String embedImage(HtmlEmail email, String imageSrc)
{
- String special = null;
- special = imageTag.contains("'") ? "'" : "\"";
-
- int opening = imageTag.indexOf(special,1);
- int closing = imageTag.lastIndexOf(special);
-
- String prefix = imageTag.substring(0,opening);
- String src = imageTag.substring(opening+1,closing);
+ if(imageSrc==null||imageSrc.isEmpty())
+ {
+ return null;
+ }
+ if(imageSrc.startsWith("cid:"))
+ {
+ return imageSrc;
+ }
+ String src = imageSrc;
String hashName = Integer.toString(src.hashCode());
String cid = null;
try{
@@ -106,9 +121,10 @@
}
catch(Exception e)
{
- return imageTag;
+ log.error("Error fetching image.",e);
+ return imageSrc;
}
- return prefix+special+"cid:"+cid+special;
+ return "cid:"+cid;
}
17 years
JBoss JBPM SVN: r4502 - in jbpm4/branches/tbaeyens/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/activity and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-08 14:52:42 -0400 (Wed, 08 Apr 2009)
New Revision: 4502
Modified:
jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl.xsd
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
Log:
event listeners testing and task schema updates
Modified: jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl.xsd
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl.xsd 2009-04-08 14:06:45 UTC (rev 4501)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/resources/jpdl.xsd 2009-04-08 18:52:42 UTC (rev 4502)
@@ -42,6 +42,7 @@
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attribute name="name" use="required" type="string">
@@ -85,6 +86,7 @@
</documentation></annotation>
<complexType>
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -97,6 +99,7 @@
</documentation></annotation>
<complexType>
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="ends" default="process-instance">
@@ -118,6 +121,7 @@
</documentation></annotation>
<complexType>
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="ends" default="process-instance">
@@ -136,6 +140,7 @@
</documentation></annotation>
<complexType>
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attribute name="ends" default="process-instance">
@@ -157,6 +162,7 @@
</documentation></annotation>
<complexType>
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -171,6 +177,7 @@
<complexType>
<sequence>
<element name="handler" minOccurs="0" type="tns:wireObjectType" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element name="transition" minOccurs="0" maxOccurs="unbounded">
<complexType>
<complexContent>
@@ -214,6 +221,7 @@
</documentation></annotation>
<complexType>
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -226,6 +234,7 @@
</documentation></annotation>
<complexType>
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -239,6 +248,7 @@
<complexContent>
<extension base="tns:scriptType">
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -254,6 +264,7 @@
<complexContent>
<extension base="tns:qlType">
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -269,6 +280,7 @@
<complexContent>
<extension base="tns:qlType">
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -287,6 +299,7 @@
<complexContent>
<extension base="tns:javaType">
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -302,6 +315,7 @@
<complexContent>
<extension base="tns:esbType">
<sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
@@ -316,10 +330,12 @@
<complexType>
<sequence>
<element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
<attributeGroup ref="tns:assignmentAttributes"/>
+ <attribute name="swimlane" type="string" />
<attribute name="on-transition" default="cancel">
<simpleType>
<restriction base="string">
@@ -370,58 +386,6 @@
<attributeGroup ref="tns:activityAttributes" />
</complexType>
</element>
-
- <element name="activity">
- <annotation><documentation>Executes an activity implementation.
- </documentation></annotation>
- <complexType>
- <sequence>
- <group ref="tns:delegationGroup"/>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </complexType>
- </element>
-
- <element name="email">
- <annotation><documentation>Sends an email
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:emailType">
- <sequence>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <element name="task">
- <annotation><documentation>Creates a human task
- </documentation></annotation>
- <complexType>
- <complexContent>
- <extension base="tns:taskType">
- <sequence>
- <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
- <element ref="tns:on" minOccurs="0" maxOccurs="unbounded">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
- </element>
- <element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attributeGroup ref="tns:activityAttributes" />
- </extension>
- </complexContent>
- </complexType>
- </element>
-->
</choice>
</group>
@@ -593,98 +557,49 @@
tasks and swimlanes to specify to whom these respectively are assigned.
</documentation></annotation>
<attribute name="assignee" type="string">
- <annotation><documentation>An expression '#{expr}' that resolves to an identifier of
- the actual actor that needs to execute the task. It can be a literal as well.
+ <annotation><documentation>Expression that resolves to a userId referencing
+ the person to which the task or swimlane will be assigned.
</documentation></annotation>
</attribute>
<attribute name="assignee-lang" type="string">
- <annotation><documentation>The expression language to use to evaluate the assignee
- expression.
+ <annotation><documentation>Expression language for the assignee attribute.
</documentation></annotation>
</attribute>
- <attribute name="candidate-groups" type="string">
- <annotation><documentation>An expression '#{expr}' that resolves to a comma separated
- list of groups of actors with candidates to execute the task.
- </documentation></annotation>
- </attribute>
- <attribute name="candidate-groups-lang" type="string">
- <annotation><documentation>The expression language to use to evaluate the candidate-groups
- expression.
- </documentation></annotation>
- </attribute>
<attribute name="candidate-users" type="string">
- <annotation><documentation>An expression '#{expr}' that resolves to a comma separated
- list of actors that are candidate to execute the task.
- </documentation></annotation>
+ <annotation><documentation>Expression that resolves to a comma separated
+ list of userId's. All the referred people will be candidates for
+ take the task or swimlane.</documentation></annotation>
</attribute>
<attribute name="candidate-users-lang" type="string">
- <annotation><documentation>The expression language to use to evaluate the candidate-users
- expression.
- </documentation></annotation>
+ <annotation><documentation>Expression language for the
+ candidate-users attribute.</documentation></annotation>
</attribute>
- <attribute name="swimlane" type="string">
- <annotation><documentation>The name of the swimlane that will contain the actor that
- needs to execute the task.
- </documentation></annotation>
- </attribute>
- </attributeGroup>
-
-<!-- <complexType name="assignmentType">
- <annotation><documentation>An element of type assignmentType will be used in
- tasks and swimlanes to specify to whom these respectively are assigned.
- </documentation></annotation>
- <attribute name="assignee" type="string">
- <annotation><documentation>An expression '#{expr}' that resolves to an identifier of
- the actual actor that needs to execute the task. It can be a literal as well.
- </documentation></annotation>
- </attribute>
<attribute name="candidate-groups" type="string">
- <annotation><documentation>An expression '#{expr}' that resolves to a comma separated
- list of groups of actors with candidates to execute the task.
- </documentation></annotation>
+ <annotation><documentation>Resolves to a comma separated list of groupId's.
+ All the referred people will be candidates to
+ take the task or swimlane.</documentation></annotation>
</attribute>
- <attribute name="candidate-users" type="string">
- <annotation><documentation>An expression '#{expr}' that resolves to a comma separated
- list of actors that are candidate to execute the task.
- </documentation></annotation>
+ <attribute name="candidate-groups-lang" type="string">
+ <annotation><documentation>Expression language for the
+ candidate-groups attribute.</documentation></annotation>
</attribute>
- <attribute name="swimlane" type="string">
- <annotation><documentation>The name of the swimlane that will contain the actor that
- needs to execute the task.
- </documentation></annotation>
- </attribute>
- </complexType>
+ </attributeGroup>
- <element name="assignment" type="tns:assignmentType">
- <annotation><documentation>The assignment which specifies who needs to execute
- task or who is among the candidates to execute it.
- </documentation></annotation>
- </element> -->
-
- <complexType name="swimlaneType">
- <annotation><documentation>Elements of type swimlaneType will be used in the
- process to enumerate all the participating swimlanes.
- </documentation></annotation>
- <sequence>
- </sequence>
- <attribute name="name" type="string"/>
- <attributeGroup ref="tns:assignmentAttributes"></attributeGroup>
- </complexType>
-
- <element name="swimlane" type="tns:swimlaneType" >
- <annotation><documentation>A participating swimlane for this process
- </documentation></annotation>
+ <element name="swimlane">
+ <annotation><documentation>A process role.</documentation></annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required" />
+ <attributeGroup ref="tns:assignmentAttributes" />
+ </complexType>
</element>
<complexType name="transitionType">
<annotation><documentation>The outgoing transitions. The first in the list
will be the default outgoing transition.
</documentation></annotation>
- <!--
<sequence>
- <group ref="tns:eventListenerGroup" />
+ <group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded" />
</sequence>
- -->
<attribute name="name" type="string">
<annotation><documentation>Name of this outgoing transition</documentation></annotation>
</attribute>
@@ -703,84 +618,30 @@
</element>
<element name="on">
- <annotation><documentation>Events on which listeners can be registered.</documentation></annotation>
<complexType>
- <!--
<sequence>
<group ref="tns:eventListenerGroup" minOccurs="0" maxOccurs="unbounded">
<annotation><documentation>A list of event listeners that will
be notified when the event is fired</documentation></annotation>
</group>
</sequence>
- -->
<attribute name="event" type="string">
- <annotation><documentation>The event identification
+ <annotation><documentation>The event identification. start, end, take or
+ any other custom event.
</documentation></annotation>
</attribute>
</complexType>
</element>
- <!--
-
<group name="eventListenerGroup">
<choice>
- <element name="notify">
- <annotation><documentation>Calls the notify method on an
- EventListener.
+ <element name="event-listener" type="tns:wireObjectType" >
+ <annotation><documentation>An EventListener
</documentation></annotation>
- <complexType>
- <group ref="tns:delegationGroup" />
- <attribute name="object" type="string">
- <annotation><documentation>The reference to an object that is declared
- in the objects section of this process definition.
- </documentation></annotation>
- </attribute>
- <attribute name="expr" type="string">
- <annotation><documentation>The expression that will resolve to
- an Activity implementation.</documentation></annotation>
- </attribute>
- </complexType>
</element>
- <element name="invoke" type="tns:invokeType">
- <annotation><documentation>Invokes a method on a Java object
- through reflection. The return value can be captured in a
- process variable.
- </documentation></annotation>
- </element>
- <element name="script" type="tns:scriptType">
- <annotation><documentation>Evaluates a piece of text as a script
- </documentation></annotation>
- </element>
- <element name="email" type="tns:emailType">
- <annotation><documentation>Sends an email
- </documentation></annotation>
- </element>
- <element ref="tns:timer">
- <annotation><documentation>Creates a timer.
- </documentation></annotation>
- </element>
</choice>
</group>
- <complexType name="scriptType">
- <sequence>
- <element name="expr" type="string">
- <annotation><documentation>The content of this expression element
- is the script text that will be evaluated. This is mutually
- exclusive with the expression attribute.</documentation></annotation>
- </element>
- </sequence>
- <attribute name="expr" type="string">
- <annotation><documentation>The script text that will be evaluated. This
- is mutually exclusive with the expression element.
- </documentation></annotation>
- </attribute>
- <attribute name="lang" type="string">
- <annotation><documentation>Identification of the scripting language
- to use.</documentation></annotation>
- </attribute>
- </complexType>
-
<complexType name="emailType">
<sequence>
<element name="property">
@@ -797,55 +658,26 @@
</attribute>
</complexType>
- <element name="timer">
- <annotation><documentation>A timer that will be bound to the most inner enclosing scope.
- Timers can give a signal to an activity instance. The signal will correspond to a transition
- or to an event being fired.
- </documentation></annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <group ref="tns:eventListenerGroup">
- <annotation><documentation>An inline list of event listeners
- on a timer is a short cut for defining the event separately.
- </documentation></annotation>
- </group>
- </choice>
- <attribute name="duedate" type="string" use="required" />
- <attribute name="signal" type="string" use="required">
- <annotation><documentation>Refers to the signal that will be used.
- If inline event listeners are declared, the signal name can not be
- the same as an event that is declared in this scope.
- </documentation></annotation>
- </attribute>
- <attribute name="repeat" type="string" />
- </complexType>
- </element>
-
- <complexType name="taskType">
+ <complexType name="taskType" >
+ <!--
<sequence>
- <element ref="tns:assignment" />
<element name="reminder">
<complexType>
<attribute name="duedate" type="string" use="required" />
<attribute name="repeat" type="string" />
</complexType>
</element>
- <element ref="tns:subtask" />
</sequence>
- <attribute name="title" type="string">
- </attribute>
+ -->
+ <attributeGroup ref="tns:assignmentAttributes" />
<attribute name="form" type="string">
</attribute>
<attribute name="swimlane" type="string">
</attribute>
<attribute name="description" type="string" />
<attribute name="duedate" type="string" />
- <attribute name="priority" type="tns:priorityType" default="normal" />
<attribute name="notify" type="boolean" default="false"/>
- <attribute name="dynamic" type="boolean" default="true">
- <annotation><documentation>Is dynamic creation of subtasks
- allowed ?</documentation></annotation>
- </attribute>
+ <!--
<attribute name="subtasksync">
<simpleType>
<union>
@@ -871,8 +703,34 @@
</union>
</simpleType>
</attribute>
+ -->
</complexType>
+ <!--
+ <element name="timer">
+ <annotation><documentation>A timer that will be bound to the most inner enclosing scope.
+ Timers can give a signal to an activity instance. The signal will correspond to a transition
+ or to an event being fired.
+ </documentation></annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <group ref="tns:eventListenerGroup">
+ <annotation><documentation>An inline list of event listeners
+ on a timer is a short cut for defining the event separately.
+ </documentation></annotation>
+ </group>
+ </choice>
+ <attribute name="duedate" type="string" use="required" />
+ <attribute name="signal" type="string" use="required">
+ <annotation><documentation>Refers to the signal that will be used.
+ If inline event listeners are declared, the signal name can not be
+ the same as an event that is declared in this scope.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="repeat" type="string" />
+ </complexType>
+ </element>
+
<simpleType name="priorityType">
<restriction base="string">
<enumeration value="highest"/>
@@ -885,52 +743,40 @@
<element name="subtask" type="tns:taskType">
<annotation><documentation>Subtask in a task activity.</documentation></annotation>
- </element>
+ </element>
+
+ <complexType name="assignmentType">
+ <annotation><documentation>An element of type assignmentType will be used in
+ tasks and swimlanes to specify to whom these respectively are assigned.
+ </documentation></annotation>
+ <attribute name="assignee" type="string">
+ <annotation><documentation>An expression '#{expr}' that resolves to an identifier of
+ the actual actor that needs to execute the task. It can be a literal as well.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="candidate-groups" type="string">
+ <annotation><documentation>An expression '#{expr}' that resolves to a comma separated
+ list of groups of actors with candidates to execute the task.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="candidate-users" type="string">
+ <annotation><documentation>An expression '#{expr}' that resolves to a comma separated
+ list of actors that are candidate to execute the task.
+ </documentation></annotation>
+ </attribute>
+ <attribute name="swimlane" type="string">
+ <annotation><documentation>The name of the swimlane that will contain the actor that
+ needs to execute the task.
+ </documentation></annotation>
+ </attribute>
+ </complexType>
- <element name="swimlane">
- <annotation><documentation>A process role.</documentation></annotation>
- <complexType>
- <sequence>
- <element ref="tns:assignment"/>
- </sequence>
- <attribute name="name" type="string" use="required" />
- </complexType>
+ <element name="assignment" type="tns:assignmentType">
+ <annotation><documentation>The assignment which specifies who needs to execute
+ task or who is among the candidates to execute it.
+ </documentation></annotation>
</element>
+
+ -->
- <element name="assignment">
- <annotation><documentation>Specifies how a task or a swimlane should be assigned
- to a specific user or who will be identified as a candidate for it.</documentation></annotation>
- <complexType>
- <sequence minOccurs="0">
- <group ref="tns:delegationGroup">
- <annotation><documentation>An object that implements the
- Assigner interface.
- </documentation></annotation>
- </group>
- </sequence>
- <attribute name="assignee" type="string">
- <annotation><documentation>User ID of the person to which the task
- or swimlane will be assigned.
- </documentation></annotation>
- </attribute>
- <attribute name="assignee-expr" type="string">
- <annotation><documentation>Expression that resolves to a
- User ID to which the task or swimlane will be assigned.
- </documentation></annotation>
- </attribute>
- <attribute name="candidates" type="string">
- <annotation><documentation>Comma separated list of User ID's
- or Group ID's. All the referred people will be candidates to
- take the task or swimlane.</documentation></annotation>
- </attribute>
- <attribute name="candidate-expr" type="string">
- <annotation><documentation>Expression that resolves to a
- comma separated list of User ID's or Group ID's. All the
- referred people will be candidates to
- take the task or swimlane.</documentation></annotation>
- </attribute>
- </complexType>
- </element>
- -->
-
</schema>
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-04-08 14:06:45 UTC (rev 4501)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-04-08 18:52:42 UTC (rev 4502)
@@ -25,6 +25,7 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
+import org.jbpm.model.Event;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.TagBinding;
@@ -63,13 +64,15 @@
return true;
}
- public void parseFlows(Element element, ActivityImpl activity, Parse parse) {
+ public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
List<Element> transitionElements = XmlUtil.elements(element, "transition");
UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
for (Element transitionElement: transitionElements) {
String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
TransitionImpl transition = activity.createOutgoingTransition(transitionName);
unresolvedTransitions.add(transition, transitionElement);
+
+ jpdlParser.parseEventListeners(transitionElement, transition, Event.TAKE, parse);
}
}
}
Modified: jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-08 14:06:45 UTC (rev 4501)
+++ jbpm4/branches/tbaeyens/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-04-08 18:52:42 UTC (rev 4502)
@@ -177,7 +177,7 @@
}
}
- parseEventListeners(documentElement, parse, processDefinition);
+ parseOnEvents(documentElement, parse, processDefinition);
// activities
List<Element> elements = XmlUtil.elements(documentElement);
@@ -190,11 +190,11 @@
try {
activity.setType(activityBinding.getTagName());
activityBinding.parseName(element, activity, parse);
- activityBinding.parseFlows(element, activity, parse);
+ activityBinding.parseTransitions(element, activity, parse, this);
ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(element, parse, this);
activity.setBehaviour(activityBehaviour);
- parseEventListeners(element, parse, activity);
+ parseOnEvents(element, parse, activity);
} finally {
parse.popObject();
@@ -221,26 +221,30 @@
return processDefinition;
}
- public void parseEventListeners(Element element, Parse parse, ObservableElementImpl observableElement) {
+ public void parseOnEvents(Element element, Parse parse, ObservableElementImpl observableElement) {
// event listeners
List<Element> onElements = XmlUtil.elements(element, "on");
for (Element onElement: onElements) {
String eventName = XmlUtil.attribute(onElement, "event", true, parse);
- if (eventName!=null) {
- EventImpl event = observableElement.getEvent(eventName);
- if (event==null) {
- event = observableElement.createEvent(eventName);
+ parseEventListeners(onElement, observableElement, eventName, parse);
+ }
+ }
+
+ public void parseEventListeners(Element element, ObservableElementImpl observableElement, String eventName, Parse parse) {
+ if (eventName!=null) {
+ EventImpl event = observableElement.getEvent(eventName);
+ if (event==null) {
+ event = observableElement.createEvent(eventName);
+ }
+
+ for (Element eventListenerElement: XmlUtil.elements(element)) {
+ JpdlBinding eventBinding = (JpdlBinding) getBinding(eventListenerElement, "eventlistener");
+ if (eventBinding!=null) {
+ EventListener eventListener = (EventListener) eventBinding.parse(eventListenerElement, parse, this);
+ event.createEventListenerReference(eventListener);
+ } else {
+ log.debug("unrecognized event listener: "+XmlUtil.getTagLocalName(eventListenerElement));
}
-
- for (Element eventListenerElement: XmlUtil.elements(onElement)) {
- JpdlBinding eventBinding = (JpdlBinding) getBinding(eventListenerElement, "eventlistener");
- if (eventBinding!=null) {
- EventListener eventListener = (EventListener) eventBinding.parse(eventListenerElement, parse, this);
- event.createEventListenerReference(eventListener);
- } else {
- log.debug("unrecognized event listener: "+XmlUtil.getTagLocalName(eventListenerElement));
- }
- }
}
}
}
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-04-08 14:06:45 UTC (rev 4501)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-04-08 18:52:42 UTC (rev 4502)
@@ -21,6 +21,10 @@
*/
package org.jbpm.test.eventlistener;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.Execution;
import org.jbpm.listener.EventListener;
import org.jbpm.listener.EventListenerExecution;
import org.jbpm.test.JbpmTestCase;
@@ -31,18 +35,28 @@
*/
public class EventListenerTest extends JbpmTestCase {
- public static class ProcessEventRecorder implements EventListener {
+ static boolean isInvoked = false;
+ static List<Integer> order;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ isInvoked = false;
+ }
+
+ public static class ProcessStartListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- assertNull(execution.getActivity());
+ assertNotNull(execution.getActivity());
+ assertSame(execution.getActivity(), execution.getProcessDefinition().getInitial());
+ isInvoked = true;
}
}
- public void testProcessStart() {
+ public void testProcessStartListener() {
deployJpdlXmlString(
"<process name='Insurance claim' key='ICL'>" +
" <on event='start'>" +
- " <event-listener class='"+ProcessEventRecorder.class.getName()+"' />" +
+ " <event-listener class='"+ProcessStartListener.class.getName()+"' />" +
" </on>" +
" <start>" +
" <transition to='a' />" +
@@ -52,6 +66,171 @@
);
executionService.startProcessInstanceByKey("ICL");
+
+ assertTrue("process start listener not invoked", isInvoked);
}
+ public static class ProcessEndListener implements EventListener {
+ private static final long serialVersionUID = 1L;
+ public void notify(EventListenerExecution execution) {
+ assertNotNull(execution.getActivity());
+ assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("end"));
+ isInvoked = true;
+ }
+ }
+
+ public void testProcessEndListener() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <on event='end'>" +
+ " <event-listener class='"+ProcessEndListener.class.getName()+"' />" +
+ " </on>" +
+ " <start>" +
+ " <transition to='end' />" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("ICL");
+
+ assertTrue("process end listener not invoked", isInvoked);
+ }
+
+ public static class ActivityStartListener implements EventListener {
+ private static final long serialVersionUID = 1L;
+ public void notify(EventListenerExecution execution) {
+ assertNotNull(execution.getActivity());
+ assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("s"));
+ isInvoked = true;
+ }
+ }
+
+ public void testActivityStartListener() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='s' />" +
+ " </start>" +
+ " <state name='s'>" +
+ " <on event='start'>" +
+ " <event-listener class='"+ActivityStartListener.class.getName()+"' />" +
+ " </on>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("ICL");
+
+ assertTrue("activity start listener not invoked", isInvoked);
+ }
+
+ public static class ActivityEndListener implements EventListener {
+ private static final long serialVersionUID = 1L;
+ public void notify(EventListenerExecution execution) {
+ assertNotNull(execution.getActivity());
+ assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("s"));
+ isInvoked = true;
+ }
+ }
+
+ public void testActivityEndListener() {
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='s' />" +
+ " </start>" +
+ " <state name='s'>" +
+ " <on event='end'>" +
+ " <event-listener class='"+ActivityStartListener.class.getName()+"' />" +
+ " </on>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ Execution execution = executionService.startProcessInstanceByKey("ICL");
+
+ assertFalse("activity end listener invoked too early", isInvoked);
+
+ executionService.signalExecutionById(execution.getId());
+
+ assertTrue("activity end listener not invoked", isInvoked);
+ }
+
+ public static class TransitionListener implements EventListener {
+ private static final long serialVersionUID = 1L;
+ public void notify(EventListenerExecution execution) {
+ assertNotNull(execution.getTransition());
+ isInvoked = true;
+ }
+ }
+
+ public void testTransitionListener() {
+ order = new ArrayList<Integer>();
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='end'>" +
+ " <event-listener class='"+TransitionListener.class.getName()+"' />" +
+ " </transition>" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("ICL");
+
+ assertTrue("transition listener not invoked", isInvoked);
+ }
+
+ public static class OrderListener implements EventListener {
+ private static final long serialVersionUID = 1L;
+ int i;
+ public void notify(EventListenerExecution execution) {
+ order.add(i);
+ }
+ }
+
+ public void testEventOrdering() {
+ order = new ArrayList<Integer>();
+ deployJpdlXmlString(
+ "<process name='Insurance claim' key='ICL'>" +
+ " <start>" +
+ " <transition to='end'>" +
+ " <event-listener class='"+OrderListener.class.getName()+"'>" +
+ " <field name='i'><int value='1' /></field> " +
+ " </event-listener>" +
+ " <event-listener class='"+OrderListener.class.getName()+"'>" +
+ " <field name='i'><int value='2' /></field> " +
+ " </event-listener>" +
+ " <event-listener class='"+OrderListener.class.getName()+"'>" +
+ " <field name='i'><int value='3' /></field> " +
+ " </event-listener>" +
+ " <event-listener class='"+OrderListener.class.getName()+"'>" +
+ " <field name='i'><int value='4' /></field> " +
+ " </event-listener>" +
+ " <event-listener class='"+OrderListener.class.getName()+"'>" +
+ " <field name='i'><int value='5' /></field> " +
+ " </event-listener>" +
+ " </transition>" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("ICL");
+
+ List<Integer> expectedOrder = new ArrayList<Integer>();
+ expectedOrder.add(1);
+ expectedOrder.add(2);
+ expectedOrder.add(3);
+ expectedOrder.add(4);
+ expectedOrder.add(5);
+
+ assertEquals(expectedOrder, order);
+ }
}
17 years
JBoss JBPM SVN: r4501 - in jbpm4/branches/jbpm-4.0.0.Beta1/modules: userguide and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-08 10:06:45 -0400 (Wed, 08 Apr 2009)
New Revision: 4501
Added:
jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml
jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/userguide.iml
Modified:
jbpm4/branches/jbpm-4.0.0.Beta1/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/master.xml
Log:
svn merge -r4496:4500 https://svn.jboss.org/repos/jbpm/jbpm4/trunk
Modified: jbpm4/branches/jbpm-4.0.0.Beta1/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-04-08 13:30:13 UTC (rev 4500)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-04-08 14:06:45 UTC (rev 4501)
@@ -34,6 +34,8 @@
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.RepositoryService;
+import org.jbpm.env.Environment;
+import org.jbpm.env.EnvironmentFactory;
import org.jbpm.model.OpenExecution;
/**
@@ -41,127 +43,214 @@
*/
class ProcessManagementImpl extends JBPMIntegration implements ProcessManagement
{
-
+
public List<ProcessDefinitionRef> getProcessDefinitions()
{
- List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- List<ProcessDefinition> definitions = repositoryService.createProcessDefinitionQuery()
- .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
- .execute();
-
- // adopt ProcessDefinition to console model
- for(ProcessDefinition processDefinition : definitions)
+ try
{
- results.add( ModelAdaptor.adoptDefinition(processDefinition) );
+ List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
+
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ List<ProcessDefinition> definitions = repositoryService.createProcessDefinitionQuery()
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .execute();
+
+ // adopt ProcessDefinition to console model
+ for(ProcessDefinition processDefinition : definitions)
+ {
+ results.add( ModelAdaptor.adoptDefinition(processDefinition) );
+ }
+
+ return results;
}
+ finally
+ {
+ env.close();
+ }
- return results;
-
}
public ProcessDefinitionRef getProcessDefinition(String procDefId)
{
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
- .id(procDefId)
- .uniqueResult();
- return ModelAdaptor.adoptDefinition(processDefinition);
+
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .id(procDefId)
+ .uniqueResult();
+ return ModelAdaptor.adoptDefinition(processDefinition);
+
+ }
+ finally
+ {
+ env.close();
+ }
}
public List<ProcessDefinitionRef> removeProcessDefinition(String procDefId)
{
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
- .id(procDefId)
- .uniqueResult();
- if (processDefinition!=null) {
- repositoryService.deleteDeploymentCascade(processDefinition.getDeploymentDbid());
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .id(procDefId)
+ .uniqueResult();
+ if (processDefinition!=null) {
+ repositoryService.deleteDeploymentCascade(processDefinition.getDeploymentDbid());
+ }
+ return getProcessDefinitions();
}
- return getProcessDefinitions();
+ finally
+ {
+ env.close();
+ }
}
public List<ProcessInstanceRef> getProcessInstances(String procDefId)
{
- ExecutionService execService = this.processEngine.getExecutionService();
- ExecutionQuery query = execService.createExecutionQuery();
- query.processDefinitionId(String.valueOf(procDefId));
-
- List<Execution> executions = query.execute();
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- List<ProcessInstanceRef> results = adoptTopLevelExecutions(executions);
+ try
+ {
- return results;
+ ExecutionService execService = this.processEngine.getExecutionService();
+ ExecutionQuery query = execService.createExecutionQuery();
+ query.processDefinitionId(String.valueOf(procDefId));
+
+ List<Execution> executions = query.execute();
+
+ List<ProcessInstanceRef> results = adoptTopLevelExecutions(executions);
+
+ return results;
+ }
+ finally
+ {
+ env.close();
+ }
}
private List<ProcessInstanceRef> adoptTopLevelExecutions(List<Execution> executions)
{
- List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
- for(Execution exec : executions)
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
{
- if(exec.isEnded())
+
+ List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
+ for(Execution exec : executions)
{
- System.out.println("*** JBPM-2055: Execution ("+exec.getId()+") is already ended. " +
- "Should not show up in query");
- continue;
- }
+ if(exec.isEnded())
+ {
+ System.out.println("*** JBPM-2055: Execution ("+exec.getId()+") is already ended. " +
+ "Should not show up in query");
+ continue;
+ }
- if(exec.isProcessInstance()) // parent execution
- {
- results.add( ModelAdaptor.adoptExecution((OpenExecution)exec) );
+ if(exec.isProcessInstance()) // parent execution
+ {
+ results.add( ModelAdaptor.adoptExecution((OpenExecution)exec) );
+ }
}
+ return results;
}
- return results;
+ finally
+ {
+ env.close();
+ }
}
public ProcessInstanceRef getProcessInstance(String instanceId)
{
- ExecutionService execService = this.processEngine.getExecutionService();
- ExecutionQuery query = execService.createProcessInstanceQuery();
- query.processInstanceId(instanceId);
- List<Execution> executions = query.execute();
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- if(executions.size()>1 || executions.isEmpty())
- throw new IllegalStateException("No precise match for instanceId " + instanceId +". Num results "+executions);
+ try
+ {
- return ModelAdaptor.adoptExecution( (OpenExecution)executions.get(0));
+ ExecutionService execService = this.processEngine.getExecutionService();
+ ExecutionQuery query = execService.createProcessInstanceQuery();
+ query.processInstanceId(instanceId);
+ List<Execution> executions = query.execute();
+
+ if(executions.size()>1 || executions.isEmpty())
+ throw new IllegalStateException("No precise match for instanceId " + instanceId +". Num results "+executions);
+
+ return ModelAdaptor.adoptExecution( (OpenExecution)executions.get(0));
+ }
+ finally
+ {
+ env.close();
+ }
}
public ProcessInstanceRef newInstance(String definitionId)
{
- ExecutionService execService = this.processEngine.getExecutionService();
- Execution exec = execService.startProcessInstanceById(definitionId);
- return ModelAdaptor.adoptExecution((OpenExecution)exec);
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ ExecutionService execService = this.processEngine.getExecutionService();
+ Execution exec = execService.startProcessInstanceById(definitionId);
+ return ModelAdaptor.adoptExecution((OpenExecution)exec);
+ }
+ finally{
+ env.close();
+ }
}
public void setProcessState(String executionId, ProcessInstanceRef.STATE nextState)
{
- if(ProcessInstanceRef.STATE.ENDED==nextState)
+
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
{
- // TODO: It's actually a delete call. Once we got the 'cancel' notion this should be changed
- ExecutionService execService = this.processEngine.getExecutionService();
- Execution exec = execService.findExecution(executionId);
- if(null==exec)
- throw new IllegalArgumentException("No such execution with id "+ executionId);
-
- execService.deleteProcessInstance(executionId);
+ if(ProcessInstanceRef.STATE.ENDED==nextState)
+ {
+ // TODO: It's actually a delete call. Once we got the 'cancel' notion this should be changed
+ ExecutionService execService = this.processEngine.getExecutionService();
+ Execution exec = execService.findExecution(executionId);
+ if(null==exec)
+ throw new IllegalArgumentException("No such execution with id "+ executionId);
+
+ execService.deleteProcessInstance(executionId);
+ }
+ else
+ {
+ throw new IllegalArgumentException("State " + nextState + " currently not supported");
+ }
}
- else
+ finally
{
- throw new IllegalArgumentException("State " + nextState + " currently not supported");
+ env.close();
}
}
public void signalExecution(String executionId, String signal)
- {
- ExecutionService execService = this.processEngine.getExecutionService();
+ {
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- if(null==signal)
- execService.signalExecutionById(executionId);
- else
- execService.signalExecutionById(executionId, signal);
-
+ try
+ {
+ ExecutionService execService = this.processEngine.getExecutionService();
+
+ if(null==signal)
+ execService.signalExecutionById(executionId);
+ else
+ execService.signalExecutionById(executionId, signal);
+ }
+ finally
+ {
+ env.close();
+ }
+
}
public void deploy(String fileName, String contentType, InputStream deployment)
Modified: jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/master.xml 2009-04-08 13:30:13 UTC (rev 4500)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/master.xml 2009-04-08 14:06:45 UTC (rev 4501)
@@ -9,6 +9,7 @@
<!ENTITY ch06-Variables SYSTEM "modules/ch06-Variables.xml">
<!ENTITY ch07-Scripting SYSTEM "modules/ch07-Scripting.xml">
<!ENTITY ch08-Identity SYSTEM "modules/ch08-Identity.xml">
+ <!ENTITY ch08-JBossIntegration SYSTEM "modules/ch09-JBossIntegration.xml">
]>
<book lang="en">
@@ -27,5 +28,6 @@
&ch06-Variables;
&ch07-Scripting;
&ch08-Identity;
+ &ch08-JBossIntegration;
</book>
\ No newline at end of file
Copied: jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml (from rev 4500, jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml)
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml (rev 0)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml 2009-04-08 14:06:45 UTC (rev 4501)
@@ -0,0 +1,140 @@
+<chapter id="identity">
+ <title>JBoss Integration</title>
+
+ <para>
+ jBPM provides integration with JBoss 4.2.x and JBoss 5.0.0.GA.
+ As part of the <link linkend="runningtheinstaller">installation</link>, the ProcessEngine and a deployer for jBPM archives
+ will be installed as a JBoss service.
+ </para>
+
+ <para>
+ After a successful installation you should see that the ProcessEngine
+ has been started and bound to JNDI:
+ </para>
+
+ <programlisting>
+ [...]
+ 14:12:09,301 INFO [JBPMService] jBPM 4 - Integration JBoss 4
+ 14:12:09,301 INFO [JBPMService] 4.0.0.Beta1
+ 14:12:09,301 INFO [JBPMService] ProcessEngine bound to: java:/ProcessEngine
+ </programlisting>
+
+ <section>
+ <title>Packaging process archives</title>
+ <para>
+ When jBPM is deployed on a JBoss instance, process deployments are treated like
+ any other deployment artifact (i.e. *.war, *.ear) and processed by the JBPMDeployer.
+ In order to deploy a process archive simply create a *.jpdl archive (zip file) that contains
+ the process definition (*.jpdl.xml) and all required resources to execute the process (i.e. classes, property files):
+ </para>
+ <programlisting>
+ Bonanova:Desktop hbraun$ jar -tf OrderProcess.jpdl
+
+ META-INF/MANIFEST.MF
+ OrderProcess.jpdl.xml
+ org/mycompany/order/*.class
+ </programlisting>
+ </section>
+
+ <section>
+ <title>Deploying processes archives to a JBoss instance</title>
+ <para>
+ In order to deploy a process archive simply copy it to $JBOSS_HOME/server/<config>/deploy:
+ </para>
+
+ <programlisting>
+ (1) cp OrderProcess.jpdl $JBOSS_HOME/server/default/deploy
+
+ (2) less $JBOSS_HOME/server/default/log
+ [...]
+ 2009-04-08 14:12:21,947 INFO [org.jbpm.integration.jboss4.JBPMDeployer]
+ Deploy file:/Users/hbraun/dev/prj/jboss/tags/JBoss_4_2_2_GA
+ /build/output/jboss-4.2.2.GA/server/default/deploy/OrderProcess.jpdl
+ </programlisting>
+
+ <para>
+ In order to remove a process simply remove the process archive from the deploy directory.
+ </para>
+ </section>
+
+ <section>
+ <title>Process deployments and versioning</title>
+ <para>
+ TBD: A prelimenary explanation cn be found <ulink url="http://relative-order.blogspot.com/2009/03/rfc-process-deployment-use-cas...">here</ulink>
+ </para>
+ </section>
+
+ <section>
+ <title>ProcessEngine and J2EE/JEE programming models</title>
+ <para>
+ As described above the ProcessEngine will be installed as JBoss service and bound to JNDI.
+ This means that any EE component (i.e. servlet, ejb) can access it doing a JNDI lookup:
+ </para>
+
+ <programlisting>
+ private ProcessEngine processEngine;
+ [...]
+
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ this.processEngine = (ProcessEngine)ctx.lookup("java:/ProcessEngine");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to lookup process engine");
+ }
+ </programlisting>
+
+ <para>
+ Once you obtained an instance of the ProcessEngine you can invoke on it
+ as described in <link linkend="services">chapter services</link>
+ </para>
+
+ <programlisting>
+ UserTransaction tx = (UserTransaction)ctx.lookup("UserTransaction"); (1)
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+
+ ExecutionService execService = (ExecutionService)
+ this.processEngine.get(ExecutionService.class);
+
+ // begin transaction
+ tx.begin();
+
+ // invoke on process engine
+ executionService.signalExecutionById("ICL.82436");
+
+ // commit transaction
+ tx.commit();
+
+ }
+ catch (Exception e)
+ {
+ if(tx!=null)
+ {
+ try
+ {
+ tx.rollback();
+ }
+ catch (SystemException e1) {}
+ }
+
+ throw new RuntimeException("...", e);
+
+ }
+ finally
+ {
+ env.close();
+ }
+ </programlisting>
+
+ <para>
+ (1) Wrapping the call in a UserTransaction is not necessary if the invocation comes a
+ CMT component, i.e. an EJB.
+ </para>
+ </section>
+
+</chapter>
Copied: jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/userguide.iml (from rev 4500, jbpm4/trunk/modules/userguide/userguide.iml)
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/userguide.iml (rev 0)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/userguide/userguide.iml 2009-04-08 14:06:45 UTC (rev 4501)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntryProperties />
+ </component>
+</module>
+
17 years
JBoss JBPM SVN: r4500 - in jbpm4/trunk/modules/userguide: src/main/docbook/en and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-08 09:30:13 -0400 (Wed, 08 Apr 2009)
New Revision: 4500
Added:
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml
jbpm4/trunk/modules/userguide/userguide.iml
Modified:
jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
Log:
Fix JBPM-2152: Document the JBoss integration
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml 2009-04-08 12:33:28 UTC (rev 4499)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml 2009-04-08 13:30:13 UTC (rev 4500)
@@ -9,6 +9,7 @@
<!ENTITY ch06-Variables SYSTEM "modules/ch06-Variables.xml">
<!ENTITY ch07-Scripting SYSTEM "modules/ch07-Scripting.xml">
<!ENTITY ch08-Identity SYSTEM "modules/ch08-Identity.xml">
+ <!ENTITY ch08-JBossIntegration SYSTEM "modules/ch09-JBossIntegration.xml">
]>
<book lang="en">
@@ -27,5 +28,6 @@
&ch06-Variables;
&ch07-Scripting;
&ch08-Identity;
+ &ch08-JBossIntegration;
</book>
\ No newline at end of file
Added: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml (rev 0)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-JBossIntegration.xml 2009-04-08 13:30:13 UTC (rev 4500)
@@ -0,0 +1,140 @@
+<chapter id="identity">
+ <title>JBoss Integration</title>
+
+ <para>
+ jBPM provides integration with JBoss 4.2.x and JBoss 5.0.0.GA.
+ As part of the <link linkend="runningtheinstaller">installation</link>, the ProcessEngine and a deployer for jBPM archives
+ will be installed as a JBoss service.
+ </para>
+
+ <para>
+ After a successful installation you should see that the ProcessEngine
+ has been started and bound to JNDI:
+ </para>
+
+ <programlisting>
+ [...]
+ 14:12:09,301 INFO [JBPMService] jBPM 4 - Integration JBoss 4
+ 14:12:09,301 INFO [JBPMService] 4.0.0.Beta1
+ 14:12:09,301 INFO [JBPMService] ProcessEngine bound to: java:/ProcessEngine
+ </programlisting>
+
+ <section>
+ <title>Packaging process archives</title>
+ <para>
+ When jBPM is deployed on a JBoss instance, process deployments are treated like
+ any other deployment artifact (i.e. *.war, *.ear) and processed by the JBPMDeployer.
+ In order to deploy a process archive simply create a *.jpdl archive (zip file) that contains
+ the process definition (*.jpdl.xml) and all required resources to execute the process (i.e. classes, property files):
+ </para>
+ <programlisting>
+ Bonanova:Desktop hbraun$ jar -tf OrderProcess.jpdl
+
+ META-INF/MANIFEST.MF
+ OrderProcess.jpdl.xml
+ org/mycompany/order/*.class
+ </programlisting>
+ </section>
+
+ <section>
+ <title>Deploying processes archives to a JBoss instance</title>
+ <para>
+ In order to deploy a process archive simply copy it to $JBOSS_HOME/server/<config>/deploy:
+ </para>
+
+ <programlisting>
+ (1) cp OrderProcess.jpdl $JBOSS_HOME/server/default/deploy
+
+ (2) less $JBOSS_HOME/server/default/log
+ [...]
+ 2009-04-08 14:12:21,947 INFO [org.jbpm.integration.jboss4.JBPMDeployer]
+ Deploy file:/Users/hbraun/dev/prj/jboss/tags/JBoss_4_2_2_GA
+ /build/output/jboss-4.2.2.GA/server/default/deploy/OrderProcess.jpdl
+ </programlisting>
+
+ <para>
+ In order to remove a process simply remove the process archive from the deploy directory.
+ </para>
+ </section>
+
+ <section>
+ <title>Process deployments and versioning</title>
+ <para>
+ TBD: A prelimenary explanation cn be found <ulink url="http://relative-order.blogspot.com/2009/03/rfc-process-deployment-use-cas...">here</ulink>
+ </para>
+ </section>
+
+ <section>
+ <title>ProcessEngine and J2EE/JEE programming models</title>
+ <para>
+ As described above the ProcessEngine will be installed as JBoss service and bound to JNDI.
+ This means that any EE component (i.e. servlet, ejb) can access it doing a JNDI lookup:
+ </para>
+
+ <programlisting>
+ private ProcessEngine processEngine;
+ [...]
+
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ this.processEngine = (ProcessEngine)ctx.lookup("java:/ProcessEngine");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to lookup process engine");
+ }
+ </programlisting>
+
+ <para>
+ Once you obtained an instance of the ProcessEngine you can invoke on it
+ as described in <link linkend="services">chapter services</link>
+ </para>
+
+ <programlisting>
+ UserTransaction tx = (UserTransaction)ctx.lookup("UserTransaction"); (1)
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+
+ ExecutionService execService = (ExecutionService)
+ this.processEngine.get(ExecutionService.class);
+
+ // begin transaction
+ tx.begin();
+
+ // invoke on process engine
+ executionService.signalExecutionById("ICL.82436");
+
+ // commit transaction
+ tx.commit();
+
+ }
+ catch (Exception e)
+ {
+ if(tx!=null)
+ {
+ try
+ {
+ tx.rollback();
+ }
+ catch (SystemException e1) {}
+ }
+
+ throw new RuntimeException("...", e);
+
+ }
+ finally
+ {
+ env.close();
+ }
+ </programlisting>
+
+ <para>
+ (1) Wrapping the call in a UserTransaction is not necessary if the invocation comes a
+ CMT component, i.e. an EJB.
+ </para>
+ </section>
+
+</chapter>
Added: jbpm4/trunk/modules/userguide/userguide.iml
===================================================================
--- jbpm4/trunk/modules/userguide/userguide.iml (rev 0)
+++ jbpm4/trunk/modules/userguide/userguide.iml 2009-04-08 13:30:13 UTC (rev 4500)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="true" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntryProperties />
+ </component>
+</module>
+
17 years
JBoss JBPM SVN: r4499 - projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-08 08:33:28 -0400 (Wed, 08 Apr 2009)
New Revision: 4499
Modified:
projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html
Log:
Display demo user logins
Modified: projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html
===================================================================
--- projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html 2009-04-08 12:33:08 UTC (rev 4498)
+++ projects/gwt-console/trunk/war/src/main/resources/org/jboss/bpm/console/public/Application.html 2009-04-08 12:33:28 UTC (rev 4499)
@@ -31,11 +31,40 @@
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic ui -->
<!-- -->
-<body>
-
+<body style="font:sans-serif;">
<p>
-<h4 style="text-align:center;">BPM console preview. Login as admin/admin</h4>
-</p>
+ <center>
+ <br/>
+ <table width=250 style="color:gray;position:relative;">
+ <th colspan=3>Demo user accounts</th>
+ <tr style="font-weight:bold">
+ <td>Role</td>
+ <td>Username</td>
+ <td>Password</td>
+ </tr>
+ <tr>
+ <td>Manager</td>
+ <td>mike</td>
+ <td>password</td>
+ </tr>
+ <tr>
+ <td>User</td>
+ <td>peter</td>
+ <td>password</td>
+ </tr>
+ <tr>
+ <td>User</td>
+ <td>mary</td>
+ <td>password</td>
+ </tr>
+ <tr>
+ <td>Administrator</td>
+ <td>alex</td>
+ <td>password</td>
+ </tr>
+ </table>
+ </center>
+ </p>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" style="width: 0; height: 0; border: 0"></iframe>
17 years
JBoss JBPM SVN: r4498 - projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-08 08:33:08 -0400 (Wed, 08 Apr 2009)
New Revision: 4498
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
Log:
Remove process deployment from console
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-04-08 12:15:59 UTC (rev 4497)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-04-08 12:33:08 UTC (rev 4498)
@@ -77,7 +77,7 @@
// ----------------------------------
- Panel outerFormPanel = new Panel();
+ /*Panel outerFormPanel = new Panel();
outerFormPanel.setBorder(false);
outerFormPanel.setPaddings(10);
@@ -140,10 +140,10 @@
}
);
- outerFormPanel.add(formPanel);
+ outerFormPanel.add(formPanel); */
this.add(processDefinitionList);
- this.add(outerFormPanel);
+ //this.add(outerFormPanel);
}
17 years
JBoss JBPM SVN: r4497 - jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-08 08:15:59 -0400 (Wed, 08 Apr 2009)
New Revision: 4497
Modified:
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
Log:
Fix JBPM-2151: no environment to get org.jbpm.session.RepositorySession
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-04-08 11:57:51 UTC (rev 4496)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessManagementImpl.java 2009-04-08 12:15:59 UTC (rev 4497)
@@ -34,6 +34,8 @@
import org.jbpm.ProcessDefinition;
import org.jbpm.ProcessDefinitionQuery;
import org.jbpm.RepositoryService;
+import org.jbpm.env.Environment;
+import org.jbpm.env.EnvironmentFactory;
import org.jbpm.model.OpenExecution;
/**
@@ -41,127 +43,214 @@
*/
class ProcessManagementImpl extends JBPMIntegration implements ProcessManagement
{
-
+
public List<ProcessDefinitionRef> getProcessDefinitions()
{
- List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- List<ProcessDefinition> definitions = repositoryService.createProcessDefinitionQuery()
- .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
- .execute();
-
- // adopt ProcessDefinition to console model
- for(ProcessDefinition processDefinition : definitions)
+ try
{
- results.add( ModelAdaptor.adoptDefinition(processDefinition) );
+ List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
+
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ List<ProcessDefinition> definitions = repositoryService.createProcessDefinitionQuery()
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .execute();
+
+ // adopt ProcessDefinition to console model
+ for(ProcessDefinition processDefinition : definitions)
+ {
+ results.add( ModelAdaptor.adoptDefinition(processDefinition) );
+ }
+
+ return results;
}
+ finally
+ {
+ env.close();
+ }
- return results;
-
}
public ProcessDefinitionRef getProcessDefinition(String procDefId)
{
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
- .id(procDefId)
- .uniqueResult();
- return ModelAdaptor.adoptDefinition(processDefinition);
+
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .id(procDefId)
+ .uniqueResult();
+ return ModelAdaptor.adoptDefinition(processDefinition);
+
+ }
+ finally
+ {
+ env.close();
+ }
}
public List<ProcessDefinitionRef> removeProcessDefinition(String procDefId)
{
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
- .id(procDefId)
- .uniqueResult();
- if (processDefinition!=null) {
- repositoryService.deleteDeploymentCascade(processDefinition.getDeploymentDbid());
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .id(procDefId)
+ .uniqueResult();
+ if (processDefinition!=null) {
+ repositoryService.deleteDeploymentCascade(processDefinition.getDeploymentDbid());
+ }
+ return getProcessDefinitions();
}
- return getProcessDefinitions();
+ finally
+ {
+ env.close();
+ }
}
public List<ProcessInstanceRef> getProcessInstances(String procDefId)
{
- ExecutionService execService = this.processEngine.getExecutionService();
- ExecutionQuery query = execService.createExecutionQuery();
- query.processDefinitionId(String.valueOf(procDefId));
-
- List<Execution> executions = query.execute();
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- List<ProcessInstanceRef> results = adoptTopLevelExecutions(executions);
+ try
+ {
- return results;
+ ExecutionService execService = this.processEngine.getExecutionService();
+ ExecutionQuery query = execService.createExecutionQuery();
+ query.processDefinitionId(String.valueOf(procDefId));
+
+ List<Execution> executions = query.execute();
+
+ List<ProcessInstanceRef> results = adoptTopLevelExecutions(executions);
+
+ return results;
+ }
+ finally
+ {
+ env.close();
+ }
}
private List<ProcessInstanceRef> adoptTopLevelExecutions(List<Execution> executions)
{
- List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
- for(Execution exec : executions)
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
{
- if(exec.isEnded())
+
+ List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
+ for(Execution exec : executions)
{
- System.out.println("*** JBPM-2055: Execution ("+exec.getId()+") is already ended. " +
- "Should not show up in query");
- continue;
- }
+ if(exec.isEnded())
+ {
+ System.out.println("*** JBPM-2055: Execution ("+exec.getId()+") is already ended. " +
+ "Should not show up in query");
+ continue;
+ }
- if(exec.isProcessInstance()) // parent execution
- {
- results.add( ModelAdaptor.adoptExecution((OpenExecution)exec) );
+ if(exec.isProcessInstance()) // parent execution
+ {
+ results.add( ModelAdaptor.adoptExecution((OpenExecution)exec) );
+ }
}
+ return results;
}
- return results;
+ finally
+ {
+ env.close();
+ }
}
public ProcessInstanceRef getProcessInstance(String instanceId)
{
- ExecutionService execService = this.processEngine.getExecutionService();
- ExecutionQuery query = execService.createProcessInstanceQuery();
- query.processInstanceId(instanceId);
- List<Execution> executions = query.execute();
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- if(executions.size()>1 || executions.isEmpty())
- throw new IllegalStateException("No precise match for instanceId " + instanceId +". Num results "+executions);
+ try
+ {
- return ModelAdaptor.adoptExecution( (OpenExecution)executions.get(0));
+ ExecutionService execService = this.processEngine.getExecutionService();
+ ExecutionQuery query = execService.createProcessInstanceQuery();
+ query.processInstanceId(instanceId);
+ List<Execution> executions = query.execute();
+
+ if(executions.size()>1 || executions.isEmpty())
+ throw new IllegalStateException("No precise match for instanceId " + instanceId +". Num results "+executions);
+
+ return ModelAdaptor.adoptExecution( (OpenExecution)executions.get(0));
+ }
+ finally
+ {
+ env.close();
+ }
}
public ProcessInstanceRef newInstance(String definitionId)
{
- ExecutionService execService = this.processEngine.getExecutionService();
- Execution exec = execService.startProcessInstanceById(definitionId);
- return ModelAdaptor.adoptExecution((OpenExecution)exec);
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ ExecutionService execService = this.processEngine.getExecutionService();
+ Execution exec = execService.startProcessInstanceById(definitionId);
+ return ModelAdaptor.adoptExecution((OpenExecution)exec);
+ }
+ finally{
+ env.close();
+ }
}
public void setProcessState(String executionId, ProcessInstanceRef.STATE nextState)
{
- if(ProcessInstanceRef.STATE.ENDED==nextState)
+
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
{
- // TODO: It's actually a delete call. Once we got the 'cancel' notion this should be changed
- ExecutionService execService = this.processEngine.getExecutionService();
- Execution exec = execService.findExecution(executionId);
- if(null==exec)
- throw new IllegalArgumentException("No such execution with id "+ executionId);
-
- execService.deleteProcessInstance(executionId);
+ if(ProcessInstanceRef.STATE.ENDED==nextState)
+ {
+ // TODO: It's actually a delete call. Once we got the 'cancel' notion this should be changed
+ ExecutionService execService = this.processEngine.getExecutionService();
+ Execution exec = execService.findExecution(executionId);
+ if(null==exec)
+ throw new IllegalArgumentException("No such execution with id "+ executionId);
+
+ execService.deleteProcessInstance(executionId);
+ }
+ else
+ {
+ throw new IllegalArgumentException("State " + nextState + " currently not supported");
+ }
}
- else
+ finally
{
- throw new IllegalArgumentException("State " + nextState + " currently not supported");
+ env.close();
}
}
public void signalExecution(String executionId, String signal)
- {
- ExecutionService execService = this.processEngine.getExecutionService();
+ {
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- if(null==signal)
- execService.signalExecutionById(executionId);
- else
- execService.signalExecutionById(executionId, signal);
-
+ try
+ {
+ ExecutionService execService = this.processEngine.getExecutionService();
+
+ if(null==signal)
+ execService.signalExecutionById(executionId);
+ else
+ execService.signalExecutionById(executionId, signal);
+ }
+ finally
+ {
+ env.close();
+ }
+
}
public void deploy(String fileName, String contentType, InputStream deployment)
17 years
JBoss JBPM SVN: r4496 - in jbpm4/trunk/modules: examples/src/test/resources and 3 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-08 07:57:51 -0400 (Wed, 08 Apr 2009)
New Revision: 4496
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
Log:
Fix JBPM-2149
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/hibernate/mapping.files/jbpm.repository.hbm.xml 2009-04-08 11:57:51 UTC (rev 4496)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:57:51 UTC (rev 4496)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:57:51 UTC (rev 4496)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:57:51 UTC (rev 4496)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:57:51 UTC (rev 4496)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
17 years
JBoss JBPM SVN: r4495 - in jbpm4/branches/jbpm-4.0.0.Beta1/modules: jpdl/src/test/resources and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-08 07:48:15 -0400 (Wed, 08 Apr 2009)
New Revision: 4495
Modified:
jbpm4/branches/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/jbpm-4.0.0.Beta1/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/jbpm-4.0.0.Beta1/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
jbpm4/branches/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
Log:
Fix remaining type=string occurances
Modified: jbpm4/branches/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 10:02:37 UTC (rev 4494)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
Modified: jbpm4/branches/jbpm-4.0.0.Beta1/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 10:02:37 UTC (rev 4494)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/jpdl/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
Modified: jbpm4/branches/jbpm-4.0.0.Beta1/modules/pvm/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 10:02:37 UTC (rev 4494)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/pvm/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
Modified: jbpm4/branches/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 10:02:37 UTC (rev 4494)
+++ jbpm4/branches/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/jbpm.repository.hbm.xml 2009-04-08 11:48:15 UTC (rev 4495)
@@ -19,7 +19,7 @@
<key foreign-key="FK_LOB_DEPLOYMENT">
<column name="DEPLOYMENT_" index="IDX_LOB_DEPLOYMENT" />
</key>
- <map-key type="string" column="NAME_" />
+ <map-key type="text" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.lob.Lob"/>
</map>
@@ -47,4 +47,4 @@
<property name="longValue" column="LONGVAL_" />
</class>
-</hibernate-mapping>
\ No newline at end of file
+</hibernate-mapping>
17 years