[jbpm-commits] JBoss JBPM SVN: r6250 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm: command and 8 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 7 05:58:17 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-04-07 05:58:16 -0400 (Wed, 07 Apr 2010)
New Revision: 6250

Modified:
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/calendar/Duration.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/exe/MilestoneInstance.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java
   jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/Clock.java
Log:
remove undue UnsupportedOperationException in deprecated methods

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/calendar/Duration.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/calendar/Duration.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/calendar/Duration.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -300,7 +300,7 @@
     case Calendar.WEEK_OF_MONTH:
       return amount * WEEK;
     default:
-      throw new UnsupportedOperationException("calendar field '"
+      throw new IllegalStateException("calendar field '"
           + field
           + "' does not have a fixed duration");
     }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/command/AsynchronousCommand.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -3,26 +3,25 @@
 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.
+ * 
+ * @deprecated asynchronous commands were never implemented
  */
-public class AsynchronousCommand implements Command
-{
+public class AsynchronousCommand implements Command {
 
   private static final long serialVersionUID = 1L;
 
+  Command command;
   int retryCount = 1;
 
-  Command command;
-
-  public AsynchronousCommand(Command command)
-  {
+  public AsynchronousCommand(Command command) {
     this.command = command;
   }
 
-  public Object execute(JbpmContext jbpmContext) throws Exception
-  {
-    throw new UnsupportedOperationException("sending any command over the message service is not yet supported");
+  public Object execute(JbpmContext jbpmContext) throws Exception {
+    throw new UnsupportedOperationException(
+      "sending commands over message service is not yet supported");
   }
 
 }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/GraphSession.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -33,6 +33,7 @@
 import org.hibernate.Session;
 import org.hibernate.criterion.Restrictions;
 
+import org.jbpm.JbpmContext;
 import org.jbpm.JbpmException;
 import org.jbpm.graph.def.ProcessDefinition;
 import org.jbpm.graph.exe.ProcessInstance;
@@ -282,10 +283,9 @@
 
   /**
    * @deprecated use {@link org.jbpm.JbpmContext#save(ProcessInstance)} instead.
-   * @throws UnsupportedOperationException to prevent invocation
    */
   public void saveProcessInstance(ProcessInstance processInstance) {
-    throw new UnsupportedOperationException("use JbpmContext.save(ProcessInstance) instead");
+    JbpmContext.getCurrentJbpmContext().save(processInstance);
   }
 
   /**

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/instantiation/Delegation.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -119,8 +119,8 @@
     String configuration = this.configuration;
     if (configuration != null) {
       try {
-        Element actionElement = DocumentHelper.parseText(
-          "<action>" + configuration + "</action>").getRootElement();
+        Element actionElement = DocumentHelper.parseText("<action>" + configuration
+          + "</action>").getRootElement();
         element.appendContent(actionElement);
       }
       catch (DocumentException e) {
@@ -234,11 +234,11 @@
   }
 
   /**
+   * This method has no effect.
+   * 
    * @deprecated database identifier is not meant to be mutable
-   * @throws UnsupportedOperationException to prevent invocation
    */
   public void setId(long id) {
-    throw new UnsupportedOperationException();
   }
 
   public ProcessDefinition getProcessDefinition() {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/executor/JobExecutor.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -290,14 +290,14 @@
   }
 
   /**
-   * @deprecated Replaced by {@link #getNbrOfThreads()}
+   * @deprecated replaced by {@link #getNbrOfThreads()}
    */
   public int getSize() {
     return nbrOfThreads;
   }
 
   /**
-   * @deprecated Replaced by {@link #setNbrOfThreads(int)}
+   * @deprecated replaced by {@link #setNbrOfThreads(int)}
    */
   public void setSize(int nbrOfThreads) {
     this.nbrOfThreads = nbrOfThreads;
@@ -316,11 +316,11 @@
   }
 
   /**
-   * @deprecated <code>threads</code> is an internal control field
-   * @throws UnsupportedOperationException to prevent invocation
+   * This method has no effect.
+   * 
+   * @deprecated this job executor manages its own thread pool
    */
   public void setThreads(Map threads) {
-    throw new UnsupportedOperationException();
   }
 
   public int getMaxLockTime() {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/exe/MilestoneInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/exe/MilestoneInstance.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/jpdl/exe/MilestoneInstance.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -67,8 +67,7 @@
   public void notifyListeners() {
     if (listeners != null) {
       // for every token that was waiting for this milestone
-      Iterator iter = listeners.iterator();
-      while (iter.hasNext()) {
+      for (Iterator iter = listeners.iterator(); iter.hasNext();) {
         Token token = (Token) iter.next();
         // leave the milestone node
         Node node = token.getNode();
@@ -82,8 +81,12 @@
     return id;
   }
 
+  /**
+   * This method has no effect.
+   * 
+   * @deprecated database identified is not meant to be mutable
+   */
   public void setId(long id) {
-    this.id = id;
   }
 
   public Collection getListeners() {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -406,11 +406,8 @@
       }
     }
     catch (NoSuchMethodException e) {
-      throw new JbpmException("constructor not found: "
-        + sessionClass.getName()
-        + '('
-        + Session.class.getName()
-        + ')', e);
+      throw new JbpmException("constructor not found: " + sessionClass.getName() + '('
+        + Session.class.getName() + ')', e);
     }
   }
 
@@ -433,13 +430,13 @@
   }
 
   /**
-   * @throws UnsupportedOperationException if <code>rollbackOnly</code> is
-   * <code>false</code>
    * @deprecated use {@link TxService#setRollbackOnly()} instead
+   * @throws IllegalArgumentException if <code>rollbackOnly</code> is
+   * <code>false</code>
    */
   public void setRollbackOnly(boolean rollbackOnly) {
     if (!rollbackOnly) {
-      throw new UnsupportedOperationException();
+      throw new IllegalArgumentException("cannot unmark transaction for rollback");
     }
     setRollbackOnly();
   }

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/def/Task.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -55,8 +55,7 @@
       return Integer.parseInt(priorityText);
     }
     catch (NumberFormatException e) {
-      throw new JbpmException("'" + priorityText
-          + "' could not be parsed as a priority");
+      throw new JbpmException("invalid priority text: " + priorityText);
     }
   }
 
@@ -97,24 +96,26 @@
   // task instance factory methods ////////////////////////////////////////////
 
   /**
-   * sets the taskNode unidirectionally. use {@link TaskNode#addTask(Task)} to create a
-   * bidirectional relation.
+   * sets the task node unidirectionally. use {@link TaskNode#addTask(Task)} to
+   * create a bidirectional relation.
    */
   public void setTaskNode(TaskNode taskNode) {
     this.taskNode = taskNode;
   }
 
   /**
-   * sets the taskMgmtDefinition unidirectionally. use TaskMgmtDefinition.addTask to create a
-   * bidirectional relation.
+   * sets the task management definition unidirectionally. use
+   * {@link TaskMgmtDefinition#addTask(Task)} to create a bidirectional
+   * relation.
    */
   public void setTaskMgmtDefinition(TaskMgmtDefinition taskMgmtDefinition) {
     this.taskMgmtDefinition = taskMgmtDefinition;
   }
 
   /**
-   * sets the swimlane. Since a task can have max one of swimlane or assignmentHandler, this
-   * method removes the swimlane if it is set.
+   * sets the swimlane. Since a task can have either a swimlane, an assignment
+   * handler or an assignment expression, this method removes the other forms of
+   * assignment.
    */
   public void setAssignmentDelegation(Delegation assignmentDelegation) {
     this.actorIdExpression = null;
@@ -124,25 +125,27 @@
   }
 
   /**
-   * sets the actorId expression. The assignmentExpression is a JSF-like expression to perform
-   * assignment. Since a task can have max one of swimlane or assignmentHandler, this method
-   * removes the swimlane and assignmentDelegation if it is set.
+   * sets the actor expression. The given expression is a JSF-like expression
+   * that returns the actor. Since a task can have either a swimlane, an
+   * assignment handler or an assignment expression, this method removes the
+   * other forms of assignment.
    */
   public void setActorIdExpression(String actorIdExpression) {
     this.actorIdExpression = actorIdExpression;
-    // Note: combination of actorIdExpression and pooledActorsExpression is allowed
+    // Note: combining actorIdExpression and pooledActorsExpression is allowed
     // this.pooledActorsExpression = null;
     this.assignmentDelegation = null;
     this.swimlane = null;
   }
 
   /**
-   * sets the actorId expression. The assignmentExpression is a JSF-like expression to perform
-   * assignment. Since a task can have max one of swimlane or assignmentHandler, this method
+   * sets the pooled actors expression. The given expression is a JSF-like
+   * expression that returns the pooled actors. Since a task can have either a
+   * swimlane, an assignment handler or an assignment expression, this method
    * removes the other forms of assignment.
    */
   public void setPooledActorsExpression(String pooledActorsExpression) {
-    // Note: combination of actorIdExpression and pooledActorsExpression is allowed
+    // Note: combining actorIdExpression and pooledActorsExpression is allowed
     // this.actorIdExpression = null;
     this.pooledActorsExpression = pooledActorsExpression;
     this.assignmentDelegation = null;
@@ -150,9 +153,10 @@
   }
 
   /**
-   * sets the swimlane unidirectionally. Since a task can have max one of swimlane or
-   * assignmentHandler, this method removes the assignmentHandler and assignmentExpression if
-   * one of those isset. To create a bidirectional relation, use {@link Swimlane#addTask(Task)}.
+   * sets the swimlane unidirectionally. To create a bidirectional relation, use
+   * {@link Swimlane#addTask(Task)}. Since a task can have either a swimlane, an
+   * assignment handler or an assignment expression, this method removes other
+   * forms of assignment.
    */
   public void setSwimlane(Swimlane swimlane) {
     this.actorIdExpression = null;
@@ -164,12 +168,8 @@
   // parent ///////////////////////////////////////////////////////////////////
 
   public GraphElement getParent() {
-    if (taskNode != null) {
-      return taskNode;
-    }
-    if (startState != null) {
-      return startState;
-    }
+    if (taskNode != null) return taskNode;
+    if (startState != null) return startState;
     return processDefinition;
   }
 

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskInstance.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -592,11 +592,11 @@
   }
 
   /**
+   * This method has no effect.
+   * 
    * @deprecated database identifier is not meant to be mutable
-   * @throws UnsupportedOperationException to prevent invocation
    */
   public void setId(long id) {
-    throw new UnsupportedOperationException();
   }
 
   public Date getStart() {

Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/Clock.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/Clock.java	2010-04-07 09:47:40 UTC (rev 6249)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/util/Clock.java	2010-04-07 09:58:16 UTC (rev 6250)
@@ -34,8 +34,8 @@
     if (dateGenerator != null) return dateGenerator.getCurrentTime();
 
     if (Configs.hasObject("jbpm.date.generator")) {
-      DateGenerator configDateGen = (DateGenerator) Configs.getObject("jbpm.date.generator");
-      return configDateGen.getCurrentTime();
+      DateGenerator generator = (DateGenerator) Configs.getObject("jbpm.date.generator");
+      return generator.getCurrentTime();
     }
 
     return new Date();



More information about the jbpm-commits mailing list