AnsweredAssumed Answered

invalid Workflow Id problems.

Question asked by tfrith on Aug 7, 2009
I'm having a problem with checking for workflow Id's

I have the workflow id and I want to check and see if the workflow still exists.
Ex: jbpm$275

i'm using the following code:

      WorkflowInstance workflow = null;
      try {
         workflow = this.serviceRegistry.getWorkflowService().getWorkflowById("jbpm$" + workflowId);
         if (workflow == null)
         {
            return false;
         }
      }
      catch (WorkflowException we) {
         return false;
      }

The problem is, if the workflow doesn't exist, instead of returning NULL the 'getWorkflowById' throws a WorkflowException and sets the transaction for rollback.

Since i'm calling this from a webscript, everything in this webscript is rolling back.

I need a way of checking to see if I have a valid workflowId without throwing any exceptions.

Thanks in advance,
TF

Outcomes