Package org.jbpm

Examples of org.jbpm.JbpmException


    q.setLong("taskNodeId", newTaskNode.getId());

    Task newTask = (Task)q.uniqueResult();   
    if (newTask == null)
    {
      throw new JbpmException("Task '" + replacementTaskName + "' for node '" + newTaskNode.getName() + "' not found in new process definition");
    }
    return newTask;
  }
View Full Code Here


   */
  public void signal()
  {
    if (node == null)
    {
      throw new JbpmException("token '" + this + "' can't be signalled cause it is currently not positioned in a node");
    }
    if (node.getDefaultLeavingTransition() == null)
    {
      throw new JbpmException("couldn't signal token '" + this + "' : node '" + node + "' doesn't have a default transition");
    }
    signal(node.getDefaultLeavingTransition(), new ExecutionContext(this));
  }
View Full Code Here

   * This leave the current state over the given transition name.
   */
  public void signal(String transitionName)
  {
    if (node == null)
      throw new JbpmException("token '" + this + "' can't be signalled cause it is currently not positioned in a node");
   
    Transition leavingTransition = node.getLeavingTransition(transitionName);
   
    if (leavingTransition == null)
    {
      // Fall back to the name of the target node
      for (Transition auxTrans : node.getLeavingTransitions())
      {
        if (transitionName.equals(auxTrans.getTo().getName()))
        {
          leavingTransition = auxTrans;
          break;
        }
      }
    }
   
    if (leavingTransition == null)
      throw new JbpmException("transition '" + transitionName + "' does not exist on " + node);
   
    signal(leavingTransition, new ExecutionContext(this));
  }
View Full Code Here

  static void addMapping(Map mappings, String elementTagName, Class objectInfoClass) {
    try {
      Constructor constructor = objectInfoClass.getDeclaredConstructor(constructorParameterTypes);
      mappings.put(elementTagName, constructor);
    } catch (Exception e) {
      throw new JbpmException("couldn't add mapping for element '"+elementTagName+"': constructor("+Element.class.getName()+","+ObjectFactoryParser.class.getName()+") was missing for class '"+objectInfoClass.getName()+"'", e);
    }
  }
View Full Code Here

  void signal(Transition transition, ExecutionContext executionContext)
  {
    if (transition == null)
    {
      throw new JbpmException("couldn't signal without specifying  a leaving transition : transition is null");
    }
    if (executionContext == null)
    {
      throw new JbpmException("couldn't signal without an execution context: executionContext is null");
    }
    if (isSuspended)
    {
      throw new JbpmException("can't signal token '" + name + "' (" + id + "): it is suspended");
    }
    if (isLocked())
    {
      throw new JbpmException("this token is locked by " + lock);
    }
    if (hasEnded())
    {
      throw new JbpmException("Token '" + name + "' (" + id + ") is already ended and cannot be signaled");
    }

    startCompositeLog(new SignalLog(transition));
    try
    {
View Full Code Here

  public ObjectInfo parse(Element element) {
    ObjectInfo objectInfo = null;
    String elementTagName = element.getTagName().toLowerCase();
    Constructor constructor = (Constructor) mappings.get(elementTagName);
    if (constructor==null) {
      throw new JbpmException("no ObjectInfo class specified for element '"+elementTagName+"'");
    }
    try {
      objectInfo = (ObjectInfo) constructor.newInstance(new Object[]{element,this});
    } catch (Exception e) {
      throw new JbpmException("couldn't parse '"+elementTagName+"' into a '"+constructor.getDeclaringClass().getName()+"': "+XmlUtil.toString(element), e);
    }
    return objectInfo;
  }
View Full Code Here

   */
  public void lock(String lockOwnerId)
  {
    if (lockOwnerId == null)
    {
      throw new JbpmException("can't lock with null value for the lockOwnerId");
    }
    if ((lock != null) && (!lock.equals(lockOwnerId)))
    {
      throw new JbpmException("token '" + id + "' can't be locked by '" + lockOwnerId + "' cause it's already locked by '" + lock + "'");
    }
    log.debug("token[" + id + "] is locked by " + lockOwnerId);
    lock = lockOwnerId;
  }
View Full Code Here

    {
      log.warn("lock owner '" + lockOwnerId + "' tries to unlock token '" + id + "' which is not locked");
    }
    else if (!lock.equals(lockOwnerId))
    {
      throw new JbpmException("'" + lockOwnerId + "' can't unlock token '" + id + "' because it was already locked by '" + lock + "'");
    }
    log.debug("token[" + id + "] is unlocked by " + lockOwnerId);
    lock = null;
  }
View Full Code Here

  boolean hasProducedJobs = false;

  public DbSchedulerService() {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (jbpmContext==null) {
      throw new JbpmException("instantiation of the DbSchedulerService requires a current JbpmContext");
    }
    this.jobSession = jbpmContext.getJobSession();
    this.jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor();
  }
View Full Code Here

          baseDate = (Date) o;         
        } else {
          if (o instanceof Calendar) {
            baseDate = ((Calendar) o).getTime();
          } else {
            throw new JbpmException("Invalid basedate type: " + baseDateEL + " is of type " + o.getClass().getName() +". Only Date and Calendar are supported");
          }
        }
        int endOfELIndex = dueDate.indexOf("}");
        if (endOfELIndex < (dueDate.length() -1) ) {
          durationSeparator = dueDate.substring(endOfELIndex+1).trim().substring(0,1);
          if ( !(durationSeparator.equals("+") || durationSeparator.equals("-") ) ){
            throw new JbpmException("Invalid duedate, + or - missing after EL");
          }
          durationString = dueDate.substring(endOfELIndex+1).trim();
        }
      } else {
        durationString = dueDate;
View Full Code Here

TOP

Related Classes of org.jbpm.JbpmException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.