Package org.jbpm.api

Examples of org.jbpm.api.JbpmException


 
  public void resume(javax.transaction.Transaction transaction) {
    try {
      lookupJeeTransactionManager().resume(transaction);
    } catch (Exception e) {
      throw new JbpmException("couldn't resume: "+e.getMessage(), e);
    }
  }
View Full Code Here


  public javax.transaction.Transaction lookupJeeTransaction() {
    try {
      TransactionManager transactionManager = lookupJeeTransactionManager();
      return transactionManager.getTransaction();
    } catch (Exception e) {
      throw new JbpmException("couldn't get transaction from transaction manager "+transactionManagerJndiName+": "+e.getMessage(), e);
    }
  }
View Full Code Here

  public static Object lookupFromJndi(String jndiName) {
    try {
      InitialContext initialContext = new InitialContext();
      return initialContext.lookup(jndiName);
    } catch (Exception e) {
      throw new JbpmException("couldn't lookup '"+jndiName+"' from jndi: "+e.getMessage()+": "+e.getMessage(), e);
    }
  }
View Full Code Here

  public static int getUserTransactionStatus(UserTransaction userTransaction) {
    int status = -1;
    try {
      status = userTransaction.getStatus();
    } catch (SystemException e) {
      throw new JbpmException("couldn't get transaction status: "+e.getMessage(), e);
    }
    log.trace("jta transaction status: "+JtaStatusHelper.toString(status));
    return status;
  }
View Full Code Here

   
    if ( (status != Status.STATUS_NO_TRANSACTION)
         && (status != Status.STATUS_COMMITTED)
         && (status != Status.STATUS_ROLLEDBACK)
       ) {
      throw new JbpmException("invalid transaction state: "+JtaStatusHelper.toString(status));
    }

    return executeInNewTx(command, jtaTransaction, status);
  }
View Full Code Here

  protected void begin() {
    try {
      transaction = identitySession.beginTransaction();
    } catch (IdentityException e) {
      throw new JbpmException("couldn't begin identity transaction", e);
    }
  }
View Full Code Here

  public void prepare() {
    try {
      identitySession.save();
    } catch (IdentityException e) {
      throw new JbpmException("couldn't save identity transaction", e);
    }
  }
View Full Code Here

         || duration.getMonths()>0
         || duration.getYears()>0
       ) {
      Environment environment = Environment.getCurrent();
      if (environment==null) {
        throw new JbpmException("no environment to get business calendar for calculating duedate "+dueDateDescription);
      }
      BusinessCalendar businessCalendar = environment.get(BusinessCalendar.class);
      dueDate = businessCalendar.add(now, duration);

    } else {
View Full Code Here

  public Boolean execute(Environment environment) throws Exception {
    if (log.isDebugEnabled()) log.debug("executing " + this);

    if (environment==null) {
      throw new JbpmException("environment is null");
    }
   
    if (signalName!=null) {
      if (log.isDebugEnabled()) log.debug("feeding timer signal "+signalName+" into "+execution);
      execution.signal(signalName);
    }
   
    if (eventName!=null) {
      ObservableElement eventSource = execution.getActivity();
      if (log.isDebugEnabled()) log.debug("firing event "+signalName+" into "+eventSource);
      execution.fire(eventName, eventSource);
    }
   
    boolean deleteThisJob = true;
    // if there is no repeat on this timer
    if (repeat==null) {
      // delete the job
      if (log.isDebugEnabled()) log.debug("deleting " + this);
      DbSession dbSession = environment.get(DbSession.class);
      if (dbSession==null) {
        throw new JbpmException("no "+DbSession.class.getName()+" in environment");
      }
      dbSession.delete(this);

    } else { // there is a repeat on this timer
      deleteThisJob = false;
      // suppose that it took the timer runner thread a very long time to execute the timers
      // then the repeat action duedate could already have passed
      do {
        setDueDateDescription(repeat);
      } while (dueDate.getTime() <= Clock.getCurrentTime().getTime());

      if (log.isDebugEnabled()) log.debug("rescheduled "+this+" for "+formatDueDate(dueDate));
     
      // release the lock on the timer
      release();
     
      // notify the jobExecutor at the end of the transaction
      JobExecutor jobExecutor = environment.get(JobExecutor.class);
      if (jobExecutor!=null) {
        Transaction transaction = environment.get(Transaction.class);
        if (transaction==null) {
          throw new JbpmException("no transaction in environment");
        }
        JobAddedNotification jobNotificator = new JobAddedNotification(jobExecutor);
        transaction.registerSynchronization(jobNotificator);
      }
    }
View Full Code Here

        byte[] bytes = configurationBytes.extractBytes();
        ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
        ObjectInputStream objectStream = new ObjectInputStream(byteStream);
        configuration = objectStream.readObject();
      } catch (Exception e) {
        throw new JbpmException("couldn't deserialize configuration object for "+this, e);
      }
    }
    return configuration;
  }
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.