[jbpm-commits] JBoss JBPM SVN: r3881 - in jbpm4/trunk: modules/api/src/main/java/org/jbpm/session and 23 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Feb 16 05:49:48 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-02-16 05:49:48 -0500 (Mon, 16 Feb 2009)
New Revision: 3881
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Assigner.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Swimlane.java
jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/ConsoleHandler.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleState.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/RoleImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskExecution.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskDbSessionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.default.lifecycle.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml
Removed:
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Swimlane.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/SwimlaneDefinition.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskDefinition.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskException.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/DeleteTaskCmd.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/GetTaskCmd.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/NewTaskCmd.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SaveTaskCmd.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SubmitTaskCmd.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/hibernate/HibernateTaskDbSession.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycle.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleParser.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleState.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/RoleImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneDefinitionImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskDefinitionImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskExecution.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskQueryImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskServiceImpl.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskDbSessionBinding.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskServiceBinding.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/session/TaskDbSession.java
jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/task.model.jpg
jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml
jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml
Modified:
jbpm4/trunk/modules/jpdl/pom.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/TaskActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/internal/model/TaskTest.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
jbpm4/trunk/modules/test-db/src/main/resources/logging.properties
jbpm4/trunk/pom.xml
Log:
JBPM-2041 moving task module into pvm
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/session/TaskDbSession.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/session/TaskDbSession.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,35 @@
+/*
+ * 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.session;
+
+import org.jbpm.task.Task;
+
+/**
+ * Persistence interface for tasks.
+ * @author Alejandro Guizar
+ */
+public interface TaskDbSession extends DbSession {
+
+ Task findTaskById(String taskId);
+
+ void saveTask(Task task);
+}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Assigner.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Assigner.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Assigner.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,34 @@
+/*
+ * 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.task;
+
+import java.io.Serializable;
+
+
+/** interface to delegate {@link Task} or {@link Swimlane} assignment.
+ * @author Tom Baeyens
+ */
+public interface Assigner extends Serializable {
+
+ /** sets the actorId and candidates for the given task. */
+ void assign(Task task) throws Exception;
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Assigner.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Swimlane.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Swimlane.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Swimlane.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Swimlane.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,44 @@
+/*
+ * 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.task;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+/** a runtime process role that can store an assignment so that
+ * multiple related tasks are assigned to the same actor.
+ *
+ * @author Tom Baeyens
+ */
+public interface Swimlane extends Serializable {
+
+ long getDbid();
+
+ String getName();
+
+ String getAssignee();
+ void setAssignee(String assignee);
+
+ Collection<Role> getCandidates();
+ Role createCandidate(String identityId);
+ void removeCandidate(Role candidate);
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/task/Swimlane.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/jpdl/pom.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/pom.xml 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/jpdl/pom.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -42,11 +42,6 @@
<artifactId>jbpm-pvm</artifactId>
<version>${version}</version>
</dependency>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-task</artifactId>
- <version>${version}</version>
- </dependency>
<!-- 3rd Party -->
<dependency>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/TaskActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/TaskActivity.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/TaskActivity.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -28,8 +28,8 @@
import org.jbpm.env.Environment;
import org.jbpm.model.Activity;
import org.jbpm.model.Transition;
-import org.jbpm.task.internal.model.TaskImpl;
-import org.jbpm.task.session.TaskDbSession;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
/**
Added: jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/ConsoleHandler.java
===================================================================
--- jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/ConsoleHandler.java (rev 0)
+++ jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/ConsoleHandler.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,30 @@
+/*
+ * 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.internal.log;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ConsoleHandler extends java.util.logging.ConsoleHandler {
+
+}
Property changes on: jbpm4/trunk/modules/log/src/main/java/org/jbpm/internal/log/ConsoleHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/DeleteTaskCmd.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/DeleteTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,49 @@
+/*
+ * 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.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.session.TaskDbSession;
+import org.jbpm.task.Task;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class DeleteTaskCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String taskId;
+
+ public DeleteTaskCmd(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+ Task task = taskDbSession.findTaskById(taskId);
+ taskDbSession.delete(task);
+ return null;
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/GetTaskCmd.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,46 @@
+/*
+ * 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.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.session.TaskDbSession;
+import org.jbpm.task.Task;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class GetTaskCmd implements Command<Task> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String taskId;
+
+ public GetTaskCmd(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public Task execute(Environment environment) throws Exception {
+ TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+ return taskDbSession.findTaskById(taskId);
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/NewTaskCmd.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/NewTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,60 @@
+/*
+ * 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.hibernate.Session;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.task.Task;
+
+/**
+ * @author Tom Baeyens
+ */
+public class NewTaskCmd implements Command<Task> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Long executionDbid;
+
+ public NewTaskCmd() {
+ }
+
+ public NewTaskCmd(long executionDbid) {
+ this.executionDbid = executionDbid;
+ }
+
+ public Task execute(Environment environment) throws Exception {
+ ExecutionImpl execution = null;
+
+ Session session = environment.get(Session.class);
+
+ if (executionDbid!=null) {
+ execution = (ExecutionImpl) session.load(ExecutionImpl.class, executionDbid);
+ }
+
+ Task task = TaskImpl.create(execution);
+
+ return task;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SaveTaskCmd.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SaveTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,49 @@
+/*
+ * 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.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class SaveTaskCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected TaskImpl task;
+
+ public SaveTaskCmd(TaskImpl task) {
+ this.task = task;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
+
+ taskDbSession.saveTask(task);
+
+ return null;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SubmitTaskCmd.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,59 @@
+/*
+ * 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.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubmitTaskCmd implements Command<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String taskId;
+ protected TaskImpl task;
+
+ public SubmitTaskCmd(TaskImpl task) {
+ this.task = task;
+ }
+
+ public SubmitTaskCmd(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public Void execute(Environment environment) throws Exception {
+ TaskDbSession taskDbession = environment.get(TaskDbSession.class);
+ if (task!=null) {
+ taskDbession.merge(task);
+ } else {
+ task = (TaskImpl) taskDbession.findTaskById(taskId);
+ }
+ task.submit();
+ taskDbession.delete(task);
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SubmitTaskCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/hibernate/HibernateTaskDbSession.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,57 @@
+/*
+ * 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.hibernate;
+
+import java.io.Serializable;
+
+import org.hibernate.criterion.Restrictions;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
+import org.jbpm.task.Task;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class HibernateTaskDbSession extends HibernateDbSession implements TaskDbSession {
+
+ public TaskImpl findTaskById(String taskId) {
+ // TODO maybe we should move these criteria queries to hql queries in the
+ // hbm file so that users can easily customize.
+ return (TaskImpl) session.createCriteria(TaskImpl.class)
+ .add(Restrictions.eq("id", taskId))
+ .uniqueResult();
+ }
+
+ public void saveTask(Task task) {
+ TaskImpl taskImpl = (TaskImpl) task;
+
+ if (! taskImpl.isPersisted()) {
+ Serializable dbid = session.save(taskImpl);
+ if (taskImpl.getId() == null) {
+ taskImpl.setId(dbid.toString());
+ }
+
+ } else {
+ session.update(taskImpl);
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DefaultCommandService.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -42,11 +42,11 @@
return command.execute(environment);
} catch (RuntimeException e) {
- log.error("exception while executing command "+command, e);
+ log.info("exception while executing command "+command, e);
throw e;
} catch (Exception e) {
- log.error("exception while executing command "+command, e);
+ log.info("exception while executing command "+command, e);
throw new JbpmException("exception while executing command "+command, e);
}
}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycle.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,96 @@
+/*
+ * 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.task;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.model.Activity;
+import org.jbpm.model.IdGenerator;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class LifeCycle extends ProcessDefinitionImpl {
+
+ private static final long serialVersionUID = 1L;
+ private static LifeCycleParser lifeCycleParser = new LifeCycleParser();
+ private static Map<String, ProcessDefinitionImpl> lifeCycleProcesses = new HashMap<String, ProcessDefinitionImpl>();
+
+ public static String initialise(TaskImpl task) {
+ ProcessDefinitionImpl lifeCycle = getLifeCycle(task);
+ Map<String, Object> lifeCycleVariables = new HashMap<String, Object>();
+ lifeCycleVariables.put("task", task);
+ ClientProcessInstance lifeCycleExecution = lifeCycle.createProcessInstance();
+ lifeCycleExecution.setVariables(lifeCycleVariables);
+ lifeCycleExecution.start();
+ return lifeCycleExecution.getActivity().getName();
+ }
+
+ public static ProcessDefinitionImpl getLifeCycle(TaskImpl task) {
+ if (task==null) {
+ throw new JbpmException("task is null");
+ }
+ String resource = task.getLifeCycleResource();
+ if (resource==null) {
+ throw new JbpmException("task "+task.getClass().getName()+" did'nt return a lifecycle");
+ }
+ ProcessDefinitionImpl lifeCycleProcess;
+ synchronized (lifeCycleProcesses) {
+ lifeCycleProcess = lifeCycleProcesses.get(resource);
+ if (lifeCycleProcess==null) {
+ lifeCycleProcess = (ProcessDefinitionImpl) lifeCycleParser
+ .createParse()
+ .setResource(resource)
+ .execute()
+ .checkProblems("task lifecycle")
+ .getDocumentObject();
+ lifeCycleProcesses.put(resource, lifeCycleProcess);
+ }
+ }
+ return lifeCycleProcess;
+ }
+
+ protected static void fireLifeCycleEvent(String eventName, TaskImpl task) {
+ ExecutionImpl lifeCycleExecution = new ExecutionImpl();
+ ProcessDefinitionImpl lifeCycleProcess = getLifeCycle(task);
+ lifeCycleExecution.setProcessDefinition(lifeCycleProcess);
+ String state = task.getState();
+ Activity activity = lifeCycleProcess.getActivity(state);
+ lifeCycleExecution.setActivity((ActivityImpl) activity);
+ lifeCycleExecution.signal(eventName);
+ task.state = lifeCycleExecution.getActivity().getName();
+ }
+
+ public IdGenerator getIdGenerator() {
+ // overrides the default ProcessDefinitionImpl behaviour that will end up
+ // in the execution being persisted
+ return null;
+ }
+
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleParser.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,105 @@
+/*
+ * 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.task;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class LifeCycleParser extends Parser {
+
+ public Object parseDocumentElement(Element element, Parse parse) {
+ ProcessDefinitionImpl lifeCycleProcess = new LifeCycle();
+
+ List<Element> stateElements = XmlUtil.elements(element, "state");
+ for (Element stateElement: stateElements) {
+ parseState(stateElement, lifeCycleProcess, parse);
+ }
+ for (Element stateElement: stateElements) {
+ parseTransitions(stateElement, lifeCycleProcess, parse);
+ }
+
+ String initialStateName = null;
+ if (element.hasAttribute("initial")) {
+ initialStateName = element.getAttribute("initial");
+ ActivityImpl initial = (ActivityImpl) lifeCycleProcess.getActivity(initialStateName);
+ if (initial!=null) {
+ lifeCycleProcess.setInitial(initial);
+ } else {
+ parse.addProblem("initial "+initialStateName+" doesn't exist");
+ }
+ }
+
+ return lifeCycleProcess;
+ }
+
+ public void parseTransitions(Element element, ProcessDefinitionImpl lifeCycleProcess, Parse parse) {
+ if (! element.hasAttribute("name")) {
+ parse.addProblem("state doesn't have a name: "+XmlUtil.toString(element));
+ return;
+ }
+ String stateName = element.getAttribute("name");
+ ActivityImpl state = (ActivityImpl) lifeCycleProcess.getActivity(stateName);
+
+ List<Element> transitionElements = XmlUtil.elements(element, "transition");
+ for (Element transitionElement: transitionElements) {
+ parseTransition(transitionElement, state, parse);
+ }
+ }
+
+ public void parseTransition(Element element, ActivityImpl state, Parse parse) {
+ if (! element.hasAttribute("name")) {
+ parse.addProblem("transition doesn't have a name: "+XmlUtil.toString(element));
+ return;
+ }
+ String transitionName = element.getAttribute("name");
+ if (! element.hasAttribute("to")) {
+ parse.addProblem("transition "+transitionName+" doesn't have a to attribute indicating the destination state: "+XmlUtil.toString(element));
+ return;
+ }
+ String destinationName = element.getAttribute("to");
+ ActivityImpl destination = (ActivityImpl) state.getProcessDefinition().getActivity(destinationName);
+ if (destination!=null) {
+ state.createOutgoingTransition(destination, transitionName);
+ } else {
+ parse.addProblem("destination "+destinationName+" of "+transitionName+" is unknown");
+ }
+ }
+
+ public void parseState(Element element, ProcessDefinitionImpl lifeCycleProcess, Parse parse) {
+ if (! element.hasAttribute("name")) {
+ parse.addProblem("state doesn't have an id: "+XmlUtil.toString(element));
+ return;
+ }
+ String stateName = element.getAttribute("name");
+ ActivityImpl state = lifeCycleProcess.createActivity(stateName);
+ state.setBehaviour(new LifeCycleState());
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleState.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleState.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleState.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleState.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,44 @@
+/*
+ * 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.task;
+
+import java.util.Map;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.activity.ExternalActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public class LifeCycleState implements ExternalActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName,
+ Map<String, Object> parameters) throws Exception {
+ execution.take(signalName);
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/RoleImpl.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/RoleImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/RoleImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/RoleImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -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.task;
+
+import java.io.Serializable;
+
+import org.jbpm.task.Role;
+
+
+/** the relation between a task and a person.
+ * @author Tom Baeyens
+ */
+public class RoleImpl implements Serializable, Role {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+ protected String identityId;
+ protected String roleType;
+ protected String description;
+ protected TaskImpl task;
+ protected SwimlaneImpl swimlane;
+
+ public String toString() {
+ return roleType.toString()+"("+identityId+")";
+ }
+
+ public TaskImpl getTask() {
+ return task;
+ }
+ public void setTask(TaskImpl task) {
+ this.task = task;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public long getDbid() {
+ return dbid;
+ }
+ public SwimlaneImpl getSwimlane() {
+ return swimlane;
+ }
+ public void setSwimlane(SwimlaneImpl swimlane) {
+ this.swimlane = swimlane;
+ }
+ public String getIdentityId() {
+ return identityId;
+ }
+ public void setIdentityId(String identityId) {
+ this.identityId = identityId;
+ }
+ public String getRoleType() {
+ return roleType;
+ }
+ public void setRoleType(String roleType) {
+ this.roleType = roleType;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneDefinitionImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneDefinitionImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,98 @@
+/*
+ * 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.task;
+
+import java.io.Serializable;
+
+import org.jbpm.pvm.internal.util.EqualsUtil;
+
+/**
+ * is a process role (aka participant).
+ */
+public class SwimlaneDefinitionImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+ protected String name = null;
+
+ /**
+ * expression that resolves to 1 single actorId.
+ */
+ protected String actorIdExpression = null;
+
+ /**
+ * expression that resolves to a comma separated list of actorIds.
+ */
+ protected String candidatesExpression = null;
+
+ /**
+ * expression that resolves to an AssignmentHandler implementation.
+ */
+ protected String assignmentExpression = null;
+
+ // equals ///////////////////////////////////////////////////////////////////
+ // hack to support comparing hibernate proxies against the real objects
+ // since this always falls back to ==, we don't need to overwrite the hashcode
+ public boolean equals(Object o) {
+ return EqualsUtil.equals(this, o);
+ }
+
+ public void setActorIdExpression(String actorIdExpression) {
+ // Note: combination of actorIdExpression and candidatesExpression is allowed
+ this.actorIdExpression = actorIdExpression;
+ this.assignmentExpression = null;
+ }
+ public void setCandidatesExpression(String pooledActorsExpression) {
+ // Note: combination of actorIdExpression and pooledActorsExpression is allowed
+ this.candidatesExpression = pooledActorsExpression;
+ this.assignmentExpression = null;
+ }
+ public void setAssignmentExpression(String assignmentExpression) {
+ // assignment expressions and assignmentDelegation are mutually exclusive
+ this.actorIdExpression = null;
+ this.candidatesExpression = null;
+ this.assignmentExpression = assignmentExpression;
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+ public String getActorIdExpression() {
+ return actorIdExpression;
+ }
+ public String getCandidatesExpression() {
+ return candidatesExpression;
+ }
+ public String getAssignmentExpression() {
+ return assignmentExpression;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/SwimlaneImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,119 @@
+/*
+ * 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.task;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.JbpmException;
+import org.jbpm.pvm.internal.util.EqualsUtil;
+import org.jbpm.task.Role;
+import org.jbpm.task.Swimlane;
+import org.jbpm.task.Task;
+
+/**
+ * runtime process role for a specific process instance.
+ */
+public class SwimlaneImpl implements Serializable, Swimlane {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int dbversion;
+ protected String name = null;
+ protected String assignee = null;
+ protected Set<RoleImpl> candidates = null;
+ protected SwimlaneDefinitionImpl swimlaneDefinition = null;
+
+ // assignment methods ///////////////////////////////////////////////////////
+
+ public String getAssignee() {
+ return assignee;
+ }
+
+ public void setAssignee(String assignee) {
+ this.assignee = assignee;
+ }
+
+ // candidates ///////////////////////////////////////////////////////////////
+
+ public Collection<Role> getCandidates() {
+ if (candidates==null) {
+ return Collections.EMPTY_LIST;
+ }
+ return (Collection)candidates;
+ }
+
+ public Role createCandidate(String identityId) {
+ if (identityId==null) {
+ throw new JbpmException("identityId is null");
+ }
+ RoleImpl role = new RoleImpl();
+ role.setIdentityId(identityId);
+ role.setRoleType(Task.ROLETYPE_CANDIDATE);
+ role.setSwimlane(this);
+ if (candidates==null) {
+ candidates = new HashSet<RoleImpl>();
+ }
+ candidates.add(role);
+ return role;
+ }
+
+ public void removeCandidate(Role candidate) {
+ if (candidate==null) {
+ throw new JbpmException("candidate is null");
+ }
+ if ( (candidates!=null)
+ && (candidates.remove(candidate))
+ ) {
+ ((RoleImpl)candidate).setTask(null);
+ }
+ }
+
+ // equals ///////////////////////////////////////////////////////////////////
+ // hack to support comparing hibernate proxies against the real objects
+ // since this always falls back to ==, we don't need to overwrite the hashcode
+ public boolean equals(Object o) {
+ return EqualsUtil.equals(this, o);
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getName() {
+ return name;
+ }
+ public SwimlaneDefinitionImpl getSwimlaneDefinition() {
+ return swimlaneDefinition;
+ }
+ public void setSwimlaneDefinition(SwimlaneDefinitionImpl swimlaneDefinition) {
+ this.swimlaneDefinition = swimlaneDefinition;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskDefinitionImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskDefinitionImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,143 @@
+/*
+ * 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.task;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.jbpm.model.ObservableElement;
+import org.jbpm.pvm.internal.model.ProcessElementImpl;
+import org.jbpm.pvm.internal.util.Priority;
+import org.jbpm.pvm.internal.wire.Descriptor;
+
+/**
+ * defines a task and how the actor(s) must be calculated at runtime.
+ */
+public class TaskDefinitionImpl extends ProcessElementImpl implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+ protected String description;
+
+ /** @see #isBlocking() */
+ protected boolean isBlocking;
+
+ /** @see #isSignalling() */
+ protected boolean isSignalling = true;
+
+ protected String dueDateDuration;
+ protected List<TaskDefinitionImpl> subTaskDefinitions;
+ protected int priority = Priority.NORMAL;
+ protected SwimlaneDefinitionImpl swimlaneDefinition;
+ protected String assigneeExpression;
+ protected String candidatesExpression;
+ protected Descriptor assignerDescriptor;
+
+
+ public String getForm() {
+ return (String) (properties!=null ? properties.get("form") : null);
+ }
+
+ public ObservableElement getParent() {
+ // TODO Auto-generated method stub
+ // huh ?
+ return null;
+ }
+
+ public boolean hasEvent(String eventName) {
+ // TODO Auto-generated method stub
+ // huh ?
+ return false;
+ }
+
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public String getAssigneeExpression() {
+ return assigneeExpression;
+ }
+ public void setAssigneeExpression(String assigneeExpression) {
+ this.assigneeExpression = assigneeExpression;
+ }
+ public Descriptor getAssignerDescriptor() {
+ return assignerDescriptor;
+ }
+ public void setAssignerDescriptor(Descriptor assignerDescriptor) {
+ this.assignerDescriptor = assignerDescriptor;
+ }
+ public String getCandidatesExpression() {
+ return candidatesExpression;
+ }
+ public void setCandidatesExpression(String candidatesExpression) {
+ this.candidatesExpression = candidatesExpression;
+ }
+ public boolean isBlocking() {
+ return isBlocking;
+ }
+ public void setBlocking(boolean isBlocking) {
+ this.isBlocking = isBlocking;
+ }
+ public boolean isSignalling() {
+ return isSignalling;
+ }
+ public void setSignalling(boolean isSignalling) {
+ this.isSignalling = isSignalling;
+ }
+ public int getPriority() {
+ return priority;
+ }
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+ public List<TaskDefinitionImpl> getSubTaskDefinitions() {
+ return subTaskDefinitions;
+ }
+ public void setSubTaskDefinitions(List<TaskDefinitionImpl> subTaskDefinitions) {
+ this.subTaskDefinitions = subTaskDefinitions;
+ }
+ public SwimlaneDefinitionImpl getSwimlaneDefinition() {
+ return swimlaneDefinition;
+ }
+ public void setSwimlaneDefinition(SwimlaneDefinitionImpl swimlaneDefinition) {
+ this.swimlaneDefinition = swimlaneDefinition;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public String getDueDateDuration() {
+ return dueDateDuration;
+ }
+ public void setDueDateDuration(String dueDateDuration) {
+ this.dueDateDuration = dueDateDuration;
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskExecution.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskExecution.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskExecution.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskExecution.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,36 @@
+/*
+ * 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.task;
+
+import java.util.Map;
+
+import org.jbpm.task.Swimlane;
+import org.jbpm.task.Task;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface TaskExecution {
+
+ Map<String, ? extends Task> getTasks();
+ Map<String, ? extends Swimlane> getSwimlanes();
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,388 @@
+/*
+ * 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.task;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.model.Comment;
+import org.jbpm.pvm.internal.cal.Duration;
+import org.jbpm.pvm.internal.model.CommentImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
+import org.jbpm.pvm.internal.util.Clock;
+import org.jbpm.pvm.internal.util.EqualsUtil;
+import org.jbpm.pvm.internal.util.Priority;
+import org.jbpm.task.Role;
+import org.jbpm.task.Swimlane;
+import org.jbpm.task.Task;
+
+/**
+ * is one task instance that can be assigned to an actor (read: put in
+ * someones task list) and that can trigger the continuation of execution
+ * of the token upon completion.
+ */
+public class TaskImpl extends ScopeInstanceImpl implements Serializable, Task {
+
+ private static final long serialVersionUID = 1L;
+ // private static final Logger log = Logger.getLogger(TaskImpl.class.getName());
+
+ protected String id;
+ protected String name;
+ protected String description;
+
+ protected String assignee;
+ protected Set<RoleImpl> roles;
+
+ protected Date create;
+ protected Date dueDate;
+ protected Integer progress;
+
+ // protected VariableMap variableMap;
+ protected List<CommentImpl> comments;
+
+ protected int priority = Priority.NORMAL;
+
+ protected String state;
+
+ protected ExecutionImpl execution;
+ protected boolean isSignalling = true;
+ protected boolean isBlocking;
+
+ protected SwimlaneImpl swimlane;
+
+ protected TaskImpl superTask;
+ protected Set<TaskImpl> subTasks;
+
+ protected TaskImpl() {
+ }
+
+ // creating a task
+
+ public static TaskImpl create() {
+ return create(null);
+ }
+
+ public static TaskImpl create(Execution execution) {
+ TaskImpl task = new TaskImpl();
+
+ /*
+ // if a task class name is configured
+ Environment environment = Environment.getCurrent();
+ String taskClassName = environment!=null ? (String) environment.get(TaskImpl.CONTEXTKEY_TASK_CLASS_NAME, TaskImpl.SEARCHORDER_TASK_CLASS_NAME) : null;
+ if (taskClassName!=null) {
+ // dynamically instantiate it
+ ClassLoader classLoader = environment.getClassLoader();
+ Class<?> taskClass = ReflectUtil.loadClass(classLoader, taskClassName);
+ task = (TaskImpl) ReflectUtil.newInstance(taskClass);
+ }
+ // otherwise just use the default task implementation type
+ else {
+ task = new TaskImpl();
+ }
+ */
+
+ task.setCreate(Clock.getCurrentTime());
+ task.setExecution(execution);
+
+ // initialise the task state
+ task.state = LifeCycle.initialise(task);
+
+ return task;
+ }
+
+ public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
+ if (taskDefinition!=null) {
+ this.name = taskDefinition.getName();
+ this.description = taskDefinition.getDescription();
+ this.isBlocking = taskDefinition.isBlocking();
+ this.isSignalling = taskDefinition.isSignalling();
+ this.priority = taskDefinition.getPriority();
+
+ String durationText = taskDefinition.getDueDateDuration();
+ if (durationText!=null) {
+ this.dueDate = calculateDueDate(new Duration(durationText));
+ }
+ }
+ }
+
+ protected static Date calculateDueDate(Duration dueDate) {
+ // TODO
+ return null;
+ }
+
+ // roles ////////////////////////////////////////////////////////////////////
+
+ public Set<RoleImpl> getRoles() {
+ if (roles==null) {
+ return Collections.emptySet();
+ }
+ return roles;
+ }
+
+ public Set<RoleImpl> getAllRoles() {
+ Set<RoleImpl> allRoles = null;
+ if (roles!=null) {
+ allRoles = new HashSet<RoleImpl>(roles);
+ } else {
+ allRoles = new HashSet<RoleImpl>();
+ }
+ if (swimlane!=null) {
+ allRoles.addAll((Set)swimlane.getCandidates());
+ }
+ return allRoles;
+ }
+
+ public Role addRole(String identityId, String roleType) {
+ if (identityId==null) {
+ throw new JbpmException("userId is null");
+ }
+ if (roleType==null) {
+ throw new JbpmException("roleType is null");
+ }
+ RoleImpl role = new RoleImpl();
+ role.setIdentityId(identityId);
+ role.setTask(this);
+ role.setRoleType(roleType);
+ if (roles==null) {
+ roles = new HashSet<RoleImpl>();
+ }
+ roles.add(role);
+ return role;
+ }
+
+ public void removeRole(Role role) {
+ if (role==null) {
+ throw new JbpmException("role is null");
+ }
+ if ( (roles!=null)
+ && (roles.remove(role))
+ ) {
+ ((RoleImpl)role).setTask(null);
+ }
+ }
+
+ // completion ///////////////////////////////////////////////////////////////
+
+ public void submit() {
+ if (execution!=null) {
+ // the outcome is dynamically calculated based on e.g. a
+ // variable or a decision table on a variable. an
+ // interface OutcomeEvaluator for user defined outcome calculation
+ // could be envisioned.
+ String outcome = evaluateOutcome();
+ // the outcome serves as the signal given to the execution.
+ execution.signal(outcome);
+ }
+ }
+
+ public String evaluateOutcome() {
+ // for now, only the default signal can be given.
+ return null;
+ }
+
+ // comments /////////////////////////////////////////////////////////////////
+
+ public List<Comment> getComments() {
+ if (comments==null) {
+ return Collections.emptyList();
+ }
+ return (List) comments;
+ }
+
+ public Comment createComment(String commentText) {
+ if (comments==null) {
+ comments = new ArrayList<CommentImpl>();
+ }
+ CommentImpl comment = new CommentImpl(commentText);
+ comments.add(comment);
+ return comment;
+ }
+
+ public void removeComment(Comment comment) {
+ if (comment==null) {
+ throw new JbpmException("comment is null");
+ }
+ if (comments!=null) {
+ comments.remove(comment);
+ }
+ }
+
+ // subtasks /////////////////////////////////////////////////////////////////
+
+ public Set<Task> getSubTasks() {
+ if (subTasks==null) {
+ return Collections.emptySet();
+ }
+ return (Set) subTasks;
+ }
+
+ public Task createSubTask(String name) {
+ if (subTasks==null) {
+ subTasks = new HashSet<TaskImpl>();
+ }
+ TaskImpl subtask = new TaskImpl();
+ subtask.setName(name);
+ addSubTask(subtask);
+ return subtask;
+ }
+
+ public Task addSubTask(TaskImpl subtask) {
+ if (subTasks==null) {
+ subTasks = new HashSet<TaskImpl>();
+ }
+ subtask.setSuperTask(this);
+ subTasks.add(subtask);
+ return subtask;
+ }
+
+ public void removeSubTask(Task subtask) {
+ if (subtask==null) {
+ throw new JbpmException("subtask is null");
+ }
+ if ( (subTasks!=null)
+ && (subTasks.remove(subtask))
+ ) {
+ ((TaskImpl)subtask).setSuperTask(null);
+ }
+ }
+
+ // equals ///////////////////////////////////////////////////////////////////
+ // hack to support comparing hibernate proxies against the real objects
+ // since this always falls back to ==, we don't need to overwrite the hashcode
+ public boolean equals(Object o) {
+ return EqualsUtil.equals(this, o);
+ }
+
+ public String getLifeCycleResource() {
+ // the default lifecycle can be overridden in subclasses
+ return "jbpm.task.default.lifecycle.xml";
+ }
+
+ // modified getters and setters /////////////////////////////////////////////
+ public void setProgress(Integer progress) {
+ if ( (progress<0)
+ || (progress>100)
+ ) {
+ throw new JbpmException("task progress is a percentage (integer) and must be expressed between 0 and 100");
+ }
+ this.progress = progress;
+ }
+
+ public boolean isPersisted() {
+ return dbid!=0;
+ }
+
+ // getters and setters //////////////////////////////////////////////////////
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public boolean isBlocking() {
+ return isBlocking;
+ }
+ public void setBlocking(boolean isBlocking) {
+ this.isBlocking = isBlocking;
+ }
+ public boolean isSignalling() {
+ return isSignalling;
+ }
+ public void setSignalling(boolean isSignalling) {
+ this.isSignalling = isSignalling;
+ }
+ public int getPriority() {
+ return priority;
+ }
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+ public void setComments(List<CommentImpl> comments) {
+ this.comments = comments;
+ }
+ public Date getCreate() {
+ return create;
+ }
+ public void setCreate(Date create) {
+ this.create = create;
+ }
+ public Date getDueDate() {
+ return dueDate;
+ }
+ public void setDueDate(Date dueDate) {
+ this.dueDate = dueDate;
+ }
+ public ExecutionImpl getExecution() {
+ return execution;
+ }
+ public void setExecution(Execution execution) {
+ this.execution = (ExecutionImpl) execution;
+ }
+ public String getState() {
+ return state;
+ }
+ public String getAssignee() {
+ return assignee;
+ }
+ public void setAssignee(String assignedUserId) {
+ this.assignee = assignedUserId;
+ }
+ public Swimlane getSwimlane() {
+ return swimlane;
+ }
+ public void setSwimlane(SwimlaneImpl swimlane) {
+ this.swimlane = swimlane;
+ }
+ public TaskImpl getSuperTask() {
+ return superTask;
+ }
+ public void setSuperTask(TaskImpl superTask) {
+ this.superTask = superTask;
+ }
+ public Integer getProgress() {
+ return progress;
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskQueryImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,101 @@
+/*
+ * 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.task;
+
+import java.util.List;
+
+import org.hibernate.Query;
+import org.jbpm.TaskQuery;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.query.AbstractQuery;
+import org.jbpm.pvm.internal.query.Page;
+import org.jbpm.task.Task;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskQueryImpl extends AbstractQuery implements TaskQuery {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String UNASSIGNED = "unassigned";
+
+ protected String assignee = null;
+
+ public TaskQueryImpl(CommandService commandService) {
+ super(commandService);
+ }
+
+ public TaskQuery assignee(String assignee) {
+ this.assignee = assignee;
+ return this;
+ }
+
+ public TaskQuery unassigned() {
+ this.assignee = UNASSIGNED;
+ return this;
+ }
+
+ public TaskQuery orderAsc(String property) {
+ orderByClause = "task."+property+" asc ";
+ return this;
+ }
+
+ public TaskQuery orderDesc(String property) {
+ orderByClause = "task."+property+" desc ";
+ return this;
+ }
+
+ public TaskQuery page(int firstResult, int maxResults) {
+ page = new Page(firstResult, maxResults);
+ return this;
+ }
+
+ public List<Task> execute() {
+ return (List<Task>) commandService.execute(this);
+ }
+
+ protected void applyParameters(Query query) {
+ if ( (assignee!=UNASSIGNED) && (assignee!=null) ) {
+ query.setString("assignee", assignee);
+ }
+ }
+
+ public String hql() {
+ StringBuffer hql = new StringBuffer();
+ hql.append("select task ");
+ hql.append("from ");
+ hql.append(TaskImpl.class.getName());
+ hql.append(" as task ");
+
+ if (assignee==UNASSIGNED) {
+ appendWhereClause("task.assignee is null ", hql);
+ } else if (assignee!=null) {
+ appendWhereClause("task.assignee = :assignee ", hql);
+ }
+
+ appendOrderByClause(hql);
+
+ return hql.toString();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskServiceImpl.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskServiceImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,106 @@
+/*
+ * 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.task;
+
+import java.util.List;
+
+import org.jbpm.TaskQuery;
+import org.jbpm.TaskService;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.cmd.DeleteTaskCmd;
+import org.jbpm.pvm.internal.cmd.GetTaskCmd;
+import org.jbpm.pvm.internal.cmd.NewTaskCmd;
+import org.jbpm.pvm.internal.cmd.SaveTaskCmd;
+import org.jbpm.pvm.internal.cmd.SubmitTaskCmd;
+import org.jbpm.task.Role;
+import org.jbpm.task.Task;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class TaskServiceImpl implements TaskService {
+
+ protected CommandService commandService;
+
+ public TaskServiceImpl() {
+ }
+
+ public TaskServiceImpl(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+ public CommandService getCommandService() {
+ return commandService;
+ }
+
+ public void setCommandService(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+ public Task newTask() {
+ return commandService.execute(new NewTaskCmd());
+ }
+
+ public Task getTask(String taskId) {
+ return commandService.execute(new GetTaskCmd(taskId));
+ }
+
+ public void saveTask(Task task) {
+ commandService.execute(new SaveTaskCmd((TaskImpl) task));
+ }
+
+ public void deleteTask(String taskId) {
+ commandService.execute(new DeleteTaskCmd(taskId));
+ }
+
+ public void submitTask(String taskId) {
+ commandService.execute(new SubmitTaskCmd(taskId));
+ }
+
+ public void submitTask(Task task) {
+ commandService.execute(new SubmitTaskCmd((TaskImpl)task));
+ }
+
+ public List<String> getCandidates(String taskId) {
+ return null;
+ }
+
+ public List<Role> getRoles(String taskId) {
+ return null;
+ }
+
+ public List<Task> getPersonalTaskList(String assignee, int firstResult, int maxResults) {
+ return createTaskQuery()
+ .assignee(assignee)
+ .orderDesc(TaskQuery.PROPERTY_PRIORITY)
+ .page(firstResult, maxResults)
+ .execute();
+ }
+
+ public List<Task> getGroupTaskList(String userId, int firstResult, int maxResults) {
+ return null;
+ }
+
+ public TaskQuery createTaskQuery() {
+ return new TaskQueryImpl(commandService);
+ }
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskDbSessionBinding.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskDbSessionBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskDbSessionBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskDbSessionBinding.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,48 @@
+/*
+ * 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.wire.descriptor.HibernateTaskDbSessionDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class TaskDbSessionBinding extends WireDescriptorBinding {
+
+ public TaskDbSessionBinding() {
+ super("task-db-session");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ HibernateTaskDbSessionDescriptor descriptor = new HibernateTaskDbSessionDescriptor();
+
+ if (element.hasAttribute("session")) {
+ descriptor.setSessionName(element.getAttribute("session"));
+ }
+
+ return descriptor;
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskServiceBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TaskServiceBinding.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -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.cmd.CommandService;
+import org.jbpm.pvm.internal.task.TaskServiceImpl;
+import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
+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 TaskServiceBinding extends WireDescriptorBinding {
+
+ public TaskServiceBinding() {
+ super("task-service");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ObjectDescriptor descriptor = new ObjectDescriptor(TaskServiceImpl.class);
+ descriptor.addInjection("commandService", new ContextTypeRefDescriptor(CommandService.class));
+ return descriptor;
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java (from rev 3880, jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,69 @@
+/*
+ * 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 org.hibernate.Session;
+import org.jbpm.pvm.internal.hibernate.HibernateTaskDbSession;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireDefinition;
+import org.jbpm.pvm.internal.wire.WireException;
+
+/**
+ * @author Tom Baeyens
+ */
+public class HibernateTaskDbSessionDescriptor extends AbstractDescriptor {
+
+ private static final long serialVersionUID = 1L;
+
+ private String sessionName;
+
+ public Object construct(WireContext wireContext) {
+ return new HibernateTaskDbSession();
+ }
+
+ public void initialize(Object object, WireContext wireContext) {
+ // get the hibernate-session
+ Session session = null;
+ if (sessionName != null) {
+ session = (Session) wireContext.get(sessionName);
+ } else {
+ session = wireContext.get(Session.class);
+ }
+
+ if (session == null) {
+ throw new WireException("couldn't find hibernate-session "
+ + (sessionName != null ? "'" + sessionName + "'" : "by type ")
+ + "to create pvm-db-session");
+ }
+
+ // inject the session
+ ((HibernateTaskDbSession) object).setSession(session);
+ }
+
+ public Class<?> getType(WireDefinition wireDefinition) {
+ return HibernateTaskDbSession.class;
+ }
+
+ public void setSessionName(String sessionName) {
+ this.sessionName = sessionName;
+ }
+}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -52,6 +52,8 @@
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.JobDbSessionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.TaskDbSessionBinding" />
+
<!-- dynamic type mapping configuration -->
<binding class="org.jbpm.pvm.internal.wire.binding.TypesBinding" />
<!-- services -->
@@ -62,6 +64,7 @@
<binding class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdentityServiceBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.HistoryServiceBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.TaskServiceBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding" />
Copied: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.default.lifecycle.xml (from rev 3880, jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.default.lifecycle.xml (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.default.lifecycle.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,13 @@
+<task-lifecycle initial="open">
+ <state name="open">
+ <transition name="complete" to="completed" />
+ <transition name="suspend" to="suspended" />
+ <transition name="cancel" to="cancelled" />
+ </state>
+ <state name="suspended">
+ <transition name="resume" to="open" />
+ <transition name="cancel" to="cancelled" />
+ </state>
+ <state name="cancelled" />
+ <state name="completed" />
+</task-lifecycle>
Copied: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml (from rev 3880, jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.task.hbm.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -0,0 +1,164 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
+
+ <!-- ### TASK DEFINITION ################################################ -->
+ <class name="TaskDefinitionImpl" discriminator-value="T">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <discriminator type="char" column="CLASS_"/>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="name" column="NAME_"/>
+ <property name="description" column="DESCR_"/>
+
+ <property name="priority" column="PRIORITY_"/>
+ <property name="dueDateDuration" column="DUEDATE_"/>
+ <property name="isBlocking" column="BLOCK_"/>
+ <property name="isSignalling" column="SIGNAL_"/>
+ <property name="assigneeExpression" column="ASSIGNEE_EXPR_"/>
+ <property name="candidatesExpression" column="CANDIDATES_EXPR_"/>
+
+ <many-to-one name="assignerDescriptor"
+ column="ASSIGNER_DESCR_"
+ cascade="all"
+ class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
+ foreign-key="FK_TSK_ASIG_DESCR"
+ index="IDX_TSK_ASIG_DESCR" />
+
+ <many-to-one name="swimlaneDefinition"
+ column="SWIMLANE_DEF_"
+ cascade="all"
+ class="SwimlaneDefinitionImpl"
+ foreign-key="FK_TSK_SWIML_DEF"
+ index="IDX_TSK_SWIML_DEF" />
+
+ <list name="subTaskDefinitions" cascade="all-delete-orphan">
+ <key column="TASKDEF_" />
+ <list-index column="TASKDEF_IDX_" />
+ <one-to-many class="TaskDefinitionImpl" />
+ </list>
+ </class>
+
+ <!-- ### TASK ########################################################### -->
+ <class name="TaskImpl"
+ discriminator-value="T">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <discriminator type="char" column="CLASS_"/>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="id" column="ID_" unique="true" />
+ <property name="name" column="NAME_"/>
+ <property name="description" column="DESCR_"/>
+ <property name="assignee" column="ASSIGNEE_"/>
+
+ <set name="roles" cascade="all-delete-orphan">
+ <key column="TASK_" foreign-key="FK_ROLE_TASK" />
+ <one-to-many class="RoleImpl" />
+ </set>
+
+ <property name="priority" column="PRIORITY_"/>
+ <property name="create" column="CREATE_"/>
+ <property name="dueDate" column="DUEDATE_"/>
+ <property name="progress" column="PROGRESS_"/>
+
+ <!--
+ <many-to-one name="variableMap"
+ class="org.jbpm.pvm.impl.VariableMap"
+ column="VARMAP_"
+ foreign-key="FK_TASK_VARMAP"
+ cascade="all" />
+ -->
+
+ <many-to-one name="execution"
+ class="org.jbpm.pvm.internal.model.ExecutionImpl"
+ column="EXECUTION_"
+ foreign-key="FK_TASK_EXEC" />
+
+ <many-to-one name="swimlane"
+ class="SwimlaneImpl"
+ column="SWIMLANE_"
+ foreign-key="FK_TASK_SWIML" />
+
+ <list name="comments" cascade="all-delete-orphan">
+ <key column="TASK_" />
+ <list-index column="TASK_IDX_" />
+ <one-to-many class="org.jbpm.pvm.internal.model.CommentImpl" />
+ </list>
+
+ <set name="subTasks" cascade="all-delete-orphan">
+ <key column="SUPERTASK_" foreign-key="FK_TASK_SUPERTASK" />
+ <one-to-many class="TaskImpl" />
+ </set>
+
+ </class>
+
+ <!-- ### ROLE ########################################################### -->
+ <class name="RoleImpl"
+ discriminator-value="R">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <discriminator type="char" column="CLASS_"/>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="identityId" column="IDENTITYID_"/>
+ <property name="roleType" column="ROLETYPE_" />
+ <property name="description" column="DESCR_"/>
+
+ <many-to-one name="task"
+ class="TaskImpl"
+ column="TASK_"
+ foreign-key="FK_ROLE_TASK" />
+
+ </class>
+
+ <!-- ### SWIMLANE DEFINITION ############################################ -->
+ <class name="SwimlaneDefinitionImpl">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="name" column="NAME_"/>
+ </class>
+
+
+ <!-- ### SWIMLANE ####################################################### -->
+ <class name="SwimlaneImpl">
+ <id name="dbid" column="DBID_">
+ <generator class="native" />
+ </id>
+ <version name="dbversion" column="DBVERSION_" />
+
+ <property name="name" column="NAME_"/>
+ <property name="assignee" column="ASSIGNEE_"/>
+
+ <many-to-one name="swimlaneDefinition"
+ class="SwimlaneDefinitionImpl"
+ column="SWIMLANEDEF_"
+ foreign-key="FK_SWIMLANE_DEF" />
+
+ <set name="candidates" cascade="all-delete-orphan">
+ <key column="SWIMLANE_" foreign-key="FK_ROLE_SWIMLANE" />
+ <one-to-many class="RoleImpl" />
+ </set>
+
+ </class>
+
+
+ <!-- ### QUERIES ######################################################## -->
+
+ <query name="findTasks">
+ <![CDATA[
+ select task
+ from org.jbpm.pvm.internal.task.TaskImpl as task
+ ]]>
+ </query>
+
+</hibernate-mapping>
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Assigner.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,34 +0,0 @@
-/*
- * 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.task;
-
-import java.io.Serializable;
-
-
-/** interface to delegate {@link Task} or {@link Swimlane} assignment.
- * @author Tom Baeyens
- */
-public interface Assigner extends Serializable {
-
- /** sets the actorId and candidates for the given task. */
- void assign(Task task) throws Exception;
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Swimlane.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Swimlane.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/Swimlane.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,46 +0,0 @@
-/*
- * 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.task;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-/** a runtime process role that can store an assignment so that
- * multiple related tasks are assigned to the same actor.
- *
- * @author Tom Baeyens
- */
-public interface Swimlane extends Serializable {
-
- long getDbid();
-
- String getName();
-
- String getAssignee();
- void setAssignee(String assignee);
-
- Collection<Role> getCandidates();
- Role createCandidate(String identityId);
- void removeCandidate(Role candidate);
-
- SwimlaneDefinition getSwimlaneDefinition();
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/SwimlaneDefinition.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/SwimlaneDefinition.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/SwimlaneDefinition.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,39 +0,0 @@
-/*
- * 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.task;
-
-import java.io.Serializable;
-
-/** design-time declaration of a swimlane.
- *
- * @author Tom Baeyens
- */
-public interface SwimlaneDefinition extends Serializable {
-
- long getDbid();
-
- String getName();
-
- String getActorIdExpression();
- String getCandidatesExpression();
- String getAssignmentExpression();
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskDefinition.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskDefinition.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskDefinition.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,65 +0,0 @@
-/*
- * 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.task;
-
-import java.util.List;
-
-import org.jbpm.model.ObservableElement;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.task.internal.model.SwimlaneDefinitionImpl;
-import org.jbpm.task.internal.model.TaskDefinitionImpl;
-
-/** design-time declaration of a task.
- *
- * @author Tom Baeyens
- */
-public interface TaskDefinition extends ObservableElement {
-
- String getForm();
-
- String getAssigneeExpression();
-
- Descriptor getAssignerDescriptor();
-
- String getCandidatesExpression();
-
- String getDueDateDuration();
-
- /** indicates whether the process must be blocked as long as this task is
- * not completed. blocking should be turned off by default (isBlocking=false).
- * but if a user (through the process language) sets isBlocking to true, then
- * the process cannot be signalled until all blocking tasks are completed first. */
- boolean isBlocking();
-
- /** indicates if completion of this task causes a signal on the related execution.
- * This is to support n-out-of-m. Whenever an execution leaves a task activity, all the
- * tasks that are not completed, related to that execution should loose their
- * signalling power. */
- boolean isSignalling();
-
- int getPriority();
-
- List<TaskDefinitionImpl> getSubTaskDefinitions();
-
- SwimlaneDefinitionImpl getSwimlaneDefinition();
-
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskException.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskException.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/TaskException.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,40 +0,0 @@
-/*
- * 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.task;
-
-public class TaskException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public TaskException() {
- super();
- }
- public TaskException(String msg, Throwable cause) {
- super(msg, cause);
- }
- public TaskException(String msg) {
- super(msg);
- }
- public TaskException(Throwable cause) {
- super(cause);
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/DeleteTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/DeleteTaskCmd.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/DeleteTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,49 +0,0 @@
-/*
- * 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.task.internal.cmd;
-
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.task.Task;
-import org.jbpm.task.session.TaskDbSession;
-
-/**
- * @author Alejandro Guizar
- */
-public class DeleteTaskCmd implements Command<Void> {
-
- private static final long serialVersionUID = 1L;
-
- protected String taskId;
-
- public DeleteTaskCmd(String taskId) {
- this.taskId = taskId;
- }
-
- public Void execute(Environment environment) throws Exception {
- TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
- Task task = taskDbSession.findTaskById(taskId);
- taskDbSession.delete(task);
- return null;
- }
-
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/GetTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/GetTaskCmd.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/GetTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,46 +0,0 @@
-/*
- * 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.task.internal.cmd;
-
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.task.Task;
-import org.jbpm.task.session.TaskDbSession;
-
-/**
- * @author Alejandro Guizar
- */
-public class GetTaskCmd implements Command<Task> {
-
- private static final long serialVersionUID = 1L;
-
- protected String taskId;
-
- public GetTaskCmd(String taskId) {
- this.taskId = taskId;
- }
-
- public Task execute(Environment environment) throws Exception {
- TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
- return taskDbSession.findTaskById(taskId);
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/NewTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/NewTaskCmd.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/NewTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,63 +0,0 @@
-/*
- * 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.task.internal.cmd;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.session.DbSession;
-import org.jbpm.task.Task;
-import org.jbpm.task.internal.model.TaskDefinitionImpl;
-import org.jbpm.task.internal.model.TaskImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class NewTaskCmd implements Command<Task> {
-
- private static final long serialVersionUID = 1L;
-
- protected Long executionDbid;
-
- public NewTaskCmd() {
- }
-
- public NewTaskCmd(long executionDbid) {
- this.executionDbid = executionDbid;
- }
-
- public Task execute(Environment environment) throws Exception {
- TaskDefinitionImpl taskDefinition = null;
- ExecutionImpl execution = null;
-
- Session session = environment.get(Session.class);
-
- if (executionDbid!=null) {
- execution = (ExecutionImpl) session.load(ExecutionImpl.class, executionDbid);
- }
-
- Task task = TaskImpl.create(execution);
-
- return task;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SaveTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SaveTaskCmd.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SaveTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,52 +0,0 @@
-/*
- * 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.task.internal.cmd;
-
-import java.io.Serializable;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.task.internal.model.TaskImpl;
-import org.jbpm.task.session.TaskDbSession;
-
-/**
- * @author Alejandro Guizar
- */
-public class SaveTaskCmd implements Command<Void> {
-
- private static final long serialVersionUID = 1L;
-
- protected TaskImpl task;
-
- public SaveTaskCmd(TaskImpl task) {
- this.task = task;
- }
-
- public Void execute(Environment environment) throws Exception {
- TaskDbSession taskDbSession = environment.get(TaskDbSession.class);
-
- taskDbSession.saveTask(task);
-
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SubmitTaskCmd.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SubmitTaskCmd.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/cmd/SubmitTaskCmd.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,60 +0,0 @@
-/*
- * 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.task.internal.cmd;
-
-import org.hibernate.Session;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.task.internal.model.TaskImpl;
-import org.jbpm.task.session.TaskDbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SubmitTaskCmd implements Command<Void> {
-
- private static final long serialVersionUID = 1L;
-
- protected String taskId;
- protected TaskImpl task;
-
- public SubmitTaskCmd(TaskImpl task) {
- this.task = task;
- }
-
- public SubmitTaskCmd(String taskId) {
- this.taskId = taskId;
- }
-
- public Void execute(Environment environment) throws Exception {
- TaskDbSession taskDbession = environment.get(TaskDbSession.class);
- if (task!=null) {
- taskDbession.merge(task);
- } else {
- task = taskDbession.findTaskById(taskId);
- }
- task.submit();
- taskDbession.delete(task);
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/hibernate/HibernateTaskDbSession.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/hibernate/HibernateTaskDbSession.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/hibernate/HibernateTaskDbSession.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,55 +0,0 @@
-/*
- * 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.task.internal.hibernate;
-
-import java.io.Serializable;
-
-import org.hibernate.criterion.Restrictions;
-import org.jbpm.pvm.internal.hibernate.HibernateDbSession;
-import org.jbpm.task.internal.model.TaskImpl;
-import org.jbpm.task.session.TaskDbSession;
-
-/**
- * @author Alejandro Guizar
- */
-public class HibernateTaskDbSession extends HibernateDbSession implements TaskDbSession {
-
- public TaskImpl findTaskById(String taskId) {
- // TODO maybe we should move these criteria queries to hql queries in the
- // hbm file so that users can easily customize.
- return (TaskImpl) session.createCriteria(TaskImpl.class)
- .add(Restrictions.eq("id", taskId))
- .uniqueResult();
- }
-
- public void saveTask(TaskImpl task) {
- if (! task.isPersisted()) {
- Serializable dbid = session.save(task);
- if (task.getId() == null) {
- task.setId(dbid.toString());
- }
-
- } else {
- session.update(task);
- }
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycle.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycle.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycle.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,96 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.model.IdGenerator;
-import org.jbpm.model.Activity;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.task.TaskException;
-
-/**
- * @author Tom Baeyens
- */
-public class LifeCycle extends ProcessDefinitionImpl {
-
- private static final long serialVersionUID = 1L;
- private static LifeCycleParser lifeCycleParser = new LifeCycleParser();
- private static Map<String, ProcessDefinitionImpl> lifeCycleProcesses = new HashMap<String, ProcessDefinitionImpl>();
-
- public static String initialise(TaskImpl task) {
- ProcessDefinitionImpl lifeCycle = getLifeCycle(task);
- Map<String, Object> lifeCycleVariables = new HashMap<String, Object>();
- lifeCycleVariables.put("task", task);
- ClientProcessInstance lifeCycleExecution = lifeCycle.createProcessInstance();
- lifeCycleExecution.setVariables(lifeCycleVariables);
- lifeCycleExecution.start();
- return lifeCycleExecution.getActivity().getName();
- }
-
- public static ProcessDefinitionImpl getLifeCycle(TaskImpl task) {
- if (task==null) {
- throw new TaskException("task is null");
- }
- String resource = task.getLifeCycleResource();
- if (resource==null) {
- throw new TaskException("task "+task.getClass().getName()+" did'nt return a lifecycle");
- }
- ProcessDefinitionImpl lifeCycleProcess;
- synchronized (lifeCycleProcesses) {
- lifeCycleProcess = lifeCycleProcesses.get(resource);
- if (lifeCycleProcess==null) {
- lifeCycleProcess = (ProcessDefinitionImpl) lifeCycleParser
- .createParse()
- .setResource(resource)
- .execute()
- .checkProblems("task lifecycle")
- .getDocumentObject();
- lifeCycleProcesses.put(resource, lifeCycleProcess);
- }
- }
- return lifeCycleProcess;
- }
-
- protected static void fireLifeCycleEvent(String eventName, TaskImpl task) {
- ExecutionImpl lifeCycleExecution = new ExecutionImpl();
- ProcessDefinitionImpl lifeCycleProcess = getLifeCycle(task);
- lifeCycleExecution.setProcessDefinition(lifeCycleProcess);
- String state = task.getState();
- Activity activity = lifeCycleProcess.getActivity(state);
- lifeCycleExecution.setActivity((ActivityImpl) activity);
- lifeCycleExecution.signal(eventName);
- task.state = lifeCycleExecution.getActivity().getName();
- }
-
- public IdGenerator getIdGenerator() {
- // overrides the default ProcessDefinitionImpl behaviour that will end up
- // in the execution being persisted
- return null;
- }
-
-
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleParser.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleParser.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleParser.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,105 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.util.List;
-
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class LifeCycleParser extends Parser {
-
- public Object parseDocumentElement(Element element, Parse parse) {
- ProcessDefinitionImpl lifeCycleProcess = new LifeCycle();
-
- List<Element> stateElements = XmlUtil.elements(element, "state");
- for (Element stateElement: stateElements) {
- parseState(stateElement, lifeCycleProcess, parse);
- }
- for (Element stateElement: stateElements) {
- parseTransitions(stateElement, lifeCycleProcess, parse);
- }
-
- String initialStateName = null;
- if (element.hasAttribute("initial")) {
- initialStateName = element.getAttribute("initial");
- ActivityImpl initial = (ActivityImpl) lifeCycleProcess.getActivity(initialStateName);
- if (initial!=null) {
- lifeCycleProcess.setInitial(initial);
- } else {
- parse.addProblem("initial "+initialStateName+" doesn't exist");
- }
- }
-
- return lifeCycleProcess;
- }
-
- public void parseTransitions(Element element, ProcessDefinitionImpl lifeCycleProcess, Parse parse) {
- if (! element.hasAttribute("name")) {
- parse.addProblem("state doesn't have a name: "+XmlUtil.toString(element));
- return;
- }
- String stateName = element.getAttribute("name");
- ActivityImpl state = (ActivityImpl) lifeCycleProcess.getActivity(stateName);
-
- List<Element> transitionElements = XmlUtil.elements(element, "transition");
- for (Element transitionElement: transitionElements) {
- parseTransition(transitionElement, state, parse);
- }
- }
-
- public void parseTransition(Element element, ActivityImpl state, Parse parse) {
- if (! element.hasAttribute("name")) {
- parse.addProblem("transition doesn't have a name: "+XmlUtil.toString(element));
- return;
- }
- String transitionName = element.getAttribute("name");
- if (! element.hasAttribute("to")) {
- parse.addProblem("transition "+transitionName+" doesn't have a to attribute indicating the destination state: "+XmlUtil.toString(element));
- return;
- }
- String destinationName = element.getAttribute("to");
- ActivityImpl destination = (ActivityImpl) state.getProcessDefinition().getActivity(destinationName);
- if (destination!=null) {
- state.createOutgoingTransition(destination, transitionName);
- } else {
- parse.addProblem("destination "+destinationName+" of "+transitionName+" is unknown");
- }
- }
-
- public void parseState(Element element, ProcessDefinitionImpl lifeCycleProcess, Parse parse) {
- if (! element.hasAttribute("name")) {
- parse.addProblem("state doesn't have an id: "+XmlUtil.toString(element));
- return;
- }
- String stateName = element.getAttribute("name");
- ActivityImpl state = lifeCycleProcess.createActivity(stateName);
- state.setBehaviour(new LifeCycleState());
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleState.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleState.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/LifeCycleState.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,44 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.util.Map;
-
-import org.jbpm.activity.ActivityExecution;
-import org.jbpm.activity.ExternalActivityBehaviour;
-
-/**
- * @author Tom Baeyens
- */
-public class LifeCycleState implements ExternalActivityBehaviour {
-
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) throws Exception {
- execution.waitForSignal();
- }
-
- public void signal(ActivityExecution execution, String signalName,
- Map<String, Object> parameters) throws Exception {
- execution.take(signalName);
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/RoleImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/RoleImpl.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/RoleImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,81 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.io.Serializable;
-
-import org.jbpm.task.Role;
-
-
-/** the relation between a task and a person.
- * @author Tom Baeyens
- */
-public class RoleImpl implements Serializable, Role {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
- protected int dbversion;
- protected String identityId;
- protected String roleType;
- protected String description;
- protected TaskImpl task;
- protected SwimlaneImpl swimlane;
-
- public String toString() {
- return roleType.toString()+"("+identityId+")";
- }
-
- public TaskImpl getTask() {
- return task;
- }
- public void setTask(TaskImpl task) {
- this.task = task;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public long getDbid() {
- return dbid;
- }
- public SwimlaneImpl getSwimlane() {
- return swimlane;
- }
- public void setSwimlane(SwimlaneImpl swimlane) {
- this.swimlane = swimlane;
- }
- public String getIdentityId() {
- return identityId;
- }
- public void setIdentityId(String identityId) {
- this.identityId = identityId;
- }
- public String getRoleType() {
- return roleType;
- }
- public void setRoleType(String roleType) {
- this.roleType = roleType;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneDefinitionImpl.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneDefinitionImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,99 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.io.Serializable;
-
-import org.jbpm.pvm.internal.util.EqualsUtil;
-import org.jbpm.task.SwimlaneDefinition;
-
-/**
- * is a process role (aka participant).
- */
-public class SwimlaneDefinitionImpl implements Serializable, SwimlaneDefinition {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
- protected int dbversion;
- protected String name = null;
-
- /**
- * expression that resolves to 1 single actorId.
- */
- protected String actorIdExpression = null;
-
- /**
- * expression that resolves to a comma separated list of actorIds.
- */
- protected String candidatesExpression = null;
-
- /**
- * expression that resolves to an AssignmentHandler implementation.
- */
- protected String assignmentExpression = null;
-
- // equals ///////////////////////////////////////////////////////////////////
- // hack to support comparing hibernate proxies against the real objects
- // since this always falls back to ==, we don't need to overwrite the hashcode
- public boolean equals(Object o) {
- return EqualsUtil.equals(this, o);
- }
-
- public void setActorIdExpression(String actorIdExpression) {
- // Note: combination of actorIdExpression and candidatesExpression is allowed
- this.actorIdExpression = actorIdExpression;
- this.assignmentExpression = null;
- }
- public void setCandidatesExpression(String pooledActorsExpression) {
- // Note: combination of actorIdExpression and pooledActorsExpression is allowed
- this.candidatesExpression = pooledActorsExpression;
- this.assignmentExpression = null;
- }
- public void setAssignmentExpression(String assignmentExpression) {
- // assignment expressions and assignmentDelegation are mutually exclusive
- this.actorIdExpression = null;
- this.candidatesExpression = null;
- this.assignmentExpression = assignmentExpression;
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public long getDbid() {
- return dbid;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getName() {
- return name;
- }
- public String getActorIdExpression() {
- return actorIdExpression;
- }
- public String getCandidatesExpression() {
- return candidatesExpression;
- }
- public String getAssignmentExpression() {
- return assignmentExpression;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneImpl.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/SwimlaneImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,120 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jbpm.pvm.internal.util.EqualsUtil;
-import org.jbpm.task.Role;
-import org.jbpm.task.Swimlane;
-import org.jbpm.task.SwimlaneDefinition;
-import org.jbpm.task.Task;
-import org.jbpm.task.TaskException;
-
-/**
- * runtime process role for a specific process instance.
- */
-public class SwimlaneImpl implements Serializable, Swimlane {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
- protected int dbversion;
- protected String name = null;
- protected String assignee = null;
- protected Set<RoleImpl> candidates = null;
- protected SwimlaneDefinition swimlaneDefinition = null;
-
- // assignment methods ///////////////////////////////////////////////////////
-
- public String getAssignee() {
- return assignee;
- }
-
- public void setAssignee(String assignee) {
- this.assignee = assignee;
- }
-
- // candidates ///////////////////////////////////////////////////////////////
-
- public Collection<Role> getCandidates() {
- if (candidates==null) {
- return Collections.EMPTY_LIST;
- }
- return (Collection)candidates;
- }
-
- public Role createCandidate(String identityId) {
- if (identityId==null) {
- throw new TaskException("identityId is null");
- }
- RoleImpl role = new RoleImpl();
- role.setIdentityId(identityId);
- role.setRoleType(Task.ROLETYPE_CANDIDATE);
- role.setSwimlane(this);
- if (candidates==null) {
- candidates = new HashSet<RoleImpl>();
- }
- candidates.add(role);
- return role;
- }
-
- public void removeCandidate(Role candidate) {
- if (candidate==null) {
- throw new TaskException("candidate is null");
- }
- if ( (candidates!=null)
- && (candidates.remove(candidate))
- ) {
- ((RoleImpl)candidate).setTask(null);
- }
- }
-
- // equals ///////////////////////////////////////////////////////////////////
- // hack to support comparing hibernate proxies against the real objects
- // since this always falls back to ==, we don't need to overwrite the hashcode
- public boolean equals(Object o) {
- return EqualsUtil.equals(this, o);
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public long getDbid() {
- return dbid;
- }
- public String getName() {
- return name;
- }
- public SwimlaneDefinition getSwimlaneDefinition() {
- return swimlaneDefinition;
- }
- public void setSwimlaneDefinition(SwimlaneDefinition swimlaneDefinition) {
- this.swimlaneDefinition = swimlaneDefinition;
- }
- public void setName(String name) {
- this.name = name;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskDefinitionImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskDefinitionImpl.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskDefinitionImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,144 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.io.Serializable;
-import java.util.List;
-
-import org.jbpm.model.ObservableElement;
-import org.jbpm.pvm.internal.model.ProcessElementImpl;
-import org.jbpm.pvm.internal.util.Priority;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.task.TaskDefinition;
-
-/**
- * defines a task and how the actor(s) must be calculated at runtime.
- */
-public class TaskDefinitionImpl extends ProcessElementImpl implements Serializable, TaskDefinition {
-
- private static final long serialVersionUID = 1L;
-
- protected String name;
- protected String description;
-
- /** @see #isBlocking() */
- protected boolean isBlocking;
-
- /** @see #isSignalling() */
- protected boolean isSignalling = true;
-
- protected String dueDateDuration;
- protected List<TaskDefinitionImpl> subTaskDefinitions;
- protected int priority = Priority.NORMAL;
- protected SwimlaneDefinitionImpl swimlaneDefinition;
- protected String assigneeExpression;
- protected String candidatesExpression;
- protected Descriptor assignerDescriptor;
-
-
- public String getForm() {
- return (String) (properties!=null ? properties.get("form") : null);
- }
-
- public ObservableElement getParent() {
- // TODO Auto-generated method stub
- // huh ?
- return null;
- }
-
- public boolean hasEvent(String eventName) {
- // TODO Auto-generated method stub
- // huh ?
- return false;
- }
-
-
- // getters and setters //////////////////////////////////////////////////////
-
- public String getAssigneeExpression() {
- return assigneeExpression;
- }
- public void setAssigneeExpression(String assigneeExpression) {
- this.assigneeExpression = assigneeExpression;
- }
- public Descriptor getAssignerDescriptor() {
- return assignerDescriptor;
- }
- public void setAssignerDescriptor(Descriptor assignerDescriptor) {
- this.assignerDescriptor = assignerDescriptor;
- }
- public String getCandidatesExpression() {
- return candidatesExpression;
- }
- public void setCandidatesExpression(String candidatesExpression) {
- this.candidatesExpression = candidatesExpression;
- }
- public boolean isBlocking() {
- return isBlocking;
- }
- public void setBlocking(boolean isBlocking) {
- this.isBlocking = isBlocking;
- }
- public boolean isSignalling() {
- return isSignalling;
- }
- public void setSignalling(boolean isSignalling) {
- this.isSignalling = isSignalling;
- }
- public int getPriority() {
- return priority;
- }
- public void setPriority(int priority) {
- this.priority = priority;
- }
- public List<TaskDefinitionImpl> getSubTaskDefinitions() {
- return subTaskDefinitions;
- }
- public void setSubTaskDefinitions(List<TaskDefinitionImpl> subTaskDefinitions) {
- this.subTaskDefinitions = subTaskDefinitions;
- }
- public SwimlaneDefinitionImpl getSwimlaneDefinition() {
- return swimlaneDefinition;
- }
- public void setSwimlaneDefinition(SwimlaneDefinitionImpl swimlaneDefinition) {
- this.swimlaneDefinition = swimlaneDefinition;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public String getDueDateDuration() {
- return dueDateDuration;
- }
- public void setDueDateDuration(String dueDateDuration) {
- this.dueDateDuration = dueDateDuration;
- }
-
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskExecution.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskExecution.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskExecution.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,36 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.util.Map;
-
-import org.jbpm.task.Swimlane;
-import org.jbpm.task.Task;
-
-/**
- * @author Tom Baeyens
- */
-public interface TaskExecution {
-
- Map<String, ? extends Task> getTasks();
- Map<String, ? extends Swimlane> getSwimlanes();
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskImpl.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,394 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.jbpm.Execution;
-import org.jbpm.model.Comment;
-import org.jbpm.pvm.internal.cal.Duration;
-import org.jbpm.pvm.internal.model.CommentImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ScopeInstanceImpl;
-import org.jbpm.pvm.internal.util.Clock;
-import org.jbpm.pvm.internal.util.EqualsUtil;
-import org.jbpm.pvm.internal.util.Priority;
-import org.jbpm.task.Role;
-import org.jbpm.task.Swimlane;
-import org.jbpm.task.Task;
-import org.jbpm.task.TaskDefinition;
-import org.jbpm.task.TaskException;
-
-/**
- * is one task instance that can be assigned to an actor (read: put in
- * someones task list) and that can trigger the continuation of execution
- * of the token upon completion.
- */
-public class TaskImpl extends ScopeInstanceImpl implements Serializable, Task {
-
- private static final long serialVersionUID = 1L;
- // private static final Logger log = Logger.getLogger(TaskImpl.class.getName());
-
- protected String id;
- protected String name;
- protected String description;
-
- protected String assignee;
- protected Set<RoleImpl> roles;
-
- protected Date create;
- protected Date dueDate;
- protected Integer progress;
-
- // protected VariableMap variableMap;
- protected List<CommentImpl> comments;
-
- protected int priority = Priority.NORMAL;
-
- protected String state;
-
- protected ExecutionImpl execution;
- protected boolean isSignalling = true;
- protected boolean isBlocking;
-
- protected TaskDefinitionImpl taskDefinition;
- protected SwimlaneImpl swimlane;
-
- protected TaskImpl superTask;
- protected Set<TaskImpl> subTasks;
-
- protected TaskImpl() {
- }
-
- // creating a task
-
- public static TaskImpl create() {
- return create(null);
- }
-
- public static TaskImpl create(Execution execution) {
- TaskImpl task = new TaskImpl();
-
- /*
- // if a task class name is configured
- Environment environment = Environment.getCurrent();
- String taskClassName = environment!=null ? (String) environment.get(TaskImpl.CONTEXTKEY_TASK_CLASS_NAME, TaskImpl.SEARCHORDER_TASK_CLASS_NAME) : null;
- if (taskClassName!=null) {
- // dynamically instantiate it
- ClassLoader classLoader = environment.getClassLoader();
- Class<?> taskClass = ReflectUtil.loadClass(classLoader, taskClassName);
- task = (TaskImpl) ReflectUtil.newInstance(taskClass);
- }
- // otherwise just use the default task implementation type
- else {
- task = new TaskImpl();
- }
- */
-
- task.setCreate(Clock.getCurrentTime());
- task.setExecution(execution);
-
- // initialise the task state
- task.state = LifeCycle.initialise(task);
-
- return task;
- }
-
- public void setTaskDefinition(TaskDefinitionImpl taskDefinition) {
- this.taskDefinition = taskDefinition;
- if (taskDefinition!=null) {
- this.name = taskDefinition.getName();
- this.description = taskDefinition.getDescription();
- this.isBlocking = taskDefinition.isBlocking();
- this.isSignalling = taskDefinition.isSignalling();
- this.priority = taskDefinition.getPriority();
-
- String durationText = taskDefinition.getDueDateDuration();
- if (durationText!=null) {
- this.dueDate = calculateDueDate(new Duration(durationText));
- }
- }
- }
-
- protected static Date calculateDueDate(Duration dueDate) {
- // TODO
- return null;
- }
-
- // roles ////////////////////////////////////////////////////////////////////
-
- public Set<RoleImpl> getRoles() {
- if (roles==null) {
- return Collections.emptySet();
- }
- return roles;
- }
-
- public Set<RoleImpl> getAllRoles() {
- Set<RoleImpl> allRoles = null;
- if (roles!=null) {
- allRoles = new HashSet<RoleImpl>(roles);
- } else {
- allRoles = new HashSet<RoleImpl>();
- }
- if (swimlane!=null) {
- allRoles.addAll((Set)swimlane.getCandidates());
- }
- return allRoles;
- }
-
- public Role addRole(String identityId, String roleType) {
- if (identityId==null) {
- throw new TaskException("userId is null");
- }
- if (roleType==null) {
- throw new TaskException("roleType is null");
- }
- RoleImpl role = new RoleImpl();
- role.setIdentityId(identityId);
- role.setTask(this);
- role.setRoleType(roleType);
- if (roles==null) {
- roles = new HashSet<RoleImpl>();
- }
- roles.add(role);
- return role;
- }
-
- public void removeRole(Role role) {
- if (role==null) {
- throw new TaskException("role is null");
- }
- if ( (roles!=null)
- && (roles.remove(role))
- ) {
- ((RoleImpl)role).setTask(null);
- }
- }
-
- // completion ///////////////////////////////////////////////////////////////
-
- public void submit() {
- if (execution!=null) {
- // the outcome is dynamically calculated based on e.g. a
- // variable or a decision table on a variable. an
- // interface OutcomeEvaluator for user defined outcome calculation
- // could be envisioned.
- String outcome = evaluateOutcome();
- // the outcome serves as the signal given to the execution.
- execution.signal(outcome);
- }
- }
-
- public String evaluateOutcome() {
- // for now, only the default signal can be given.
- return null;
- }
-
- // comments /////////////////////////////////////////////////////////////////
-
- public List<Comment> getComments() {
- if (comments==null) {
- return Collections.emptyList();
- }
- return (List) comments;
- }
-
- public Comment createComment(String commentText) {
- if (comments==null) {
- comments = new ArrayList<CommentImpl>();
- }
- CommentImpl comment = new CommentImpl(commentText);
- comments.add(comment);
- return comment;
- }
-
- public void removeComment(Comment comment) {
- if (comment==null) {
- throw new TaskException("comment is null");
- }
- if (comments!=null) {
- comments.remove(comment);
- }
- }
-
- // subtasks /////////////////////////////////////////////////////////////////
-
- public Set<Task> getSubTasks() {
- if (subTasks==null) {
- return Collections.emptySet();
- }
- return (Set) subTasks;
- }
-
- public Task createSubTask(String name) {
- if (subTasks==null) {
- subTasks = new HashSet<TaskImpl>();
- }
- TaskImpl subtask = new TaskImpl();
- subtask.setName(name);
- addSubTask(subtask);
- return subtask;
- }
-
- public Task addSubTask(TaskImpl subtask) {
- if (subTasks==null) {
- subTasks = new HashSet<TaskImpl>();
- }
- subtask.setSuperTask(this);
- subTasks.add(subtask);
- return subtask;
- }
-
- public void removeSubTask(Task subtask) {
- if (subtask==null) {
- throw new TaskException("subtask is null");
- }
- if ( (subTasks!=null)
- && (subTasks.remove(subtask))
- ) {
- ((TaskImpl)subtask).setSuperTask(null);
- }
- }
-
- // equals ///////////////////////////////////////////////////////////////////
- // hack to support comparing hibernate proxies against the real objects
- // since this always falls back to ==, we don't need to overwrite the hashcode
- public boolean equals(Object o) {
- return EqualsUtil.equals(this, o);
- }
-
- public String getLifeCycleResource() {
- // the default lifecycle can be overridden in subclasses
- return "jbpm.task.default.lifecycle.xml";
- }
-
- // modified getters and setters /////////////////////////////////////////////
- public void setProgress(Integer progress) {
- if ( (progress<0)
- || (progress>100)
- ) {
- throw new TaskException("task progress is a percentage (integer) and must be expressed between 0 and 100");
- }
- this.progress = progress;
- }
-
- public boolean isPersisted() {
- return dbid!=0;
- }
-
- // getters and setters //////////////////////////////////////////////////////
-
- public long getDbid() {
- return dbid;
- }
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public boolean isBlocking() {
- return isBlocking;
- }
- public void setBlocking(boolean isBlocking) {
- this.isBlocking = isBlocking;
- }
- public boolean isSignalling() {
- return isSignalling;
- }
- public void setSignalling(boolean isSignalling) {
- this.isSignalling = isSignalling;
- }
- public int getPriority() {
- return priority;
- }
- public void setPriority(int priority) {
- this.priority = priority;
- }
- public void setComments(List<CommentImpl> comments) {
- this.comments = comments;
- }
- public Date getCreate() {
- return create;
- }
- public void setCreate(Date create) {
- this.create = create;
- }
- public Date getDueDate() {
- return dueDate;
- }
- public void setDueDate(Date dueDate) {
- this.dueDate = dueDate;
- }
- public ExecutionImpl getExecution() {
- return execution;
- }
- public void setExecution(Execution execution) {
- this.execution = (ExecutionImpl) execution;
- }
- public String getState() {
- return state;
- }
- public String getAssignee() {
- return assignee;
- }
- public void setAssignee(String assignedUserId) {
- this.assignee = assignedUserId;
- }
- public Swimlane getSwimlane() {
- return swimlane;
- }
- public void setSwimlane(SwimlaneImpl swimlane) {
- this.swimlane = swimlane;
- }
- public TaskDefinition getTaskDefinition() {
- return taskDefinition;
- }
- public TaskImpl getSuperTask() {
- return superTask;
- }
- public void setSuperTask(TaskImpl superTask) {
- this.superTask = superTask;
- }
- public Integer getProgress() {
- return progress;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskQueryImpl.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskQueryImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,101 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.util.List;
-
-import org.hibernate.Query;
-import org.jbpm.TaskQuery;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.query.AbstractQuery;
-import org.jbpm.pvm.internal.query.Page;
-import org.jbpm.task.Task;
-
-
-/**
- * @author Tom Baeyens
- */
-public class TaskQueryImpl extends AbstractQuery implements TaskQuery {
-
- private static final long serialVersionUID = 1L;
-
- private static final String UNASSIGNED = "unassigned";
-
- protected String assignee = null;
-
- public TaskQueryImpl(CommandService commandService) {
- super(commandService);
- }
-
- public TaskQuery assignee(String assignee) {
- this.assignee = assignee;
- return this;
- }
-
- public TaskQuery unassigned() {
- this.assignee = UNASSIGNED;
- return this;
- }
-
- public TaskQuery orderAsc(String property) {
- orderByClause = "task."+property+" asc ";
- return this;
- }
-
- public TaskQuery orderDesc(String property) {
- orderByClause = "task."+property+" desc ";
- return this;
- }
-
- public TaskQuery page(int firstResult, int maxResults) {
- page = new Page(firstResult, maxResults);
- return this;
- }
-
- public List<Task> execute() {
- return (List<Task>) commandService.execute(this);
- }
-
- protected void applyParameters(Query query) {
- if ( (assignee!=UNASSIGNED) && (assignee!=null) ) {
- query.setString("assignee", assignee);
- }
- }
-
- public String hql() {
- StringBuffer hql = new StringBuffer();
- hql.append("select task ");
- hql.append("from ");
- hql.append(TaskImpl.class.getName());
- hql.append(" as task ");
-
- if (assignee==UNASSIGNED) {
- appendWhereClause("task.assignee is null ", hql);
- } else if (assignee!=null) {
- appendWhereClause("task.assignee = :assignee ", hql);
- }
-
- appendOrderByClause(hql);
-
- return hql.toString();
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskServiceImpl.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/model/TaskServiceImpl.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,106 +0,0 @@
-/*
- * 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.task.internal.model;
-
-import java.util.List;
-
-import org.jbpm.TaskQuery;
-import org.jbpm.TaskService;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.task.Role;
-import org.jbpm.task.Task;
-import org.jbpm.task.internal.cmd.DeleteTaskCmd;
-import org.jbpm.task.internal.cmd.GetTaskCmd;
-import org.jbpm.task.internal.cmd.NewTaskCmd;
-import org.jbpm.task.internal.cmd.SaveTaskCmd;
-import org.jbpm.task.internal.cmd.SubmitTaskCmd;
-
-/**
- * @author Alejandro Guizar
- */
-public class TaskServiceImpl implements TaskService {
-
- protected CommandService commandService;
-
- public TaskServiceImpl() {
- }
-
- public TaskServiceImpl(CommandService commandService) {
- this.commandService = commandService;
- }
-
- public CommandService getCommandService() {
- return commandService;
- }
-
- public void setCommandService(CommandService commandService) {
- this.commandService = commandService;
- }
-
- public Task newTask() {
- return commandService.execute(new NewTaskCmd());
- }
-
- public Task getTask(String taskId) {
- return commandService.execute(new GetTaskCmd(taskId));
- }
-
- public void saveTask(Task task) {
- commandService.execute(new SaveTaskCmd((TaskImpl) task));
- }
-
- public void deleteTask(String taskId) {
- commandService.execute(new DeleteTaskCmd(taskId));
- }
-
- public void submitTask(String taskId) {
- commandService.execute(new SubmitTaskCmd(taskId));
- }
-
- public void submitTask(Task task) {
- commandService.execute(new SubmitTaskCmd((TaskImpl)task));
- }
-
- public List<String> getCandidates(String taskId) {
- return null;
- }
-
- public List<Role> getRoles(String taskId) {
- return null;
- }
-
- public List<Task> getPersonalTaskList(String assignee, int firstResult, int maxResults) {
- return createTaskQuery()
- .assignee(assignee)
- .orderDesc(TaskQuery.PROPERTY_PRIORITY)
- .page(firstResult, maxResults)
- .execute();
- }
-
- public List<Task> getGroupTaskList(String userId, int firstResult, int maxResults) {
- return null;
- }
-
- public TaskQuery createTaskQuery() {
- return new TaskQueryImpl(commandService);
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskDbSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskDbSessionBinding.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskDbSessionBinding.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,49 +0,0 @@
-/*
- * 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.task.internal.wire.binding;
-
-import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.jbpm.task.internal.wire.descriptor.HibernateTaskDbSessionDescriptor;
-import org.w3c.dom.Element;
-
-/**
- * @author Alejandro Guizar
- */
-public class TaskDbSessionBinding extends WireDescriptorBinding {
-
- public TaskDbSessionBinding() {
- super("task-db-session");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- HibernateTaskDbSessionDescriptor descriptor = new HibernateTaskDbSessionDescriptor();
-
- if (element.hasAttribute("session")) {
- descriptor.setSessionName(element.getAttribute("session"));
- }
-
- return descriptor;
- }
-
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskServiceBinding.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskServiceBinding.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/binding/TaskServiceBinding.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,48 +0,0 @@
-/*
- * 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.task.internal.wire.binding;
-
-import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.jbpm.task.internal.model.TaskServiceImpl;
-import org.w3c.dom.Element;
-
-/**
- * @author Tom Baeyens
- */
-public class TaskServiceBinding extends WireDescriptorBinding {
-
- public TaskServiceBinding() {
- super("task-service");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- ObjectDescriptor descriptor = new ObjectDescriptor(TaskServiceImpl.class);
- descriptor.addInjection("commandService", new ContextTypeRefDescriptor(CommandService.class));
- return descriptor;
- }
-
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/internal/wire/descriptor/HibernateTaskDbSessionDescriptor.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,70 +0,0 @@
-/*
- * 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.task.internal.wire.descriptor;
-
-import org.hibernate.Session;
-import org.jbpm.pvm.internal.wire.WireContext;
-import org.jbpm.pvm.internal.wire.WireDefinition;
-import org.jbpm.pvm.internal.wire.WireException;
-import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
-import org.jbpm.task.internal.hibernate.HibernateTaskDbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class HibernateTaskDbSessionDescriptor extends AbstractDescriptor {
-
- private static final long serialVersionUID = 1L;
-
- private String sessionName;
-
- public Object construct(WireContext wireContext) {
- return new HibernateTaskDbSession();
- }
-
- public void initialize(Object object, WireContext wireContext) {
- // get the hibernate-session
- Session session = null;
- if (sessionName != null) {
- session = (Session) wireContext.get(sessionName);
- } else {
- session = wireContext.get(Session.class);
- }
-
- if (session == null) {
- throw new WireException("couldn't find hibernate-session "
- + (sessionName != null ? "'" + sessionName + "'" : "by type ")
- + "to create pvm-db-session");
- }
-
- // inject the session
- ((HibernateTaskDbSession) object).setSession(session);
- }
-
- public Class<?> getType(WireDefinition wireDefinition) {
- return HibernateTaskDbSession.class;
- }
-
- public void setSessionName(String sessionName) {
- this.sessionName = sessionName;
- }
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/session/TaskDbSession.java
===================================================================
--- jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/session/TaskDbSession.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/session/TaskDbSession.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,36 +0,0 @@
-/*
- * 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.task.session;
-
-import org.jbpm.session.DbSession;
-import org.jbpm.task.internal.model.TaskImpl;
-
-/**
- * Persistence interface for tasks.
- * @author Alejandro Guizar
- */
-public interface TaskDbSession extends DbSession {
-
- TaskImpl findTaskById(String taskId);
-
- void saveTask(TaskImpl task);
-}
Deleted: jbpm4/trunk/modules/task/src/main/java/org/jbpm/task/task.model.jpg
===================================================================
(Binary files differ)
Deleted: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.default.lifecycle.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,13 +0,0 @@
-<task-lifecycle initial="open">
- <state name="open">
- <transition name="complete" to="completed" />
- <transition name="suspend" to="suspended" />
- <transition name="cancel" to="cancelled" />
- </state>
- <state name="suspended">
- <transition name="resume" to="open" />
- <transition name="cancel" to="cancelled" />
- </state>
- <state name="cancelled" />
- <state name="completed" />
-</task-lifecycle>
Deleted: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.hbm.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,170 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<hibernate-mapping auto-import="false" package="org.jbpm.task.internal.model" default-access="field">
-
- <!-- ### TASK DEFINITION ################################################ -->
- <class name="TaskDefinitionImpl" discriminator-value="T">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- <property name="description" column="DESCR_"/>
-
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
- <property name="isBlocking" column="BLOCK_"/>
- <property name="isSignalling" column="SIGNAL_"/>
- <property name="assigneeExpression" column="ASSIGNEE_EXPR_"/>
- <property name="candidatesExpression" column="CANDIDATES_EXPR_"/>
-
- <many-to-one name="assignerDescriptor"
- column="ASSIGNER_DESCR_"
- cascade="all"
- class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSK_ASIG_DESCR"
- index="IDX_TSK_ASIG_DESCR" />
-
- <many-to-one name="swimlaneDefinition"
- column="SWIMLANE_DEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIML_DEF"
- index="IDX_TSK_SWIML_DEF" />
-
- <list name="subTaskDefinitions" cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </class>
-
- <!-- ### TASK ########################################################### -->
- <class name="TaskImpl"
- discriminator-value="T">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="id" column="ID_" unique="true" />
- <property name="name" column="NAME_"/>
- <property name="description" column="DESCR_"/>
- <property name="assignee" column="ASSIGNEE_"/>
-
- <set name="roles" cascade="all-delete-orphan">
- <key column="TASK_" foreign-key="FK_ROLE_TASK" />
- <one-to-many class="RoleImpl" />
- </set>
-
- <property name="priority" column="PRIORITY_"/>
- <property name="create" column="CREATE_"/>
- <property name="dueDate" column="DUEDATE_"/>
- <property name="progress" column="PROGRESS_"/>
-
- <!--
- <many-to-one name="variableMap"
- class="org.jbpm.pvm.impl.VariableMap"
- column="VARMAP_"
- foreign-key="FK_TASK_VARMAP"
- cascade="all" />
- -->
-
- <many-to-one name="execution"
- class="org.jbpm.pvm.internal.model.ExecutionImpl"
- column="EXECUTION_"
- foreign-key="FK_TASK_EXEC" />
-
- <many-to-one name="swimlane"
- class="SwimlaneImpl"
- column="SWIMLANE_"
- foreign-key="FK_TASK_SWIML" />
-
- <many-to-one name="taskDefinition"
- column="TASK_DEF_"
- class="TaskDefinitionImpl"
- foreign-key="FK_TSK_DEF"
- index="IDX_TSK_DEF" />
-
- <list name="comments" cascade="all-delete-orphan">
- <key column="TASK_" />
- <list-index column="TASK_IDX_" />
- <one-to-many class="org.jbpm.pvm.internal.model.CommentImpl" />
- </list>
-
- <set name="subTasks" cascade="all-delete-orphan">
- <key column="SUPERTASK_" foreign-key="FK_TASK_SUPERTASK" />
- <one-to-many class="TaskImpl" />
- </set>
-
- </class>
-
- <!-- ### ROLE ########################################################### -->
- <class name="RoleImpl"
- discriminator-value="R">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator type="char" column="CLASS_"/>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="identityId" column="IDENTITYID_"/>
- <property name="roleType" column="ROLETYPE_" />
- <property name="description" column="DESCR_"/>
-
- <many-to-one name="task"
- class="TaskImpl"
- column="TASK_"
- foreign-key="FK_ROLE_TASK" />
-
- </class>
-
- <!-- ### SWIMLANE DEFINITION ############################################ -->
- <class name="SwimlaneDefinitionImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- </class>
-
-
- <!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl">
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- <property name="assignee" column="ASSIGNEE_"/>
-
- <many-to-one name="swimlaneDefinition"
- class="SwimlaneDefinitionImpl"
- column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
-
- <set name="candidates" cascade="all-delete-orphan">
- <key column="SWIMLANE_" foreign-key="FK_ROLE_SWIMLANE" />
- <one-to-many class="RoleImpl" />
- </set>
-
- </class>
-
-
- <!-- ### QUERIES ######################################################## -->
-
- <query name="findTasks">
- <![CDATA[
- select task
- from org.jbpm.task.internal.model.TaskImpl as task
- ]]>
- </query>
-
-</hibernate-mapping>
Deleted: jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/main/resources/jbpm.task.wire.bindings.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,6 +0,0 @@
-<wire-bindings>
-
- <binding class="org.jbpm.task.internal.wire.binding.TaskDbSessionBinding" />
- <binding class="org.jbpm.task.internal.wire.binding.TaskServiceBinding" />
-
-</wire-bindings>
Modified: jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/internal/model/TaskTest.java
===================================================================
--- jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/internal/model/TaskTest.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/task/src/test/java/org/jbpm/task/internal/model/TaskTest.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -26,12 +26,12 @@
import java.util.Map;
import java.util.Set;
+import org.jbpm.pvm.internal.task.RoleImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.util.Clock;
import org.jbpm.pvm.internal.util.Priority;
import org.jbpm.task.Task;
-import org.jbpm.task.internal.model.RoleImpl;
-import org.jbpm.task.internal.model.SwimlaneImpl;
-import org.jbpm.task.internal.model.TaskImpl;
import org.jbpm.test.BaseJbpmTestCase;
/**
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-02-16 10:49:48 UTC (rev 3881)
@@ -60,11 +60,11 @@
protected void setUp() throws Exception {
assertNull(Environment.getCurrent());
LogFormatter.resetIndentation();
- log.info("=== starting "+getName()+" =============================");
+ log.debug("=== starting "+getName()+" =============================");
}
protected void tearDown() throws Exception {
- log.info("=== ending "+getName()+" =============================\n");
+ log.debug("=== ending "+getName()+" =============================\n");
assertNull(Environment.getCurrent());
}
Modified: jbpm4/trunk/modules/test-db/src/main/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-db/src/main/resources/logging.properties 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/modules/test-db/src/main/resources/logging.properties 2009-02-16 10:49:48 UTC (rev 3881)
@@ -1,28 +1,32 @@
-handlers= java.util.logging.ConsoleHandler
-# to add the error triggered file handler
-# handlers= java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler
+handlers= java.util.logging.MemoryHandler
redirect.commons.logging = enabled
-java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
-# org.jbpm.util.ErrorTriggeredFileHandler.size = 500
-# org.jbpm.util.ErrorTriggeredFileHandler.push = OFF
-# org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log
+java.util.logging.MemoryHandler.level=FINEST
+#java.util.logging.MemoryHandler.filter=
+java.util.logging.MemoryHandler.size=500
+java.util.logging.MemoryHandler.push=SEVERE
+java.util.logging.MemoryHandler.target=org.jbpm.internal.log.ConsoleHandler
+org.jbpm.internal.log.ConsoleHandler.level = FINEST
+org.jbpm.internal.log.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
# For example, set the com.xyz.foo logger to only log SEVERE messages:
# com.xyz.foo.level = SEVERE
-org.jbpm.level=INFO
+org.jbpm.level=FINEST
# org.jbpm.pvm.internal.tx.level=FINE
# org.jbpm.pvm.internal.wire.level=FINE
# org.jbpm.pvm.internal.util.level=FINE
-org.hibernate.level=INFO
+org.hibernate.level=FINE
org.hibernate.cfg.HbmBinder.level=SEVERE
org.hibernate.cfg.SettingsFactory.level=SEVERE
-# org.hibernate.SQL.level=FINEST
+org.hibernate.SQL.level=FINEST
# org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
# org.hibernate.transaction.level=FINEST
+
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-02-15 13:22:37 UTC (rev 3880)
+++ jbpm4/trunk/pom.xml 2009-02-16 10:49:48 UTC (rev 3881)
@@ -36,7 +36,6 @@
<module>modules/pvm</module>
<module>modules/examples</module>
<module>modules/jpdl</module>
- <module>modules/task</module>
<module>modules/enterprise</module>
<module>modules/test-base</module>
<module>modules/test-db</module>
More information about the jbpm-commits
mailing list