[jbpm-commits] JBoss JBPM SVN: r3029 - in jbpm3/trunk/modules: core/src/main/java/org/jbpm/command/impl and 7 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 21 08:10:25 EST 2008


Author: thomas.diesler at jboss.com
Date: 2008-11-21 08:10:25 -0500 (Fri, 21 Nov 2008)
New Revision: 3029

Added:
   jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/deploy/
   jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/deploy/DeployerTest.java
   jbpm3/trunk/modules/integration/api/
   jbpm3/trunk/modules/integration/api/pom.xml
   jbpm3/trunk/modules/integration/api/src/
   jbpm3/trunk/modules/integration/jboss42/
   jbpm3/trunk/modules/integration/jboss42/src/
   jbpm3/trunk/modules/integration/jboss42/src/main/
   jbpm3/trunk/modules/integration/jboss42/src/main/java/
   jbpm3/trunk/modules/integration/jboss42/src/main/resources/
Removed:
   jbpm3/trunk/modules/integration/pom.xml
   jbpm3/trunk/modules/integration/src/
Modified:
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractCancelCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/BatchSignalCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelProcessInstanceCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelTokenCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelWorkOnTaskCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/Command.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CommandService.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CompositeCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeployProcessCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ExecuteJobsCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionsCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceLogCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskInstanceCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskListCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/NewProcessInstanceCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SignalCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartProcessInstanceCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartWorkOnTaskCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/TaskInstanceEndCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/VariablesCommand.java
   jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/impl/CommandServiceImpl.java
Log:
Add Integration for JBoss42

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractCancelCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractCancelCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractCancelCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -12,7 +12,8 @@
 import org.jbpm.graph.exe.Token;
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
-public class AbstractCancelCommand implements Serializable {
+public class AbstractCancelCommand implements Serializable
+{
 
   private static final long serialVersionUID = 1L;
 
@@ -20,16 +21,20 @@
 
   protected static final Log log = LogFactory.getLog(AbstractCancelCommand.class);
 
-  protected void cancelTokens(Collection tokens) {
-    if (tokens != null && tokens.size() > 0) {
+  protected void cancelTokens(Collection tokens)
+  {
+    if (tokens != null && tokens.size() > 0)
+    {
       log.info("cancel " + tokens.size() + " tokens");
-      for (Iterator itr = tokens.iterator(); itr.hasNext();) {
-        cancelToken((Token) itr.next());
+      for (Iterator itr = tokens.iterator(); itr.hasNext();)
+      {
+        cancelToken((Token)itr.next());
       }
     }
   }
 
-  protected void cancelToken(Token token) {
+  protected void cancelToken(Token token)
+  {
     token.end(false); // end the token but dont verify
     // ParentTermination
     // if set to token.end() == token.end(true) the parent token is
@@ -42,17 +47,21 @@
     log.info("token " + token.getId() + " canceled");
   }
 
-  protected List getTasksForToken(Token token) {
+  protected List getTasksForToken(Token token)
+  {
     Query hqlQuery = jbpmContext.getSession().getNamedQuery("TaskMgmtSession.findTaskInstancesByTokenId");
     hqlQuery.setLong("tokenId", token.getId());
     return hqlQuery.list();
   }
 
-  protected void cancelTasks(List tasks) {
-    if (tasks != null && tasks.size() > 0) {
+  protected void cancelTasks(List tasks)
+  {
+    if (tasks != null && tasks.size() > 0)
+    {
       log.info("cancel " + tasks.size() + " tasks");
-      for (Iterator it = tasks.iterator(); it.hasNext();) {
-        TaskInstance ti = (TaskInstance) it.next();
+      for (Iterator it = tasks.iterator(); it.hasNext();)
+      {
+        TaskInstance ti = (TaskInstance)it.next();
 
         // if the process def doesn't set signal="never", we have to
         // manually turn off signaling for all tasks;

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AbstractGetObjectBaseCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -13,165 +13,195 @@
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
 /**
- * abstract base class for "get" commands which also implements
- * default pre-fetching.
+ * abstract base class for "get" commands which also implements default pre-fetching.
  * 
- * Note: prefetching logs is not possible here, so you have to load
- * Loags explicit with GetProcessInstanceLogCommand
+ * Note: prefetching logs is not possible here, so you have to load Loags explicit with GetProcessInstanceLogCommand
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public abstract class AbstractGetObjectBaseCommand implements Command {
+public abstract class AbstractGetObjectBaseCommand implements Command
+{
 
-    static final Log log = LogFactory.getLog(AbstractGetObjectBaseCommand.class);
+  static final Log log = LogFactory.getLog(AbstractGetObjectBaseCommand.class);
 
-    private static final long serialVersionUID = 1L;
+  private static final long serialVersionUID = 1L;
 
-    /**
-     * if true, all process variables in the context (process instance / task)
-     * are prefetched too
-     */
-    private boolean includeAllVariables = false;
+  /**
+   * if true, all process variables in the context (process instance / task) are prefetched too
+   */
+  private boolean includeAllVariables = false;
 
-    /**
-     * specify the names of the variables to prefetch
-     */
-    private String[] variablesToInclude = new String[0];
-    
-    private transient JbpmContext jbpmContext;
+  /**
+   * specify the names of the variables to prefetch
+   */
+  private String[] variablesToInclude = new String[0];
 
-    public AbstractGetObjectBaseCommand() {
-    }
+  private transient JbpmContext jbpmContext;
 
-    public AbstractGetObjectBaseCommand(boolean includeAllVariables, boolean includeLogs) {
-        this.includeAllVariables = includeAllVariables;
-    }
+  public AbstractGetObjectBaseCommand()
+  {
+  }
 
-    public AbstractGetObjectBaseCommand(String[] variablesToInclude) {
-        this.variablesToInclude = variablesToInclude;
-    }
+  public AbstractGetObjectBaseCommand(boolean includeAllVariables, boolean includeLogs)
+  {
+    this.includeAllVariables = includeAllVariables;
+  }
 
-    public void retrieveTaskInstanceDetails(TaskInstance ti) {
-        try {
-            ti.getToken().getProcessInstance().getProcessDefinition().getName();
+  public AbstractGetObjectBaseCommand(String[] variablesToInclude)
+  {
+    this.variablesToInclude = variablesToInclude;
+  }
 
-            // in TaskInstances created with jbpm 3.1, this association was
-            // not present!
-            ti.setProcessInstance(ti.getToken().getProcessInstance());
-            ti.getToken().getNode().getName();
-            ti.getTask().getName();
+  public void retrieveTaskInstanceDetails(TaskInstance ti)
+  {
+    try
+    {
+      ti.getToken().getProcessInstance().getProcessDefinition().getName();
 
-            ti.getAvailableTransitions();
+      // in TaskInstances created with jbpm 3.1, this association was
+      // not present!
+      ti.setProcessInstance(ti.getToken().getProcessInstance());
+      ti.getToken().getNode().getName();
+      ti.getTask().getName();
 
-            retrieveVariables(ti);
-        }
-        catch (Exception ex) {
-            log.warn("exception while retrieving task instance data for task instance " + ti.getId(), ex);
-        }
-    }
+      ti.getAvailableTransitions();
 
-    public ProcessInstance retrieveProcessInstance(ProcessInstance pi) {
-        try {
-            pi.getProcessDefinition().getName();
-            retrieveToken(pi.getRootToken());
-            
-            // load at least the super process id and token id
-            if (pi.getSuperProcessToken()!=null) {
-              pi.getSuperProcessToken().getId();
-              pi.getSuperProcessToken().getProcessInstance().getId();
-            }
-
-            retrieveVariables(pi);
-        }
-        catch (Exception ex) {
-            log.warn("exception while retrieving process instance data for process instance " + pi.getId(), ex);
-        }
-        return pi;
+      retrieveVariables(ti);
     }
-
-    public ProcessDefinition retrieveProcessDefinition(ProcessDefinition pd) {
-        try {
-            pd.getName();
-            // often needed to start a process:
-            Iterator iter = pd.getStartState().getLeavingTransitions().iterator();
-            while (iter.hasNext()) {
-                Transition t = (Transition) iter.next();
-                t.getName();
-            }
-        }
-        catch (Exception ex) {
-            log.warn("exception while retrieving process instance data for process definiton " + pd.getName(), ex);
-        }
-        return pd;
+    catch (Exception ex)
+    {
+      log.warn("exception while retrieving task instance data for task instance " + ti.getId(), ex);
     }
+  }
 
-    protected void retrieveToken(Token t) {
-    	retrieveNode(t.getNode());
-        t.getAvailableTransitions();
-        
-//        if (includeLogs)
-//            t.getProcessInstance().getLoggingInstance().
+  public ProcessInstance retrieveProcessInstance(ProcessInstance pi)
+  {
+    try
+    {
+      pi.getProcessDefinition().getName();
+      retrieveToken(pi.getRootToken());
 
-        Iterator iter = t.getChildren().values().iterator();
-        while (iter.hasNext()) {
-            retrieveToken((Token) iter.next());
-        }
-    }
+      // load at least the super process id and token id
+      if (pi.getSuperProcessToken() != null)
+      {
+        pi.getSuperProcessToken().getId();
+        pi.getSuperProcessToken().getProcessInstance().getId();
+      }
 
-    protected void retrieveNode(Node n) {
-    	n.getName();
-    	n.getLeavingTransitions();
-        if (n.getSuperState()!=null)
-        	retrieveNode(n.getSuperState());
+      retrieveVariables(pi);
     }
-    
-    public void retrieveVariables(ProcessInstance pi) {
-        if (includeAllVariables) {
-            pi.getContextInstance().getVariables();
-        }
-        else {
-            for (int i = 0; i < variablesToInclude.length; i++) {
-                pi.getContextInstance().getVariable(variablesToInclude[i]);
-            }
-        }
+    catch (Exception ex)
+    {
+      log.warn("exception while retrieving process instance data for process instance " + pi.getId(), ex);
     }
+    return pi;
+  }
 
-    public void retrieveVariables(TaskInstance ti) {
-        if (includeAllVariables) {
-            ti.getVariables();
-        }
-        else {
-            for (int i = 0; i < variablesToInclude.length; i++) {
-                ti.getVariable(variablesToInclude[i]);
-            }
-        }
+  public ProcessDefinition retrieveProcessDefinition(ProcessDefinition pd)
+  {
+    try
+    {
+      pd.getName();
+      // often needed to start a process:
+      Iterator iter = pd.getStartState().getLeavingTransitions().iterator();
+      while (iter.hasNext())
+      {
+        Transition t = (Transition)iter.next();
+        t.getName();
+      }
     }
-
-    public boolean isIncludeAllVariables() {
-        return includeAllVariables;
+    catch (Exception ex)
+    {
+      log.warn("exception while retrieving process instance data for process definiton " + pd.getName(), ex);
     }
+    return pd;
+  }
 
-    public void setIncludeAllVariables(boolean includeAllVariables) {
-        this.includeAllVariables = includeAllVariables;
-    }
+  protected void retrieveToken(Token t)
+  {
+    retrieveNode(t.getNode());
+    t.getAvailableTransitions();
 
-    public String[] getVariablesToInclude() {
-        return variablesToInclude;
+    // if (includeLogs)
+    // t.getProcessInstance().getLoggingInstance().
+
+    Iterator iter = t.getChildren().values().iterator();
+    while (iter.hasNext())
+    {
+      retrieveToken((Token)iter.next());
     }
+  }
 
-    public void setVariablesToInclude(String[] variablesToInclude) {
-        this.variablesToInclude = variablesToInclude;
+  protected void retrieveNode(Node n)
+  {
+    n.getName();
+    n.getLeavingTransitions();
+    if (n.getSuperState() != null)
+      retrieveNode(n.getSuperState());
+  }
+
+  public void retrieveVariables(ProcessInstance pi)
+  {
+    if (includeAllVariables)
+    {
+      pi.getContextInstance().getVariables();
     }
+    else
+    {
+      for (int i = 0; i < variablesToInclude.length; i++)
+      {
+        pi.getContextInstance().getVariable(variablesToInclude[i]);
+      }
+    }
+  }
 
-    public void setVariablesToInclude(String variableToInclude) {
-        this.variablesToInclude = new String[] { variableToInclude };
+  public void retrieveVariables(TaskInstance ti)
+  {
+    if (includeAllVariables)
+    {
+      ti.getVariables();
     }
-    
-    protected JbpmContext getJbpmContext() {
-        return jbpmContext;
+    else
+    {
+      for (int i = 0; i < variablesToInclude.length; i++)
+      {
+        ti.getVariable(variablesToInclude[i]);
+      }
     }
+  }
 
-    protected void setJbpmContext(JbpmContext jbpmContext) {
-        this.jbpmContext = jbpmContext;
-    }
+  public boolean isIncludeAllVariables()
+  {
+    return includeAllVariables;
+  }
+
+  public void setIncludeAllVariables(boolean includeAllVariables)
+  {
+    this.includeAllVariables = includeAllVariables;
+  }
+
+  public String[] getVariablesToInclude()
+  {
+    return variablesToInclude;
+  }
+
+  public void setVariablesToInclude(String[] variablesToInclude)
+  {
+    this.variablesToInclude = variablesToInclude;
+  }
+
+  public void setVariablesToInclude(String variableToInclude)
+  {
+    this.variablesToInclude = new String[] { variableToInclude };
+  }
+
+  protected JbpmContext getJbpmContext()
+  {
+    return jbpmContext;
+  }
+
+  protected void setJbpmContext(JbpmContext jbpmContext)
+  {
+    this.jbpmContext = jbpmContext;
+  }
 }
\ No newline at end of file

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -3,23 +3,26 @@
 import org.jbpm.JbpmContext;
 
 /**
- * provides extra configuration options for the execution of asynchronous commands.
- * Plain commands can also be executed asynchronously.
+ * provides extra configuration options for the execution of asynchronous commands. Plain commands can also be executed
+ * asynchronously.
  */
-public class AsynchronousCommand implements Command {
+public class AsynchronousCommand implements Command
+{
 
   private static final long serialVersionUID = 1L;
 
   int retryCount = 1;
 
   Command command;
-  
-  public AsynchronousCommand(Command command) {
+
+  public AsynchronousCommand(Command command)
+  {
     this.command = command;
   }
-  
-  public Object execute(JbpmContext jbpmContext) throws Exception {
+
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
     throw new UnsupportedOperationException("sending any command over the message service is not yet supported");
   }
-  
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/BatchSignalCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/BatchSignalCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/BatchSignalCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -10,132 +10,145 @@
 import org.jbpm.graph.exe.Token;
 
 /**
- * a bunch of processes is signalled with this command. you can specify the
- * tokens either
- * <li> by a array of token ids
- * <li> or by processName, processVersion (optional, without all versions),
- * stateName
+ * a bunch of processes is signalled with this command. you can specify the tokens either <li>by a array of token ids
+ * <li>or by processName, processVersion (optional, without all versions), stateName
  * 
- * transitionName speicifies the transition to take (if null, the default
- * transition is taken).
+ * transitionName speicifies the transition to take (if null, the default transition is taken).
  * 
- * This command can be for example useful, if you have a lot of processes to
- * check some information a not jBPM task has altered before (maybe in batch
- * too).
+ * This command can be for example useful, if you have a lot of processes to check some information a not jBPM task has
+ * altered before (maybe in batch too).
  * 
- * CURRENTLY EXPERIMENTAL! 
+ * CURRENTLY EXPERIMENTAL!
  * 
  * @author Bernd Rucker (bernd.ruecker at camunda.com)
  */
-public class BatchSignalCommand implements Command {
+public class BatchSignalCommand implements Command
+{
 
-    private static final long serialVersionUID = -4330623193546102772L;
+  private static final long serialVersionUID = -4330623193546102772L;
 
-    private static Log log = LogFactory.getLog(BatchSignalCommand.class);
+  private static Log log = LogFactory.getLog(BatchSignalCommand.class);
 
-    private long[] tokenIds = null;
+  private long[] tokenIds = null;
 
-    private String processName = null;
+  private String processName = null;
 
-    private String stateName = null;
-    
-    /**
-     * if set, only tokens which are started after this date are signaled
-     * (interessting to implement some timeout for example)
-     */
-    private Date inStateAtLeastSince = null;
+  private String stateName = null;
 
-    private long processVersion = 0;
+  /**
+   * if set, only tokens which are started after this date are signaled (interessting to implement some timeout for
+   * example)
+   */
+  private Date inStateAtLeastSince = null;
 
-    private String transitionName = null;
+  private long processVersion = 0;
 
-    public Object execute(JbpmContext jbpmContext) throws Exception {
-	log.debug("executing " + this);
+  private String transitionName = null;
 
-	// batch tokens
-	if (tokenIds != null && tokenIds.length > 0) {
-	    for (int i = 0; i < tokenIds.length; i++) {
-	        Token token = jbpmContext.loadTokenForUpdate(tokenIds[i]);
-	        signalToken(token);
-	    }
-	}
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    log.debug("executing " + this);
 
-	// search for tokens in process/state
-	if (processName != null && stateName != null) {
-	    Query query = jbpmContext
-		    .getSession()
-		    .getNamedQuery(
-			    "GraphSession.findTokensForProcessInNode");
-	    query.setString("processDefinitionName", processName);
-        query.setString("nodeName", stateName);
+    // batch tokens
+    if (tokenIds != null && tokenIds.length > 0)
+    {
+      for (int i = 0; i < tokenIds.length; i++)
+      {
+        Token token = jbpmContext.loadTokenForUpdate(tokenIds[i]);
+        signalToken(token);
+      }
+    }
 
-        Iterator iter = query.list().iterator();
-        while (iter.hasNext()) {
-            Token t = (Token) iter.next();
-            if (inStateAtLeastSince== null || t.getNodeEnter().before(inStateAtLeastSince))
-              signalToken(t);            
-        }
-	}
+    // search for tokens in process/state
+    if (processName != null && stateName != null)
+    {
+      Query query = jbpmContext.getSession().getNamedQuery("GraphSession.findTokensForProcessInNode");
+      query.setString("processDefinitionName", processName);
+      query.setString("nodeName", stateName);
 
-	return null;
+      Iterator iter = query.list().iterator();
+      while (iter.hasNext())
+      {
+        Token t = (Token)iter.next();
+        if (inStateAtLeastSince == null || t.getNodeEnter().before(inStateAtLeastSince))
+          signalToken(t);
+      }
     }
 
-    private void signalToken(Token token) {
-        log.debug("signal token " + token);
-        if (transitionName == null) {
-            token.signal();
-        }
-        else {
-            token.signal(transitionName);
-        }
-    }
+    return null;
+  }
 
-    public String getProcessName() {
-        return processName;
+  private void signalToken(Token token)
+  {
+    log.debug("signal token " + token);
+    if (transitionName == null)
+    {
+      token.signal();
     }
-
-    public void setProcessName(String processName) {
-        this.processName = processName;
+    else
+    {
+      token.signal(transitionName);
     }
+  }
 
-    public long getProcessVersion() {
-        return processVersion;
-    }
+  public String getProcessName()
+  {
+    return processName;
+  }
 
-    public void setProcessVersion(long processVersion) {
-        this.processVersion = processVersion;
-    }
+  public void setProcessName(String processName)
+  {
+    this.processName = processName;
+  }
 
-    public String getStateName() {
-        return stateName;
-    }
+  public long getProcessVersion()
+  {
+    return processVersion;
+  }
 
-    public void setStateName(String stateName) {
-        this.stateName = stateName;
-    }
+  public void setProcessVersion(long processVersion)
+  {
+    this.processVersion = processVersion;
+  }
 
-    public long[] getTokenIds() {
-        return tokenIds;
-    }
+  public String getStateName()
+  {
+    return stateName;
+  }
 
-    public void setTokenIds(long[] tokenIds) {
-        this.tokenIds = tokenIds;
-    }
+  public void setStateName(String stateName)
+  {
+    this.stateName = stateName;
+  }
 
-    public String getTransitionName() {
-        return transitionName;
-    }
+  public long[] getTokenIds()
+  {
+    return tokenIds;
+  }
 
-    public void setTransitionName(String transitionName) {
-        this.transitionName = transitionName;
-    }
+  public void setTokenIds(long[] tokenIds)
+  {
+    this.tokenIds = tokenIds;
+  }
 
-    public Date getInStateAtLeastSince() {
-      return inStateAtLeastSince;
-    }
+  public String getTransitionName()
+  {
+    return transitionName;
+  }
 
-    public void setInStateAtLeastSince(Date inStateAtLeastSince) {
-      this.inStateAtLeastSince = inStateAtLeastSince;
-    }
+  public void setTransitionName(String transitionName)
+  {
+    this.transitionName = transitionName;
+  }
 
+  public Date getInStateAtLeastSince()
+  {
+    return inStateAtLeastSince;
+  }
+
+  public void setInStateAtLeastSince(Date inStateAtLeastSince)
+  {
+    this.inStateAtLeastSince = inStateAtLeastSince;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelProcessInstanceCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelProcessInstanceCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelProcessInstanceCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -1,9 +1,7 @@
 package org.jbpm.command;
 
 import java.util.Date;
-import java.util.Iterator;
 
-import org.hibernate.Query;
 import org.jbpm.JbpmContext;
 import org.jbpm.graph.exe.ProcessInstance;
 
@@ -12,59 +10,68 @@
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  * 
  */
-public class CancelProcessInstanceCommand extends AbstractCancelCommand implements Command {
+public class CancelProcessInstanceCommand extends AbstractCancelCommand implements Command
+{
 
-	private static final long serialVersionUID = 7145293049356621597L;
+  private static final long serialVersionUID = 7145293049356621597L;
 
-	private long processId;
+  private long processId;
 
-	public CancelProcessInstanceCommand() {		
-	}
+  public CancelProcessInstanceCommand()
+  {
+  }
 
-	public CancelProcessInstanceCommand(long processId) {
-		this.processId = processId;
-	}
+  public CancelProcessInstanceCommand(long processId)
+  {
+    this.processId = processId;
+  }
 
-	public Object execute(JbpmContext jbpmContext) throws Exception {
-		this.jbpmContext = jbpmContext;
-		cancelProcess(processId);
-		this.jbpmContext = null;
-		return null;
-	}
-	
-	protected void cancelProcess(long processIdToCancel) {
-		ProcessInstance pi = jbpmContext.getGraphSession().loadProcessInstance(
-				processIdToCancel);
-	
-		log.info("cancel process instance " + pi.getId());
-	
-		// Record a standardized variable that we can use to determine that this
-		// process has been 'cancelled' and not just ended.
-		pi.getContextInstance().createVariable("cancelled", new Date());
-	
-		try {
-			// End the process instance and any open tokens
-			// TODO: better implementation (also cancel sub processes etc.)
-			// see http://intranet.computation.de/bugs/view_bug.php?bug_id=295
-	
-			cancelToken(pi.getRootToken());
-			cancelTokens(pi.getRootToken().getChildren().values());
-	
-            pi.end();
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    this.jbpmContext = jbpmContext;
+    cancelProcess(processId);
+    this.jbpmContext = null;
+    return null;
+  }
 
-			log.info("finished process cancellation");
-		} catch (RuntimeException ex) {
-			log.error("problems while cancel process", ex);
-			throw ex;
-		}
-	}
-	
-	public long getProcessId() {
-		return processId;
-	}
+  protected void cancelProcess(long processIdToCancel)
+  {
+    ProcessInstance pi = jbpmContext.getGraphSession().loadProcessInstance(processIdToCancel);
 
-	public void setProcessId(long processId) {
-		this.processId = processId;
-	}
+    log.info("cancel process instance " + pi.getId());
 
+    // Record a standardized variable that we can use to determine that this
+    // process has been 'cancelled' and not just ended.
+    pi.getContextInstance().createVariable("cancelled", new Date());
+
+    try
+    {
+      // End the process instance and any open tokens
+      // TODO: better implementation (also cancel sub processes etc.)
+      // see http://intranet.computation.de/bugs/view_bug.php?bug_id=295
+
+      cancelToken(pi.getRootToken());
+      cancelTokens(pi.getRootToken().getChildren().values());
+
+      pi.end();
+
+      log.info("finished process cancellation");
+    }
+    catch (RuntimeException ex)
+    {
+      log.error("problems while cancel process", ex);
+      throw ex;
+    }
+  }
+
+  public long getProcessId()
+  {
+    return processId;
+  }
+
+  public void setProcessId(long processId)
+  {
+    this.processId = processId;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelTokenCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelTokenCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelTokenCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -7,32 +7,38 @@
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  * 
  */
-public class CancelTokenCommand extends AbstractCancelCommand implements Command {
+public class CancelTokenCommand extends AbstractCancelCommand implements Command
+{
 
-    private static final long serialVersionUID = 7145293049356621597L;
+  private static final long serialVersionUID = 7145293049356621597L;
 
-    private long tokenId;
+  private long tokenId;
 
-    public CancelTokenCommand() {
-    }
+  public CancelTokenCommand()
+  {
+  }
 
-    public CancelTokenCommand(long tokenId) {
-        this.tokenId = tokenId;
-    }
+  public CancelTokenCommand(long tokenId)
+  {
+    this.tokenId = tokenId;
+  }
 
-    public Object execute(JbpmContext jbpmContext) throws Exception {
-        this.jbpmContext = jbpmContext;
-        cancelToken(jbpmContext.getGraphSession().loadToken(tokenId));
-        this.jbpmContext = null;
-        return null;
-    }
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    this.jbpmContext = jbpmContext;
+    cancelToken(jbpmContext.getGraphSession().loadToken(tokenId));
+    this.jbpmContext = null;
+    return null;
+  }
 
-    public long getTokenId() {
-        return tokenId;
-    }
+  public long getTokenId()
+  {
+    return tokenId;
+  }
 
-    public void setTokenId(long tokenId) {
-        this.tokenId = tokenId;
-    }
+  public void setTokenId(long tokenId)
+  {
+    this.tokenId = tokenId;
+  }
 
 }
\ No newline at end of file

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelWorkOnTaskCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelWorkOnTaskCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CancelWorkOnTaskCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -4,40 +4,45 @@
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
 /**
- * The current authorizes actor starts to work on the TaskInstance
- * so the actor is set to the given actor
+ * The current authorizes actor starts to work on the TaskInstance so the actor is set to the given actor
  * 
- *  see some more information why we need that in the
- *  <a href="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018785">jbpm forum</a>	
+ * see some more information why we need that in the <a
+ * href="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018785">jbpm forum</a>
  * 
  * @author Bernd Ruecker
  */
-public class CancelWorkOnTaskCommand implements Command {
+public class CancelWorkOnTaskCommand implements Command
+{
 
-	private static final long serialVersionUID = -172457633891242288L;
+  private static final long serialVersionUID = -172457633891242288L;
 
-	private long taskInstanceId;
+  private long taskInstanceId;
 
-	public CancelWorkOnTaskCommand(long taskInstanceId) {
-		this.taskInstanceId = taskInstanceId;	
-	}
+  public CancelWorkOnTaskCommand(long taskInstanceId)
+  {
+    this.taskInstanceId = taskInstanceId;
+  }
 
-	public CancelWorkOnTaskCommand() {		
-	}
-	
-	public Object execute(JbpmContext jbpmContext) throws Exception {	
-		TaskInstance ti = jbpmContext.getTaskInstance(taskInstanceId);
-		ti.setActorId(null);
-		ti.setStart(null);      
-      return null;
-	}
+  public CancelWorkOnTaskCommand()
+  {
+  }
 
-	public long getTaskInstanceId() {
-		return taskInstanceId;
-	}
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    TaskInstance ti = jbpmContext.getTaskInstance(taskInstanceId);
+    ti.setActorId(null);
+    ti.setStart(null);
+    return null;
+  }
 
-	public void setTaskInstanceId(long taskInstanceId) {
-		this.taskInstanceId = taskInstanceId;
-	}
+  public long getTaskInstanceId()
+  {
+    return taskInstanceId;
+  }
 
+  public void setTaskInstanceId(long taskInstanceId)
+  {
+    this.taskInstanceId = taskInstanceId;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ChangeProcessInstanceVersionCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -21,226 +21,246 @@
 /**
  * <b>THIS COMMAND IS NOT YET STABLE, BUT FEEL FREE TO TEST :-)</b>
  * 
- * change the version of a running process instance. This works only, if the
- * current node is also available in the new version of the process definition
- * (identified by name, so the name has to be exactly the same). One problem
- * with this approach ist also, that if a task with the same name is moved to
- * another node (but this is a rare case)
+ * change the version of a running process instance. This works only, if the current node is also available in the new
+ * version of the process definition (identified by name, so the name has to be exactly the same). One problem with this
+ * approach ist also, that if a task with the same name is moved to another node (but this is a rare case)
  * 
  * 
- * make trouble, if there are 2 tokens in the process, because only one actual
- * node is used...
+ * make trouble, if there are 2 tokens in the process, because only one actual node is used...
  * 
  * Possible workaround: use process id instead of node id.
  * 
- * TODO: new hibernate query for that? Proposal Fluffi "select distinct task " +
- * "from " + Task.class.getName() + " task " + "where task.name = :taskName " + "
- * and task.processDefinition.id = :processDefinitionId ";
+ * TODO: new hibernate query for that? Proposal Fluffi "select distinct task " + "from " + Task.class.getName() +
+ * " task " + "where task.name = :taskName " + " and task.processDefinition.id = :processDefinitionId ";
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class ChangeProcessInstanceVersionCommand implements Command {
+public class ChangeProcessInstanceVersionCommand implements Command
+{
 
-    private static final long serialVersionUID = 2277080393930008224L;
+  private static final long serialVersionUID = 2277080393930008224L;
 
-    /**
-     * process id of process to update. If set, this special process is updated
-     */
-    private long processId = -1;
-    
-    /**
-     * if set, all running processes of the process with this name are updated
-     */
-    private String processName;
+  /**
+   * process id of process to update. If set, this special process is updated
+   */
+  private long processId = -1;
 
-    /**
-     * new version of process, if <=0, the latest process definition is used
-     */
-    private int newVersion = -1;
+  /**
+   * if set, all running processes of the process with this name are updated
+   */
+  private String processName;
 
-    private static final Log log = LogFactory.getLog(JbpmSchema.class);
+  /**
+   * new version of process, if <=0, the latest process definition is used
+   */
+  private int newVersion = -1;
 
-    private transient JbpmContext jbpmContext = null;
+  private static final Log log = LogFactory.getLog(JbpmSchema.class);
 
-    /**
-     * the map configures for every node-name in the old process definition (as
-     * key) which node-name to use in the new process definition.
-     * 
-     * if a node is not mentioned in this Map, old node name = new node name is
-     * applied
-     */
-    private Map nameMapping = new HashMap();
-    
-    private transient ProcessDefinition newDef;
+  private transient JbpmContext jbpmContext = null;
 
-    public ChangeProcessInstanceVersionCommand() {
+  /**
+   * the map configures for every node-name in the old process definition (as key) which node-name to use in the new
+   * process definition.
+   * 
+   * if a node is not mentioned in this Map, old node name = new node name is applied
+   */
+  private Map nameMapping = new HashMap();
+
+  private transient ProcessDefinition newDef;
+
+  public ChangeProcessInstanceVersionCommand()
+  {
+  }
+
+  public ChangeProcessInstanceVersionCommand(long processId, int newVersion)
+  {
+    this.processId = processId;
+    this.newVersion = newVersion;
+  }
+
+  private ProcessDefinition getNewDef(String processName)
+  {
+    if (newDef == null)
+    {
+      if (newVersion <= 0)
+        newDef = jbpmContext.getGraphSession().findLatestProcessDefinition(processName);
+      else
+        newDef = jbpmContext.getGraphSession().findProcessDefinition(processName, newVersion);
     }
+    return newDef;
+  }
 
-    public ChangeProcessInstanceVersionCommand(long processId, int newVersion) {
-        this.processId = processId;
-        this.newVersion = newVersion;
+  /**
+   * @return always null
+   * @see org.jbpm.command.Command#execute(org.jbpm.JbpmContext)
+   */
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    this.jbpmContext = jbpmContext;
+    if (processId > -1)
+    {
+      ProcessInstance pi = jbpmContext.getGraphSession().loadProcessInstance(processId);
+      changeProcessVersion(pi);
     }
-    
-    private ProcessDefinition getNewDef(String processName) {
-        if(newDef==null) {
-            if (newVersion<=0)
-                newDef = jbpmContext.getGraphSession().findLatestProcessDefinition(processName);
-            else
-                newDef = jbpmContext.getGraphSession().findProcessDefinition(processName, newVersion);            
-        }
-        return newDef;
+    if (processName != null && processName.length() > 0)
+    {
+      changeAllProcessInstances(processName);
     }
+    return null;
+  }
 
-    /**
-     * @return always null
-     * @see org.jbpm.command.Command#execute(org.jbpm.JbpmContext)
-     */
-    public Object execute(JbpmContext jbpmContext) throws Exception {
-        this.jbpmContext = jbpmContext;
-        if (processId>-1) {
-	        ProcessInstance pi = jbpmContext.getGraphSession().loadProcessInstance(processId);
-	        changeProcessVersion(pi);
-        }
-        if (processName!=null && processName.length()>0) {
-        	changeAllProcessInstances(processName);
-        }
-        return null;
-    }
+  private void changeProcessVersion(ProcessInstance pi)
+  {
+    changeTokenVersion(jbpmContext, pi.getRootToken());
 
-	private void changeProcessVersion(ProcessInstance pi) {
-		changeTokenVersion(jbpmContext, pi.getRootToken());
+    ProcessDefinition oldDef = pi.getProcessDefinition();
+    ProcessDefinition newDef = getNewDef(oldDef.getName());
 
-        ProcessDefinition oldDef = pi.getProcessDefinition();
-        ProcessDefinition newDef = getNewDef(oldDef.getName());
+    log.debug("changes process id " + pi.getId() + " from version " + pi.getProcessDefinition().getVersion() + " to new version " + newDef.getVersion());
 
-        log.debug("changes process id " + pi.getId() + " from version " + pi.getProcessDefinition().getVersion() + " to new version " + newDef.getVersion());
+    pi.setProcessDefinition(newDef);
 
-        pi.setProcessDefinition(newDef);
+    log.debug("process id " + pi.getId() + " changed to version " + pi.getProcessDefinition().getVersion());
+  }
 
-        log.debug("process id " + pi.getId() + " changed to version " + pi.getProcessDefinition().getVersion());
-	}
-    
-    private void changeAllProcessInstances(String processName) throws Exception {
-    	log.debug("changing version all processes '" + processName + "'");
+  private void changeAllProcessInstances(String processName) throws Exception
+  {
+    log.debug("changing version all processes '" + processName + "'");
 
-    	GetProcessInstancesCommand cmd = new GetProcessInstancesCommand();
-    	cmd.setProcessName(processName);
-    	cmd.setOnlyRunning(true);
-    	
-    	List instances = (List)cmd.execute(jbpmContext);
-    	for (Iterator iter = instances.iterator(); iter.hasNext();) {
-    		ProcessInstance pi = (ProcessInstance) iter.next();
-    		changeProcessVersion(pi);
-    	}
+    GetProcessInstancesCommand cmd = new GetProcessInstancesCommand();
+    cmd.setProcessName(processName);
+    cmd.setOnlyRunning(true);
+
+    List instances = (List)cmd.execute(jbpmContext);
+    for (Iterator iter = instances.iterator(); iter.hasNext();)
+    {
+      ProcessInstance pi = (ProcessInstance)iter.next();
+      changeProcessVersion(pi);
     }
+  }
 
-    private void changeTokenVersion(JbpmContext jbpmContext, Token token) {
-        Node oldNode = token.getNode();
+  private void changeTokenVersion(JbpmContext jbpmContext, Token token)
+  {
+    Node oldNode = token.getNode();
 
-        ProcessDefinition oldDef = token.getProcessInstance().getProcessDefinition();
-        ProcessDefinition newDef = getNewDef(oldDef.getName());
-        
-        Node newNode = newDef.findNode(getNewNodeName(oldNode));
+    ProcessDefinition oldDef = token.getProcessInstance().getProcessDefinition();
+    ProcessDefinition newDef = getNewDef(oldDef.getName());
 
-        if (newNode == null) {
-            throw new JbpmException("node with name '" + getNewNodeName(oldNode) + "' not found in new process definition");
-        }
+    Node newNode = newDef.findNode(getNewNodeName(oldNode));
 
-        log.debug("change token id " + token.getId() + " from version " + oldDef.getVersion() + " to new version " + newDef.getVersion());
+    if (newNode == null)
+    {
+      throw new JbpmException("node with name '" + getNewNodeName(oldNode) + "' not found in new process definition");
+    }
 
-        token.setNode(newNode);
+    log.debug("change token id " + token.getId() + " from version " + oldDef.getVersion() + " to new version " + newDef.getVersion());
 
-        // TODO: Change timers too!
+    token.setNode(newNode);
 
-        // change tasks
-        Iterator iter = getTasksForToken(token).iterator();
-        while (iter.hasNext()) {
-            TaskInstance ti = (TaskInstance) iter.next();
+    // TODO: Change timers too!
 
-            Task oldTask = ti.getTask();
-            // find new task
-            Query q = jbpmContext.getSession().getNamedQuery("TaskMgmtSession.findTaskForNode");
-            q.setString("taskName", oldTask.getName());
-            q.setLong("taskNodeId", newNode.getId());
-            // TODO: q.setLong("processDefinitionId", newDef.getId());
+    // change tasks
+    Iterator iter = getTasksForToken(token).iterator();
+    while (iter.hasNext())
+    {
+      TaskInstance ti = (TaskInstance)iter.next();
 
-            Task newTask = (Task) q.uniqueResult();
+      Task oldTask = ti.getTask();
+      // find new task
+      Query q = jbpmContext.getSession().getNamedQuery("TaskMgmtSession.findTaskForNode");
+      q.setString("taskName", oldTask.getName());
+      q.setLong("taskNodeId", newNode.getId());
+      // TODO: q.setLong("processDefinitionId", newDef.getId());
 
-            if (newTask == null) {
-                throw new JbpmException("node '" + newNode.getName() + "' has no Task configured! Check the new process definition");
-            }
+      Task newTask = (Task)q.uniqueResult();
 
-            ti.setTask(newTask);
-            log.debug("change dependent task-instance with id " + oldTask.getId());
-        }
+      if (newTask == null)
+      {
+        throw new JbpmException("node '" + newNode.getName() + "' has no Task configured! Check the new process definition");
+      }
 
-        // change childs recursive
-        Iterator childIter = token.getChildren().values().iterator();
-        while (childIter.hasNext()) {
-            changeTokenVersion(jbpmContext, (Token) childIter.next());
-        }
+      ti.setTask(newTask);
+      log.debug("change dependent task-instance with id " + oldTask.getId());
     }
 
-    /**
-     * @param oldNode
-     * @return the name of the new node (given in the map or return default
-     *         value, which is the old node name)
-     */
-    private String getNewNodeName(Node oldNode) {
-        String oldName = oldNode.getFullyQualifiedName();
-        if (nameMapping.containsKey(oldName)) {
-            return (String) nameMapping.get(oldName);
-        }
-        // return new node name = old node name as default
-        return oldName;
+    // change childs recursive
+    Iterator childIter = token.getChildren().values().iterator();
+    while (childIter.hasNext())
+    {
+      changeTokenVersion(jbpmContext, (Token)childIter.next());
     }
+  }
 
-    /**
-     * We may still have open tasks, even though their parent tokens have been
-     * ended. So we'll simply get all tasks from this process instance and
-     * cancel them if they are still active.
-     * 
-     */
-    private List getTasksForToken(Token token) {
-        Query query = jbpmContext.getSession().getNamedQuery("TaskMgmtSession.findTaskInstancesByTokenId");
-        query.setLong("tokenId", token.getId());
-        return query.list();
-
+  /**
+   * @param oldNode
+   * @return the name of the new node (given in the map or return default value, which is the old node name)
+   */
+  private String getNewNodeName(Node oldNode)
+  {
+    String oldName = oldNode.getFullyQualifiedName();
+    if (nameMapping.containsKey(oldName))
+    {
+      return (String)nameMapping.get(oldName);
     }
+    // return new node name = old node name as default
+    return oldName;
+  }
 
-    public Map getNameMapping() {
-        return nameMapping;
-    }
+  /**
+   * We may still have open tasks, even though their parent tokens have been ended. So we'll simply get all tasks from
+   * this process instance and cancel them if they are still active.
+   * 
+   */
+  private List getTasksForToken(Token token)
+  {
+    Query query = jbpmContext.getSession().getNamedQuery("TaskMgmtSession.findTaskInstancesByTokenId");
+    query.setLong("tokenId", token.getId());
+    return query.list();
 
-    public void setNameMapping(Map nameMapping) {
-        if (nameMapping==null)
-            this.nameMapping = new HashMap();
-        else
-            this.nameMapping = nameMapping;
-    }
+  }
 
-    public int getNewVersion() {
-        return newVersion;
-    }
+  public Map getNameMapping()
+  {
+    return nameMapping;
+  }
 
-    public void setNewVersion(int newVersion) {
-        this.newVersion = newVersion;
-    }
+  public void setNameMapping(Map nameMapping)
+  {
+    if (nameMapping == null)
+      this.nameMapping = new HashMap();
+    else
+      this.nameMapping = nameMapping;
+  }
 
-    public long getProcessId() {
-        return processId;
-    }
+  public int getNewVersion()
+  {
+    return newVersion;
+  }
 
-    public void setProcessId(long processId) {
-        this.processId = processId;
-    }
+  public void setNewVersion(int newVersion)
+  {
+    this.newVersion = newVersion;
+  }
 
-	public String getProcessName() {
-		return processName;
-	}
+  public long getProcessId()
+  {
+    return processId;
+  }
 
-	public void setProcessName(String processName) {
-		this.processName = processName;
-	}
+  public void setProcessId(long processId)
+  {
+    this.processId = processId;
+  }
 
+  public String getProcessName()
+  {
+    return processName;
+  }
+
+  public void setProcessName(String processName)
+  {
+    this.processName = processName;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/Command.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/Command.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/Command.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -25,7 +25,8 @@
 
 import org.jbpm.JbpmContext;
 
-public interface Command extends Serializable {
+public interface Command extends Serializable
+{
 
   Object execute(JbpmContext jbpmContext) throws Exception;
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CommandService.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CommandService.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CommandService.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -22,26 +22,24 @@
 package org.jbpm.command;
 
 import org.jbpm.JbpmException;
-import org.jbpm.command.Command;
 
 /**
  * Provides jBPM engine services.
  * 
  * @author Jim Rigsbee, Tom Baeyens
  */
-public interface CommandService {
+public interface CommandService
+{
 
   /**
-   * is the session facade that takes commands and executes them.  The CommandService 
-   * is responsible for creating or obtaining the JbpmContext.  The JbpmContext 
-   * will be passed to the commands as a parameter.  In a transactional environment,
-   * the execute method demarcates a transaction.  The command can be executed remotely and/or 
+   * is the session facade that takes commands and executes them. The CommandService is responsible for creating or
+   * obtaining the JbpmContext. The JbpmContext will be passed to the commands as a parameter. In a transactional
+   * environment, the execute method demarcates a transaction. The command can be executed remotely and/or
    * asynchronously.
    * 
-   * @param command
-   *          engine command to execute
-   * @return an object.  The types of objects is determined by the command implementation. 
-   *   See those docs for more details on the return object.
+   * @param command engine command to execute
+   * @return an object. The types of objects is determined by the command implementation. See those docs for more
+   *         details on the return object.
    * @throws JbpmException
    */
   public Object execute(Command command);

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CompositeCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CompositeCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/CompositeCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -8,25 +8,31 @@
 import org.jbpm.JbpmContext;
 import org.jbpm.JbpmException;
 
-public class CompositeCommand implements Command {
+public class CompositeCommand implements Command
+{
 
   private static final long serialVersionUID = 1L;
-  
+
   List commands = null;
-  
-  public CompositeCommand(List commands) {
+
+  public CompositeCommand(List commands)
+  {
     this.commands = commands;
   }
 
-  public Object execute(JbpmContext jbpmContext) throws Exception {
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
     List results = null;
-    if (commands!=null) {
+    if (commands != null)
+    {
       Object lastResult = null;
       results = new ArrayList(commands.size());
       Iterator iter = commands.iterator();
-      while(iter.hasNext()) {
+      while (iter.hasNext())
+      {
         Command command = (Command)iter.next();
-        if (lastResult!=null) {
+        if (lastResult != null)
+        {
           tryToInject(lastResult, command);
         }
         lastResult = command.execute(jbpmContext);
@@ -36,29 +42,33 @@
     return results;
   }
 
-  protected void tryToInject(Object lastResult, Command command) {
+  protected void tryToInject(Object lastResult, Command command)
+  {
     Field field = findField(lastResult.getClass());
-    if (field!=null) {
+    if (field != null)
+    {
       field.setAccessible(true);
-      try {
+      try
+      {
         field.set(command, lastResult);
-      } catch (Exception e) {
+      }
+      catch (Exception e)
+      {
         throw new JbpmException("couldn't propagate composite command context", e);
       }
     }
   }
 
-  protected Field findField(Class clazz) {
+  protected Field findField(Class clazz)
+  {
     Field field = null;
-    int i=0;
+    int i = 0;
     Field[] fields = clazz.getDeclaredFields();
-    while ( (i<fields.length)
-            && (field==null) 
-          ) {
+    while ((i < fields.length) && (field == null))
+    {
       Field candidate = fields[i];
-      if ( (candidate.getType().isAssignableFrom(clazz))
-           && (candidate.getName().startsWith("previous"))
-         ) {
+      if ((candidate.getType().isAssignableFrom(clazz)) && (candidate.getName().startsWith("previous")))
+      {
         field = candidate;
       }
       i++;

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -22,28 +22,29 @@
 package org.jbpm.command;
 
 import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.ProcessDefinition;
 
 /**
- * Delete a proces definition by ID 
+ * Delete a proces definition by ID
  * 
  * @author Heiko.Braun <heiko.braun at jboss.com>
  */
-public class DeleteProcessdefinitionCommand extends AbstractGetObjectBaseCommand {
+public class DeleteProcessdefinitionCommand extends AbstractGetObjectBaseCommand
+{
 
-   private static final long serialVersionUID = -1908847549444051495L;
+  private static final long serialVersionUID = -1908847549444051495L;
 
-   private long id;
-   
-   public DeleteProcessdefinitionCommand(long id) {
-      super();
-      this.id = id;
-   }
+  private long id;
 
-   public Object execute(JbpmContext jbpmContext) throws Exception
-   {
-      jbpmContext.getGraphSession().deleteProcessDefinition(id);      
-      return Boolean.TRUE;
-   }
+  public DeleteProcessdefinitionCommand(long id)
+  {
+    super();
+    this.id = id;
+  }
 
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    jbpmContext.getGraphSession().deleteProcessDefinition(id);
+    return Boolean.TRUE;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeployProcessCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeployProcessCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeployProcessCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -3,24 +3,22 @@
 import java.io.ByteArrayInputStream;
 import java.util.zip.ZipInputStream;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jbpm.JbpmContext;
 import org.jbpm.JbpmException;
 import org.jbpm.graph.def.ProcessDefinition;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
- * Deploys a process, given as XML-String (be patient with Umlauts or something
- * like that) or par archive (byte-array). if both is given, the byte-array will
- * be preferred
+ * Deploys a process, given as XML-String or process archive.
  * 
- * The deployed process definition is returned
+ * If both are given, the byte-array will be preferred The deployed process definition is returned
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  * 
  */
-public class DeployProcessCommand extends AbstractGetObjectBaseCommand {
-
+public class DeployProcessCommand extends AbstractGetObjectBaseCommand
+{
   private static final long serialVersionUID = -5861811926680981061L;
 
   private String xml;
@@ -29,64 +27,75 @@
 
   private static final Log log = LogFactory.getLog(DeployProcessCommand.class);
 
-  public DeployProcessCommand() {
-    }
+  public DeployProcessCommand()
+  {
+  }
 
-  public DeployProcessCommand(byte[] par) {
-    this.par = par;
+  public DeployProcessCommand(byte[] par)
+  {
+    setPar(par);
   }
 
-  public DeployProcessCommand(String xml) {
-    this.xml = xml;
+  public DeployProcessCommand(String xml)
+  {
+    setXml(xml);
   }
 
   /**
    * @return deployed ProcessDefinition
    */
-  public Object execute(JbpmContext jbpmContext) throws Exception {
-    ProcessDefinition processDefinition = null;
-    if (par != null && par.length > 0) {
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    if (par == null && xml == null)
+      throw new JbpmException("either xml string or process archive must be given.");
+
+    ProcessDefinition processDefinition;
+    if (par != null)
+    {
       log.debug("parse process from archive");
 
       // Thanks to George Mournos who helped to improve this:
-      ZipInputStream zipInputStream = new ZipInputStream(
-          new ByteArrayInputStream(par));
-      processDefinition = ProcessDefinition
-          .parseParZipInputStream(zipInputStream);
-
-      jbpmContext.deployProcessDefinition(processDefinition);
-      log.debug("deployment sucessfull");
+      ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(par));
+      processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream);
     }
-    else if (xml != null && xml.length() > 0) {
+    else
+    {
       log.debug("parse process from string");
       if (log.isTraceEnabled())
         log.trace("deploy process:\n" + xml);
 
-      processDefinition = ProcessDefinition
-          .parseXmlString(xml);
+      processDefinition = ProcessDefinition.parseXmlString(xml);
+    }
 
-      jbpmContext.deployProcessDefinition(processDefinition);
-      log.debug("deployment sucessfull");
-    }
-    else
-      throw new JbpmException("either xml string or process archive must be given.");
+    jbpmContext.deployProcessDefinition(processDefinition);
+    log.debug("deployment sucessfull");
+
     return retrieveProcessDefinition(processDefinition);
   }
 
-public byte[] getPar() {
+  public byte[] getPar()
+  {
     return par;
-}
+  }
 
-public void setPar(byte[] par) {
+  public void setPar(byte[] par)
+  {
     this.par = par;
-}
 
-public String getXml() {
+    if (par == null || par.length == 0)
+      throw new IllegalArgumentException("Cannot process null process archive");
+  }
+
+  public String getXml()
+  {
     return xml;
-}
+  }
 
-public void setXml(String xml) {
+  public void setXml(String xml)
+  {
     this.xml = xml;
-}
 
+    if (xml == null || xml.length() == 0)
+      throw new IllegalArgumentException("Cannot process null process definition");
+  }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ExecuteJobsCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ExecuteJobsCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/ExecuteJobsCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -19,129 +19,156 @@
 import org.jbpm.job.Timer;
 
 /**
- * Execute all overdue Jobs (may be enhanced with more attributes in future if
- * needed)
+ * Execute all overdue Jobs (may be enhanced with more attributes in future if needed)
  * 
  * @author ruecker
  */
-public class ExecuteJobsCommand implements Command {
+public class ExecuteJobsCommand implements Command
+{
 
   private static final long serialVersionUID = -2457066688404533959L;
 
   private static final Log log = LogFactory.getLog(ExecuteJobsCommand.class);
-  
+
   private static final int maxLockTime = 60000;
-  
+
   private transient JbpmContext jbpmContext;
 
-  public Object execute(JbpmContext jbpmContext) throws Exception {
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
     this.jbpmContext = jbpmContext;
-    try {
+    try
+    {
       Collection acquiredJobs = acquireJobs();
 
-      if (! acquiredJobs.isEmpty()) {
+      if (!acquiredJobs.isEmpty())
+      {
         Iterator iter = acquiredJobs.iterator();
-        while (iter.hasNext()) {
-          Job job = (Job) iter.next();
+        while (iter.hasNext())
+        {
+          Job job = (Job)iter.next();
           executeJob(job);
         }
       }
 
-      
-//      Job job = jbpmContext.getJobSession().getFirstAcquirableJob("");
-//      if (job != null) {
-//        log.info("execution job: " + job);
-//        job.execute(jbpmContext);
-//      }
-    } catch (JbpmException ex) {
+      // Job job = jbpmContext.getJobSession().getFirstAcquirableJob("");
+      // if (job != null) {
+      // log.info("execution job: " + job);
+      // job.execute(jbpmContext);
+      // }
+    }
+    catch (JbpmException ex)
+    {
       log.warn("exception while executing job", ex);
     }
     this.jbpmContext = null;
     return null;
   }
-  
-  private String getName() {
+
+  private String getName()
+  {
     return this.toString();
   }
 
-  protected Collection acquireJobs() {
+  protected Collection acquireJobs()
+  {
     Collection acquiredJobs = null;
     Collection jobsToLock = new ArrayList();
     log.debug("acquiring jobs for execution...");
 
-      try {
-        JobSession jobSession = jbpmContext.getJobSession();
-        log.debug("querying for acquirable job...");
-        Job job = jobSession.getFirstAcquirableJob(getName());
-        if (job!=null) {
-          if (job.isExclusive()) {
-            log.debug("exclusive acquirable job found ("+job+"). querying for other exclusive jobs to lock them all in one tx...");
-            List otherExclusiveJobs = jobSession.findExclusiveJobs(getName(), job.getProcessInstance());
-            jobsToLock.addAll(otherExclusiveJobs);
-            log.debug("trying to obtain a process-instance exclusive locks for '"+otherExclusiveJobs+"'");
-          } else {
-            log.debug("trying to obtain a lock for '"+job+"'");
-            jobsToLock.add(job);
-          }
-          
-          Iterator iter = jobsToLock.iterator();
-          while (iter.hasNext()) {
-            job = (Job) iter.next();
-            job.setLockOwner(getName());
-            job.setLockTime(new Date());
-            // jbpmContext.getSession().update(job);
-          }
+    try
+    {
+      JobSession jobSession = jbpmContext.getJobSession();
+      log.debug("querying for acquirable job...");
+      Job job = jobSession.getFirstAcquirableJob(getName());
+      if (job != null)
+      {
+        if (job.isExclusive())
+        {
+          log.debug("exclusive acquirable job found (" + job + "). querying for other exclusive jobs to lock them all in one tx...");
+          List otherExclusiveJobs = jobSession.findExclusiveJobs(getName(), job.getProcessInstance());
+          jobsToLock.addAll(otherExclusiveJobs);
+          log.debug("trying to obtain a process-instance exclusive locks for '" + otherExclusiveJobs + "'");
+        }
+        else
+        {
+          log.debug("trying to obtain a lock for '" + job + "'");
+          jobsToLock.add(job);
+        }
 
-          // HACKY HACK : this is a workaround for a hibernate problem that is fixed in hibernate 3.2.1
-          if (job instanceof Timer) {
-            Hibernate.initialize(((Timer)job).getGraphElement());
-          }
+        Iterator iter = jobsToLock.iterator();
+        while (iter.hasNext())
+        {
+          job = (Job)iter.next();
+          job.setLockOwner(getName());
+          job.setLockTime(new Date());
+          // jbpmContext.getSession().update(job);
+        }
 
-        } else {
-          log.debug("no acquirable jobs in job table");
+        // HACKY HACK : this is a workaround for a hibernate problem that is fixed in hibernate 3.2.1
+        if (job instanceof Timer)
+        {
+          Hibernate.initialize(((Timer)job).getGraphElement());
         }
-        
+
+      }
+      else
+      {
+        log.debug("no acquirable jobs in job table");
+      }
+
       acquiredJobs = jobsToLock;
-      log.debug("obtained locks on following jobs: "+acquiredJobs);
+      log.debug("obtained locks on following jobs: " + acquiredJobs);
 
-    } catch (StaleStateException e) {
-      log.debug("couldn't acquire lock on job(s): "+jobsToLock);
     }
+    catch (StaleStateException e)
+    {
+      log.debug("couldn't acquire lock on job(s): " + jobsToLock);
+    }
     return acquiredJobs;
   }
 
-  protected void executeJob(Job job) {
-      JobSession jobSession = jbpmContext.getJobSession();
-      job = jobSession.loadJob(job.getId());
+  protected void executeJob(Job job)
+  {
+    JobSession jobSession = jbpmContext.getJobSession();
+    job = jobSession.loadJob(job.getId());
 
-      try {
-        log.debug("executing job "+job);
-        if (job.execute(jbpmContext)) {
-          jobSession.deleteJob(job);
-        }
-
-      } catch (Exception e) {
-        log.debug("exception while executing '"+job+"'", e);
-        StringWriter sw = new StringWriter();
-        e.printStackTrace(new PrintWriter(sw));
-        job.setException(sw.toString());
-        job.setRetries(job.getRetries()-1);
+    try
+    {
+      log.debug("executing job " + job);
+      if (job.execute(jbpmContext))
+      {
+        jobSession.deleteJob(job);
       }
-      
-      // if this job is locked too long
-      long totalLockTimeInMillis = System.currentTimeMillis() - job.getLockTime().getTime(); 
-      if (totalLockTimeInMillis > maxLockTime) {
-        jbpmContext.setRollbackOnly();
-      }
 
+    }
+    catch (Exception e)
+    {
+      log.debug("exception while executing '" + job + "'", e);
+      StringWriter sw = new StringWriter();
+      e.printStackTrace(new PrintWriter(sw));
+      job.setException(sw.toString());
+      job.setRetries(job.getRetries() - 1);
+    }
+
+    // if this job is locked too long
+    long totalLockTimeInMillis = System.currentTimeMillis() - job.getLockTime().getTime();
+    if (totalLockTimeInMillis > maxLockTime)
+    {
+      jbpmContext.setRollbackOnly();
+    }
+
   }
-  protected Date getNextDueDate() {
+
+  protected Date getNextDueDate()
+  {
     Date nextDueDate = null;
-      JobSession jobSession = jbpmContext.getJobSession();
-      Job job = jobSession.getFirstDueJob(getName(), new ArrayList());
-      if (job!=null) {
-        nextDueDate = job.getDueDate();
-      }
+    JobSession jobSession = jbpmContext.getJobSession();
+    Job job = jobSession.getFirstDueJob(getName(), new ArrayList());
+    if (job != null)
+    {
+      nextDueDate = job.getDueDate();
+    }
     return nextDueDate;
   }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -7,50 +7,57 @@
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class GetProcessDefinitionCommand extends AbstractGetObjectBaseCommand {
-	
-	private static final long serialVersionUID = -1908847549444051495L;
-	
-	private int version = -1;
-	
-	private String name;
+public class GetProcessDefinitionCommand extends AbstractGetObjectBaseCommand
+{
 
-	public GetProcessDefinitionCommand() {		
-	}
+  private static final long serialVersionUID = -1908847549444051495L;
 
-	public GetProcessDefinitionCommand(String name) {
-		super();
-		this.name = name;
-	}
-	
-	public GetProcessDefinitionCommand(String name, int version) {
-		super();
-		this.version = version;
-		this.name = name;
-	}
-	
-	public Object execute(JbpmContext jbpmContext) throws Exception {
-		if (version >= 0)
-			return retrieveProcessDefinition(
-					jbpmContext.getGraphSession().findProcessDefinition(name, version));
-		else
-			return retrieveProcessDefinition(
-					jbpmContext.getGraphSession().findLatestProcessDefinition(name));
-	}
+  private int version = -1;
 
-	public String getName() {
-		return name;
-	}
+  private String name;
 
-	public void setName(String name) {
-		this.name = name;
-	}
+  public GetProcessDefinitionCommand()
+  {
+  }
 
-	public int getVersion() {
-		return version;
-	}
+  public GetProcessDefinitionCommand(String name)
+  {
+    super();
+    this.name = name;
+  }
 
-	public void setVersion(int version) {
-		this.version = version;
-	}
+  public GetProcessDefinitionCommand(String name, int version)
+  {
+    super();
+    this.version = version;
+    this.name = name;
+  }
+
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    if (version >= 0)
+      return retrieveProcessDefinition(jbpmContext.getGraphSession().findProcessDefinition(name, version));
+    else
+      return retrieveProcessDefinition(jbpmContext.getGraphSession().findLatestProcessDefinition(name));
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+
+  public int getVersion()
+  {
+    return version;
+  }
+
+  public void setVersion(int version)
+  {
+    this.version = version;
+  }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionsCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionsCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessDefinitionsCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -7,47 +7,52 @@
 import org.jbpm.graph.def.ProcessDefinition;
 
 /**
- * This Command returns all process definitions (or only the latest if
- * onlyLatest is true)
+ * This Command returns all process definitions (or only the latest if onlyLatest is true)
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class GetProcessDefinitionsCommand extends AbstractGetObjectBaseCommand {
+public class GetProcessDefinitionsCommand extends AbstractGetObjectBaseCommand
+{
 
-    private static final long serialVersionUID = -1908847549444051495L;
+  private static final long serialVersionUID = -1908847549444051495L;
 
-    private boolean onlyLatest = true;
+  private boolean onlyLatest = true;
 
-    public GetProcessDefinitionsCommand() {
-    }
+  public GetProcessDefinitionsCommand()
+  {
+  }
 
-    public GetProcessDefinitionsCommand(boolean onlyLatest) {
-        this.onlyLatest = onlyLatest;
-    }
+  public GetProcessDefinitionsCommand(boolean onlyLatest)
+  {
+    this.onlyLatest = onlyLatest;
+  }
 
-    public Object execute(JbpmContext jbpmContext) throws Exception {
-        setJbpmContext(jbpmContext);
-        List result = (onlyLatest ? jbpmContext.getGraphSession().findLatestProcessDefinitions() : jbpmContext.getGraphSession().findAllProcessDefinitions());
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    setJbpmContext(jbpmContext);
+    List result = (onlyLatest ? jbpmContext.getGraphSession().findLatestProcessDefinitions() : jbpmContext.getGraphSession().findAllProcessDefinitions());
 
-        /*
-         * traverse and access property if it is missing in the default
-         * fetchgroup
-         */
-        Iterator iter = result.iterator();
-        while (iter.hasNext()) {
-            ProcessDefinition pd = (ProcessDefinition) iter.next();
-            retrieveProcessDefinition(pd);
-        }
-
-        return result;
+    /*
+     * traverse and access property if it is missing in the default fetchgroup
+     */
+    Iterator iter = result.iterator();
+    while (iter.hasNext())
+    {
+      ProcessDefinition pd = (ProcessDefinition)iter.next();
+      retrieveProcessDefinition(pd);
     }
 
-    public boolean isOnlyLatest() {
-        return onlyLatest;
-    }
+    return result;
+  }
 
-    public void setOnlyLatest(boolean onlyLatest) {
-        this.onlyLatest = onlyLatest;
-    }
+  public boolean isOnlyLatest()
+  {
+    return onlyLatest;
+  }
 
+  public void setOnlyLatest(boolean onlyLatest)
+  {
+    this.onlyLatest = onlyLatest;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -4,72 +4,84 @@
 import org.jbpm.graph.exe.ProcessInstance;
 
 /**
- * This command can retrieve the matching process instances (e.g. for admin
- * client) with the given process-id, token id or task-id
+ * This command can retrieve the matching process instances (e.g. for admin client) with the given process-id, token id
+ * or task-id
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class GetProcessInstanceCommand extends AbstractGetObjectBaseCommand {
+public class GetProcessInstanceCommand extends AbstractGetObjectBaseCommand
+{
 
-    private static final long serialVersionUID = -8436697080972165601L;
+  private static final long serialVersionUID = -8436697080972165601L;
 
-    private long processInstanceId;
+  private long processInstanceId;
 
-    private long tokenId;
+  private long tokenId;
 
-    private long taskInstanceId;
+  private long taskInstanceId;
 
-    public GetProcessInstanceCommand() {
-    }
+  public GetProcessInstanceCommand()
+  {
+  }
 
-    public GetProcessInstanceCommand(long processInstanceId) {
-        this.processInstanceId = processInstanceId;
-    }
+  public GetProcessInstanceCommand(long processInstanceId)
+  {
+    this.processInstanceId = processInstanceId;
+  }
 
-    public GetProcessInstanceCommand(long processInstanceId, boolean includeVariables, boolean includeLogs) {
-        super(true, true);
-        this.processInstanceId = processInstanceId;
-    }
+  public GetProcessInstanceCommand(long processInstanceId, boolean includeVariables, boolean includeLogs)
+  {
+    super(true, true);
+    this.processInstanceId = processInstanceId;
+  }
 
-    public Object execute(JbpmContext jbpmContext) throws Exception {
-        setJbpmContext(jbpmContext);
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    setJbpmContext(jbpmContext);
 
-        ProcessInstance processInstance = null;
-        if (processInstanceId != 0)
-            processInstance = jbpmContext.getProcessInstance(processInstanceId);
-        else if (tokenId != 0)
-            processInstance = jbpmContext.getToken(tokenId).getProcessInstance();
-        else if (taskInstanceId != 0)
-            processInstance = jbpmContext.getTaskInstance(taskInstanceId).getProcessInstance();
+    ProcessInstance processInstance = null;
+    if (processInstanceId != 0)
+      processInstance = jbpmContext.getProcessInstance(processInstanceId);
+    else if (tokenId != 0)
+      processInstance = jbpmContext.getToken(tokenId).getProcessInstance();
+    else if (taskInstanceId != 0)
+      processInstance = jbpmContext.getTaskInstance(taskInstanceId).getProcessInstance();
 
-        if (processInstance != null) {
-            processInstance = retrieveProcessInstance(processInstance);
-        }
-        return processInstance;
+    if (processInstance != null)
+    {
+      processInstance = retrieveProcessInstance(processInstance);
     }
+    return processInstance;
+  }
 
-    public long getProcessInstanceId() {
-        return processInstanceId;
-    }
+  public long getProcessInstanceId()
+  {
+    return processInstanceId;
+  }
 
-    public void setProcessInstanceId(long processInstanceId) {
-        this.processInstanceId = processInstanceId;
-    }
+  public void setProcessInstanceId(long processInstanceId)
+  {
+    this.processInstanceId = processInstanceId;
+  }
 
-    public long getTaskInstanceId() {
-        return taskInstanceId;
-    }
+  public long getTaskInstanceId()
+  {
+    return taskInstanceId;
+  }
 
-    public void setTaskInstanceId(long taskInstanceId) {
-        this.taskInstanceId = taskInstanceId;
-    }
+  public void setTaskInstanceId(long taskInstanceId)
+  {
+    this.taskInstanceId = taskInstanceId;
+  }
 
-    public long getTokenId() {
-        return tokenId;
-    }
+  public long getTokenId()
+  {
+    return tokenId;
+  }
 
-    public void setTokenId(long tokenId) {
-        this.tokenId = tokenId;
-    }
+  public void setTokenId(long tokenId)
+  {
+    this.tokenId = tokenId;
+  }
 
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceLogCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceLogCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstanceLogCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -9,75 +9,84 @@
 import org.jbpm.logging.log.ProcessLog;
 
 /**
- * Retrieve the <code>org.jbpm.logging.log.ProcessLog</code> for the
- * process with the given process-id
+ * Retrieve the <code>org.jbpm.logging.log.ProcessLog</code> for the process with the given process-id
  * 
  * returns a map that maps {@link Token}s to {@link List}s.
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
- *
+ * 
  */
-public class GetProcessInstanceLogCommand implements Command {
-	
-	private static final long serialVersionUID = -2812852941518870502L;
-	
-	private long processInstanceId;
-	
-  public GetProcessInstanceLogCommand() {	  
-	}
-  
-  public GetProcessInstanceLogCommand(long processInstanceId) {
+public class GetProcessInstanceLogCommand implements Command
+{
+
+  private static final long serialVersionUID = -2812852941518870502L;
+
+  private long processInstanceId;
+
+  public GetProcessInstanceLogCommand()
+  {
+  }
+
+  public GetProcessInstanceLogCommand(long processInstanceId)
+  {
     this.processInstanceId = processInstanceId;
   }
 
-	public Object execute(JbpmContext jbpmContext) throws Exception {
-        Map logMap = jbpmContext.getLoggingSession().findLogsByProcessInstance(processInstanceId);
-        return loadLogdFromMap(logMap);	
-	}
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    Map logMap = jbpmContext.getLoggingSession().findLogsByProcessInstance(processInstanceId);
+    return loadLogdFromMap(logMap);
+  }
 
-	/**
-	 * access everything on all ProcessLog objects,
-	 * which is not in the default fetch group from hibernate, 
-	 * but needs to be accesible from the client
-	 * 
-	 * overwrite this method, if you need more details in your client
-	 */
-	protected Map loadLogdFromMap(Map logMap) {
-        Iterator iter = logMap.keySet().iterator();
-        while (iter.hasNext()) {
-            Token t = (Token) iter.next();
+  /**
+   * access everything on all ProcessLog objects, which is not in the default fetch group from hibernate, but needs to
+   * be accesible from the client
+   * 
+   * overwrite this method, if you need more details in your client
+   */
+  protected Map loadLogdFromMap(Map logMap)
+  {
+    Iterator iter = logMap.keySet().iterator();
+    while (iter.hasNext())
+    {
+      Token t = (Token)iter.next();
 
-            List logs = (List) logMap.get(t);
-            Iterator iter2 = logs.iterator();
-            while (iter2.hasNext()) {
-                ProcessLog pl = (ProcessLog) iter2.next();
-                // TODO: I am not sure if we need that, write a test for it
-                pl.getActorId();
-                pl.toString();
-            }
-        }	
-		return logMap;
-	}
+      List logs = (List)logMap.get(t);
+      Iterator iter2 = logs.iterator();
+      while (iter2.hasNext())
+      {
+        ProcessLog pl = (ProcessLog)iter2.next();
+        // TODO: I am not sure if we need that, write a test for it
+        pl.getActorId();
+        pl.toString();
+      }
+    }
+    return logMap;
+  }
 
-	/**
-	 * @deprecated use getProcessInstanceId instead
-	 */
-	public long getProcessId() {
-		return processInstanceId;
-	}
+  /**
+   * @deprecated use getProcessInstanceId instead
+   */
+  public long getProcessId()
+  {
+    return processInstanceId;
+  }
 
   /**
    * @deprecated use setProcessInstanceId instead
    */
-	public void setProcessId(long processId) {
-		this.processInstanceId = processId;
-	}
+  public void setProcessId(long processId)
+  {
+    this.processInstanceId = processId;
+  }
 
-  public long getProcessInstanceId() {
+  public long getProcessInstanceId()
+  {
     return processInstanceId;
   }
 
-  public void setProcessInstanceId(long processInstanceId) {
+  public void setProcessInstanceId(long processInstanceId)
+  {
     this.processInstanceId = processInstanceId;
   }
 

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetProcessInstancesCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -10,194 +10,215 @@
 
 /**
  * This command can retrieve all process instances (e.g. for admin client).
- *
- * You have the possibility to filter the command, therefor use the available
- * attributes
- *
+ * 
+ * You have the possibility to filter the command, therefor use the available attributes
+ * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class GetProcessInstancesCommand extends AbstractGetObjectBaseCommand {
+public class GetProcessInstancesCommand extends AbstractGetObjectBaseCommand
+{
 
-   private static final long serialVersionUID = -5601050489405283851L;
+  private static final long serialVersionUID = -5601050489405283851L;
 
-   /*
-   * is true, only the running process instances are retrieved (ended and
-   * canceled ones are skipped)
+  /*
+   * is true, only the running process instances are retrieved (ended and canceled ones are skipped)
    */
-   private boolean onlyRunning = true;
+  private boolean onlyRunning = true;
 
-   /*
+  /*
    * if given, only processes with start date >= given date are shown
    */
-   private Date fromStartDate;
+  private Date fromStartDate;
 
-   /*
+  /*
    * if given, only processes with start date <= given date are shown
    */
-   private Date untilStartDate;
+  private Date untilStartDate;
 
-   /*
+  /*
    * if given, only processes with this name are retrieved
    */
-   private String processName;
+  private String processName;
 
-   private long processId = -1;
-   /*
+  private long processId = -1;
+  /*
    * if given, only processes with this name are retrieved
    */
-   private String stateName;
+  private String stateName;
 
-   private String version = null;
+  private String version = null;
 
-   private transient boolean firstExpression = true;
+  private transient boolean firstExpression = true;
 
-   private String getConcatExpression() {
-      if (firstExpression) {
-         firstExpression = false;
-         return " where ";
-      }
-      return " and ";
-   }
+  private String getConcatExpression()
+  {
+    if (firstExpression)
+    {
+      firstExpression = false;
+      return " where ";
+    }
+    return " and ";
+  }
 
-   public Object execute(JbpmContext jbpmContext) throws Exception {
-      setJbpmContext(jbpmContext);
-      firstExpression = true;
-      StringBuffer queryText = new StringBuffer("select pi" + " from org.jbpm.graph.exe.ProcessInstance as pi ");
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    setJbpmContext(jbpmContext);
+    firstExpression = true;
+    StringBuffer queryText = new StringBuffer("select pi" + " from org.jbpm.graph.exe.ProcessInstance as pi ");
 
-      if (onlyRunning) {
-         queryText.append(getConcatExpression()).append(" pi.end = null");
-      }
+    if (onlyRunning)
+    {
+      queryText.append(getConcatExpression()).append(" pi.end = null");
+    }
 
-      if (fromStartDate != null) {
-         queryText.append(getConcatExpression()).append(" pi.start >= :from ");
-      }
-      if (untilStartDate != null) {
-         queryText.append(getConcatExpression()).append(" pi.start <= :until ");
-      }
-      if (version != null) {
-         queryText.append(getConcatExpression()).append(" pi.version = :version ");
-      }
+    if (fromStartDate != null)
+    {
+      queryText.append(getConcatExpression()).append(" pi.start >= :from ");
+    }
+    if (untilStartDate != null)
+    {
+      queryText.append(getConcatExpression()).append(" pi.start <= :until ");
+    }
+    if (version != null)
+    {
+      queryText.append(getConcatExpression()).append(" pi.version = :version ");
+    }
 
-      // name
-      if(processId!=-1)
-      {
-         queryText.append(getConcatExpression()).append(" pi.processDefinition.id = :processId  ");
-      }
-      else if (processName != null && processName.length() > 0) {
-         queryText.append(getConcatExpression()).append(" pi.processDefinition.name = :processDefinitionName  ");
-      }
+    // name
+    if (processId != -1)
+    {
+      queryText.append(getConcatExpression()).append(" pi.processDefinition.id = :processId  ");
+    }
+    else if (processName != null && processName.length() > 0)
+    {
+      queryText.append(getConcatExpression()).append(" pi.processDefinition.name = :processDefinitionName  ");
+    }
 
-      // TODO: this code only fecthes root tokens, child-tokens has to be
-      // considered too!
-      if (stateName != null && stateName.length() > 0) {
-         queryText.append(getConcatExpression()).append(" pi.rootToken.node.name = :nodeName ");
-      }
+    // TODO: this code only fecthes root tokens, child-tokens has to be
+    // considered too!
+    if (stateName != null && stateName.length() > 0)
+    {
+      queryText.append(getConcatExpression()).append(" pi.rootToken.node.name = :nodeName ");
+    }
 
-      queryText.append(" order by pi.start desc");
+    queryText.append(" order by pi.start desc");
 
-      Query query = jbpmContext.getSession().createQuery(queryText.toString());
+    Query query = jbpmContext.getSession().createQuery(queryText.toString());
 
-      if (fromStartDate != null) {
-         query.setTimestamp("from", fromStartDate);
-      }
-      if (untilStartDate != null) {
-         query.setTimestamp("until", untilStartDate);
-      }
+    if (fromStartDate != null)
+    {
+      query.setTimestamp("from", fromStartDate);
+    }
+    if (untilStartDate != null)
+    {
+      query.setTimestamp("until", untilStartDate);
+    }
 
-      if(processId!=-1)
-      {
-         query.setLong("processId", processId);  
-      }
-      if (processName != null && processName.length() > 0) {
-         query.setString("processDefinitionName", processName);
-      }
+    if (processId != -1)
+    {
+      query.setLong("processId", processId);
+    }
+    if (processName != null && processName.length() > 0)
+    {
+      query.setString("processDefinitionName", processName);
+    }
 
-      if (stateName != null && stateName.length() > 0) {
-         query.setString("nodeName", stateName);
-      }
+    if (stateName != null && stateName.length() > 0)
+    {
+      query.setString("nodeName", stateName);
+    }
 
-      if(version!=null)
-      {
-         query.setString("version", version);
-      }
+    if (version != null)
+    {
+      query.setString("version", version);
+    }
 
-      return retrieveProcessInstanceDetails(query.list());
-   }
+    return retrieveProcessInstanceDetails(query.list());
+  }
 
-   /**
-    * access everything on all processInstance objects, which is not in the
-    * default fetch group from hibernate, but needs to be accesible from the
-    * client
-    *
-    * overwrite this, if you need more details in your client
-    */
-   public List retrieveProcessInstanceDetails(List processInstanceList) {
-      Iterator it = processInstanceList.iterator();
-      while (it.hasNext()) {
-         retrieveProcessInstance((ProcessInstance) it.next());
-      }
-      return processInstanceList;
-   }
+  /**
+   * access everything on all processInstance objects, which is not in the default fetch group from hibernate, but needs
+   * to be accesible from the client
+   * 
+   * overwrite this, if you need more details in your client
+   */
+  public List retrieveProcessInstanceDetails(List processInstanceList)
+  {
+    Iterator it = processInstanceList.iterator();
+    while (it.hasNext())
+    {
+      retrieveProcessInstance((ProcessInstance)it.next());
+    }
+    return processInstanceList;
+  }
 
-   public Date getFromStartDate() {
-      return fromStartDate;
-   }
+  public Date getFromStartDate()
+  {
+    return fromStartDate;
+  }
 
-   public void setFromStartDate(Date fromStartDate) {
-      this.fromStartDate = fromStartDate;
-   }
+  public void setFromStartDate(Date fromStartDate)
+  {
+    this.fromStartDate = fromStartDate;
+  }
 
-   public boolean isOnlyRunning() {
-      return onlyRunning;
-   }
+  public boolean isOnlyRunning()
+  {
+    return onlyRunning;
+  }
 
-   public void setOnlyRunning(boolean onlyRunning) {
-      this.onlyRunning = onlyRunning;
-   }
+  public void setOnlyRunning(boolean onlyRunning)
+  {
+    this.onlyRunning = onlyRunning;
+  }
 
-   public String getProcessName() {
-      return processName;
-   }
+  public String getProcessName()
+  {
+    return processName;
+  }
 
-   public void setProcessName(String processName) {
-      this.processName = processName;
-   }
+  public void setProcessName(String processName)
+  {
+    this.processName = processName;
+  }
 
-   public String getStateName() {
-      return stateName;
-   }
+  public String getStateName()
+  {
+    return stateName;
+  }
 
-   public void setStateName(String stateName) {
-      this.stateName = stateName;
-   }
+  public void setStateName(String stateName)
+  {
+    this.stateName = stateName;
+  }
 
-   public Date getUntilStartDate() {
-      return untilStartDate;
-   }
+  public Date getUntilStartDate()
+  {
+    return untilStartDate;
+  }
 
-   public void setUntilStartDate(Date untilStartDate) {
-      this.untilStartDate = untilStartDate;
-   }
+  public void setUntilStartDate(Date untilStartDate)
+  {
+    this.untilStartDate = untilStartDate;
+  }
 
+  public String getVersion()
+  {
+    return version;
+  }
 
-   public String getVersion()
-   {
-      return version;
-   }
+  public void setVersion(String version)
+  {
+    this.version = version;
+  }
 
-   public void setVersion(String version)
-   {
-      this.version = version;
-   }
+  public long getProcessId()
+  {
+    return processId;
+  }
 
-
-   public long getProcessId()
-   {
-      return processId;
-   }
-
-   public void setProcessId(long processId)
-   {
-      this.processId = processId;
-   }
+  public void setProcessId(long processId)
+  {
+    this.processId = processId;
+  }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskInstanceCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskInstanceCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskInstanceCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -7,106 +7,122 @@
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
 /**
- * This command can retrieve a task instance (for client) with the given task-id
- * or the token-id (then, the first task for the token is searched)
+ * This command can retrieve a task instance (for client) with the given task-id or the token-id (then, the first task
+ * for the token is searched)
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class GetTaskInstanceCommand extends AbstractGetObjectBaseCommand {
+public class GetTaskInstanceCommand extends AbstractGetObjectBaseCommand
+{
 
-    private static final long serialVersionUID = -8436697080972165601L;
+  private static final long serialVersionUID = -8436697080972165601L;
 
-    private long taskInstanceId;
+  private long taskInstanceId;
 
-    /**
-     * if given, all tasks for this token are searched and a List of
-     * TaskInstances is given
-     */
-    private long tokenId;
+  /**
+   * if given, all tasks for this token are searched and a List of TaskInstances is given
+   */
+  private long tokenId;
 
-    /**
-     * if given, all tasks for this process are searched and a List of
-     * TaskInstances is given
-     */
-    private long processInstanceId;
+  /**
+   * if given, all tasks for this process are searched and a List of TaskInstances is given
+   */
+  private long processInstanceId;
 
-    /**
-     * NOT YET USED! JUST TO DOCUMENT THE IDEA...
-     * 
-     * result of the Command: a gui element, configured via the TaskController.
-     * Can be used to identify a Swing-Class, JSF-Site, ...
-     */
-    private String configuredGuiElement;
+  /**
+   * NOT YET USED! JUST TO DOCUMENT THE IDEA...
+   * 
+   * result of the Command: a gui element, configured via the TaskController. Can be used to identify a Swing-Class,
+   * JSF-Site, ...
+   */
+  private String configuredGuiElement;
 
-    public GetTaskInstanceCommand() {
-    }
+  public GetTaskInstanceCommand()
+  {
+  }
 
-    public GetTaskInstanceCommand(long taskInstanceId) {
-        this.taskInstanceId = taskInstanceId;
-    }
+  public GetTaskInstanceCommand(long taskInstanceId)
+  {
+    this.taskInstanceId = taskInstanceId;
+  }
 
-    public GetTaskInstanceCommand(long taskInstanceId, boolean includeVariables, boolean includeLogs) {
-        super(includeVariables, includeLogs);
-        this.taskInstanceId = taskInstanceId;
-    }
+  public GetTaskInstanceCommand(long taskInstanceId, boolean includeVariables, boolean includeLogs)
+  {
+    super(includeVariables, includeLogs);
+    this.taskInstanceId = taskInstanceId;
+  }
 
-    public GetTaskInstanceCommand(long taskInstanceId, String[] variablesToInclude) {
-        super(variablesToInclude);
-        this.taskInstanceId = taskInstanceId;
-    }
+  public GetTaskInstanceCommand(long taskInstanceId, String[] variablesToInclude)
+  {
+    super(variablesToInclude);
+    this.taskInstanceId = taskInstanceId;
+  }
 
-    public Object execute(JbpmContext jbpmContext) throws Exception {
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
 
-        if (taskInstanceId > 0) {
-            TaskInstance taskInstance = jbpmContext.getTaskInstance(taskInstanceId);
-            if (taskInstance != null) {
-                retrieveTaskInstanceDetails(taskInstance);
-            }
+    if (taskInstanceId > 0)
+    {
+      TaskInstance taskInstance = jbpmContext.getTaskInstance(taskInstanceId);
+      if (taskInstance != null)
+      {
+        retrieveTaskInstanceDetails(taskInstance);
+      }
 
-            return taskInstance;
-        }
-        else if (tokenId > 0) {
-            List result = jbpmContext.getTaskMgmtSession().findTaskInstancesByToken(tokenId);
-            for (Iterator iter = result.iterator(); iter.hasNext();) {
-                TaskInstance ti = (TaskInstance) iter.next();
-                retrieveTaskInstanceDetails(ti);
-            }
-            return result;
-        }
-        else if (processInstanceId > 0) {
-            List result = jbpmContext.getTaskMgmtSession().findTaskInstancesByProcessInstance(jbpmContext.getProcessInstance(processInstanceId));
-            for (Iterator iter = result.iterator(); iter.hasNext();) {
-                TaskInstance ti = (TaskInstance) iter.next();
-                retrieveTaskInstanceDetails(ti);
-            }
-            return result;
-        }
-        else
-            return null;
+      return taskInstance;
     }
-
-    public long getTaskInstanceId() {
-        return taskInstanceId;
+    else if (tokenId > 0)
+    {
+      List result = jbpmContext.getTaskMgmtSession().findTaskInstancesByToken(tokenId);
+      for (Iterator iter = result.iterator(); iter.hasNext();)
+      {
+        TaskInstance ti = (TaskInstance)iter.next();
+        retrieveTaskInstanceDetails(ti);
+      }
+      return result;
     }
-
-    public void setTaskInstanceId(long taskInstanceId) {
-        this.taskInstanceId = taskInstanceId;
+    else if (processInstanceId > 0)
+    {
+      List result = jbpmContext.getTaskMgmtSession().findTaskInstancesByProcessInstance(jbpmContext.getProcessInstance(processInstanceId));
+      for (Iterator iter = result.iterator(); iter.hasNext();)
+      {
+        TaskInstance ti = (TaskInstance)iter.next();
+        retrieveTaskInstanceDetails(ti);
+      }
+      return result;
     }
+    else
+      return null;
+  }
 
-    public long getTokenId() {
-        return tokenId;
-    }
+  public long getTaskInstanceId()
+  {
+    return taskInstanceId;
+  }
 
-    public void setTokenId(long tokenId) {
-        this.tokenId = tokenId;
-    }
+  public void setTaskInstanceId(long taskInstanceId)
+  {
+    this.taskInstanceId = taskInstanceId;
+  }
 
-    public long getProcessInstanceId() {
-        return processInstanceId;
-    }
+  public long getTokenId()
+  {
+    return tokenId;
+  }
 
-    public void setProcessInstanceId(long processInstanceId) {
-        this.processInstanceId = processInstanceId;
-    }
+  public void setTokenId(long tokenId)
+  {
+    this.tokenId = tokenId;
+  }
 
+  public long getProcessInstanceId()
+  {
+    return processInstanceId;
+  }
+
+  public void setProcessInstanceId(long processInstanceId)
+  {
+    this.processInstanceId = processInstanceId;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskListCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskListCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/GetTaskListCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -11,8 +11,7 @@
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
 /**
- * return a {@link java.util.List} of {@link org.jbpm.taskmgmt.exe.TaskInstance}s
- * for the given actor(s).
+ * return a {@link java.util.List} of {@link org.jbpm.taskmgmt.exe.TaskInstance}s for the given actor(s).
  * 
  * if no actor is used, the current authenticated user is taken as actor.
  * 
@@ -20,67 +19,78 @@
  * 
  * @author Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class GetTaskListCommand extends AbstractGetObjectBaseCommand implements Command {
+public class GetTaskListCommand extends AbstractGetObjectBaseCommand implements Command
+{
 
-    private static final long serialVersionUID = -1627380259541998349L;
+  private static final long serialVersionUID = -1627380259541998349L;
 
-    static final Log log = LogFactory.getLog(GetTaskListCommand.class);
+  static final Log log = LogFactory.getLog(GetTaskListCommand.class);
 
-    private String[] actor;
+  private String[] actor;
 
-    public GetTaskListCommand(String[] actor) {
-        setActor(actor);
-    }
+  public GetTaskListCommand(String[] actor)
+  {
+    setActor(actor);
+  }
 
-    public GetTaskListCommand(String actor, boolean includeVariables) {
-        super(includeVariables, false);
-        setActor(actor);
-    }
+  public GetTaskListCommand(String actor, boolean includeVariables)
+  {
+    super(includeVariables, false);
+    setActor(actor);
+  }
 
-    public GetTaskListCommand(String actor, String[] variablesToInclude) {
-        super(variablesToInclude);
-        setActor(actor);
+  public GetTaskListCommand(String actor, String[] variablesToInclude)
+  {
+    super(variablesToInclude);
+    setActor(actor);
+  }
+
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    setJbpmContext(jbpmContext);
+    List result = null;
+    if (actor == null || actor.length == 0)
+      result = jbpmContext.getTaskList();
+    else
+    {
+      result = new ArrayList();
+      for (int i = 0; i < actor.length; i++)
+      {
+        result.addAll(jbpmContext.getTaskList(actor[i]));
+      }
+      result.addAll(jbpmContext.getGroupTaskList(Arrays.asList(actor)));
     }
 
-    public Object execute(JbpmContext jbpmContext) throws Exception {
-        setJbpmContext(jbpmContext);
-        List result = null;
-        if (actor == null || actor.length == 0)
-            result = jbpmContext.getTaskList();
-        else {
-            result = new ArrayList();
-            for (int i = 0; i < actor.length; i++) {
-                result.addAll(jbpmContext.getTaskList(actor[i]));                
-            }
-            result.addAll(jbpmContext.getGroupTaskList(Arrays.asList(actor)));
-        }
+    return retrieveTaskInstanceDetails(result);
+  }
 
-        return retrieveTaskInstanceDetails(result);
+  /**
+   * access everything on all TaskInstance objects, which is not in the default fetch group from hibernate, but needs to
+   * be accesible from the client
+   * 
+   * overwrite this, if you need more details in your client
+   */
+  public List retrieveTaskInstanceDetails(List taskInstanceList)
+  {
+    for (Iterator iter = taskInstanceList.iterator(); iter.hasNext();)
+    {
+      retrieveTaskInstanceDetails((TaskInstance)iter.next());
     }
+    return taskInstanceList;
+  }
 
-    /**
-     * access everything on all TaskInstance objects, which is not in the
-     * default fetch group from hibernate, but needs to be accesible from the
-     * client
-     * 
-     * overwrite this, if you need more details in your client
-     */
-    public List retrieveTaskInstanceDetails(List taskInstanceList) {
-        for (Iterator iter = taskInstanceList.iterator(); iter.hasNext();) {
-            retrieveTaskInstanceDetails((TaskInstance) iter.next());
-        }
-        return taskInstanceList;
-    }
+  public String[] getActor()
+  {
+    return actor;
+  }
 
-    public String[] getActor() {
-        return actor;
-    }
+  public void setActor(String actor)
+  {
+    this.actor = new String[] { actor };
+  }
 
-    public void setActor(String actor) {
-        this.actor = new String[] { actor };
-    }
-
-    public void setActor(String[] actor) {
-        this.actor = actor;
-    }
+  public void setActor(String[] actor)
+  {
+    this.actor = actor;
+  }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/NewProcessInstanceCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/NewProcessInstanceCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/NewProcessInstanceCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -30,113 +30,149 @@
 import org.jbpm.graph.exe.ProcessInstance;
 
 /**
- * Graph command to start a new process and create a task instance if the start
- * node has a start task definition.
+ * Graph command to start a new process and create a task instance if the start node has a start task definition.
  * 
- * The result of this command, if requested, is a {@link Long} value containing
- * the process instance id.
+ * The result of this command, if requested, is a {@link Long} value containing the process instance id.
  * 
  * @author Jim Rigsbee, Tom Baeyens, Bernd Ruecker
  */
-public class NewProcessInstanceCommand implements Command {
+public class NewProcessInstanceCommand implements Command
+{
 
   private static final long serialVersionUID = 1L;
 
   private String processDefinitionName = null;
   private long processDefinitionId = 0;
-  
+
   // TODO: This is not clear to me, what for do we need that actorId here? // Bernd Ruecker
-  //       It specifies who is creating this new process instance command  // Tom Baeyens
+  // It specifies who is creating this new process instance command // Tom Baeyens
   String actorId = null;
   private Map variables = null;
   private boolean createStartTask = false;
-  
+
   private String key;
 
-  public NewProcessInstanceCommand() {
+  public NewProcessInstanceCommand()
+  {
   }
 
-  public NewProcessInstanceCommand(String processDefinitionName) {
+  public NewProcessInstanceCommand(String processDefinitionName)
+  {
     this.processDefinitionName = processDefinitionName;
   }
 
   /**
-   * return the id of the newly created process instance. 
-   * @throws Exception 
+   * return the id of the newly created process instance.
+   * 
+   * @throws Exception
    */
-  public Object execute(JbpmContext jbpmContext) throws Exception {
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
 
-    if (actorId!=null) {
+    if (actorId != null)
+    {
       jbpmContext.setActorId(actorId);
     }
-    
+
     ProcessInstance processInstance = null;
-    if (processDefinitionName!=null) {
+    if (processDefinitionName != null)
+    {
       processInstance = jbpmContext.newProcessInstance(processDefinitionName);
-    } else {
+    }
+    else
+    {
       ProcessDefinition processDefinition = jbpmContext.getGraphSession().loadProcessDefinition(processDefinitionId);
       processInstance = new ProcessInstance(processDefinition);
     }
 
-    if (key!=null) {
+    if (key != null)
+    {
       processInstance.setKey(key);
     }
 
     Object result = null;
-    if (createStartTask) {
+    if (createStartTask)
+    {
       result = processInstance.getTaskMgmtInstance().createStartTaskInstance();
-    } else {
+    }
+    else
+    {
       result = processInstance;
     }
-    
-    if (variables!=null) {
+
+    if (variables != null)
+    {
       ContextInstance contextInstance = processInstance.getContextInstance();
       Iterator iter = variables.keySet().iterator();
-      while (iter.hasNext()) {
-        String variableName = (String) iter.next();
+      while (iter.hasNext())
+      {
+        String variableName = (String)iter.next();
         contextInstance.setVariable(variableName, variables.get(variableName));
-      } 
-    }   
+      }
+    }
 
     jbpmContext.save(processInstance);
 
     return result;
   }
 
-  public String getActorId() {
+  public String getActorId()
+  {
     return actorId;
   }
-  public void setActorId(String actorId) {
+
+  public void setActorId(String actorId)
+  {
     this.actorId = actorId;
   }
-  public long getProcessId() {
+
+  public long getProcessId()
+  {
     return processDefinitionId;
   }
-  public void setProcessId(long processId) {
+
+  public void setProcessId(long processId)
+  {
     this.processDefinitionId = processId;
   }
-  public String getProcessName() {
+
+  public String getProcessName()
+  {
     return processDefinitionName;
   }
-  public void setProcessName(String processName) {
+
+  public void setProcessName(String processName)
+  {
     this.processDefinitionName = processName;
   }
-  public boolean isCreateStartTask() {
+
+  public boolean isCreateStartTask()
+  {
     return createStartTask;
   }
-  public void setCreateStartTask(boolean createStartTask) {
+
+  public void setCreateStartTask(boolean createStartTask)
+  {
     this.createStartTask = createStartTask;
   }
-  public Map getVariables() {
+
+  public Map getVariables()
+  {
     return variables;
   }
-  public void setVariables(Map variables) {
+
+  public void setVariables(Map variables)
+  {
     this.variables = variables;
   }
-  public String getKey() {
+
+  public String getKey()
+  {
     return key;
   }
-  public void setKey(String key) {
+
+  public void setKey(String key)
+  {
     this.key = key;
   }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SignalCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SignalCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/SignalCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -27,114 +27,133 @@
 import org.apache.commons.logging.LogFactory;
 import org.jbpm.JbpmContext;
 import org.jbpm.JbpmException;
+import org.jbpm.graph.exe.ProcessInstance;
 import org.jbpm.graph.exe.Token;
-import org.jbpm.graph.exe.ProcessInstance;
 
 /**
  * Signals a token. After signalling the token is returned
  * 
  * @author ??, Bernd Ruecker
  */
-public class SignalCommand implements Command {
+public class SignalCommand implements Command
+{
 
-    private static final long serialVersionUID = 1L;
+  private static final long serialVersionUID = 1L;
 
-    private long tokenId = 0;
+  private long tokenId = 0;
 
-    private String transitionName = null;
-    
-    /**
-     * if given, it is checked if the state is as expected. If not, a exception is thrown
-     * Ignored if null
-     */
-    private String expectedStateName = null;
+  private String transitionName = null;
 
-    private Token previousToken = null;
+  /**
+   * if given, it is checked if the state is as expected. If not, a exception is thrown Ignored if null
+   */
+  private String expectedStateName = null;
 
-    private ProcessInstance previousProcessInstance = null;
+  private Token previousToken = null;
 
-    private Map variables;
+  private ProcessInstance previousProcessInstance = null;
 
-    public SignalCommand() {
-    }
+  private Map variables;
 
-    public SignalCommand(long tokenId, String transitionName) {
-        this.tokenId = tokenId;
-        this.transitionName = transitionName;
-    }
+  public SignalCommand()
+  {
+  }
 
-    public Object execute(JbpmContext jbpmContext) {
-        log.debug("executing " + this);
-        if (previousProcessInstance != null) {
+  public SignalCommand(long tokenId, String transitionName)
+  {
+    this.tokenId = tokenId;
+    this.transitionName = transitionName;
+  }
 
-            if (variables != null && variables.size() > 0)
-                previousProcessInstance.getContextInstance().addVariables(variables);
+  public Object execute(JbpmContext jbpmContext)
+  {
+    log.debug("executing " + this);
+    if (previousProcessInstance != null)
+    {
 
-            if (transitionName == null) {
-                previousProcessInstance.signal();
-            }
-            else {
-                previousProcessInstance.signal(transitionName);
-            }
-            return previousProcessInstance.getRootToken();
-        }
-        else {
-            Token token = getToken(jbpmContext);
-            
-            if (expectedStateName!=null && !expectedStateName.equals( token.getNode().getName() ))
-                throw new JbpmException("token is not in expected state '"+expectedStateName+"' but in '" + token.getNode().getName() + "'");
+      if (variables != null && variables.size() > 0)
+        previousProcessInstance.getContextInstance().addVariables(variables);
 
-            if (variables != null && variables.size() > 0)
-                token.getProcessInstance().getContextInstance().addVariables(variables);
-
-            if (transitionName == null) {
-                token.signal();
-            }
-            else {
-                token.signal(transitionName);
-            }
-            return token;
-        }
+      if (transitionName == null)
+      {
+        previousProcessInstance.signal();
+      }
+      else
+      {
+        previousProcessInstance.signal(transitionName);
+      }
+      return previousProcessInstance.getRootToken();
     }
+    else
+    {
+      Token token = getToken(jbpmContext);
 
-    protected Token getToken(JbpmContext jbpmContext) {
-        if (previousToken != null) {
-            return previousToken;
-        }
-        return jbpmContext.loadTokenForUpdate(tokenId);
-    }
+      if (expectedStateName != null && !expectedStateName.equals(token.getNode().getName()))
+        throw new JbpmException("token is not in expected state '" + expectedStateName + "' but in '" + token.getNode().getName() + "'");
 
-    public long getTokenId() {
-        return tokenId;
-    }
+      if (variables != null && variables.size() > 0)
+        token.getProcessInstance().getContextInstance().addVariables(variables);
 
-    public void setTokenId(long tokenId) {
-        this.tokenId = tokenId;
+      if (transitionName == null)
+      {
+        token.signal();
+      }
+      else
+      {
+        token.signal(transitionName);
+      }
+      return token;
     }
+  }
 
-    public String getTransitionName() {
-        return transitionName;
+  protected Token getToken(JbpmContext jbpmContext)
+  {
+    if (previousToken != null)
+    {
+      return previousToken;
     }
+    return jbpmContext.loadTokenForUpdate(tokenId);
+  }
 
-    public void setTransitionName(String transitionName) {
-        this.transitionName = transitionName;
-    }
+  public long getTokenId()
+  {
+    return tokenId;
+  }
 
-    private static Log log = LogFactory.getLog(SignalCommand.class);
+  public void setTokenId(long tokenId)
+  {
+    this.tokenId = tokenId;
+  }
 
-    public Map getVariables() {
-        return variables;
-    }
+  public String getTransitionName()
+  {
+    return transitionName;
+  }
 
-    public void setVariables(Map variables) {
-        this.variables = variables;
-    }
+  public void setTransitionName(String transitionName)
+  {
+    this.transitionName = transitionName;
+  }
 
-    public String getExpectedStateName() {
-        return expectedStateName;
-    }
+  private static Log log = LogFactory.getLog(SignalCommand.class);
 
-    public void setExpectedStateName(String expectedStateName) {
-        this.expectedStateName = expectedStateName;
-    }
+  public Map getVariables()
+  {
+    return variables;
+  }
+
+  public void setVariables(Map variables)
+  {
+    this.variables = variables;
+  }
+
+  public String getExpectedStateName()
+  {
+    return expectedStateName;
+  }
+
+  public void setExpectedStateName(String expectedStateName)
+  {
+    this.expectedStateName = expectedStateName;
+  }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartProcessInstanceCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartProcessInstanceCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartProcessInstanceCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -4,44 +4,45 @@
 import org.jbpm.graph.exe.ProcessInstance;
 
 /**
- * Graph command to start a new process and signal it immidiatly.
- * The transition named in <code>startTransitionName</code> is used (or the default transition if it is null).
+ * Graph command to start a new process and signal it immidiatly. The transition named in
+ * <code>startTransitionName</code> is used (or the default transition if it is null).
  * 
- * The result of this command, if requested, is a {@link Long} value containing
- * the process instance id.
+ * The result of this command, if requested, is a {@link Long} value containing the process instance id.
  * 
  * @author Jim Rigsbee, Tom Baeyens, Bernd Ruecker
  */
-public class StartProcessInstanceCommand extends NewProcessInstanceCommand
-		implements Command {
+public class StartProcessInstanceCommand extends NewProcessInstanceCommand implements Command
+{
 
-	private static final long serialVersionUID = -2428234069404269048L;
+  private static final long serialVersionUID = -2428234069404269048L;
 
-	/**
-	 * this transition name is used for signalling (if null, the default
-	 * transition is used)
-	 */
-	private String startTransitionName = null;
+  /**
+   * this transition name is used for signalling (if null, the default transition is used)
+   */
+  private String startTransitionName = null;
 
-	public Object execute(JbpmContext jbpmContext) throws Exception {
-		Object object = super.execute(jbpmContext);
-		if (object instanceof ProcessInstance) {
-			ProcessInstance processInstance = (ProcessInstance) object;
-			if (startTransitionName == null
-					|| startTransitionName.length() == 0)
-				processInstance.signal();
-			else
-				processInstance.signal(startTransitionName);
-		}
-		return object;
-	}
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    Object object = super.execute(jbpmContext);
+    if (object instanceof ProcessInstance)
+    {
+      ProcessInstance processInstance = (ProcessInstance)object;
+      if (startTransitionName == null || startTransitionName.length() == 0)
+        processInstance.signal();
+      else
+        processInstance.signal(startTransitionName);
+    }
+    return object;
+  }
 
-	public String getStartTransitionName() {
-		return startTransitionName;
-	}
+  public String getStartTransitionName()
+  {
+    return startTransitionName;
+  }
 
-	public void setStartTransitionName(String startTransitionName) {
-		this.startTransitionName = startTransitionName;
-	}
+  public void setStartTransitionName(String startTransitionName)
+  {
+    this.startTransitionName = startTransitionName;
+  }
 
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartWorkOnTaskCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartWorkOnTaskCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/StartWorkOnTaskCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -1,76 +1,81 @@
 package org.jbpm.command;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jbpm.JbpmContext;
-import org.jbpm.db.JbpmSchema;
 import org.jbpm.taskmgmt.exe.TaskInstance;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
- * The current authorizes actor starts to work on the TaskInstance
- * so the actor is set to the given actor
+ * The current authorizes actor starts to work on the TaskInstance so the actor is set to the given actor
  * 
  * @author Bernd Ruecker
  */
-public class StartWorkOnTaskCommand implements Command {
+public class StartWorkOnTaskCommand implements Command
+{
 
-	private static final long serialVersionUID = 53004484398726736L;
+  private static final long serialVersionUID = 53004484398726736L;
 
-   private static final Log log = LogFactory.getLog(StartWorkOnTaskCommand.class);
+  private static final Log log = LogFactory.getLog(StartWorkOnTaskCommand.class);
 
-   private long taskInstanceId;
-	
-	private boolean overwriteSwimlane = false;
+  private long taskInstanceId;
 
-   private String actorId;
+  private boolean overwriteSwimlane = false;
 
-   public StartWorkOnTaskCommand(long taskInstanceId, boolean overwriteSwimlane) {
-		this.taskInstanceId = taskInstanceId;
-		this.overwriteSwimlane = overwriteSwimlane;
-	}
+  private String actorId;
 
-	public StartWorkOnTaskCommand() {		
-	}
-	
-	public Object execute(JbpmContext jbpmContext) throws Exception {
-      String actor = this.actorId==null ? jbpmContext.getActorId() : this.actorId;
-      TaskInstance taskInstance = jbpmContext.getTaskInstance(taskInstanceId);
+  public StartWorkOnTaskCommand(long taskInstanceId, boolean overwriteSwimlane)
+  {
+    this.taskInstanceId = taskInstanceId;
+    this.overwriteSwimlane = overwriteSwimlane;
+  }
 
+  public StartWorkOnTaskCommand()
+  {
+  }
 
-      if(taskInstance.getStart()!=null)
-      {
-         log.warn("Force stop on task " + taskInstance.getId() + ". Will be restarted.");
-         taskInstance.setStart(null);   // strange, but means isNotStarted()
-      }
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
+    String actor = this.actorId == null ? jbpmContext.getActorId() : this.actorId;
+    TaskInstance taskInstance = jbpmContext.getTaskInstance(taskInstanceId);
 
-      taskInstance.start(actor, overwriteSwimlane);
-               
-      return null;
-	}
+    if (taskInstance.getStart() != null)
+    {
+      log.warn("Force stop on task " + taskInstance.getId() + ". Will be restarted.");
+      taskInstance.setStart(null); // strange, but means isNotStarted()
+    }
 
-	public boolean isOverwriteSwimlane() {
-		return overwriteSwimlane;
-	}
+    taskInstance.start(actor, overwriteSwimlane);
 
-	public void setOverwriteSwimlane(boolean overwriteSwimlane) {
-		this.overwriteSwimlane = overwriteSwimlane;
-	}
+    return null;
+  }
 
-	public long getTaskInstanceId() {
-		return taskInstanceId;
-	}
+  public boolean isOverwriteSwimlane()
+  {
+    return overwriteSwimlane;
+  }
 
-	public void setTaskInstanceId(long taskInstanceId) {
-		this.taskInstanceId = taskInstanceId;
-	}
+  public void setOverwriteSwimlane(boolean overwriteSwimlane)
+  {
+    this.overwriteSwimlane = overwriteSwimlane;
+  }
 
-   public void setActorId(String actorId)
-   {
-      this.actorId = actorId;
-   }
+  public long getTaskInstanceId()
+  {
+    return taskInstanceId;
+  }
 
-   public String getActorId()
-   {
-      return actorId;
-   }
+  public void setTaskInstanceId(long taskInstanceId)
+  {
+    this.taskInstanceId = taskInstanceId;
+  }
+
+  public void setActorId(String actorId)
+  {
+    this.actorId = actorId;
+  }
+
+  public String getActorId()
+  {
+    return actorId;
+  }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/TaskInstanceEndCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/TaskInstanceEndCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/TaskInstanceEndCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -27,82 +27,97 @@
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
 /**
- * end the task with the given id if variables are given as a map, they are
- * added/changed bevore ending the task
+ * end the task with the given id if variables are given as a map, they are added/changed bevore ending the task
  * 
  * @author ??, Bernd Ruecker (bernd.ruecker at camunda.com)
  */
-public class TaskInstanceEndCommand implements Command {
+public class TaskInstanceEndCommand implements Command
+{
 
-	private static final long serialVersionUID = 5721341060757950369L;
+  private static final long serialVersionUID = 5721341060757950369L;
 
-	private long taskInstanceId = 0;
+  private long taskInstanceId = 0;
 
-	private String transitionName = null;
+  private String transitionName = null;
 
-	private Map variables;
+  private Map variables;
 
-	private TaskInstance previoustaskInstance = null;
+  private TaskInstance previoustaskInstance = null;
 
-	public TaskInstanceEndCommand() {
-	}
-	
-	public TaskInstanceEndCommand(long taskInstanceId, String transitionName) {
-		this.taskInstanceId = taskInstanceId;
-		this.transitionName = transitionName;
-	}
+  public TaskInstanceEndCommand()
+  {
+  }
 
-	public TaskInstanceEndCommand(long taskInstanceId, String transitionName,
-			Map variables) {
-		this.taskInstanceId = taskInstanceId;
-		this.transitionName = transitionName;
-		this.variables = variables;
-	}
+  public TaskInstanceEndCommand(long taskInstanceId, String transitionName)
+  {
+    this.taskInstanceId = taskInstanceId;
+    this.transitionName = transitionName;
+  }
 
-	public Object execute(JbpmContext jbpmContext) {
-		TaskInstance taskInstance = getTaskInstance(jbpmContext);
+  public TaskInstanceEndCommand(long taskInstanceId, String transitionName, Map variables)
+  {
+    this.taskInstanceId = taskInstanceId;
+    this.transitionName = transitionName;
+    this.variables = variables;
+  }
 
-		if (variables != null && variables.size() > 0) {
-			taskInstance.getContextInstance().addVariables(variables);
-		}
+  public Object execute(JbpmContext jbpmContext)
+  {
+    TaskInstance taskInstance = getTaskInstance(jbpmContext);
 
-		if (transitionName == null) {
-			taskInstance.end();
-		} else {
-			taskInstance.end(transitionName);
-		}
-		return taskInstance;
-	}
+    if (variables != null && variables.size() > 0)
+    {
+      taskInstance.getContextInstance().addVariables(variables);
+    }
 
-	protected TaskInstance getTaskInstance(JbpmContext jbpmContext) {
-		if (previoustaskInstance != null) {
-			return previoustaskInstance;
-		}
-		return jbpmContext.getTaskInstance(taskInstanceId);
-	}
+    if (transitionName == null)
+    {
+      taskInstance.end();
+    }
+    else
+    {
+      taskInstance.end(transitionName);
+    }
+    return taskInstance;
+  }
 
-	public long getTaskInstanceId() {
-		return taskInstanceId;
-	}
+  protected TaskInstance getTaskInstance(JbpmContext jbpmContext)
+  {
+    if (previoustaskInstance != null)
+    {
+      return previoustaskInstance;
+    }
+    return jbpmContext.getTaskInstance(taskInstanceId);
+  }
 
-	public void setTaskInstanceId(long taskInstanceId) {
-		this.taskInstanceId = taskInstanceId;
-	}
+  public long getTaskInstanceId()
+  {
+    return taskInstanceId;
+  }
 
-	public String getTransitionName() {
-		return transitionName;
-	}
+  public void setTaskInstanceId(long taskInstanceId)
+  {
+    this.taskInstanceId = taskInstanceId;
+  }
 
-	public void setTransitionName(String transitionName) {
-		this.transitionName = transitionName;
-	}
+  public String getTransitionName()
+  {
+    return transitionName;
+  }
 
-	public Map getVariables() {
-		return variables;
-	}
+  public void setTransitionName(String transitionName)
+  {
+    this.transitionName = transitionName;
+  }
 
-	public void setVariables(Map variables) {
-		this.variables = variables;
-	}
+  public Map getVariables()
+  {
+    return variables;
+  }
 
+  public void setVariables(Map variables)
+  {
+    this.variables = variables;
+  }
+
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/VariablesCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/VariablesCommand.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/VariablesCommand.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -8,68 +8,87 @@
 import org.jbpm.graph.exe.Token;
 import org.jbpm.taskmgmt.exe.TaskInstance;
 
-public class VariablesCommand implements Command {
-  
+public class VariablesCommand implements Command
+{
+
   private static final long serialVersionUID = 1L;
 
   long tokenId = 0;
   long taskInstanceId = 0;
   Map variables = null;
-  
+
   ProcessInstance previousProcessInstance = null;
   Token previousToken = null;
   TaskInstance previousTaskInstance = null;
 
-  public Object execute(JbpmContext jbpmContext) throws Exception {
+  public Object execute(JbpmContext jbpmContext) throws Exception
+  {
     VariableContainer variableContainer = getVariableContainer(jbpmContext);
-    if ( (variableContainer!=null)
-         && (variables!=null)
-       ) {
+    if ((variableContainer != null) && (variables != null))
+    {
       variableContainer.addVariables(variables);
     }
     return variableContainer;
   }
 
-  protected VariableContainer getVariableContainer(JbpmContext jbpmContext) {
-    if (previousProcessInstance!=null) {
+  protected VariableContainer getVariableContainer(JbpmContext jbpmContext)
+  {
+    if (previousProcessInstance != null)
+    {
       return getVariableContainer(previousProcessInstance.getRootToken());
     }
-    if (previousToken!=null) {
+    if (previousToken != null)
+    {
       return getVariableContainer(previousToken);
     }
-    if (previousTaskInstance!=null) {
+    if (previousTaskInstance != null)
+    {
       return previousTaskInstance;
     }
-    
-    if (tokenId!=0) {
+
+    if (tokenId != 0)
+    {
       return getVariableContainer(jbpmContext.getToken(tokenId));
     }
-    if (taskInstanceId!=0) {
+    if (taskInstanceId != 0)
+    {
       return jbpmContext.getTaskInstance(taskInstanceId);
     }
     return null;
   }
 
-  protected VariableContainer getVariableContainer(Token token) {
+  protected VariableContainer getVariableContainer(Token token)
+  {
     return token.getProcessInstance().getContextInstance().getTokenVariableMap(token);
   }
 
-  public long getTaskInstanceId() {
+  public long getTaskInstanceId()
+  {
     return taskInstanceId;
   }
-  public void setTaskInstanceId(long taskInstanceId) {
+
+  public void setTaskInstanceId(long taskInstanceId)
+  {
     this.taskInstanceId = taskInstanceId;
   }
-  public long getTokenId() {
+
+  public long getTokenId()
+  {
     return tokenId;
   }
-  public void setTokenId(long tokenId) {
+
+  public void setTokenId(long tokenId)
+  {
     this.tokenId = tokenId;
   }
-  public Map getVariables() {
+
+  public Map getVariables()
+  {
     return variables;
   }
-  public void setVariables(Map variables) {
+
+  public void setVariables(Map variables)
+  {
     this.variables = variables;
   }
 }

Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/impl/CommandServiceImpl.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/impl/CommandServiceImpl.java	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/impl/CommandServiceImpl.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -32,46 +32,49 @@
 import org.jbpm.command.CommandService;
 
 /**
- * Provide services for accessing the jBPM engine. Access is currently provided
- * through a set of {@link org.jbpm.command.Command} derived operations.
+ * Provide services for accessing the jBPM engine. Access is currently provided through a set of
+ * {@link org.jbpm.command.Command} derived operations.
  * 
  * @author Jim Rigsbee, Tom Baeyens
  */
-public class CommandServiceImpl implements CommandService, Serializable {
-
+public class CommandServiceImpl implements CommandService, Serializable
+{
   private static final long serialVersionUID = 1L;
 
   protected JbpmConfiguration jbpmConfiguration = null;
 
   /**
-   * Establish an instance of the command service with a particular jBPM
-   * configuration which provides connectivity to the jBPM engine and its
-   * related services including the persistence manager.
+   * Establish an instance of the command service with a particular jBPM configuration which provides connectivity to
+   * the jBPM engine and its related services including the persistence manager.
    * 
-   * @param jbpmConfiguration
-   *          jBPM Configuration
+   * @param jbpmConfiguration jBPM Configuration
    */
-  public CommandServiceImpl(JbpmConfiguration jbpmConfiguration) {
+  public CommandServiceImpl(JbpmConfiguration jbpmConfiguration)
+  {
     this.jbpmConfiguration = jbpmConfiguration;
   }
 
   /**
-   * Executes command based on its current context. Each command contains the
-   * appropriate context information such as token, process instance, etc. to
-   * insure that the operation is carried out on the proper graph object.
+   * Executes command based on its current context. Each command contains the appropriate context information such as
+   * token, process instance, etc. to insure that the operation is carried out on the proper graph object.
    * 
-   * @param command
-   *          jBPM engine command to execute
+   * @param command jBPM engine command to execute
    */
-  public Object execute(Command command) {
+  public Object execute(Command command)
+  {
     Object result = null;
     JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-    try {
+    try
+    {
       log.debug("executing " + command);
       result = command.execute(jbpmContext);
-    } catch (Exception e) {
-      throw new JbpmException("couldn't execute "+command, e);
-    } finally {
+    }
+    catch (Exception e)
+    {
+      throw new JbpmException("couldn't execute " + command, e);
+    }
+    finally
+    {
       jbpmContext.close();
     }
     return result;

Added: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/deploy/DeployerTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/deploy/DeployerTest.java	                        (rev 0)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/deploy/DeployerTest.java	2008-11-21 13:10:25 UTC (rev 3029)
@@ -0,0 +1,37 @@
+/*
+ * 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.enterprise.deploy;
+
+import org.jbpm.api.test.IntegrationTestCase;
+
+/**
+ * 
+ * @author Thomas.Diesler at jboss.com
+ */
+public class DeployerTest extends IntegrationTestCase
+{
+  
+  public void testSimpleDeployment()
+  {
+    
+  }
+}


Property changes on: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/enterprise/deploy/DeployerTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: jbpm3/trunk/modules/integration/api/pom.xml (from rev 3019, jbpm3/trunk/modules/integration/pom.xml)
===================================================================
--- jbpm3/trunk/modules/integration/api/pom.xml	                        (rev 0)
+++ jbpm3/trunk/modules/integration/api/pom.xml	2008-11-21 13:10:25 UTC (rev 3029)
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <name>JBoss jBPM3 - Integration API</name>
+  <groupId>org.jbpm.jbpm3</groupId>
+  <artifactId>jbpm-integration-api</artifactId>
+  <packaging>jar</packaging>
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jbpm.jbpm3</groupId>
+    <artifactId>jbpm-integration</artifactId>
+    <version>3.3.1-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <!-- Properties -->
+  <properties>
+    <mvel.version>1.3.7-java1.5</mvel.version>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-spec-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-jpdl</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-jpdl</artifactId>
+      <classifier>config</classifier>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.mvel</groupId>
+      <artifactId>mvel</artifactId>
+      <version>${mvel.version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-spec-dialect-api10</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-spec-cts</artifactId>
+      <scope>test</scope>
+      <type>zip</type>
+    </dependency>
+  </dependencies>
+  
+  <build>
+   <plugins>
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>src/test</directory>
+              <includes>
+                <include>java/org/jbpm/test/**</include>
+              </includes>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.jbpm.jbpm4</groupId>
+                  <artifactId>jbpm-spec-cts</artifactId>
+                  <type>zip</type>
+                </artifactItem>
+              </artifactItems>
+              <outputDirectory>src/test</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>org/jbpm/test/incubator/**/*Test.java</exclude>
+            <exclude>org/jbpm/test/pattern/**/*Test.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+     </plugins>
+  </build>
+
+</project>

Copied: jbpm3/trunk/modules/integration/api/src (from rev 3019, jbpm3/trunk/modules/integration/src)

Deleted: jbpm3/trunk/modules/integration/pom.xml
===================================================================
--- jbpm3/trunk/modules/integration/pom.xml	2008-11-21 11:50:41 UTC (rev 3028)
+++ jbpm3/trunk/modules/integration/pom.xml	2008-11-21 13:10:25 UTC (rev 3029)
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ====================================================================== -->
-<!--                                                                        -->
-<!--  JBoss, the OpenSource J2EE webOS                                      -->
-<!--                                                                        -->
-<!--  Distributable under LGPL license.                                     -->
-<!--  See terms of license at http://www.gnu.org.                           -->
-<!--                                                                        -->
-<!-- ====================================================================== -->
-
-<!-- $Id$ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <name>JBoss jBPM3 - Integration</name>
-  <groupId>org.jbpm.jbpm3</groupId>
-  <artifactId>jbpm-integration</artifactId>
-  <packaging>jar</packaging>
-
-  <!-- Parent -->
-  <parent>
-    <groupId>org.jbpm.jbpm3</groupId>
-    <artifactId>jbpm</artifactId>
-    <version>3.3.1-SNAPSHOT</version>
-    <relativePath>../../pom.xml</relativePath>
-  </parent>
-
-  <!-- Properties -->
-  <properties>
-    <mvel.version>1.3.7-java1.5</mvel.version>
-  </properties>
-
-  <!-- Dependencies -->
-  <dependencies>
-    <dependency>
-      <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-spec-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.jbpm.jbpm3</groupId>
-      <artifactId>jbpm-jpdl</artifactId>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jbpm.jbpm3</groupId>
-      <artifactId>jbpm-jpdl</artifactId>
-      <classifier>config</classifier>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.mvel</groupId>
-      <artifactId>mvel</artifactId>
-      <version>${mvel.version}</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-spec-dialect-api10</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-spec-cts</artifactId>
-      <scope>test</scope>
-      <type>zip</type>
-    </dependency>
-  </dependencies>
-  
-  <build>
-   <plugins>
-      <plugin>
-        <artifactId>maven-clean-plugin</artifactId>
-        <configuration>
-          <filesets>
-            <fileset>
-              <directory>src/test</directory>
-              <includes>
-                <include>java/org/jbpm/test/**</include>
-              </includes>
-            </fileset>
-          </filesets>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>unpack</goal>
-            </goals>
-            <configuration>
-              <artifactItems>
-                <artifactItem>
-                  <groupId>org.jbpm.jbpm4</groupId>
-                  <artifactId>jbpm-spec-cts</artifactId>
-                  <type>zip</type>
-                </artifactItem>
-              </artifactItems>
-              <outputDirectory>src/test</outputDirectory>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>org/jbpm/test/incubator/**/*Test.java</exclude>
-            <exclude>org/jbpm/test/pattern/**/*Test.java</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-     </plugins>
-  </build>
-
-</project>




More information about the jbpm-commits mailing list