JBoss JBPM SVN: r4474 - in jbpm4/tags/jbpm-4.0.0.Beta1/modules: examples/src/test/java/org/jbpm/examples/task and 13 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-07 05:34:55 -0400 (Tue, 07 Apr 2009)
New Revision: 4474
Added:
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.xml.view.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.swimlane.png
Removed:
jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/states/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/cancel/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/handler/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
Modified:
jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml
jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.file.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.wizard.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.concurrency.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.multiple.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.processinstance.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.state.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.esb.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.exclusive.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.hql.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.java.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.script.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.choice.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.sequence.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.png
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml
jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
merging tom baeyens and koen aers trunk updates in the beta 1 release tag
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-04-07 09:34:55 UTC (rev 4474)
@@ -35,26 +35,26 @@
public void testGroupCandidateAssignment() {
// create johndoe and joesmoe as members of the sales group
- identityService.createGroup("sales");
-
+ identityService.createGroup("sales-dept");
+
identityService.createUser("johndoe", "johndoe", "John", "Doe");
- identityService.createMembership("johndoe", "sales");
+ identityService.createMembership("johndoe", "sales-dept");
identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
- identityService.createMembership("joesmoe", "sales");
+ identityService.createMembership("joesmoe", "sales-dept");
// deploy the process
deployJpdlResource("org/jbpm/examples/task/candidates/process.jpdl.xml");
-
+
Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
String executionId = execution.getId();
-
+
// both johndoe and joesmoe will see the task in their *takable* task list
List<Task> taskList = taskService.findTakableTasks("johndoe");
- assertEquals("Expected a single task in johndoe's takable task list", 1, taskList.size());
+ assertEquals("Expected a single task in johndoe's task list", 1, taskList.size());
Task task = taskList.get(0);
assertEquals("review", task.getName());
-
+
taskList = taskService.findTakableTasks("joesmoe");
assertEquals("Expected a single task in joesmoe's takable task list", 1, taskList.size());
task = taskList.get(0);
@@ -70,7 +70,7 @@
// lets assume that johndoe takes the task
taskService.assignTask(task.getDbid(), "johndoe");
-
+
// johndoe's and joesmoe's takable task list is now empty
taskList = taskService.findTakableTasks("johndoe");
assertEquals(0, taskList.size());
@@ -84,14 +84,14 @@
task = taskList.get(0);
assertEquals("review", task.getName());
assertEquals("johndoe", task.getAssignee());
-
+
// joesmoe will not see the task in the assigned task list
taskList = taskService.findAssignedTasks("joesmoe");
assertEquals(0, taskList.size());
// now johndoe completes the task
taskService.completeTask(task.getDbid());
-
+
// verify that the task list is now empty
taskList = taskService.findAssignedTasks("johndoe");
assertEquals(0, taskList.size());
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-04-07 09:34:55 UTC (rev 4474)
@@ -32,13 +32,13 @@
*/
public class TaskSwimlaneTest extends JbpmTestCase {
- public void testTaskSwimlane() {
- identityService.createGroup("sales");
+ public void testTaskSwimlane() {
+ identityService.createGroup("sales-dept");
identityService.createUser("johndoe", "johndoe", "John", "Doe");
- identityService.createMembership("johndoe", "sales");
+ identityService.createMembership("johndoe", "sales-dept");
deployJpdlResource("org/jbpm/examples/task/swimlane/process.jpdl.xml");
-
+
executionService.startProcessInstanceByKey("TaskSwimlane");
List<Task> taskList = taskService.findTakableTasks("johndoe");
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml 2009-04-07 09:34:55 UTC (rev 4474)
@@ -7,7 +7,7 @@
</start>
<task name="review"
- candidate-groups="sales"
+ candidate-groups="sales-dept"
g="96,16,127,52">
<transition to="wait" />
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml 2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/examples/src/test/resources/org/jbpm/examples/task/swimlane/process.jpdl.xml 2009-04-07 09:34:55 UTC (rev 4474)
@@ -3,7 +3,7 @@
<process name="TaskSwimlane" xmlns="http://jbpm.org/4/jpdl">
<swimlane name="sales representative"
- candidate-groups="sales" />
+ candidate-groups="sales-dept" />
<start g="20,20,48,48">
<transition to="enter order data" />
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/DeploymentResourcesTest.java 2009-04-07 09:34:55 UTC (rev 4474)
@@ -29,6 +29,7 @@
import java.util.Arrays;
import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
import org.jbpm.test.JbpmTestCase;
@@ -64,6 +65,25 @@
assertTrue(Arrays.equals(otherBytes, retrievedOtherBytes));
}
+ public void testLoadProcessAsResource() {
+ ClassLoader classLoader = DeploymentResourcesTest.class.getClassLoader();
+ InputStream inputStream = classLoader.getResourceAsStream("org/jbpm/test/process/process.jpdl.xml");
+ assertNotNull(inputStream);
+
+ long deploymentDbid =
+ repositoryService.createDeployment()
+ .addResourceFromInputStream("process.jpdl.xml", inputStream)
+ .deploy();
+
+ registerDeployment(deploymentDbid);
+
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+ .key("Resource")
+ .uniqueResult();
+
+ assertNotNull(processDefinition);
+ }
+
protected String generateString(String base, int multiplier) {
StringBuffer buffer = new StringBuffer();
for (int i=0; i<multiplier; i++) {
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml (from rev 4384, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml)
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml (rev 0)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/java/org/jbpm/test/process/process.jpdl.xml 2009-04-07 09:34:55 UTC (rev 4474)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="get return code" />
+ </start>
+
+ <state name="get return code">
+ <transition to="ok"/>
+ </state>
+
+ <end name="ok" state="completed"/>
+
+</process>
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org)
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm)
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test)
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process)
Deleted: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml 2009-04-02 10:34:41 UTC (rev 4387)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml 2009-04-07 09:34:55 UTC (rev 4474)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
-
- <start>
- <transition to="get return code" />
- </start>
-
- <state name="get return code">
- <transition to="ok"/>
- </state>
-
- <end name="ok" state="completed"/>
-
-</process>
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml (from rev 4387, jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml)
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml (rev 0)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/test-db/src/test/resources/org/jbpm/test/process/process.jpdl.xml 2009-04-07 09:34:55 UTC (rev 4474)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Resource" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="get return code" />
+ </start>
+
+ <state name="get return code">
+ <transition to="ok"/>
+ </state>
+
+ <end name="ok" state="completed"/>
+
+</process>
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.file.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.new.process.wizard.png
===================================================================
(Binary files differ)
Deleted: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
===================================================================
(Binary files differ)
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png (from rev 4402, jbpm4/trunk/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png)
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.png
===================================================================
(Binary files differ)
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/gpd.xml.view.png (from rev 4402, jbpm4/trunk/modules/userguide/src/main/docbook/en/images/gpd.xml.view.png)
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.concurrency.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.multiple.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.processinstance.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.end.state.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.esb.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.exclusive.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.hql.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.java.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.script.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.choice.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.state.sequence.png
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.png
===================================================================
(Binary files differ)
Copied: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/images/process.task.swimlane.png (from rev 4443, jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.task.swimlane.png)
===================================================================
(Binary files differ)
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml 2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml 2009-04-07 09:34:55 UTC (rev 4474)
@@ -33,7 +33,14 @@
<section id="editingtheprocesssource">
<title>Editing the process source</title>
- <para>To edit the process XML sources directly, select the process file, right click
+ <para>The GPD contains a 'Source' tab with the XML sources. These are directly editable in
+ this tab and the graphical view will reflect the changes when you switch back to the diagram.</para>
+ <figure id="gpd.source.tab">
+ <title>Editing jPDL using the source view</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/gpd.xml.view.png"/></imageobject></mediaobject>
+ </figure>
+ <para>You can of course still edit the process XML sources using the built in XML editor.
+ To do this, select the process file, right click
and select 'Open with...' --> 'XML editor'
</para>
<figure id="gpd.open.in.xml">
@@ -43,7 +50,7 @@
<para>After you've done this, eclipse will remember that and the next time
you double click it, eclipse will open your process file in the XML Editor
automatically. To open up the process file in the GPD, perform the
- same Open-with-action, but select 'jPDL 4 Editor'
+ same Open-with-action, but select 'jBPM jPDL 4 Editor'
</para>
</section>
Modified: jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
--- jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-07 08:16:32 UTC (rev 4473)
+++ jbpm4/tags/jbpm-4.0.0.Beta1/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-07 09:34:55 UTC (rev 4474)
@@ -526,14 +526,8 @@
</process></programlisting>
</section>
-
-
-
-
-
-
-
-
+ <!-- ### END ########################################################### -->
+
<section id="end">
<title><literal>end</literal></title>
<para>Ends the execution.
@@ -696,6 +690,8 @@
respectively.</para>
</section>
</section>
+
+ <!-- ### JAVA ########################################################## -->
<section id="java">
<title><literal>java</literal></title>
@@ -821,62 +817,442 @@
</para>
</section>
+ <!-- ### TASK ########################################################## -->
+
<section id="task">
<title><literal>task</literal></title>
- <para>Creates a task for a person in the task component. The configuration capabilities
- of the task activity will be expanded in the next releases.
+
+ <para>Creates a task for a person in the task component.
</para>
- <table><title><literal>task</literal> attributes:</title>
- <tgroup cols="5" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Attribute</entry>
- <entry>Type</entry>
- <entry>Default</entry>
- <entry>Required?</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>assignee</literal></entry>
- <entry>text</entry>
- <entry></entry>
- <entry><emphasis role="bold">required</emphasis></entry>
- <entry>id of the person to which this task must be assigned</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>For example:</para>
- <figure id="process.task">
- <title>The task example process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
- </figure>
- <programlisting><process name="Task" xmlns="http://jbpm.org/4/jpdl">
+
+ <!-- ~~~ TASK ASSIGNEE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <section id="taskassignee">
+ <title><literal>task</literal> assignee</title>
+ <para>A simple task that will be assigned to a specific user
+ </para>
+ <table><title><literal>task</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>assignee</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>userId referring to the person that is responsible for
+ completing this task.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <figure id="process.task.assignee">
+ <title>The task assignee example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="TaskAssignee">
+
<start>
<transition to="review" />
</start>
- <emphasis role="bold"><task name="review"
- assignee="johndoe"></emphasis>
-
- <transition to="wait" />
- <emphasis role="bold"></task></emphasis>
+ <task name="review"
+ <emphasis role="bold">assignee="#{order.owner}"</emphasis>>
+
+ <transition to="wait" />
+ </task>
<state name="wait" />
</process></programlisting>
- <para>After starting a process like this
- </para>
- <programlisting>executionService.startProcessInstanceByKey("Task");</programlisting>
- <para>The task list for user johndoe can be obtained from the <literal>TaskService</literal>
- like this</para>
- <programlisting>taskService.getPersonalTaskList("johndoe", 0, 10);</programlisting>
- <para>The task list for user 'johndoe' will contain a task named 'review'.</para>
+ <para>This process shows 2 aspects of task assignment. First, that the
+ attribute <literal>assignee</literal> is used to indicate the user that is
+ responsible for completing the task. The assignee is a String property
+ of a task and refers to a user.
+ </para>
+ <para>Secondly, this attribute is by default evaluated as an expression.
+ In this case the task is assigned to <literal>#{order.owner}</literal>.
+ Which means that first an object is searched for with name order. One of
+ the places where this object is looked up is the process variables
+ associated to the task. Then the <literal>getOwner()</literal> getter
+ will be used to get the userId that references the user that is
+ responsible for completing this task.
+ </para>
+ <para>Here's the Order class used in our example:</para>
+ <programlisting>public class Order implements Serializable {
+
+ String owner;
+
+ public Order(String owner) {
+ this.owner = owner;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+}</programlisting>
+ <para>Next a new process instance is created with an order as a process
+ variable.</para>
+ <programlisting>Map<String, Object> variables = new HashMap<String, Object>();
+variables.put("order", new Order("johndoe"));
+Execution execution = executionService
+ .startProcessInstanceByKey("TaskAssignee", variables);</programlisting>
+ <para>Then the task list for <literal>johndoe</literal> can be obtained like this.</para>
+ <programlisting>List<Task> taskList = taskService.findAssignedTasks("johndoe");</programlisting>
+ <para>Note that it is also possible to put plain text like
+ <literal>assignee="johndoe"</literal>. In that case
+ the task will be assigned to johndoe.
+ </para>
+ </section>
+
+ <!-- ~~~ TASK CANDIDATES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <section id="taskcandidates">
+ <title><literal>task</literal> candidates</title>
+ <para>A task that will be offered to a group of users. One of the users should then
+ take the task in order to complete it.
+ </para>
+ <table><title><literal>task</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>candidate-groups</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>resolves to a comma separated list of groupIds.
+ All the people in the groups will be candidates for this
+ task.</entry>
+ </row>
+ <row>
+ <entry><literal>candidate-users</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>resolves to a comma separated list of userIds.
+ All the users will be candidates for this task.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <figure id="process.task.candidates">
+ <title>The task candidates example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Here's an example process using task candidates:</para>
+ <programlisting><process name="TaskCandidates">
+
+ <start>
+ <transition to="review" />
+ </start>
+
+ <task name="review"
+ <emphasis role="bold">candidate-groups="sales-dept"</emphasis>>
+
+ <transition to="wait" />
+ </task>
+
+ <state name="wait"/>
+
+</process>
+ </programlisting>
+ <para>After starting, a task will be created. The task will not show up in anyone's
+ personal task list. Following task lists will be empty.
+ </para>
+ <programlisting>taskService.getAssignedTasks("johndoe");
+taskService.getAssignedTasks("joesmoe");</programlisting>
+ <para>But the task will show up in the takable task list of all members of the <literal>sales-dept</literal>
+ group.
+ </para>
+ <para>The in our example, the <literal>sales-dept</literal> has two members: johndoe and joesmoe</para>
+ <programlisting>identityService.createGroup("sales-dept");
+
+identityService.createUser("johndoe", "johndoe", "John", "Doe");
+identityService.createMembership("johndoe", "sales-dept");
+
+identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
+identityService.createMembership("joesmoe", "sales-dept"); </programlisting>
+ <para>So after the process is created, the task will appear in both the
+ takable tasks for users johndoe and joesmoe</para>
+ <programlisting>taskService.findTakableTasks("johndoe");
+taskService.findTakableTasks("joesmoe");</programlisting>
+ <para>Candidates must take a task before they can work on it. This will prevent
+ that two candides start working on the same task. The user interface must only
+ offer the action 'Take' for the tasks in the takable task list.
+ </para>
+ <programlisting>taskService.takeTask(task.getDbid(), "johndoe");</programlisting>
+ <para>When a user takes a task, the assignee of that task will be set to the given
+ user. The task will disappear from all the candidate's takable task list and
+ it will appear in the user's assigned tasks.
+ </para>
+ <para>Users are only allowed to work on tasks in their personal task list. This
+ should be enforced by the user interface.</para>
+ <para>Similarly, the attribute <literal>candidate-users</literal> can be used that
+ resolves to a comma separated list of userIds. The <literal>candidate-users</literal>
+ attribute can be used in combination with other assignment options.
+ </para>
+ </section>
+
+ <!-- ~~~ TASK ASSIGNMENT HANDLER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <section id="taskassignmenthandler">
+ <title><literal>task</literal> assignment handler</title>
+ <para>An <literal>AssignmentHandler</literal> can be used to calculate the
+ assignee and the candidates for a task programmatically.
+ </para>
+ <programlisting>public interface <emphasis role="bold">AssignmentHandler</emphasis> extends Serializable {
+
+ /** sets the actorId and candidates for the given assignable. */
+ void assign(Assignable assignable, OpenExecution execution) throws Exception;
+}</programlisting>
+ <para><literal>Assignable</literal> is a common interface for Tasks and
+ Swimlanes. So AssignmentHandlers can be used for tasks as well as swimlanes
+ (see later).
+ </para>
+ <para><literal>assignment-handler</literal> is a sub element of the task element.
+ It specifies a user code object. So the attributes and elements of <literal>assignment-handler</literal>
+ are documented in <xref linkend="usercode" />
+ </para>
+ <para>Let's look at the task assignment example process.</para>
+ <figure id="process.task.assignmenthandler">
+ <title>The task assignment handler example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="TaskAssignmentHandler" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="review" />
+ </start>
+
+ <task name="review" g="96,16,127,52">
+ <emphasis role="bold"><assignment-handler class="org.jbpm.examples.task.assignmenthandler.AssignTask">
+ <field name="assignee">
+ <string value="johndoe" />
+ </field>
+ </assignment-handler></emphasis>
+ <transition to="wait" />
+ </task>
+
+ <state name="wait" g="255,16,88,52" />
+
+</process></programlisting>
+ <para>The referenced class <literal>AssignTask</literal> looks like this: </para>
+ <programlisting>public class AssignTask implements AssignmentHandler {
+
+ String assignee;
+
+ public void assign(Assignable assignable, OpenExecution execution) {
+ assignable.setAssignee(assignee);
+ }
+}</programlisting>
+ <para>Please note that potentially, AssignmentHandler implementations can use
+ the process variables and any other Java API to access resources like your
+ application database to calculate the assignee and candidate users and groups.
+ </para>
+ <para>Starting a new process instance of the <literal>TaskAssignmentHandler</literal>
+ process will immediately bring the new execution to the task activity. A new
+ <literal>review</literal> task is created and at that point, the <literal>AssignTask</literal>
+ assignment handler is called. That will set <literal>johndoe</literal> as
+ the assignee. So John Doe will find the task in his personal task list.
+ </para>
+ </section>
+
+ <!-- ~~~ TASK SWIMLANES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <section id="taskswimlanes">
+ <title><literal>task</literal> swimlanes</title>
+ <para>Multiple tasks in a process should be assigned to the same
+ user or candidates. Multiple tasks in a process can be associated to a
+ single swimlane. The process instance will remember the candidates and user
+ that performed the first task in the swimlane. And subsequent tasks in the
+ same swimlane will be assigned to those user and candidates.
+ </para>
+ <para>A swimlane can also be considered as a process role. In some
+ cases, this might boil down to authorization roles in the
+ identity component. But bare in mind that it is not always the
+ same thing.</para>
+ <table><title><literal>task</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>swimlane</literal></entry>
+ <entry>swimlane (string)</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>refers to a swimlane that is declared in the process</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>Swimlanes can be declared inside a process element:</para>
+ <table><title><literal>swimlane</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>name</literal></entry>
+ <entry>swimlane (string)</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>Name for this swimlane. This is the
+ name that will be referenced by task swimlane attributes.
+ </entry>
+ </row>
+ <row>
+ <entry><literal>assignee</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>userId referring to the person that is responsible for
+ completing this task.</entry>
+ </row>
+ <row>
+ <entry><literal>candidate-groups</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>resolves to a comma separated list of groupIds.
+ All the people in the groups will be candidates for this
+ the tasks in this swimlane.</entry>
+ </row>
+ <row>
+ <entry><literal>candidate-users</literal></entry>
+ <entry>expression</entry>
+ <entry></entry>
+ <entry>optional</entry>
+ <entry>resolves to a comma separated list of userIds.
+ All the users will be candidates for the
+ tasks in this swimlane.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <figure id="process.task.swimlane">
+ <title>The task swimlane example process</title>
+
+ <!-- KOEN: volgende image moet aangepast worden naar
+ images/process.task.swimlane.png
+ nadat je die hebt toegevoegd aan de images directory -->
+
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.task.png"/></imageobject></mediaobject>
+ </figure>
+ <para>The task swimlane example has the following process file :</para>
+ <programlisting><process name="TaskSwimlane" xmlns="http://jbpm.org/4/jpdl">
+
+ <emphasis role="bold"><swimlane name="sales representative"
+ candidate-groups="sales-dept" /></emphasis>
+
+ <start>
+ <transition to="enter order data" />
+ </start>
+
+ <task name="enter order data"
+ <emphasis role="bold">swimlane="sales representative"</emphasis>>
+
+ <transition to="calculate quote"/>
+ </task>
+
+ <task
+ name="calculate quote"
+ <emphasis role="bold">swimlane="sales representative"</emphasis>>
+ </task>
+
+</process></programlisting>
+ <para>In this example we create the following information in the identity
+ component:</para>
+ <programlisting>identityService.createGroup("sales-dept");
+
+identityService.createUser("johndoe", "johndoe", "John", "Doe");
+identityService.createMembership("johndoe", "sales-dept");</programlisting>
+ <para>After starting a new process instance, user <literal>johndoe</literal> will
+ be a candidate for task <literal>enter order data</literal>. Again like in the
+ previous task candidates example, John Doe can now take this task like this:
+ </para>
+ <programlisting>taskService.takeTask(taskDbid, "johndoe");</programlisting>
+ <para>Taking the task will make Lit<literal>johndoe</literal> the assignee for
+ the task. And since this task is coupled to the swimlane
+ <literal>sales representative</literal>, assignee <literal>johndoe</literal> will
+ also be propagated as the assignee in the swimlane.</para>
+ <para>Next, John Doe can complete the task like this:</para>
+ <programlisting>taskService.completeTask(taskDbid);</programlisting>
+ <para>Completing the task will bring the process execution to the
+ next task, which is <literal>calculate quote</literal>. Also
+ this task is linked to the swimlane. Therefore, the task will be
+ assigned to <literal>johndoe</literal>. Also the candidate users
+ and candidate groups of the initial assignment will be copied from
+ the swimlane to the task. This is relevant in case user <literal>johndoe</literal>
+ would release the task and offer it back to the other candidates.
+ </para>
+ </section>
+
+ <!-- ~~~ TASK VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <section id="taskvariables">
+ <title><literal>task</literal> variables</title>
+ <para>Tasks can see and update process variables. Later tasks will have
+ the option to declare task-local process variables. Task variables
+ are an important part of the task forms. Task forms typically show
+ data that comes from the task and the process instance. Then
+ input from the user is translated in setting task variables.
+ </para>
+ <para>Getting task variables can be done like this:</para>
+ <programlisting>List<Task> taskList = taskService.findAssignedTasks("johndoe");
+
+Task task = taskList.get(0);
+long taskDbid = task.getDbid();
+
+Set<String> variableNames = taskService.getVariableNames(taskDbid);
+
+Map<String, Object> variables = taskService.getVariables(taskDbid, variableNames);</programlisting>
+ <para>And setting task variables can be done like this:</para>
+ <programlisting>variables = new HashMap<String, Object>();
+variables.put("category", "small");
+variables.put("lires", 923874893);
+
+taskService.setVariables(taskDbid, variables);</programlisting>
+ </section>
</section>
+ <!-- ### SCRIPT ######################################################## -->
+
<section id="script">
<title><literal>script</literal></title>
<para>A script activity evaluates a script. Scripts can be specified in any language for
@@ -1064,6 +1440,8 @@
</para>
</section>
+ <!-- ### ESB ########################################################### -->
+
<section id="esb">
<title><literal>esb</literal></title>
<para>An <literal>esb</literal> activity sends a message to a service over the ESB.
@@ -1153,6 +1531,8 @@
</para>
</section>
+ <!-- ### HQL ########################################################### -->
+
<section id="hql">
<title><literal>hql</literal></title>
<para>With the<literal>hql</literal> activity, a HQL query can be performed
@@ -1253,6 +1633,8 @@
</process></programlisting>
</section>
+ <!-- ### SQL ########################################################### -->
+
<section id="sql">
<title><literal>sql</literal></title>
<para>The <literal>sql</literal> activity is exactly the same as the
@@ -1309,4 +1691,100 @@
</section>
</section>
+ <section id="usercode">
+ <title>User code</title>
+ <para>Various elements in the jPDL process language refer to a an
+ object on which an interface method will be invoked. See for example
+ <xref linkend="taskassignmenthandler" />. This section describes the
+ attributes and sub elements of those type of user code objects.
+ </para>
+ <table><title>attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>class</literal></entry>
+ <entry>classname</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>The fully qualified classname.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title>sub elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>field</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to be injected directly in
+ a memberfield before this user class is used.</entry>
+ </row>
+ <row>
+ <entry><literal>property</literal></entry>
+ <entry>0..*</entry>
+ <entry>describes a configuration value to injected through a setter
+ method before this user object is used.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>field</literal> attributes:</title>
+ <tgroup cols="5" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ <entry>Required?</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>name</literal></entry>
+ <entry>string</entry>
+ <entry></entry>
+ <entry><emphasis role="bold">required</emphasis></entry>
+ <entry>the name of the field</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table><title><literal>field</literal> sub elements:</title>
+ <tgroup cols="3" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Element</entry>
+ <entry>Multiplicity</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>string</literal></entry>
+ <entry>0..1</entry>
+ <entry>represents a string value</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
</chapter>
17 years
JBoss JBPM SVN: r4473 - jbpm4/tags.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-07 04:16:32 -0400 (Tue, 07 Apr 2009)
New Revision: 4473
Added:
jbpm4/tags/jbpm-4.0.0.Beta1/
Log:
creating beta 1 tag
Copied: jbpm4/tags/jbpm-4.0.0.Beta1 (from rev 4382, jbpm4/trunk)
17 years
JBoss JBPM SVN: r4472 - in jbpm4/trunk/modules: distro/src/main/resources/config-tool/jbpm/cfg and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-07 03:58:24 -0400 (Tue, 07 Apr 2009)
New Revision: 4472
Added:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
Log:
adding jta transaction for enterprise configuration
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml 2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/build.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -15,6 +15,11 @@
<equals arg1="${database}" arg2="mysql" />
</condition>
+ <condition property="transaction.type" value="jta">
+ <equals arg1="${deployment.type}" arg2="sar" />
+ </condition>
+ <property name="transaction.type" value="default" />
+
<!-- condition property="is.identity.included">
<equals arg1="${identity}" arg2="include" />
</condition -->
@@ -62,6 +67,7 @@
<!-- file name="jbpm/cfg/identity.session.factory.${identity}.xml" / -->
<file name="jbpm/cfg/jpdl.deployers.${jpdl}.xml" />
<file name="jbpm/cfg/part3.jbpm.cfg.xml" />
+ <file name="jbpm/cfg/transaction.${transaction.type}.xml" />
<file name="jbpm/cfg/hibernate.session.${hibernate.session}.xml" />
<file name="jbpm/cfg/identity.session.${identity}.xml" />
<file name="jbpm/cfg/part4.jbpm.cfg.xml" />
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/part3.jbpm.cfg.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -26,7 +26,6 @@
</process-engine-context>
<transaction-context>
- <transaction />
<repository-session />
<pvm-db-session />
<job-db-session />
Added: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -0,0 +1 @@
+ <transaction />
Property changes on: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.default.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -0,0 +1 @@
+ <transaction type="jta" />
Property changes on: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jbpm/cfg/transaction.jta.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml 2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -53,7 +53,6 @@
</process-engine-context>
<transaction-context>
- <transaction />
<repository-session />
<pvm-db-session />
<job-db-session />
@@ -61,6 +60,7 @@
<message-session />
<timer-session />
<history-session />
+ <transaction />
<hibernate-session />
<identity-session />
</transaction-context>
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-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.repository.hbm.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -12,7 +12,7 @@
<generator class="native" />
</id>
- <property name="name" type="text" column="NAME_" />
+ <property name="name" type="text" column="NAME_" />
<property name="timestamp" column="TIMESTAMP_" />
<map name="resources" cascade="all-delete-orphan">
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -53,7 +53,6 @@
</process-engine-context>
<transaction-context>
- <transaction />
<repository-session />
<pvm-db-session />
<job-db-session />
@@ -61,6 +60,7 @@
<message-session />
<timer-session />
<history-session />
+ <transaction />
<hibernate-session />
<identity-session />
</transaction-context>
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java 2009-04-07 07:58:24 UTC (rev 4472)
@@ -0,0 +1,85 @@
+/*
+ * 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.pvm.internal.tx;
+
+import javax.naming.InitialContext;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.jbpm.JbpmException;
+import org.jbpm.env.Transaction;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JtaTransaction implements Transaction {
+
+ protected String userTransactionJndiName = "java:comp/UserTransaction";
+ protected String transactionManagerJndiName = "java:/TransactionManager";
+
+ public boolean isRollbackOnly() {
+ try {
+ return getUserTransaction().getStatus()==Status.STATUS_MARKED_ROLLBACK;
+ } catch (SystemException e) {
+ throw new JbpmException("couldn't get status of user transaction", e);
+ }
+ }
+
+ public void setRollbackOnly() {
+ try {
+ getUserTransaction().setRollbackOnly();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't set user transaction to rollback only", e);
+ }
+ }
+
+ public void registerSynchronization(Synchronization synchronization) {
+ try {
+ getJeeTransaction().registerSynchronization(synchronization);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't register synchronization", e);
+ }
+ }
+
+ protected UserTransaction getUserTransaction() {
+ try {
+ InitialContext initialContext = new InitialContext();
+ return (UserTransaction) initialContext.lookup(userTransactionJndiName);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't lookup user transaction at "+userTransactionJndiName, e);
+ }
+ }
+
+ protected javax.transaction.Transaction getJeeTransaction() {
+ try {
+ InitialContext initialContext = new InitialContext();
+ TransactionManager transactionManager = (TransactionManager) initialContext.lookup(transactionManagerJndiName);
+ return transactionManager.getTransaction();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't get transaction from transaction manager "+userTransactionJndiName, e);
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/JtaTransaction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-04-07 07:58:24 UTC (rev 4472)
@@ -22,6 +22,7 @@
package org.jbpm.pvm.internal.wire.binding;
import org.jbpm.env.Transaction;
+import org.jbpm.pvm.internal.tx.JtaTransaction;
import org.jbpm.pvm.internal.tx.StandardTransaction;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
@@ -50,6 +51,8 @@
if ("standard".equals(type)) {
transactionDescriptor = new ObjectDescriptor(StandardTransaction.class);
+ } else if ("jta".equals(type)){
+ transactionDescriptor = new ObjectDescriptor(JtaTransaction.class);
} else {
parse.addProblem("unsupported transaction type: "+type);
}
Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -52,7 +52,6 @@
</process-engine-context>
<transaction-context>
- <transaction />
<repository-session />
<pvm-db-session />
<job-db-session />
@@ -60,6 +59,7 @@
<message-session />
<timer-session />
<history-session />
+ <transaction />
<hibernate-session />
<identity-session />
</transaction-context>
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-04-07 06:03:24 UTC (rev 4471)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-04-07 07:58:24 UTC (rev 4472)
@@ -53,7 +53,6 @@
</process-engine-context>
<transaction-context>
- <transaction />
<repository-session />
<pvm-db-session />
<job-db-session />
@@ -61,6 +60,7 @@
<message-session />
<timer-session />
<history-session />
+ <transaction />
<hibernate-session />
<identity-session />
</transaction-context>
17 years
JBoss JBPM SVN: r4471 - in jbpm4/branches/email/modules/pvm: src/main/java/org/jbpm/pvm and 13 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-04-07 02:03:24 -0400 (Tue, 07 Apr 2009)
New Revision: 4471
Added:
jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/PatternDescriptor.java
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailSessionWireTest.java
Removed:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/model/
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/execution/
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/spring/
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/variables/
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
jbpm4/branches/email/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
Log:
provide mail session binding
Added: jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs (rev 0)
+++ jbpm4/branches/email/modules/pvm/.settings/org.eclipse.jdt.ui.prefs 2009-04-07 06:03:24 UTC (rev 4471)
@@ -0,0 +1,3 @@
+#Mon Apr 06 21:23:03 CDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java 2009-04-07 00:38:39 UTC (rev 4470)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -10,12 +10,19 @@
* Allows filtering of to/cc/bcc recipient lists based on
* regular expressions for include and exclude patterns.
* @author Brad Davis
- *
*/
public class WildCardAddressFilter implements AddressFilter {
- protected Collection<String> includePatterns;
- protected Collection<String> excludePatterns;
+ /**
+ * patterns of addresses to be included.
+ * all addresses are included when omitted.
+ */
+ protected Collection<Pattern> includePatterns;
+ /**
+ * patterns of addresses to be excluded.
+ * no addresses are excluded when omitted.
+ */
+ protected Collection<Pattern> excludePatterns;
public Collection<InternetAddress> filter(final Collection<InternetAddress> addresses)
{
@@ -41,39 +48,48 @@
*/
protected boolean keepAddress(InternetAddress address)
{
- if(includePatterns!=null)
+ return includeAddress(address) && !excludeAddress(address);
+ }
+
+ protected boolean includeAddress(InternetAddress address)
+ {
+ if (includePatterns == null || includePatterns.isEmpty())
+ return true;
+
+ for (Pattern pattern : includePatterns)
{
- for(String pattern : includePatterns)
- {
- if(Pattern.matches(pattern, address.toString()))
- {
- return true;
- }
- }
+ if (pattern.matcher(address.toString()).matches())
+ return true;
}
- if(excludePatterns!=null)
+ return false;
+ }
+
+ protected boolean excludeAddress(InternetAddress address)
+ {
+ if (excludePatterns == null || excludePatterns.isEmpty())
+ return false;
+
+ for (Pattern pattern : excludePatterns)
{
- for(String pattern : excludePatterns)
- {
- if(Pattern.matches(pattern, address.toString()))
- {
- return false;
- }
- }
+ if (pattern.matcher(address.toString()).matches())
+ return true;
}
- if(includePatterns==null||includePatterns.isEmpty())
- {
- //Includes were not set, which means if it wasn't excluded, include it.
- return true;
- }
return false;
}
- public void setIncludePatterns(Collection<String> includePatterns) {
+ public Collection<Pattern> getIncludePatterns() {
+ return includePatterns;
+ }
+
+ public void setIncludePatterns(Collection<Pattern> includePatterns) {
this.includePatterns = includePatterns;
}
- public void setExcludePatterns(Collection<String> excludePatterns) {
+ public void setExcludePatterns(Collection<Pattern> excludePatterns) {
this.excludePatterns = excludePatterns;
}
+
+ public Collection<Pattern> getExcludePatterns() {
+ return excludePatterns;
+ }
}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java 2009-04-07 00:38:39 UTC (rev 4470)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -12,7 +12,6 @@
private Collection<String> toAddresses;
private Collection<String> ccAddresses;
private Collection<String> bccAddresses;
-
public Collection<User> getActors() {
return actors;
}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java 2009-04-07 00:38:39 UTC (rev 4470)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -20,6 +20,10 @@
return Session.getDefaultInstance(properties, null);
}
+ public Properties getProperties() {
+ return properties;
+ }
+
public void setProperties(Properties properties) {
this.properties = properties;
}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java 2009-04-07 00:38:39 UTC (rev 4470)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -1,15 +1,9 @@
package org.jbpm.pvm.internal.email.service;
-import java.util.Arrays;
import java.util.Collection;
-import java.util.HashSet;
-import javax.mail.Address;
-import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMessage.RecipientType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -70,11 +64,11 @@
}
}
}
-
-
}
-
-
}
-
+
+ public Collection<MailServerConfiguration> getServerConfigs() {
+ return serverConfigs;
+ }
+
}
Added: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -0,0 +1,108 @@
+/*
+ * 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.pvm.internal.wire.binding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.email.filter.WildCardAddressFilter;
+import org.jbpm.pvm.internal.email.server.MailServerConfiguration;
+import org.jbpm.pvm.internal.email.server.SmtpServer;
+import org.jbpm.pvm.internal.email.service.MailService;
+import org.jbpm.pvm.internal.email.service.SynchronousMailService;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.CollectionDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.PatternDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.PropertiesDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * Parses a descriptor for creating a {@link MailService}.
+ *
+ * @author Alejandro Guizar
+ */
+public class MailSessionBinding extends WireDescriptorBinding {
+
+ private static final PropertiesBinding propertiesBinding = new PropertiesBinding();
+
+ public MailSessionBinding() {
+ super("mail-session");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ // mail servers
+ List<Descriptor> serverDescriptors = new ArrayList<Descriptor>();
+ for (Element serverElement : XmlUtil.elements(element, "mail-server")) {
+ // smtp properties
+ Element smtpElement = XmlUtil.element(serverElement, "smtp-properties");
+ PropertiesDescriptor propertiesDescriptor = propertiesBinding.parse(smtpElement, parse,
+ parser);
+ ObjectDescriptor smtpDescriptor = new ObjectDescriptor(SmtpServer.class);
+ smtpDescriptor.addInjection("properties", propertiesDescriptor);
+
+ // address filter
+ Element filterElement = XmlUtil.element(serverElement, "wildcard-address-filter");
+
+ // includes
+ List<Descriptor> includeDescriptors = new ArrayList<Descriptor>();
+ for (Element includeElement : XmlUtil.elements(filterElement, "include")) {
+ includeDescriptors.add(new PatternDescriptor(XmlUtil.getContentText(includeElement), 0));
+ }
+ CollectionDescriptor includesDescriptor = new ListDescriptor();
+ includesDescriptor.setValueDescriptors(includeDescriptors);
+
+ // excludes
+ List<Descriptor> excludeDescriptors = new ArrayList<Descriptor>();
+ for (Element excludeElement : XmlUtil.elements(filterElement, "exclude")) {
+ excludeDescriptors.add(new PatternDescriptor(XmlUtil.getContentText(excludeElement), 0));
+ }
+ CollectionDescriptor excludesDescriptor = new ListDescriptor();
+ excludesDescriptor.setValueDescriptors(excludeDescriptors);
+
+ // address filter
+ ObjectDescriptor filterDescriptor = new ObjectDescriptor(WildCardAddressFilter.class);
+ filterDescriptor.addInjection("includePatterns", includesDescriptor);
+ filterDescriptor.addInjection("excludePatterns", excludesDescriptor);
+
+ // mail server
+ ObjectDescriptor serverDescriptor = new ObjectDescriptor(MailServerConfiguration.class);
+ serverDescriptor.addInjection("server", smtpDescriptor);
+ serverDescriptor.addInjection("filter", filterDescriptor);
+ serverDescriptors.add(serverDescriptor);
+ }
+
+ // mail servers
+ CollectionDescriptor serversDescriptor = new ListDescriptor();
+ serversDescriptor.setValueDescriptors(serverDescriptors);
+
+ // mail session
+ ObjectDescriptor sessionDescriptor = new ObjectDescriptor(SynchronousMailService.class);
+ sessionDescriptor.addInjection("serverConfigs", serversDescriptor);
+ return sessionDescriptor;
+ }
+
+}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java 2009-04-07 00:38:39 UTC (rev 4470)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -44,7 +44,7 @@
super("properties");
}
- public Object parse(Element element, Parse parse, Parser parser) {
+ public PropertiesDescriptor parse(Element element, Parse parse, Parser parser) {
PropertiesDescriptor descriptor = new PropertiesDescriptor();
if (element.hasAttribute("file")) {
Added: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/PatternDescriptor.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/PatternDescriptor.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/PatternDescriptor.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -0,0 +1,50 @@
+/*
+ * 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.pvm.internal.wire.descriptor;
+
+import java.util.regex.Pattern;
+
+import org.jbpm.pvm.internal.wire.WireContext;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class PatternDescriptor extends AbstractDescriptor {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String regex;
+ protected int flags;
+
+ public PatternDescriptor() {
+ }
+
+ public PatternDescriptor(String regex, int flags) {
+ this.regex = regex;
+ this.flags = flags;
+ }
+
+ public Object construct(WireContext wireContext) {
+ return Pattern.compile(regex, flags);
+ }
+
+}
Modified: jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java 2009-04-07 00:38:39 UTC (rev 4470)
+++ jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -1,7 +1,9 @@
package org.jbpm.pvm.internal.email.filter;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
+import java.util.regex.Pattern;
import javax.mail.internet.InternetAddress;
@@ -16,7 +18,7 @@
{
WildCardAddressFilter filter = new WildCardAddressFilter();
//Ensure it is-a AddressFilter.
- this.assertTrue(AddressFilter.class.isAssignableFrom(filter.getClass()));
+ assertTrue(AddressFilter.class.isAssignableFrom(filter.getClass()));
}
/**
@@ -30,7 +32,7 @@
addresses.add(new InternetAddress("test(a)jboss.org"));
Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
- this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
}
/**
@@ -45,13 +47,12 @@
addresses.add(new InternetAddress("test(a)jboss.org"));
addresses.add(new InternetAddress("test(a)amentra.com"));
- Collection<String> regExIncludes = new HashSet<String>();
- regExIncludes.add(".+(a)jboss.org");
+ Collection<Pattern> regExIncludes = Collections.singleton(Pattern.compile(".+(a)jboss.org"));
filter.setIncludePatterns(regExIncludes);
Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
- this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
- this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
+ assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
}
/**
@@ -65,19 +66,17 @@
addresses.add(new InternetAddress("test(a)jboss.org"));
addresses.add(new InternetAddress("test(a)amentra.com"));
- Collection<String> regExIncludes = new HashSet<String>();
- regExIncludes.add(".+(a)jboss.org");
+ Collection<Pattern> regExIncludes = Collections.singleton(Pattern.compile(".+(a)jboss.org"));
filter.setIncludePatterns(regExIncludes);
- Collection<String> regExExcludes = new HashSet<String>();
- regExExcludes.add(".+(a)jboss.org");
+ Collection<Pattern> regExExcludes = Collections.singleton(Pattern.compile(".+(a)amentra.com"));
filter.setExcludePatterns(regExExcludes);
Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
//Includes jboss
- this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
//Does not include amentra.
- this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
+ assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
}
/**
@@ -93,19 +92,15 @@
addresses.add(new InternetAddress("test(a)amentra.com"));
addresses.add(new InternetAddress("test(a)redhat.com"));
- Collection<String> regExExcludes = new HashSet<String>();
- regExExcludes.add(".+(a)jboss.org");
+ Collection<Pattern> regExExcludes = Collections.singleton(Pattern.compile(".+(a)jboss.org"));
filter.setExcludePatterns(regExExcludes);
Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
//Does not include jboss
- this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
//Does include amentra
- this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
+ assertTrue(filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
//Does include redhat
- this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)redhat.com")));
+ assertTrue(filteredAddresses.contains(new InternetAddress("test(a)redhat.com")));
}
-
-
-
}
Added: jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailSessionWireTest.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailSessionWireTest.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailSessionWireTest.java 2009-04-07 06:03:24 UTC (rev 4471)
@@ -0,0 +1,81 @@
+/*
+ * 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.pvm.internal.wire;
+
+import java.util.Collection;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+import org.jbpm.pvm.internal.email.filter.WildCardAddressFilter;
+import org.jbpm.pvm.internal.email.server.MailServerConfiguration;
+import org.jbpm.pvm.internal.email.service.MailService;
+import org.jbpm.pvm.internal.email.service.SynchronousMailService;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class MailSessionWireTest extends WireTestCase {
+
+ public void testMailSession() {
+ WireContext wireContext = createWireContext(
+ "<objects>" +
+ " <mail-session>" +
+ " <mail-server>" +
+ " <wildcard-address-filter>" +
+ " <include>.+(a)jbpm.org</include>" +
+ " <exclude>.+(a)jboss.com</exclude>" +
+ " </wildcard-address-filter>" +
+ " <smtp-properties>" +
+ " <property name='mail.host' value='localhost' />" +
+ " <property name='mail.user' value='aguizar' />" +
+ " <property name='mail.from' value='noreply(a)jbpm.org' />" +
+ " </smtp-properties>" +
+ " </mail-server>" +
+ " </mail-session>" +
+ "</objects>"
+ );
+
+ MailService mailService = wireContext.get(MailService.class);
+ assertTrue("expected sync mail service", mailService instanceof SynchronousMailService);
+
+ SynchronousMailService syncMailService = (SynchronousMailService) mailService;
+ Collection<MailServerConfiguration> serverConfigs = syncMailService.getServerConfigs();
+ assertEquals(1, serverConfigs.size());
+
+ MailServerConfiguration serverConfig = serverConfigs.iterator().next();
+ WildCardAddressFilter addressFilter = (WildCardAddressFilter) serverConfig.getFilter();
+
+ Collection<Pattern> includePatterns = addressFilter.getIncludePatterns();
+ assertEquals(1, includePatterns.size());
+ assertEquals(".+(a)jbpm.org", includePatterns.iterator().next().toString());
+
+ Collection<Pattern> excludePatterns = addressFilter.getExcludePatterns();
+ assertEquals(1, excludePatterns.size());
+ assertEquals(".+(a)jboss.com", excludePatterns.iterator().next().toString());
+
+ Properties properties = serverConfig.getServer().getProperties();
+ assertEquals(3, properties.size());
+ assertEquals("localhost", properties.getProperty("mail.host"));
+ assertEquals("aguizar", properties.getProperty("mail.user"));
+ assertEquals("noreply(a)jbpm.org", properties.getProperty("mail.from"));
+ }
+}
Modified: jbpm4/branches/email/modules/pvm/src/test/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/email/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-04-07 00:38:39 UTC (rev 4470)
+++ jbpm4/branches/email/modules/pvm/src/test/resources/jbpm.wire.bindings.xml 2009-04-07 06:03:24 UTC (rev 4471)
@@ -51,6 +51,7 @@
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentitySessionFactoryBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailSessionBinding" />
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
17 years
JBoss JBPM SVN: r4470 - in jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer: impl and 1 other directory.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 20:38:39 -0400 (Mon, 06 Apr 2009)
New Revision: 4470
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
Log:
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java 2009-04-07 00:37:47 UTC (rev 4469)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java 2009-04-07 00:38:39 UTC (rev 4470)
@@ -1,7 +1,6 @@
package org.jbpm.pvm.internal.email.producer;
import java.util.Collection;
-import java.util.Map;
import org.jbpm.identity.Group;
import org.jbpm.identity.User;
@@ -13,7 +12,6 @@
private Collection<String> toAddresses;
private Collection<String> ccAddresses;
private Collection<String> bccAddresses;
-
public Collection<User> getActors() {
return actors;
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-07 00:37:47 UTC (rev 4469)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-07 00:38:39 UTC (rev 4470)
@@ -25,4 +25,12 @@
return super.produce(exe, mailContext);
}
+
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
}
17 years
JBoss JBPM SVN: r4469 - 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-06 20:37:47 -0400 (Mon, 06 Apr 2009)
New Revision: 4469
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
Log:
Added accessors.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-07 00:33:23 UTC (rev 4468)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-07 00:37:47 UTC (rev 4469)
@@ -95,4 +95,12 @@
return name;
}
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
}
17 years
JBoss JBPM SVN: r4468 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 20:33:23 -0400 (Mon, 06 Apr 2009)
New Revision: 4468
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java
Log:
Added logger, todo.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java 2009-04-07 00:29:17 UTC (rev 4467)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/service/SynchronousMailService.java 2009-04-07 00:33:23 UTC (rev 4468)
@@ -11,6 +11,8 @@
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMessage.RecipientType;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.jbpm.pvm.internal.email.filter.AddressFilter;
@@ -19,6 +21,8 @@
public class SynchronousMailService implements MailService {
+ private static final Log log = LogFactory.getLog(SynchronousMailService.class);
+
Collection<MailServerConfiguration> serverConfigs;
public void send(Collection<Email> emails) {
@@ -61,7 +65,8 @@
}
catch(EmailException e)
{
- //TODO: What to do here?
+ log.error("An exception occurred while sending email.",e);
+ //TODO: Does anything else need to occur here?
}
}
}
17 years
JBoss JBPM SVN: r4467 - jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 20:29:17 -0400 (Mon, 06 Apr 2009)
New Revision: 4467
Modified:
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
Log:
Commented the testcase.
Modified: jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java 2009-04-07 00:25:25 UTC (rev 4466)
+++ jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java 2009-04-07 00:29:17 UTC (rev 4467)
@@ -9,6 +9,9 @@
public class WildCardAddressFilterTest extends TestCase{
+ /**
+ * Tests that the WildCardAddressFilter is-a AddressFilter implementation.
+ */
public void testInstantiationWildCards()
{
WildCardAddressFilter filter = new WildCardAddressFilter();
@@ -16,6 +19,9 @@
this.assertTrue(AddressFilter.class.isAssignableFrom(filter.getClass()));
}
+ /**
+ * When no filter is provided, all addresses should be contained in the filtered list.
+ */
public void testWildCardIncludesNoFilters() throws Exception
{
WildCardAddressFilter filter = new WildCardAddressFilter();
@@ -27,6 +33,10 @@
this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
}
+ /**
+ * If the includes is provided, no other addresses except those explicitly listed should
+ * be included in the filtered list.
+ */
public void testWildCardIncludes() throws Exception
{
WildCardAddressFilter filter = new WildCardAddressFilter();
@@ -44,6 +54,9 @@
this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
}
+ /**
+ * The includes should always override the excludes.
+ */
public void testWildCardIncludesOverridesExcludes() throws Exception
{
WildCardAddressFilter filter = new WildCardAddressFilter();
@@ -67,6 +80,10 @@
this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
}
+ /**
+ * When the excludes is specified but no includes, all addresses except those explicitly stated
+ * should be contained in the filtered set.
+ */
public void testWildCardExcludes() throws Exception
{
WildCardAddressFilter filter = new WildCardAddressFilter();
17 years
JBoss JBPM SVN: r4466 - jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 20:25:25 -0400 (Mon, 06 Apr 2009)
New Revision: 4466
Modified:
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
Log:
Is Assignable test.
Modified: jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java 2009-04-07 00:22:31 UTC (rev 4465)
+++ jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java 2009-04-07 00:25:25 UTC (rev 4466)
@@ -11,8 +11,9 @@
public void testInstantiationWildCards()
{
- AddressFilter filter = new WildCardAddressFilter();
-
+ WildCardAddressFilter filter = new WildCardAddressFilter();
+ //Ensure it is-a AddressFilter.
+ this.assertTrue(AddressFilter.class.isAssignableFrom(filter.getClass()));
}
public void testWildCardIncludesNoFilters() throws Exception
17 years
JBoss JBPM SVN: r4465 - in jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal: email and 1 other directories.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 20:22:31 -0400 (Mon, 06 Apr 2009)
New Revision: 4465
Added:
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/
jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
Log:
Added test class to test includes/excludes funtionality.
Added: jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/test/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilterTest.java 2009-04-07 00:22:31 UTC (rev 4465)
@@ -0,0 +1,93 @@
+package org.jbpm.pvm.internal.email.filter;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.mail.internet.InternetAddress;
+
+import junit.framework.TestCase;
+
+public class WildCardAddressFilterTest extends TestCase{
+
+ public void testInstantiationWildCards()
+ {
+ AddressFilter filter = new WildCardAddressFilter();
+
+ }
+
+ public void testWildCardIncludesNoFilters() throws Exception
+ {
+ WildCardAddressFilter filter = new WildCardAddressFilter();
+
+ Collection<InternetAddress> addresses = new HashSet<InternetAddress>();
+ addresses.add(new InternetAddress("test(a)jboss.org"));
+
+ Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
+ this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ }
+
+ public void testWildCardIncludes() throws Exception
+ {
+ WildCardAddressFilter filter = new WildCardAddressFilter();
+
+ Collection<InternetAddress> addresses = new HashSet<InternetAddress>();
+ addresses.add(new InternetAddress("test(a)jboss.org"));
+ addresses.add(new InternetAddress("test(a)amentra.com"));
+
+ Collection<String> regExIncludes = new HashSet<String>();
+ regExIncludes.add(".+(a)jboss.org");
+ filter.setIncludePatterns(regExIncludes);
+
+ Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
+ this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
+ }
+
+ public void testWildCardIncludesOverridesExcludes() throws Exception
+ {
+ WildCardAddressFilter filter = new WildCardAddressFilter();
+
+ Collection<InternetAddress> addresses = new HashSet<InternetAddress>();
+ addresses.add(new InternetAddress("test(a)jboss.org"));
+ addresses.add(new InternetAddress("test(a)amentra.com"));
+
+ Collection<String> regExIncludes = new HashSet<String>();
+ regExIncludes.add(".+(a)jboss.org");
+ filter.setIncludePatterns(regExIncludes);
+
+ Collection<String> regExExcludes = new HashSet<String>();
+ regExExcludes.add(".+(a)jboss.org");
+ filter.setExcludePatterns(regExExcludes);
+
+ Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
+ //Includes jboss
+ this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ //Does not include amentra.
+ this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
+ }
+
+ public void testWildCardExcludes() throws Exception
+ {
+ WildCardAddressFilter filter = new WildCardAddressFilter();
+
+ Collection<InternetAddress> addresses = new HashSet<InternetAddress>();
+ addresses.add(new InternetAddress("test(a)jboss.org"));
+ addresses.add(new InternetAddress("test(a)amentra.com"));
+ addresses.add(new InternetAddress("test(a)redhat.com"));
+
+ Collection<String> regExExcludes = new HashSet<String>();
+ regExExcludes.add(".+(a)jboss.org");
+ filter.setExcludePatterns(regExExcludes);
+
+ Collection<InternetAddress> filteredAddresses = filter.filter(addresses);
+ //Does not include jboss
+ this.assertTrue(!filteredAddresses.contains(new InternetAddress("test(a)jboss.org")));
+ //Does include amentra
+ this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)amentra.com")));
+ //Does include redhat
+ this.assertTrue(filteredAddresses.contains(new InternetAddress("test(a)redhat.com")));
+ }
+
+
+
+}
17 years