Package org.jbpm.api

Examples of org.jbpm.api.JbpmException


  public ActivityCoordinates execute(Environment environment) throws Exception {
    RepositorySession repositorySession = environment.get(RepositorySession.class);
    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) repositorySession.findProcessDefinitionById(processDefinitionId);
    if (processDefinition==null) {
      throw new JbpmException("process definition "+processDefinitionId+" doesn't exist");
    }
    ActivityImpl activity = processDefinition.findActivity(activityName);
    if (activity==null) {
      throw new JbpmException("activity '"+activityName+"' doesn't exist in process definition "+processDefinitionId);
    }
    return activity.getCoordinates();
  }
View Full Code Here


   * unit = (y|year|years|month|months|w|week|weeks|d|day|days|h|hour|hours|min|minute|minutes|s|sec|second|seconds|milli|millis|millisecond|milliseconds)
   *
   * @throws JbpmException if the parsing is unsuccessful
   */
  public Duration(String text) {
    if (text==null) throw new JbpmException("text is null");

    for (String part: splitInParts(text)) {
      parsePart(part);
    }
   
View Full Code Here

  }

  private void parsePart(String part) {
    int spaceIndex = part.indexOf(' ');
    if (spaceIndex==-1) {
      throw new JbpmException("couldn't parse duration part "+part);
    }
    String quantityText = part.substring(0, spaceIndex).trim();
    spaceIndex = part.lastIndexOf(' ');
    String unitText = part.substring(spaceIndex+1).trim().toLowerCase();
   
    int quantity;
    try {
      quantity = Integer.parseInt(quantityText);
    } catch (NumberFormatException e) {
      throw new JbpmException("couldn't parse quantity "+quantityText+" in duration text", e);
    }
    FieldSetter fieldSetter = fieldSetters.get(unitText);
    if (fieldSetter==null) {
      throw new JbpmException("couldn't parse quantity "+quantityText);
    }
    fieldSetter.set(this, quantity);
  }
View Full Code Here

          log.trace("retry sleeping got interrupted");
        }
        sleepTime *= delayFactor;
      }
    }
    throw new JbpmException("gave up after "+attempt+" attempts");
  }
View Full Code Here

    java.sql.Blob sqlBlob = lob.blob;
    if (sqlBlob!=null) {
      try {
        return sqlBlob.getBytes(1, (int) sqlBlob.length());
      } catch (SQLException e) {
        throw new JbpmException("couldn't extract bytes out of blob", e);
      }
    }
    return null;
  }
View Full Code Here

  protected String commentId;
  protected String message;
 
  public AddReplyCommentCmd(String commentId, String message) {
    if (commentId==null) {
      throw new JbpmException("commentId is null");
    }
    this.commentId = commentId;
    this.message = message;
  }
View Full Code Here

  public HistoryComment execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    HistoryCommentImpl parentComment = dbSession.get(HistoryCommentImpl.class, Long.parseLong(commentId));
    if (parentComment==null) {
      throw new JbpmException("parent comment doesn't exist: "+commentId);
    }
    HistoryComment replyComment = parentComment.createReply(message);
    return replyComment;
  }
View Full Code Here

 
  String taskId;
 
  public GetTaskVariableNamesCmd(String taskId) {
    if (taskId==null) {
      throw new JbpmException("taskId is null");
    }
    this.taskId = taskId;
  }
View Full Code Here

      javax.jms.Message jmsMessage = jmsSession.createMessage();
      MessageProducer messageProducer = jmsSession.createProducer(jmsDestination);
      try {
        messageProducer.send(jmsMessage);
      } catch (Exception e) {
        throw new JbpmException("couldn't send jms message: "+e.getMessage(), e);
      } finally {
        messageProducer.close();
      }

      jmsMessage.setStringProperty("jobId", message.getId());

      /*
      if (jobImpl.getToken()!=null) {
        message.setLongProperty("tokenId", jobImpl.getToken().getId());
      }
      if (jobImpl.getProcessInstance()!=null) {
        message.setLongProperty("processInstanceId", jobImpl.getProcessInstance().getId());
      }
      if (jobImpl.getTaskInstance()!=null) {
        message.setLongProperty("taskInstanceId", jobImpl.getTaskInstance().getId());
      }
      */
     
    } catch (JMSException e) {
      throw new JbpmException("couldn't send jms message", e);
    }
  }
View Full Code Here

        if (historyTask!=null) {
          dbSession.delete(historyTask);
        }
      }
    } else {
      throw new JbpmException("task "+taskDbid+" doesn't exist");
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.jbpm.api.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.