Package org.jbpm.api

Examples of org.jbpm.api.JbpmException


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


  public Set<String> execute(Environment environment) {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    if (task==null) {
      throw new JbpmException("task "+taskId+" doesn't exist");
    }
   
    Set<String> outcomes = new HashSet<String>();
    outcomes.add(Task.STATE_COMPLETED);
View Full Code Here

 
  protected Long jobDbid;

  public ExecuteJobCmd(String jobId) {
    if (jobId==null) {
      throw new JbpmException("jobId is null");
    }
    jobDbid = Long.parseLong(jobId);
  }
View Full Code Here

  }

  public Job execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    if (dbSession==null) {
      throw new JbpmException("no db-session configured");
    }
    JobImpl<?> job = (JobImpl<?>) dbSession.get(JobImpl.class, jobDbid);

    // in case of decision jobs, the job might have been deleted
    // before we execute it (they are in a list)
    if (job != null) {
        JobContext jobContext = new JobContext(job);
        environment.setContext(jobContext);
      try {
        log.debug("executing job "+job+"...");
        job.execute(environment);
        log.debug("executed job "+job);

        // if this job is locked too long, it could be unlocked by the lockmonitor and
        // executed by another thread.
        Date lockExpirationDate = job.getLockExpirationTime();
        // can be null if it was rescheduled
        if (lockExpirationDate != null) {
          long lockExpiration = lockExpirationDate.getTime();
          long currentTime = System.currentTimeMillis();
          if (currentTime>lockExpiration) {
            throw new JbpmException("job took too long: lock expired "+(currentTime-lockExpiration)+"ms ago");
          }
        }
      } catch (Throwable exception) {
        log.error("exception while executing '"+job+"'", exception);
        handleJobExecutionException(environment, job, exception);
View Full Code Here

    List list = untypedList();
    if (list.isEmpty()) {
      return null;
    }
    if (list.size()>1) {
      throw new JbpmException("result not unique: "+list.size());
    }
    return list.get(0);
  }
View Full Code Here

      try {
        int length = (int) sqlClob.length();
        String text = sqlClob.getSubString(1, length);
        return text.toCharArray();
      } catch (SQLException e) {
        throw new JbpmException("couldn't extract chars out of clob", e);
      }
    }
    return null;
  }
View Full Code Here

      log.info("exception while executing command "+command, e);
      throw e;
     
    } catch (Exception e) {
      log.info("exception while executing command "+command, e);
      throw new JbpmException("exception while executing command "+command, e);
    }
  }
View Full Code Here

  protected String signalName;
  protected Map<String, ?> parameters;

  public SignalCmd(String executionId, String signalName, Map<String, ?> parameters) {
    if (executionId==null) {
      throw new JbpmException("executionId is null");
    }
    this.executionId = executionId;
    this.signalName = signalName;
    this.parameters = parameters;
  }
View Full Code Here

    ClientExecution execution = null;
   
    DbSession dbSession = environment.get(DbSession.class);
    execution = dbSession.findExecutionById(executionId);
    if (execution==null) {
      throw new JbpmException("execution "+executionId+" does not exist");
    }
   
    execution.signal(signalName, parameters);
   
    return execution.getProcessInstance();
View Full Code Here

  boolean propagateUserId = true;

  public <T> T execute(Command<T> command) {
    Environment environment = Environment.getCurrent();
    if (environment==null) {
      throw new JbpmException("no environment for verifying authorization");
    }
    MessageSession messageSession = environment.get(MessageSession.class);
    if (messageSession==null) {
      throw new JbpmException("no message session for executing command asynchronously");
    }
    String userId = (propagateUserId ? environment.getUserId() : null);
    messageSession.send(new AsyncCommandMessage(command, userId));
    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.