[jbpm-commits] JBoss JBPM SVN: r4260 - in jbpm4/branches/tbaeyens/modules: distro/.settings and 12 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Mar 17 06:39:36 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-03-17 06:39:35 -0400 (Tue, 17 Mar 2009)
New Revision: 4260

Added:
   jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/
   jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/Order.java
   jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
   jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/candidates/
   jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
   jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/
   jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java
Modified:
   jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java
   jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java
   jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties
   jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
   jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
Log:
work

Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/ProcessEngine.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -37,7 +37,7 @@
   /** the {@link ProcessService process service} and supply some 
    * transactional resources.  The given transactional resources will only 
    * be associated to the returned process service.  */ 
-  ProcessService getProcessService(Map<String, Object> txResources);
+  ProcessService getProcessService(Map<String, Object> envObjects);
 
   /** the {@link ExecutionService execution service} that provides access
    * to the runtime executions repository. */ 
@@ -46,7 +46,7 @@
   /** the {@link ExecutionService execution service} and supply some 
    * transactional resources.  The given transactional resources will only 
    * be associated to the returned execution service.  */ 
-  ExecutionService getExecutionService(Map<String, Object> txResources);
+  ExecutionService getExecutionService(Map<String, Object> envObjects);
 
   /** the {@link HistoryService history service} that provides access
    * to the history executions repository. */ 
@@ -55,7 +55,7 @@
   /** the {@link HistoryService history service} that provides access
    * to the history executions repository. The given transactional resources will only 
    * be associated to the returned history service.  */ 
-  HistoryService getHistoryService(Map<String, Object> txResources);
+  HistoryService getHistoryService(Map<String, Object> envObjects);
 
   /** the {@link TaskService task service} that exposes the 
    * runtime human task lists. */ 
@@ -64,7 +64,7 @@
   /** the {@link TaskService task service} and supply some 
    * transactional resources.  The given transactional resources will only 
    * be associated to the returned task service.  */ 
-  TaskService getTaskService(Map<String, Object> txResources);
+  TaskService getTaskService(Map<String, Object> envObjects);
 
   /** the {@link ManagementService management service} that exposes the 
    * management operations to operators that have to keep the jBPM system 
@@ -74,7 +74,7 @@
   /** the {@link ManagementService management service} and supply some 
    * transactional resources.  The given transactional resources will only 
    * be associated to the returned management service. */ 
-  ManagementService getManagementService(Map<String, Object> txResources);
+  ManagementService getManagementService(Map<String, Object> envObjects);
 
   /** retrieve and object defined in the process engine by type */
   <T> T get(Class<T> type);

Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/TaskService.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -66,7 +66,8 @@
   /** Removes the task with the given identifier from persistent storage. */
   void deleteTask(long taskDbid);
   
-  
+  /** Takes a task from the group task list to the current user's personal task list. */
+  void takeTask(long taskDbid);
 
   /** add a role to a given task.
    * @param identityRef wither a new {@link UserRef} or a new {@link GroupRef}  
@@ -100,7 +101,7 @@
    * in this swimlane. see {@link Participant} for default constants. */
   void removeSwimlaneParticipant(long szimlaneDbid, IdentityRef identityRef, String participation);
 
-
+  /** create a new query for tasks */
   TaskQuery createTaskQuery();
 
   /** retrieves the personal task of the given user, which might be different 

Modified: jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/distro/.settings/attachedFile.properties	2009-03-17 10:39:35 UTC (rev 4260)
@@ -1,2 +1,2 @@
 ## index of importer -> set(imports)
-#Fri Mar 13 22:58:08 CET 2009
+#Tue Mar 17 09:02:55 CET 2009

Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/resources/config-tool/jbpm/wire.bindings/part1.jbpm.wire.bindings.xml	2009-03-17 10:39:35 UTC (rev 4260)
@@ -38,6 +38,7 @@
   <binding class="org.jbpm.pvm.internal.wire.binding.ScriptManagerBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.BusinessCalendarBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.IdGeneratorBinding" />
+  <binding class="org.jbpm.pvm.internal.wire.binding.AuthenticationBinding" />
   <!-- hibernate bindings -->
   <binding class="org.jbpm.pvm.internal.wire.binding.HibernateConfigurationBinding" />
   <binding class="org.jbpm.pvm.internal.wire.binding.SeamHibernateSessionBinding" />

Added: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/Order.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/Order.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/Order.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -0,0 +1,45 @@
+/*
+ * 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.examples.task.assignee;
+
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+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;
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/Order.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -0,0 +1,64 @@
+/*
+ * 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.examples.task.assignee;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskAssigneeTest extends JbpmTestCase {
+
+  public void testTaskAssignee() {
+    deployJpdlResource("org/jbpm/examples/task/assignee/process.jpdl.xml");
+    
+    Map<String, Object> variables = new HashMap<String, Object>(); 
+    variables.put("order", new Order("johndoe"));
+    Execution execution = executionService.startProcessInstanceByKey("TaskAssignee", variables);
+    String executionId = execution.getId();
+    
+    List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+    assertEquals(1, taskList.size());
+    Task task = taskList.get(0);
+    assertEquals("review", task.getName());
+    assertEquals("johndoe", task.getAssignee());
+
+    // submit the task
+    taskService.submitTask(task.getDbid());
+    
+    // verify that the task list is now empty
+    taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+    assertEquals(0, taskList.size());
+
+    // verify that process moved to the next state
+    execution = executionService.findExecution(executionId);
+    assertEquals("wait", execution.getActivityName());
+  }
+
+}


Property changes on: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/assignee/TaskAssigneeTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -0,0 +1,70 @@
+/*
+ * 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.examples.task.candidates;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.examples.task.assignee.Order;
+import org.jbpm.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCandidatesTest extends JbpmTestCase {
+
+  public void testTaskAssignee() {
+    /*
+    deployJpdlResource("org/jbpm/examples/task/candidates/process.jpdl.xml");
+    
+    Map<String, Object> variables = new HashMap<String, Object>(); 
+    variables.put("order", new Order("johndoe"));
+    Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+    String executionId = execution.getId();
+    
+    List<Task> taskList = taskService.getGroupTaskList("johndoe", 0, 10);
+    assertEquals(1, taskList.size());
+    Task task = taskList.get(0);
+    assertEquals("review", task.getName());
+
+    taskList = taskService.getGroupTaskList("joesmoe", 0, 10);
+    assertEquals(1, taskList.size());
+    task = taskList.get(0);
+    assertEquals("review", task.getName());
+
+    // submit the task
+    taskService.takeTask(task.getDbid());
+    
+    // verify that the group task lists are now empty
+    taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+    assertEquals(0, taskList.size());
+
+    // verify that process moved to the next state
+    execution = executionService.findExecution(executionId);
+    assertEquals("wait", execution.getActivityName());
+    */
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/jbpm.jpdl.hbm.xml	2009-03-17 10:39:35 UTC (rev 4260)
@@ -83,7 +83,12 @@
                index="IDX_ACT_PARTSDESCR" />
     </subclass>
     <subclass name="org.jbpm.jpdl.internal.activity.TaskActivity" discriminator-value="task">
-      <property name="assignee" column="TEXT_" />
+      <many-to-one name="taskDefinition"
+               column="TASKDEF_" 
+               cascade="all"
+               class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
+               foreign-key="FK_ACT_TASKDEF"
+               index="IDX_ACT_TASKDEF" />
     </subclass>
   </class>
 

Added: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml	2009-03-17 10:39:35 UTC (rev 4260)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TaskCandidates">
+
+  <start g="20,20,48,48">
+    <transition to="review" />
+  </start>
+
+  <task name="review" 
+        g="96,16,127,52">
+    <assignment candidates="johndoe, joesmoe" />
+            
+    <transition to="wait" />
+  </task>
+  
+  <state name="wait" g="255,16,88,52"/>
+
+</process>


Property changes on: jbpm4/branches/tbaeyens/modules/examples/src/test/resources/org/jbpm/examples/task/candidates/process.jpdl.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -35,23 +35,14 @@
   private static final long serialVersionUID = 1L;
   
   protected long taskDbid;
-  protected TaskImpl task;
 
-  public SubmitTaskCmd(TaskImpl task) {
-    this.task = task;
-  }
-
   public SubmitTaskCmd(long taskDbid) {
     this.taskDbid = taskDbid;
   }
 
   public Void execute(Environment environment) throws Exception {
     TaskDbSession taskDbession = environment.get(TaskDbSession.class);
-    if (task!=null) {
-      taskDbession.merge(task);
-    } else {
-      task = (TaskImpl) taskDbession.findTaskByDbid(taskDbid);
-    }
+    TaskImpl task = (TaskImpl) taskDbession.findTaskByDbid(taskDbid);
     task.submit();
     taskDbession.delete(task);
     return null;

Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -0,0 +1,53 @@
+/*
+ * 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.cmd;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TakeTaskCmd implements Command<Void> {
+
+  private static final long serialVersionUID = 1L;
+  
+  protected long taskDbid;
+
+  public TakeTaskCmd(long taskDbid) {
+    this.taskDbid = taskDbid;
+  }
+
+  public Void execute(Environment environment) {
+    TaskDbSession taskDbession = environment.get(TaskDbSession.class);
+    TaskImpl task = (TaskImpl) taskDbession.findTaskByDbid(taskDbid);
+    if (task==null) {
+      throw new JbpmException("task "+taskDbid+" does not exist");
+    }
+    task.take();
+    return null;
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/TakeTaskCmd.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/PvmEnvironment.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -54,35 +54,4 @@
     log.debug("closed "+this);
   }
 
-  
-  /*
-  // close ////////////////////////////////////////////////////////////////////
-
-  public void close() {
-    log.trace("closing "+this);
-
-    pvmEnvironmentFactory.getApplicationWireContext().fire(PvmEnvironment.EVENT_CLOSEENVIRONMENT, this);
-    
-    Environment popped = Environment.popEnvironment();
-    if (this!=popped) {
-      throw new PvmException("environment nesting problem");
-    }
-
-    Context context = getEnvironmentContext();
-    if (context instanceof Closable) {
-      ((Closable)context).close();
-    }
-    log.debug("closed "+this);
-  }
-
-  protected static void rethrow(Throwable exception) throws Error {
-    if (exception instanceof Error) {
-      throw (Error) exception;
-    }
-    if (exception instanceof RuntimeException) {
-      throw (RuntimeException) exception;
-    }
-    throw new PvmException(exception);
-  }
-  */
 }

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/EnvironmentInterceptor.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -36,6 +36,7 @@
 
   public <T> T execute(Command<T> command) {
     Environment environment = environmentFactory.openEnvironment();
+    
     try {
       return next.execute(command);
       

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -31,8 +31,10 @@
 
 import org.jbpm.Execution;
 import org.jbpm.JbpmException;
+import org.jbpm.env.Environment;
 import org.jbpm.model.Comment;
 import org.jbpm.pvm.internal.cal.Duration;
+import org.jbpm.pvm.internal.env.Authentication;
 import org.jbpm.pvm.internal.model.CommentImpl;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
@@ -204,6 +206,14 @@
     return null;
   }
 
+  public void take() {
+    if (assignee!=null) {
+      throw new JbpmException("task "+dbid+" is already taken by "+assignee);
+    }
+    Authentication authentication = Environment.getFromCurrent(Authentication.class);
+    assignee = authentication.getUserId();
+  }
+
   // comments /////////////////////////////////////////////////////////////////
 
   public List<Comment> getComments() {

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java	2009-03-17 09:55:15 UTC (rev 4259)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -40,6 +40,7 @@
 import org.jbpm.pvm.internal.cmd.RemoveParticipantCmd;
 import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
 import org.jbpm.pvm.internal.cmd.SubmitTaskCmd;
+import org.jbpm.pvm.internal.cmd.TakeTaskCmd;
 import org.jbpm.task.IdentityRef;
 import org.jbpm.task.Participant;
 import org.jbpm.task.Task;
@@ -86,10 +87,6 @@
     commandService.execute(new SubmitTaskCmd(taskDbid));
   }
 
-  public void submitTask(Task task) {
-    commandService.execute(new SubmitTaskCmd((TaskImpl)task));
-  }
-
   public void addTaskParticipant(long taskDbid, IdentityRef identityRef, String participation) {
     commandService.execute(new AddParticipantCmd(taskDbid, null, identityRef, participation));
   }
@@ -153,4 +150,8 @@
   public Comment addReplyComment(long commentDbid, String message) {
     return commandService.execute(new AddReplyCommentCmd(commentDbid, message));
   }
+
+  public void takeTask(long taskDbid) {
+    commandService.execute(new TakeTaskCmd(taskDbid));
+  }
 }

Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java	2009-03-17 10:39:35 UTC (rev 4260)
@@ -0,0 +1,47 @@
+/*
+ * 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 org.jbpm.pvm.internal.env.Authentication;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AuthenticationBinding extends WireDescriptorBinding {
+
+  public AuthenticationBinding() {
+    super("authentication");
+  }
+
+  public Object parse(Element element, Parse parse, Parser parser) {
+    ObjectDescriptor objectDescriptor = new ObjectDescriptor();
+    
+    objectDescriptor.setClassName(Authentication.class.getName());
+    
+    return objectDescriptor;
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AuthenticationBinding.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbpm-commits mailing list