JBoss JBPM SVN: r5192 - in jbpm4/trunk/modules: api/src/main/resources and 14 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-02 12:38:22 -0400 (Thu, 02 Jul 2009)
New Revision: 5192
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinition.java
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
jbpm4/trunk/modules/examples/pom.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/assignee/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/notification/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/reminder/process.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
JBPM-2378 JBPM-2352 fixed xsd stuff
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinition.java 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ProcessDefinition.java 2009-07-02 16:38:22 UTC (rev 5192)
@@ -55,4 +55,7 @@
/** the name of the resource in the deployment which contains the image
* file for this process */
String getImageResourceName();
+
+ /** description of the process definition */
+ String getDescription();
}
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-07-02 16:38:22 UTC (rev 5192)
@@ -29,7 +29,8 @@
is the top level element in a jPDL process file.</documentation></annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="description" minOccurs="0" maxOccurs="unbounded" type="string" />
+ <element ref="tns:swimlane" minOccurs="0" maxOccurs="unbounded" />
<element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
<element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
<group ref="tns:activityGroup" minOccurs="0" maxOccurs="unbounded" />
@@ -79,6 +80,10 @@
<element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attributeGroup ref="tns:activityAttributes" />
+ <attribute name="form" type="string">
+ <annotation><documentation>the resource name of the form in the
+ deployment.</documentation></annotation>
+ </attribute>
</complexType>
</element>
@@ -305,6 +310,23 @@
</complexType>
</element>
+ <!-- ~~~ MAIL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="mail">
+ <annotation><documentation>Sends an email
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:mailType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
<!-- ~~~ JAVA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="java">
<annotation><documentation>Invokes a method on a java object.
@@ -325,6 +347,24 @@
</complexType>
</element>
+ <!-- ~~~ CUSTOM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <element name="custom">
+ <annotation><documentation>Uses a user defined, custom implementation of
+ ActivityBehaviour
+ </documentation></annotation>
+ <complexType>
+ <complexContent>
+ <extension base="tns:wireObjectType">
+ <sequence>
+ <element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="tns:transition" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attributeGroup ref="tns:activityAttributes" />
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
<!-- ~~~ TASK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<element name="task">
<annotation><documentation>Creates a task in the task component.
@@ -333,6 +373,18 @@
<sequence>
<element name="assignment-handler" minOccurs="0" type="tns:wireObjectType" />
<element ref="tns:on" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="notification" minOccurs="0">
+ <complexType>
+ <attribute name="continue" type="tns:continueType" default="sync" />
+ </complexType>
+ </element>
+ <element name="reminder" minOccurs="0">
+ <complexType>
+ <attribute name="duedate" type="string" />
+ <attribute name="repeat" type="string" />
+ <attribute name="continue" type="tns:continueType" default="sync" />
+ </complexType>
+ </element>
<element ref="tns:timer" minOccurs="0" maxOccurs="unbounded"/>
<element name="transition" minOccurs="0" maxOccurs="unbounded">
<complexType>
@@ -349,6 +401,11 @@
<attributeGroup ref="tns:activityAttributes" />
<attributeGroup ref="tns:assignmentAttributes"/>
<attribute name="swimlane" type="string" />
+ <attribute name="form" type="string">
+ <annotation><documentation>the resource name of the form in the
+ deployment.</documentation></annotation>
+ </attribute>
+ <attribute name="duedate" type="string" />
<attribute name="on-transition" default="cancel">
<simpleType>
<restriction base="string">
@@ -417,7 +474,6 @@
</element>
<!-- ~~~ group ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <!--
<element name="group">
<annotation><documentation>Scope enclosing a number of activities.
</documentation></annotation>
@@ -433,7 +489,6 @@
<attributeGroup ref="tns:activityAttributes" />
</complexType>
</element>
- -->
</choice>
</group>
@@ -916,18 +971,22 @@
<annotation><documentation>Graphical information used by process designer tool.
</documentation></annotation>
</attribute>
- <attribute name="async">
- <annotation><documentation>Graphical information used by process designer tool.
+ <attribute name="continue" default="sync" type="tns:continueType">
+ <annotation><documentation>To specify async continuations.
+ sync is the default.
</documentation></annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="true" />
- <enumeration value="exclusive" />
- </restriction>
- </simpleType>
</attribute>
</attributeGroup>
+ <simpleType name="continueType">
+ <restriction base="string">
+ <enumeration value="async" />
+ <enumeration value="sync" />
+ <enumeration value="exclusive" />
+ </restriction>
+ </simpleType>
+
+
<attributeGroup name="assignmentAttributes">
<annotation><documentation>the assignment attributes will be used in
tasks and swimlanes to specify to whom these respectively are assigned.
@@ -1066,73 +1125,58 @@
<element name="sql" type="tns:qlType" />
<element name="java" type="tns:javaType" />
<element name="script" type="tns:scriptType" />
+ <element name="mail" type="tns:mailType" />
</choice>
</group>
- <complexType name="emailType">
+ <complexType name="mailType">
<sequence>
- <element name="property">
- <annotation><documentation>Template property value</documentation></annotation>
+ <element name="from" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="to" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="cc" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="bcc" type="tns:mailRecipientType" minOccurs="0" />
+ <element name="subject" type="string" minOccurs="0" />
+ <element name="text" type="string" minOccurs="0" />
+ <element name="html" type="string" minOccurs="0" />
+ <element name="attachments" minOccurs="0" >
<complexType>
- <attribute name="name" type="string" />
- <attribute name="value" type="string" />
+ <sequence>
+ <element name="attachment" maxOccurs="unbounded">
+ <complexType>
+ <attribute name="url" type="string">
+ <annotation><documentation>URL reference to the attachment</documentation></annotation>
+ </attribute>
+ <attribute name="resource" type="string">
+ <annotation><documentation>Name of the attachment resource on the classpath</documentation></annotation>
+ </attribute>
+ <attribute name="file" type="string">
+ <annotation><documentation>File reference to the attachment</documentation></annotation>
+ </attribute>
+ </complexType>
+ </element>
+ </sequence>
</complexType>
</element>
</sequence>
- <attribute name="to" type="string" />
- <attribute name="type" type="string">
+ <attribute name="template" type="string">
<annotation><documentation>Reference to the email template</documentation></annotation>
</attribute>
</complexType>
- <complexType name="taskType" >
- <!--
- <sequence>
- <element name="reminder">
- <complexType>
- <attribute name="duedate" type="string" use="required" />
- <attribute name="repeat" type="string" />
- </complexType>
- </element>
- </sequence>
- -->
- <attributeGroup ref="tns:assignmentAttributes" />
- <attribute name="form" type="string">
+ <complexType name="mailRecipientType">
+ <attribute name="addresses" type="string">
+ <annotation><documentation>list of email address separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
</attribute>
- <attribute name="swimlane" type="string">
+ <attribute name="users" type="string">
+ <annotation><documentation>list of user ids that are resolved to the email address against configured identity component.
+ user ids should be separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
</attribute>
- <attribute name="description" type="string" />
- <attribute name="duedate" type="string" />
- <attribute name="notify" type="boolean" default="false"/>
- <!--
- <attribute name="subtasksync">
- <simpleType>
- <union>
- <simpleType>
- <restriction base="string">
- <enumeration value="last">
- <annotation><documentation>When the last subtask completes,
- this task is completed.</documentation></annotation>
- </enumeration>
- <enumeration value="first">
- <annotation><documentation>When the first subtask completes,
- this task is completed.</documentation></annotation>
- </enumeration>
- </restriction>
- </simpleType>
- <simpleType>
- <restriction base="int">
- <annotation><documentation>The number of subtasks that
- have to complete before this task is considered
- completed.</documentation></annotation>
- </restriction>
- </simpleType>
- </union>
- </simpleType>
+ <attribute name="groups" type="string">
+ <annotation><documentation>list of group ids that are resolved to the email address against configured identity component.
+ group ids should be separated by ',' (comma) ';' (semicolon) '|' or whitespace</documentation></annotation>
</attribute>
- -->
</complexType>
-
+
<simpleType name="booleanValueType">
<restriction base="string">
<enumeration value="true" />
Modified: jbpm4/trunk/modules/examples/pom.xml
===================================================================
--- jbpm4/trunk/modules/examples/pom.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/examples/pom.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -75,7 +75,6 @@
</dependencies>
<profiles>
-
<!-- -Ddatabase= -->
<profile>
<id>standalone.tests</id>
@@ -131,7 +130,6 @@
<name>jboss.bind.address</name>
</property>
</activation>
-
<dependencies>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
@@ -151,11 +149,8 @@
<scope>test</scope>
</dependency>
</dependencies>
-
-
<build>
<plugins>
-
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
@@ -177,14 +172,6 @@
</execution>
</executions>
</plugin>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <failIfNoTests>false</failIfNoTests>
- <trimStackTrace>false</trimStackTrace>
- </configuration>
- </plugin>
</plugins>
</build>
</profile>
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="InlineMail">
+<process name="InlineMail" xmlns="http://jbpm.org/4.0/jpdl">
<start g="20,25,80,40">
<transition to="send rectify note" />
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/assignee/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/assignee/process.jpdl.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/assignee/process.jpdl.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="TaskAssignee">
+<process name="TaskAssignee" xmlns="http://jbpm.org/4.0/jpdl">
<start g="20,20,48,48">
<transition to="review" />
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="TaskCandidates">
+<process name="TaskCandidates" xmlns="http://jbpm.org/4.0/jpdl">
<start g="20,20,48,48">
<transition to="review" />
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/notification/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/notification/process.jpdl.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/notification/process.jpdl.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="TaskNotification">
+<process name="TaskNotification" xmlns="http://jbpm.org/4.0/jpdl">
<start g="20,20,48,48">
<transition to="review"/>
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/reminder/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/reminder/process.jpdl.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/reminder/process.jpdl.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="TaskReminder">
+<process name="TaskReminder" xmlns="http://jbpm.org/4.0/jpdl">
<start g="20,20,48,48">
<transition to="review"/>
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/task/variables/process.jpdl.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process name="TaskVariables">
+<process name="TaskVariables" xmlns="http://jbpm.org/4.0/jpdl">
<start g="20,20,48,48">
<transition to="review" />
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-07-02 16:38:22 UTC (rev 5192)
@@ -45,7 +45,7 @@
protected static final WireParser wireParser = JpdlParser.wireParser;
public JpdlBinding(String tagName) {
- super(tagName, "http://jbpm.org/4.0/jpdl", null);
+ super(tagName, JpdlParser.JPDL_NAMESPACE, null);
}
public void parseName(Element element, ActivityImpl activity, Parse parse) {
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-07-02 16:38:22 UTC (rev 5192)
@@ -83,7 +83,9 @@
public class JpdlParser extends Parser {
private static final Log log = Log.getLog(JpdlParser.class.getName());
-
+
+ public static final String JPDL_NAMESPACE = "http://jbpm.org/4.0/jpdl";
+
public static final WireParser wireParser = WireParser.getInstance();
// array elements are mutable, even when final
@@ -254,6 +256,12 @@
activityBinding.parseName(nestedElement, activity, parse);
parseTransitions(nestedElement, activity, parse);
+ Element descriptionElement = XmlUtil.element(documentElement, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ activity.setDescription(description);
+ }
+
String continuationText = XmlUtil.attribute(nestedElement, "continue");
if (continuationText!=null) {
if ("async".equals(continuationText)) {
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlSchemaTest.java 2009-07-02 16:38:22 UTC (rev 5192)
@@ -24,6 +24,7 @@
import java.util.List;
import org.jbpm.api.Problem;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
/**
@@ -34,7 +35,7 @@
public void testSimplestValidProcess() {
List<Problem> problems = jpdlParser.createParse()
.setString(
- "<jpdl:process xmlns:jpdl='http://jbpm.org/4.0/jpdl' " +
+ "<jpdl:process xmlns:jpdl='"+JpdlParser.JPDL_NAMESPACE+"' " +
" name='p' >" +
" <jpdl:start name='n' />" +
"</jpdl:process>"
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java 2009-07-02 16:38:22 UTC (rev 5192)
@@ -43,11 +43,6 @@
}
public void testInvalidXml() {
- if (true) {
- System.out.println("FIXME: unavailable schema resource: jpdl-4.0.xsd");
- return;
- }
-
List<Problem> problems = new JpdlParser()
.createParse()
.setResource("org/jbpm/test/xml/invalid.jpdl.xml")
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java 2009-07-02 16:38:22 UTC (rev 5192)
@@ -52,7 +52,6 @@
import org.jbpm.pvm.internal.email.spi.MailProducer;
import org.jbpm.pvm.internal.env.Environment;
import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.script.ScriptManager;
/**
@@ -146,7 +145,7 @@
}
private String[] tokenizeActors(String recipients, Execution execution) {
- String[] actors = evaluateExpression(recipients, execution).split("[,|\\s]+");
+ String[] actors = evaluateExpression(recipients, execution).split("[,;|\\s]+");
if (actors.length == 0) throw new JbpmException("recipient list is empty: " + recipients);
return actors;
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java 2009-07-02 16:38:22 UTC (rev 5192)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test.process;
+
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DescriptionTest extends JbpmTestCase {
+
+ public void testProcessDefinitionDescription() {
+ deployJpdlXmlString(
+ "<process name='make print' xmlns='"+JpdlParser.JPDL_NAMESPACE+"' >" +
+ " <description>This process makes a print</description>" +
+ " <start />" +
+ "</process>"
+ );
+
+ ProcessDefinition processDefinition = repositoryService
+ .createProcessDefinitionQuery()
+ .processDefinitionName("make print")
+ .uniqueResult();
+
+ assertEquals("This process makes a print", processDefinition.getDescription());
+ }
+
+// activity's are not yet available through the api
+//
+// public void testActivityDescription() {
+// deployJpdlXmlString(
+// "<process name='make print' xmlns='"+JpdlParser.JPDL_NAMESPACE+"' >" +
+// " <start>" +
+// " <description>This process is started when the user clicks a button</description>" +
+// " </start>" +
+// "</process>"
+// );
+//
+// ProcessDefinition processDefinition = repositoryService
+// .createProcessDefinitionQuery()
+// .processDefinitionName("make print")
+// .uniqueResult();
+//
+// }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/DescriptionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-07-02 13:46:33 UTC (rev 5191)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2009-07-02 16:38:22 UTC (rev 5192)
@@ -2256,15 +2256,6 @@
configuration file. If absent, the template must be specified
inline using the child elements.</entry>
</row>
- <row>
- <entry>template</entry>
- <entry>string</entry>
- <entry></entry>
- <entry>no</entry>
- <entry>Reference to a <literal>mail-template</literal> element in the
- configuration file. If absent, the template must be specified
- inline using the nested elements.</entry>
- </row>
</tbody>
</tgroup>
</table>
14 years, 11 months
JBoss JBPM SVN: r5191 - jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-02 09:46:33 -0400 (Thu, 02 Jul 2009)
New Revision: 5191
Modified:
jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java
Log:
Return null when no process image could be found
Modified: jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java 2009-07-02 13:45:28 UTC (rev 5190)
+++ jbpm4/trunk/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java 2009-07-02 13:46:33 UTC (rev 5191)
@@ -74,7 +74,7 @@
);
if(null==in)
- throw new RuntimeException("Failed to retrieve image resource: " +imgRes);
+ return null; //throw new RuntimeException("Failed to retrieve image resource: " +imgRes);
ByteArrayOutputStream out = new ByteArrayOutputStream();
final int BUF_SIZE = 1 << 8; //1KiB buffer
14 years, 11 months
JBoss JBPM SVN: r5190 - projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-02 09:45:28 -0400 (Thu, 02 Jul 2009)
New Revision: 5190
Modified:
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
Log:
Status 404 when no process image is given
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2009-07-02 13:08:35 UTC (rev 5189)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2009-07-02 13:45:28 UTC (rev 5190)
@@ -37,6 +37,8 @@
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Context;
+import javax.servlet.http.HttpServletRequest;
import java.net.URL;
import java.util.List;
import java.util.Map;
@@ -268,14 +270,20 @@
@Path("definition/{id}/image")
@Produces("image/*")
public Response getProcessImage(
- @PathParam("id")
- String id
+ @Context
+ HttpServletRequest request,
+ @PathParam("id")
+ String id
)
{
GraphViewerPlugin plugin = getProcessGraphViewPlugin();
if(plugin !=null)
{
- return Response.ok(plugin.getProcessImage(id)).type("image/png").build();
+ byte[] processImage = plugin.getProcessImage(id);
+ if(processImage!=null)
+ return Response.ok(processImage).type("image/png").build();
+ else
+ return Response.status(404).build();
}
throw new RuntimeException(
14 years, 11 months
JBoss JBPM SVN: r5189 - in jbpm3/trunk/modules/core/src: test/java/org/jbpm and 1 other directories.
by do-not-reply@jboss.org
Author: mputz
Date: 2009-07-02 09:08:35 -0400 (Thu, 02 Jul 2009)
New Revision: 5189
Added:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm2375/
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java
Log:
Fix for JBPM-2375 - JobExecutorThread is terminated after an Error: LockMonitorThread restarts terminated JobExecutorThreads.
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2009-07-02 13:03:14 UTC (rev 5188)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java 2009-07-02 13:08:35 UTC (rev 5189)
@@ -8,6 +8,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -50,7 +51,8 @@
for (int i = 0; i < nbrOfThreads; i++) {
startThread();
}
- lockMonitorThread = new LockMonitorThread(this);
+ lockMonitorThread = new LockMonitorThread(getLockMonitorThreadName(), this);
+ lockMonitorThread.start();
isStarted = true;
}
else {
@@ -102,9 +104,31 @@
if (lockMonitorThread != null) lockMonitorThread.join();
}
+
+ public void ensureThreadsAreActive() {
+ List<String> deadThreads = new ArrayList<String>();
+ for (Iterator i = threads.values().iterator(); i.hasNext();) {
+ Thread thread = (Thread) i.next();
+ if (!thread.isAlive()) {
+ if(log.isDebugEnabled())
+ {
+ log.debug("detected dead thread '" + thread.getName() + "'");
+ }
+ deadThreads.add(thread.getName());
+ i.remove();
+ }
+ }
+ for (int i = 0; i<deadThreads.size(); i++) {
+ startThread(deadThreads.get(i));
+ }
+ }
- protected synchronized void startThread() {
- String threadName = getNextThreadName();
+ protected void startThread() {
+ startThread(getNextThreadName());
+ }
+
+ protected synchronized void startThread(String name) {
+ String threadName = name;
Thread thread = createThread(threadName);
threads.put(threadName, thread);
if(log.isDebugEnabled())
@@ -129,6 +153,10 @@
private String getThreadName(int index) {
return name + '@' + getHostAddress() + ':' + index;
}
+
+ private String getLockMonitorThreadName() {
+ return name + ':' + LockMonitorThread.DEFAULT_NAME + '@' + getHostAddress();
+ }
private static String getHostAddress() {
if (hostName == null) {
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java 2009-07-02 13:03:14 UTC (rev 5188)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/job/executor/LockMonitorThread.java 2009-07-02 13:08:35 UTC (rev 5189)
@@ -15,6 +15,8 @@
public class LockMonitorThread extends Thread {
+ public static final String DEFAULT_NAME = "LockMonitorThread";
+
JbpmConfiguration jbpmConfiguration;
int lockMonitorInterval;
int maxLockTime;
@@ -23,6 +25,11 @@
volatile boolean isActive = true;
public LockMonitorThread(JobExecutor jobExecutor) {
+ this(DEFAULT_NAME, jobExecutor);
+ }
+
+ public LockMonitorThread(String name, JobExecutor jobExecutor) {
+ super(name);
jbpmConfiguration = jobExecutor.getJbpmConfiguration();
lockMonitorInterval = jobExecutor.getLockMonitorInterval();
maxLockTime = jobExecutor.getMaxLockTime();
@@ -44,6 +51,7 @@
while (isActive) {
try {
unlockOverdueJobs();
+ jbpmConfiguration.getJobExecutor().ensureThreadsAreActive();
if (isActive && lockMonitorInterval > 0) {
sleep(lockMonitorInterval);
}
Added: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java (rev 0)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm2375/JBPM2375Test.java 2009-07-02 13:08:35 UTC (rev 5189)
@@ -0,0 +1,123 @@
+package org.jbpm.jbpm2375;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.EventCallback;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.job.executor.JobExecutor;
+
+/**
+ * Test if the JobExecutorThread recovers from an Error
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2357">JBPM-2357</a>
+ * @author mputz(a)redhat.com
+ * @since 30-Jun-2009
+ */
+public class JBPM2375Test extends AbstractDbTestCase {
+
+ private static final int TEST_TIMEOUT = 10 * 1000;
+
+ private JobExecutor jobExecutor = new JobExecutor();
+ private long processDefinitionId;
+
+ // a process definition with two timers moving the token forward
+ // the second state has an action associated with the node-enter event,
+ // which can simulate an Error condition by throwing a NoClassDefFoundError
+ private static final String PROCESS_DEFINITION = "<process-definition name='jbpm2375-timer-error-test'>"
+ + " <event type='process-end'>"
+ + " <action expression='#{eventCallback.processEnd}' />"
+ + " </event>"
+ + " <start-state name='start'>"
+ + " <transition to='state1' name='to_state1'/>"
+ + " </start-state>"
+ + " <state name='state1'>"
+ + " <timer name='moveToDefaultEndAfter1second' duedate='1 second' transition='to_state2'/>"
+ + " <transition to='state2' name='to_state2'/>"
+ + " </state>"
+ + " <state name='state2'>"
+ + " <timer name='moveToEndAfter1second' duedate='1 second' transition='to_end'/>"
+ + " <event type='node-enter'>"
+ + " <action name='exceptionTest' class='"
+ + TimerExceptionAction.class.getName()
+ + "'>"
+ + " </action>"
+ + " </event>"
+ + " <transition to='end' name='to_end'/>"
+ + " </state>"
+ + " <end-state name='end' />"
+ + "</process-definition>";
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(PROCESS_DEFINITION);
+ jbpmContext.deployProcessDefinition(processDefinition);
+ newTransaction();
+ processDefinitionId = processDefinition.getId();
+
+ getJbpmConfiguration().getJobExecutor().setLockMonitorInterval(TEST_TIMEOUT/2);
+ startJobExecutor();
+
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ stopJobExecutor();
+
+ graphSession.deleteProcessDefinition(processDefinitionId);
+
+ EventCallback.clear();
+ super.tearDown();
+ }
+
+ // check if the process ends correctly if no Error is thrown
+ public void testTimerWithoutErrorAction() {
+ runTimerErrorAction(Boolean.FALSE);
+ }
+
+ // check if the process ends correctly if an Error is thrown in the ActionHandler
+ public void testTimerWithErrorAction() {
+ runTimerErrorAction(Boolean.TRUE);
+ }
+
+ private void runTimerErrorAction(Boolean withError) {
+
+ // kick off process instance
+ ProcessDefinition processDefinition = graphSession.loadProcessDefinition(processDefinitionId);
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.getContextInstance().setVariable("eventCallback", new EventCallback());
+ processInstance.getContextInstance().setVariable("throwError", withError);
+ processInstance.signal();
+ jbpmContext.save(processInstance);
+
+ commitAndCloseSession();
+ try {
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END, TEST_TIMEOUT);
+
+ waitForJobs(TEST_TIMEOUT);
+
+ } finally {
+ beginSessionTransaction();
+ }
+
+ }
+
+
+ public static class TimerExceptionAction implements ActionHandler {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ExecutionContext executionContext) throws Exception {
+ Boolean throwError = (Boolean)executionContext.getVariable("throwError");
+ if (throwError)
+ throw new NoClassDefFoundError("org.jbpm.no.class.Class");
+ }
+ }
+}
14 years, 11 months
JBoss JBPM SVN: r5188 - in projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client: process and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-02 09:03:14 -0400 (Thu, 02 Jul 2009)
New Revision: 5188
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
Log:
Fix filter panel layout on FF3
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java 2009-07-02 12:46:12 UTC (rev 5187)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/engine/DeploymentListView.java 2009-07-02 13:03:14 UTC (rev 5188)
@@ -207,7 +207,7 @@
toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
// filter
- LayoutPanel filterPanel = new LayoutPanel();
+ LayoutPanel filterPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
filterPanel.setStyleName("bpm-filter-panel");
final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
dropBox.setStyleName("bpm-operation-ui");
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-07-02 12:46:12 UTC (rev 5187)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-07-02 13:03:14 UTC (rev 5188)
@@ -109,7 +109,7 @@
toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
// filter
- LayoutPanel filterPanel = new LayoutPanel();
+ LayoutPanel filterPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
filterPanel.setStyleName("bpm-filter-panel");
final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
dropBox.setStyleName("bpm-operation-ui");
14 years, 11 months
JBoss JBPM SVN: r5187 - projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-02 08:46:12 -0400 (Thu, 02 Jul 2009)
New Revision: 5187
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java
Log:
Avoid rendering of complex data types in InstanceDataView
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-07-02 11:50:43 UTC (rev 5186)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-07-02 12:46:12 UTC (rev 5187)
@@ -245,8 +245,6 @@
for(ProcessDefinitionRef def : definitions)
{
- System.out.println("->"+def.getUrl());
-
if(FILTER_NONE==currentFilter)
{
model.add(def);
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java 2009-07-02 11:50:43 UTC (rev 5186)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java 2009-07-02 12:46:12 UTC (rev 5187)
@@ -26,11 +26,10 @@
import com.mvc4g.client.Controller;
import com.mvc4g.client.ViewInterface;
import org.gwt.mosaic.ui.client.ListBox;
-import org.gwt.mosaic.ui.client.ScrollLayoutPanel;
-import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.LazyPanel;
+import org.jboss.bpm.console.client.util.ConsoleLog;
import java.util.ArrayList;
import java.util.List;
@@ -71,7 +70,7 @@
DataEntry item) {
switch (column) {
case 0:
- listBox.setText(row, column, item.key);
+ listBox.setText(row, column, item.key);
break;
case 1:
listBox.setText(row, column, item.xsd);
@@ -116,32 +115,46 @@
{
// parse the XML document into a DOM
//Document messageDom = XMLParser.parse(messageXml);
-
+
Node dataSetNode = messageDom.getElementsByTagName("dataset").item(0);
- List<Node> dataNodeList = filterChildNodes(dataSetNode.getChildNodes());
- List<DataEntry> data = new ArrayList<DataEntry>();
+ List<Node> dataSetNodeChildren = filterChildNodes(dataSetNode.getChildNodes());
+ List<DataEntry> results = new ArrayList<DataEntry>();
- for(Node n : dataNodeList)
+ for(Node dataNode : dataSetNodeChildren)
{
- DataEntry d = new DataEntry();
- NamedNodeMap atts = n.getAttributes();
+ DataEntry dataEntry = new DataEntry();
+ NamedNodeMap dataNodeAttributes = dataNode.getAttributes();
- Node valueNode = filterChildNodes(n.getChildNodes()).get(0); // expected to have just one child‚
- NamedNodeMap attsChild = valueNode.getAttributes();
+ Node valueNode = filterChildNodes(dataNode.getChildNodes()).get(0); // expected to have just one child‚
+ NamedNodeMap valueNodeAttributes = valueNode.getAttributes();
- d.key = atts.getNamedItem("key").getNodeValue();
- d.xsd = attsChild.getNamedItem("xsi:type").getNodeValue();
- d.java = atts.getNamedItem("javaType").getNodeValue();
- d.value = valueNode.getFirstChild().getNodeValue(); // text element is first child
+ dataEntry.key = dataNodeAttributes.getNamedItem("key").getNodeValue();
+ dataEntry.java = dataNodeAttributes.getNamedItem("javaType").getNodeValue();
+ dataEntry.xsd = valueNodeAttributes.getNamedItem("xsi:type").getNodeValue();
- data.add(d);
+ List<Node> valueChildElements = filterChildNodes(valueNode.getChildNodes());
+
+ if(valueChildElements.isEmpty()
+ && valueNode.hasChildNodes()
+ && Node.TEXT_NODE == valueNode.getChildNodes().item(0).getNodeType())
+ {
+ // simple type
+ dataEntry.value = valueNode.getFirstChild().getNodeValue();
+ }
+ else
+ {
+ // complex types or empty elements
+ dataEntry.value = "n/a";
+ }
+
+ results.add(dataEntry);
}
- bindData(data);
+ bindData(results);
}
- catch (DOMException e)
+ catch (Throwable e)
{
- Window.alert("Could not parse XML document.");
+ ConsoleLog.error("Failed to parse XML document", e);
}
}
@@ -149,7 +162,7 @@
private void bindData(List<DataEntry> data)
{
initialize();
-
+
final DefaultListModel<DataEntry> model =
(DefaultListModel<DataEntry>) listBox.getModel();
model.clear();
@@ -160,7 +173,7 @@
}
// layout again
- this.layout();
+ this.layout();
}
private List<Node> filterChildNodes(NodeList childNodes)
14 years, 11 months
JBoss JBPM SVN: r5186 - in projects/gwt-console/trunk/gui: war/src/main/java/org/jboss/bpm/console/client/process and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-07-02 07:50:43 -0400 (Thu, 02 Jul 2009)
New Revision: 5186
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstanceDataAction.java
Modified:
projects/gwt-console/trunk/gui/war/pom.xml
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java
projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
Log:
Fix JBPM-2236: View data associated with a process
Modified: projects/gwt-console/trunk/gui/war/pom.xml
===================================================================
--- projects/gwt-console/trunk/gui/war/pom.xml 2009-07-02 11:45:22 UTC (rev 5185)
+++ projects/gwt-console/trunk/gui/war/pom.xml 2009-07-02 11:50:43 UTC (rev 5186)
@@ -302,7 +302,7 @@
<version>${version}</version>
</dependency>
</dependencies>
- <build>
+ <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDataView.java 2009-07-02 11:50:43 UTC (rev 5186)
@@ -0,0 +1,188 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.xml.client.*;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.ViewInterface;
+import org.gwt.mosaic.ui.client.ListBox;
+import org.gwt.mosaic.ui.client.ScrollLayoutPanel;
+import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.gwt.mosaic.ui.client.list.DefaultListModel;
+import org.jboss.bpm.console.client.LazyPanel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InstanceDataView extends LayoutPanel implements ViewInterface, LazyPanel
+{
+ public final static String ID = InstanceDataView.class.getName();
+
+ private Controller controller;
+
+ private ListBox listBox;
+
+ private String instanceId;
+
+ private boolean isInitialized;
+
+ public InstanceDataView()
+ {
+ super();
+ this.setPadding(5);
+ }
+
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ listBox =
+ new ListBox<Node>(
+ new String[] {
+ "Key", "XSD Type", "Java Type", "Value"}
+ );
+
+ listBox.setCellRenderer(new ListBox.CellRenderer<DataEntry>() {
+ public void renderCell(ListBox<DataEntry> listBox, int row, int column,
+ DataEntry item) {
+ switch (column) {
+ case 0:
+ listBox.setText(row, column, item.key);
+ break;
+ case 1:
+ listBox.setText(row, column, item.xsd);
+ break;
+ case 2:
+ listBox.setText(row,column, item.java);
+ break;
+ case 3:
+ listBox.setText(row,column, item.value);
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
+ }
+ }
+ });
+
+ this.add(listBox);
+
+ this.isInitialized = true;
+ }
+ }
+
+ public boolean isInitialized()
+ {
+ return isInitialized;
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void update(String instanceId, Document xml)
+ {
+ this.instanceId = instanceId;
+ parseMessage(xml);
+ }
+
+ private void parseMessage(Document messageDom)
+ {
+ try
+ {
+ // parse the XML document into a DOM
+ //Document messageDom = XMLParser.parse(messageXml);
+
+ Node dataSetNode = messageDom.getElementsByTagName("dataset").item(0);
+ List<Node> dataNodeList = filterChildNodes(dataSetNode.getChildNodes());
+ List<DataEntry> data = new ArrayList<DataEntry>();
+
+ for(Node n : dataNodeList)
+ {
+ DataEntry d = new DataEntry();
+ NamedNodeMap atts = n.getAttributes();
+
+ Node valueNode = filterChildNodes(n.getChildNodes()).get(0); // expected to have just one child‚
+ NamedNodeMap attsChild = valueNode.getAttributes();
+
+ d.key = atts.getNamedItem("key").getNodeValue();
+ d.xsd = attsChild.getNamedItem("xsi:type").getNodeValue();
+ d.java = atts.getNamedItem("javaType").getNodeValue();
+ d.value = valueNode.getFirstChild().getNodeValue(); // text element is first child
+
+ data.add(d);
+ }
+
+ bindData(data);
+ }
+ catch (DOMException e)
+ {
+ Window.alert("Could not parse XML document.");
+ }
+
+ }
+
+ private void bindData(List<DataEntry> data)
+ {
+ initialize();
+
+ final DefaultListModel<DataEntry> model =
+ (DefaultListModel<DataEntry>) listBox.getModel();
+ model.clear();
+
+ for(DataEntry d : data)
+ {
+ model.add(d);
+ }
+
+ // layout again
+ this.layout();
+ }
+
+ private List<Node> filterChildNodes(NodeList childNodes)
+ {
+ List<Node> result = new ArrayList<Node>();
+
+ for(int i=0; i<childNodes.getLength(); i++)
+ {
+ Node n = childNodes.item(i);
+ if(n.getNodeType()!=Node.ELEMENT_NODE) // skip #text
+ continue;
+ else
+ result.add(n);
+ }
+ return result;
+ }
+
+ private class DataEntry
+ {
+ String key;
+ String xsd;
+ String java;
+ String value;
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java 2009-07-02 11:45:22 UTC (rev 5185)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java 2009-07-02 11:50:43 UTC (rev 5186)
@@ -28,6 +28,7 @@
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.WindowCloseListener;
+import com.google.gwt.user.client.WindowResizeListener;
import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
import org.gwt.mosaic.ui.client.WindowPanel;
import org.gwt.mosaic.ui.client.Caption;
@@ -55,14 +56,20 @@
private ProcessInstanceRef currentInstance;
- private Button activityBtn;
+ private Button diagramBtn;
- private WindowPanel windowPanel;
+ private Button instanceDataBtn;
+ private WindowPanel diagramWindowPanel;
+
+ private WindowPanel instanceDataWindowPanel;
+
private ApplicationContext appContext;
private ActivityDiagramView diagramView;
+ private InstanceDataView instanceDataView;
+
private boolean hasDiagramPlugin;
private SimpleDateFormat dateFormat = new SimpleDateFormat();
@@ -81,14 +88,15 @@
this.add(grid, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
- activityBtn = new Button("Diagram",
+ LayoutPanel buttonPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL) );
+ diagramBtn = new Button("Diagram",
new ClickListener()
{
public void onClick(Widget widget)
{
if(currentInstance!=null)
{
- createActivityWindow(currentInstance);
+ createDiagramWindow(currentInstance);
controller.handleEvent(
new Event(LoadActivityDiagramAction.ID, currentInstance)
);
@@ -97,20 +105,39 @@
}
);
- activityBtn.setEnabled(false);
- this.add(activityBtn);
+ diagramBtn.setEnabled(false);
+ buttonPanel.add(diagramBtn);
+ instanceDataBtn = new Button("Instance Data",
+ new ClickListener()
+ {
+ public void onClick(Widget widget)
+ {
+ if(currentInstance!=null)
+ {
+ createDataWindow(currentInstance);
+ controller.handleEvent(
+ new Event(UpdateInstanceDataAction.ID, currentInstance.getId())
+ );
+ }
+ }
+ }
+ );
+ instanceDataBtn.setEnabled(false);
+ buttonPanel.add(instanceDataBtn);
+ this.add(buttonPanel);
+
// plugin availability
this.hasDiagramPlugin =
ServerPlugins.has("org.jboss.bpm.console.server.plugin.GraphViewerPlugin");
}
- private void createActivityWindow(ProcessInstanceRef inst)
+ private void createDiagramWindow(ProcessInstanceRef inst)
{
- windowPanel = new WindowPanel("Process Instance Activity");
- windowPanel.setAnimationEnabled(true);
- windowPanel.setSize("320px", "240px");
+ diagramWindowPanel = new WindowPanel("Process Instance Activity");
+ diagramWindowPanel.setAnimationEnabled(true);
+ diagramWindowPanel.setSize("320px", "240px");
LayoutPanel layout = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
layout.setStyleName("bpm-window-layout");
@@ -120,9 +147,9 @@
header.setStyleName("bpm-label-header");
layout.add(header, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
- windowPanel.addWindowCloseListener(new WindowCloseListener() {
+ diagramWindowPanel.addWindowCloseListener(new WindowCloseListener() {
public void onWindowClosed() {
- windowPanel = null;
+ diagramWindowPanel = null;
}
@@ -133,23 +160,65 @@
layout.add(diagramView, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
- windowPanel.setWidget(layout);
+ diagramWindowPanel.setWidget(layout);
- WindowUtil.addMaximizeButton(windowPanel, Caption.CaptionRegion.RIGHT);
- WindowUtil.addMinimizeButton(windowPanel, Caption.CaptionRegion.RIGHT);
+ WindowUtil.addMaximizeButton(diagramWindowPanel, Caption.CaptionRegion.RIGHT);
+ WindowUtil.addMinimizeButton(diagramWindowPanel, Caption.CaptionRegion.RIGHT);
// display
- windowPanel.center();
+ diagramWindowPanel.center();
}
+ private void createDataWindow(ProcessInstanceRef inst)
+ {
+ instanceDataWindowPanel = new WindowPanel("Process Instance Data: "+inst.getId());
+ instanceDataWindowPanel.setAnimationEnabled(true);
+ instanceDataWindowPanel.setSize("320px", "240px");
+
+
+ instanceDataWindowPanel.addWindowCloseListener(new WindowCloseListener() {
+ public void onWindowClosed() {
+ instanceDataWindowPanel = null;
+
+ }
+
+ public String onWindowClosing() {
+ return null;
+ }
+ });
+
+ instanceDataWindowPanel.addWindowResizeListener(
+ new WindowResizeListener() {
+
+ public void onWindowResized(int i, int i1)
+ {
+ instanceDataView.invalidate();
+ }
+ }
+ );
+
+ instanceDataWindowPanel.setWidget(instanceDataView);
+
+ WindowUtil.addMaximizeButton(instanceDataWindowPanel, Caption.CaptionRegion.RIGHT);
+ WindowUtil.addMinimizeButton(instanceDataWindowPanel, Caption.CaptionRegion.RIGHT);
+
+ // display
+ instanceDataWindowPanel.center();
+
+ }
+
public void setController(Controller controller)
{
this.controller = controller;
this.diagramView = new ActivityDiagramView();
+ this.instanceDataView = new InstanceDataView();
+
controller.addView(ActivityDiagramView.ID, diagramView);
- controller.addAction(LoadActivityDiagramAction.ID, new LoadActivityDiagramAction(appContext));
+ controller.addView(InstanceDataView.ID, instanceDataView);
+ controller.addAction(LoadActivityDiagramAction.ID, new LoadActivityDiagramAction(appContext));
+ controller.addAction(UpdateInstanceDataAction.ID, new UpdateInstanceDataAction(appContext));
}
public void update(ProcessInstanceRef instance)
@@ -167,14 +236,17 @@
grid.update(values);
if(hasDiagramPlugin)
- this.activityBtn.setEnabled(true);
+ this.diagramBtn.setEnabled(true);
+
+ instanceDataBtn.setEnabled(true);
}
public void clearView()
{
grid.clear();
this.currentInstance = null;
- this.activityBtn.setEnabled(false);
+ this.diagramBtn.setEnabled(false);
+ instanceDataBtn.setEnabled(false);
}
}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstanceDataAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstanceDataAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstanceDataAction.java 2009-07-02 11:50:43 UTC (rev 5186)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process;
+
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.ApplicationContext;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.xml.client.Document;
+import com.google.gwt.xml.client.XMLParser;
+import com.mvc4g.client.Controller;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class UpdateInstanceDataAction extends AbstractRESTAction
+{
+
+ public final static String ID = UpdateInstanceDataAction.class.getName();
+
+ public UpdateInstanceDataAction(ApplicationContext appContetext)
+ {
+ super(appContetext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ String id = (String)event;
+ return appContext.getUrlBuilder().getInstanceDataURL(id);
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ {
+ String id = (String)event;
+ String xml = response.getText();
+ System.out.println(xml);
+ Document messageDom = XMLParser.parse(xml);
+ InstanceDataView view = (InstanceDataView)controller.getView(InstanceDataView.ID);
+ view.update(id, messageDom);
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2009-07-02 11:45:22 UTC (rev 5185)
+++ projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2009-07-02 11:50:43 UTC (rev 5186)
@@ -5,6 +5,7 @@
<inherits name='com.google.gwt.json.JSON'/>
<inherits name="com.google.gwt.i18n.I18N"/>
<inherits name="com.google.gwt.user.ImageBundle"/>
+ <inherits name="com.google.gwt.xml.XML" />
<!-- Add gwt-log support, default level `DEBUG` -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-07-02 11:45:22 UTC (rev 5185)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-07-02 11:50:43 UTC (rev 5186)
@@ -100,6 +100,10 @@
return config.getConsoleServerUrl() + "/rs/process/instance/" + instanceId + "/delete";
}
+ public String getInstanceDataURL(String instanceId)
+ {
+ return config.getConsoleServerUrl() + "/rs/process/instance/" + instanceId + "/dataset";
+ }
public String getStartNewInstanceURL(String processId)
{
14 years, 11 months
JBoss JBPM SVN: r5185 - in jbpm4/trunk: modules/db/src/main/config and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-07-02 07:45:22 -0400 (Thu, 02 Jul 2009)
New Revision: 5185
Modified:
jbpm4/trunk/modules/db/src/main/config/oracle.hibernate.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
jbpm4/trunk/pom.xml
Log:
JBPM-2379 removed distinct from task query and upgraded oracle driver version to 10.2.0.4
Modified: jbpm4/trunk/modules/db/src/main/config/oracle.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/db/src/main/config/oracle.hibernate.cfg.xml 2009-07-02 01:21:59 UTC (rev 5184)
+++ jbpm4/trunk/modules/db/src/main/config/oracle.hibernate.cfg.xml 2009-07-02 11:45:22 UTC (rev 5185)
@@ -7,7 +7,7 @@
<hibernate-configuration>
<session-factory>
- <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.format_sql">true</property>
<mapping resource="jbpm.repository.hbm.xml" />
Modified: jbpm4/trunk/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml 2009-07-02 01:21:59 UTC (rev 5184)
+++ jbpm4/trunk/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml 2009-07-02 11:45:22 UTC (rev 5185)
@@ -7,17 +7,17 @@
<hibernate-configuration>
<session-factory>
- <property name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.connection.driver_class">@jdbc.driver@</property>
<property name="hibernate.connection.url">@jdbc.url@</property>
<property name="hibernate.connection.username">@jdbc.username@</property>
<property name="hibernate.connection.password">@jdbc.password@</property>
<property name="hibernate.format_sql">true</property>
- <mapping resource="jbpm.repository.hbm.xml" />
- <mapping resource="jbpm.execution.hbm.xml" />
- <mapping resource="jbpm.history.hbm.xml" />
- <mapping resource="jbpm.task.hbm.xml" />
+ <mapping resource="jbpm.repository.hbm.xml" />
+ <mapping resource="jbpm.execution.hbm.xml" />
+ <mapping resource="jbpm.history.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
<mapping resource="jbpm.identity.hbm.xml" />
</session-factory>
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-07-02 01:21:59 UTC (rev 5184)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-07-02 11:45:22 UTC (rev 5185)
@@ -136,7 +136,7 @@
public String hql() {
StringBuilder hql = new StringBuilder();
- hql.append("select distinct task ");
+ hql.append("select task ");
hql.append("from ");
hql.append(TaskImpl.class.getName());
hql.append(" as task ");
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-07-02 01:21:59 UTC (rev 5184)
+++ jbpm4/trunk/pom.xml 2009-07-02 11:45:22 UTC (rev 5185)
@@ -72,7 +72,7 @@
<mysql.connector.version>5.0.8</mysql.connector.version>
<postgresql.version>8.3-603.jdbc3</postgresql.version>
<jtds.version>1.2.2</jtds.version>
- <oracle.version>10.0.2.0</oracle.version>
+ <oracle.version>10.2.0.4</oracle.version>
</properties>
<!-- DependencyManagement -->
@@ -408,6 +408,7 @@
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemProperties>
<property>
<name>log4j.output.dir</name>
14 years, 11 months
JBoss JBPM SVN: r5184 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src/main: resources/org/jbpm/job and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-01 21:21:59 -0400 (Wed, 01 Jul 2009)
New Revision: 5184
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteActionJob.hbm.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteNodeJob.hbm.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Job.hbm.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Timer.hbm.xml
Log:
reattach job instead of loading it again
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2009-07-02 01:05:31 UTC (rev 5183)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java 2009-07-02 01:21:59 UTC (rev 5184)
@@ -166,7 +166,7 @@
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
JobSession jobSession = jbpmContext.getJobSession();
- job = jobSession.loadJob(job.getId());
+ jobSession.reattachJob(job);
// register process instance for automatic save
// see https://jira.jboss.org/jira/browse/JBPM-1015
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteActionJob.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteActionJob.hbm.xml 2009-07-02 01:05:31 UTC (rev 5183)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteActionJob.hbm.xml 2009-07-02 01:21:59 UTC (rev 5184)
@@ -12,7 +12,7 @@
<many-to-one name="action"
column="ACTION_"
- cascade="none"
+ cascade="lock"
foreign-key="FK_JOB_ACTION"
index="IDX_JOB_ACTION"/>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteNodeJob.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteNodeJob.hbm.xml 2009-07-02 01:05:31 UTC (rev 5183)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/ExecuteNodeJob.hbm.xml 2009-07-02 01:21:59 UTC (rev 5184)
@@ -12,6 +12,7 @@
<many-to-one name="node"
column="NODE_"
+ cascade="lock"
foreign-key="FK_JOB_NODE"
index="IDX_JOB_NODE"/>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Job.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Job.hbm.xml 2009-07-02 01:05:31 UTC (rev 5183)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Job.hbm.xml 2009-07-02 01:21:59 UTC (rev 5184)
@@ -17,14 +17,17 @@
<many-to-one name="processInstance"
column="PROCESSINSTANCE_"
+ cascade="lock"
foreign-key="FK_JOB_PRINST"
index="IDX_JOB_PRINST" />
<many-to-one name="token"
column="TOKEN_"
+ cascade="lock"
foreign-key="FK_JOB_TOKEN"
index="IDX_JOB_TOKEN" />
<many-to-one name="taskInstance"
column="TASKINSTANCE_"
+ cascade="lock"
foreign-key="FK_JOB_TSKINST"
index="IDX_JOB_TSKINST" />
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Timer.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Timer.hbm.xml 2009-07-02 01:05:31 UTC (rev 5183)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/org/jbpm/job/Timer.hbm.xml 2009-07-02 01:21:59 UTC (rev 5184)
@@ -16,10 +16,11 @@
<many-to-one name="action"
column="ACTION_"
+ cascade="lock"
foreign-key="FK_JOB_ACTION"
index="IDX_JOB_ACTION"/>
- <any name="graphElement" id-type="long" cascade="none">
+ <any name="graphElement" id-type="long" cascade="lock">
<column name="GRAPHELEMENTTYPE_"/>
<column name="GRAPHELEMENT_"/>
</any>
14 years, 11 months
JBoss JBPM SVN: r5183 - in jbpm3/branches/jbpm-3.2-soa/modules: core/src/test/java/org/jbpm/seam and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-07-01 21:05:31 -0400 (Wed, 01 Jul 2009)
New Revision: 5183
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutor.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutorThread.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java
jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/TimerEntityBean.java
Log:
make JobExecutorCustomizationTest resistant to stale state exceptions
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-07-01 20:20:45 UTC (rev 5182)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-07-02 01:05:31 UTC (rev 5183)
@@ -29,6 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
+import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
@@ -68,10 +69,10 @@
.list();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not find exclusive jobs owned by '"
- + lockOwner
- + "' for "
- + processInstance, e);
+ throw new JbpmPersistenceException("could not find exclusive jobs owned by '" +
+ lockOwner +
+ "' for " +
+ processInstance, e);
}
}
@@ -99,10 +100,10 @@
return (Job) query.setString("lockOwner", lockOwner).setMaxResults(1).uniqueResult();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not get first due job owned by '"
- + lockOwner
- + "' ignoring jobs "
- + monitoredJobs, e);
+ throw new JbpmPersistenceException("could not get first due job owned by '" +
+ lockOwner +
+ "' ignoring jobs " +
+ monitoredJobs, e);
}
}
@@ -134,6 +135,21 @@
}
}
+ /**
+ * Reattach job originally loaded in a previous session.
+ *
+ * @param job a detached job
+ * @see <a href="http://tinyurl.com/kjss69">Detached objects and automatic versioning</a>
+ */
+ public void reattachJob(Job job) {
+ try {
+ session.lock(job, LockMode.NONE);
+ }
+ catch (HibernateException e) {
+ throw new JbpmPersistenceException("could not reattach " + job, e);
+ }
+ }
+
public Timer loadTimer(long timerId) {
try {
return (Timer) session.load(Timer.class, new Long(timerId));
@@ -173,46 +189,51 @@
public void deleteTimersByName(String name, Token token) {
try {
// delete unowned timers
- int entityCount = session.getNamedQuery("JobSession.deleteTimersByName")
- .setString("name", name)
- .setParameter("token", token)
- .executeUpdate();
+ int entityCount =
+ session.getNamedQuery("JobSession.deleteTimersByName")
+ .setString("name", name)
+ .setParameter("token", token)
+ .executeUpdate();
log.debug("deleted " + entityCount + " timers by name '" + name + "' for " + token);
// prevent further repetitions
- List timers = session.getNamedQuery("JobSession.findRepeatingTimersByName")
- .setString("name", name)
- .setParameter("token", token)
- .list();
+ List timers =
+ session.getNamedQuery("JobSession.findRepeatingTimersByName")
+ .setString("name", name)
+ .setParameter("token", token)
+ .list();
preventFurtherRepetitions(timers);
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not delete timers by name '"
- + name
- + "' for "
- + token, e);
+ throw new JbpmPersistenceException("could not delete timers by name '" +
+ name +
+ "' for " +
+ token, e);
}
}
public int countDeletableJobsForProcessInstance(ProcessInstance processInstance) {
- Number jobCount = (Number) session.getNamedQuery("JobSession.countDeletableJobsForProcessInstance")
- .setParameter("processInstance", processInstance)
- .uniqueResult();
+ Number jobCount =
+ (Number) session.getNamedQuery("JobSession.countDeletableJobsForProcessInstance")
+ .setParameter("processInstance", processInstance)
+ .uniqueResult();
return jobCount.intValue();
}
public void deleteJobsForProcessInstance(ProcessInstance processInstance) {
try {
// delete unowned node-execute-jobs and timers
- int entityCount = session.getNamedQuery("JobSession.deleteJobsForProcessInstance")
- .setParameter("processInstance", processInstance)
- .executeUpdate();
+ int entityCount =
+ session.getNamedQuery("JobSession.deleteJobsForProcessInstance")
+ .setParameter("processInstance", processInstance)
+ .executeUpdate();
log.debug("deleted " + entityCount + " jobs for " + processInstance);
// prevent further repetitions
- List timers = session.getNamedQuery("JobSession.findRepeatingTimersForProcessInstance")
- .setParameter("processInstance", processInstance)
- .list();
+ List timers =
+ session.getNamedQuery("JobSession.findRepeatingTimersForProcessInstance")
+ .setParameter("processInstance", processInstance)
+ .list();
preventFurtherRepetitions(timers);
}
catch (HibernateException e) {
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutor.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutor.java 2009-07-01 20:20:45 UTC (rev 5182)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutor.java 2009-07-02 01:05:31 UTC (rev 5183)
@@ -6,6 +6,6 @@
private static final long serialVersionUID = 1L;
protected Thread createThread(String threadName) {
- return new CustomJobExecutorThread(threadName, this, jbpmConfiguration, idleInterval, maxIdleInterval, maxLockTime, historyMaxSize);
+ return new CustomJobExecutorThread(threadName, this);
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutorThread.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutorThread.java 2009-07-01 20:20:45 UTC (rev 5182)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/CustomJobExecutorThread.java 2009-07-02 01:05:31 UTC (rev 5183)
@@ -1,24 +1,37 @@
package org.jbpm.seam;
-import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.db.JobSession;
import org.jbpm.job.Job;
import org.jbpm.job.executor.JobExecutor;
import org.jbpm.job.executor.JobExecutorThread;
public class CustomJobExecutorThread extends JobExecutorThread {
- public CustomJobExecutorThread(String name, JobExecutor jobExecutor, JbpmConfiguration jbpmConfiguration, int idleInterval, int maxIdleInterval, long maxLockTime, int maxHistory) {
- super(name, jobExecutor, jbpmConfiguration, idleInterval, maxIdleInterval, maxLockTime, maxHistory);
+ private JobExecutor jobExecutor;
+
+ public CustomJobExecutorThread(String name, JobExecutor jobExecutor) {
+ super(name, jobExecutor);
+ this.jobExecutor = jobExecutor;
}
protected void executeJob(Job job) {
- // intercept before
- JobExecutorCustomizationTest.jobEvents.add("before");
+ JbpmContext jbpmContext = jobExecutor.getJbpmConfiguration().createJbpmContext();
try {
- super.executeJob(job);
- } finally {
- // intercept after
- JobExecutorCustomizationTest.jobEvents.add("after");
+ JobSession jobSession = jbpmContext.getJobSession();
+ jobSession.reattachJob(job);
+
+ // custom stuff
+ job.getProcessInstance().getContextInstance().setVariable("custom", Boolean.TRUE);
+
+ if (job.execute(jbpmContext)) jobSession.deleteJob(job);
}
+ catch (Exception e) {
+ e.printStackTrace();
+ jbpmContext.setRollbackOnly();
+ }
+ finally {
+ jbpmContext.close();
+ }
}
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java 2009-07-01 20:20:45 UTC (rev 5182)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/seam/JobExecutorCustomizationTest.java 2009-07-02 01:05:31 UTC (rev 5183)
@@ -1,19 +1,12 @@
package org.jbpm.seam;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.job.executor.JobExecutor;
public class JobExecutorCustomizationTest extends AbstractDbTestCase {
- static List jobEvents = new ArrayList();
-
protected String getJbpmTestConfig() {
return "org/jbpm/seam/custom.job.executor.jbpm.cfg.xml";
}
@@ -27,36 +20,28 @@
JobExecutor jobExecutor = getJbpmConfiguration().getJobExecutor();
assertEquals(CustomJobExecutor.class, jobExecutor.getClass());
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition name='customjobexecution' initial='start'>" +
- " <node name='start'>" +
- " <transition to='end'>" +
- " <action async='true' class='" +
- AsyncAction.class.getName() +
- "' />" +
- " </transition>" +
- " </node>" +
- " <state name='end' />" +
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
+ "<process-definition name='custom job exec'>" +
+ " <start-state name='start'>" +
+ " <transition to='end'/>" +
+ " </start-state>" +
+ " <end-state name='end' async='true' />" +
"</process-definition>");
jbpmContext.deployProcessDefinition(processDefinition);
newTransaction();
try {
- jbpmContext.newProcessInstanceForUpdate("customjobexecution");
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("custom job exec");
+ processInstance.signal();
- processJobs(20 * 1000);
- List expectedJobEvents = Arrays.asList(new String[] { "before", "execute action", "after" });
- assertEquals(expectedJobEvents, jobEvents);
+ processJobs(60 * 1000);
+
+ processInstance = jbpmContext.loadProcessInstance(processInstance.getId());
+ assertEquals(Boolean.TRUE, processInstance.getContextInstance().getVariable("custom"));
}
finally {
graphSession.deleteProcessDefinition(processDefinition.getId());
}
}
- public static class AsyncAction implements ActionHandler {
- private static final long serialVersionUID = 1L;
-
- public void execute(ExecutionContext executionContext) throws Exception {
- jobEvents.add("execute action");
- }
- }
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/TimerEntityBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/TimerEntityBean.java 2009-07-01 20:20:45 UTC (rev 5182)
+++ jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/TimerEntityBean.java 2009-07-02 01:05:31 UTC (rev 5183)
@@ -29,7 +29,8 @@
* <h3>Environment</h3>
*
* <p>
- * The environment entries and resources available for customization are summarized in the table below.
+ * The environment entries and resources available for customization are summarized in the table
+ * below.
* </p>
*
* <table border="1">
@@ -41,7 +42,8 @@
* <tr>
* <td><code>ejb/LocalCommandServiceBean</code></td>
* <td>EJB Reference</td>
- * <td>Link to the local {@linkplain CommandServiceBean session bean} that executes timers on a separate jBPM context.</td>
+ * <td>Link to the local {@linkplain CommandServiceBean session bean} that executes timers on a
+ * separate jBPM context.</td>
* </tr>
* </table>
*
@@ -49,11 +51,11 @@
* @author Alejandro Guizar
* @author Fady Matar
*/
-public abstract class TimerEntityBean implements EntityBean, TimedObject
-{
+public abstract class TimerEntityBean implements EntityBean, TimedObject {
private EntityContext entityContext;
private LocalCommandService commandService;
+ private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(TimerEntityBean.class);
public abstract Long getTimerId();
@@ -76,100 +78,83 @@
public abstract void setDiscriminator(String discriminator);
- public void ejbActivate()
- {
- try
- {
+ public void ejbActivate() {
+ try {
Context initial = new InitialContext();
- LocalCommandServiceHome commandServiceHome = (LocalCommandServiceHome)initial.lookup("java:comp/env/ejb/LocalCommandServiceBean");
+ LocalCommandServiceHome commandServiceHome =
+ (LocalCommandServiceHome) initial.lookup("java:comp/env/ejb/LocalCommandServiceBean");
commandService = commandServiceHome.create();
}
- catch (NamingException e)
- {
+ catch (NamingException e) {
throw new EJBException("failed to retrieve command service home", e);
}
- catch (CreateException e)
- {
+ catch (CreateException e) {
throw new EJBException("command service creation failed", e);
}
}
- public void ejbPassivate()
- {
+ public void ejbPassivate() {
commandService = null;
}
- public void ejbRemove()
- {
+ public void ejbRemove() {
commandService = null;
}
- public void ejbLoad()
- {
+ public void ejbLoad() {
}
- public void ejbStore()
- {
+ public void ejbStore() {
}
- public void setEntityContext(EntityContext entityContext)
- {
+ public void setEntityContext(EntityContext entityContext) {
this.entityContext = entityContext;
}
- public void unsetEntityContext()
- {
+ public void unsetEntityContext() {
entityContext = null;
}
/**
- * No ejbCreate operation is allowed. One approach of ensuring that an EJB is set as read-only.
+ * No ejbCreate operation is allowed, ensuring that this bean is set as read-only.
*
- * @throws CreateException
+ * @throws CreateException if invoked
*/
- public Long ejbCreate() throws CreateException
- {
+ public Long ejbCreate() throws CreateException {
throw new CreateException("direct creation of timer entities is prohibited");
}
- public void ejbPostCreate()
- {
+ public void ejbPostCreate() {
}
- public void ejbTimeout(javax.ejb.Timer ejbTimer)
- {
+ public void ejbTimeout(javax.ejb.Timer ejbTimer) {
log.debug(ejbTimer + " fired");
- TimerInfo timerInfo = (TimerInfo)ejbTimer.getInfo();
- Timer timer = (Timer)commandService.execute(new ExecuteTimerCommand(timerInfo.getTimerId()));
+ TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();
+ Timer timer = (Timer) commandService.execute(new ExecuteTimerCommand(timerInfo.getTimerId()));
// if the timer has repeat
- if (timer.getRepeat() != null)
- {
+ if (timer.getRepeat() != null) {
// create a new timer
log.debug("scheduling timer for repeat on " + timer.getDueDate());
createTimer(timer);
}
}
- public void createTimer(org.jbpm.job.Timer timer)
- {
+ public void createTimer(org.jbpm.job.Timer timer) {
TimerService timerService = entityContext.getTimerService();
javax.ejb.Timer ejbTimer = timerService.createTimer(timer.getDueDate(), new TimerInfo(timer));
log.debug("created " + ejbTimer);
}
- public void cancelTimer(org.jbpm.job.Timer timer)
- {
+ public void cancelTimer(org.jbpm.job.Timer timer) {
long timerId = timer.getId();
Collection timers = entityContext.getTimerService().getTimers();
log.debug("retrieved " + timers.size() + " ejb timer(s) by id " + timerId);
int count = 0;
- for (Iterator i = timers.iterator(); i.hasNext();)
- {
- javax.ejb.Timer ejbTimer = (javax.ejb.Timer)i.next();
- TimerInfo timerInfo = (TimerInfo)ejbTimer.getInfo();
- if (timerInfo.getTimerId() == timerId)
- {
+ for (Iterator i = timers.iterator(); i.hasNext();) {
+ javax.ejb.Timer ejbTimer = (javax.ejb.Timer) i.next();
+ TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();
+ if (timerInfo.getTimerId() == timerId) {
ejbTimer.cancel();
++count;
}
@@ -177,18 +162,20 @@
log.debug("canceled " + count + " ejb timer(s) by id " + timerId);
}
- public void cancelTimersByName(String timerName, Token token)
- {
+ public void cancelTimersByName(String timerName, Token token) {
Collection timers = entityContext.getTimerService().getTimers();
- log.debug("retrieved " + timers.size() + " ejb timer(s) by name '" + timerName + "' for " + token);
+ log.debug("retrieved " +
+ timers.size() +
+ " ejb timer(s) by name '" +
+ timerName +
+ "' for " +
+ token);
int count = 0;
- for (Iterator i = timers.iterator(); i.hasNext();)
- {
- javax.ejb.Timer ejbTimer = (javax.ejb.Timer)i.next();
- TimerInfo timerInfo = (TimerInfo)ejbTimer.getInfo();
- if (timerInfo.matchesName(timerName, token))
- {
+ for (Iterator i = timers.iterator(); i.hasNext();) {
+ javax.ejb.Timer ejbTimer = (javax.ejb.Timer) i.next();
+ TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();
+ if (timerInfo.matchesName(timerName, token)) {
ejbTimer.cancel();
++count;
}
@@ -196,18 +183,15 @@
log.debug("canceled " + count + " ejb timer(s) by name '" + timerName + "' for " + token);
}
- public void cancelTimersForProcessInstance(ProcessInstance processInstance)
- {
+ public void cancelTimersForProcessInstance(ProcessInstance processInstance) {
Collection timers = entityContext.getTimerService().getTimers();
log.debug("retrieved " + timers.size() + " timer(s) for " + processInstance);
int count = 0;
- for (Iterator i = timers.iterator(); i.hasNext();)
- {
- javax.ejb.Timer ejbTimer = (javax.ejb.Timer)i.next();
- TimerInfo timerInfo = (TimerInfo)ejbTimer.getInfo();
- if (timerInfo.matchesProcessInstance(processInstance))
- {
+ for (Iterator i = timers.iterator(); i.hasNext();) {
+ javax.ejb.Timer ejbTimer = (javax.ejb.Timer) i.next();
+ TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();
+ if (timerInfo.matchesProcessInstance(processInstance)) {
ejbTimer.cancel();
++count;
}
14 years, 11 months