Package org.jbpm.pvm.internal.env

Examples of org.jbpm.pvm.internal.env.Environment


 
    IdentitySessionFactory identitySessionFactory = Environment.getFromCurrent(IdentitySessionFactory.class);
    try {
      IdentitySession identitySession = identitySessionFactory.createIdentitySession(realmName);
     
      Environment environment = Environment.getCurrent();
        StandardTransaction transaction = environment.get(StandardTransaction.class);
        if (transaction != null) {
          IdentitySessionResource identitySessionResource = new IdentitySessionResource(identitySession);
          transaction.enlistResource(identitySessionResource);
        }
       
View Full Code Here


   
    if ( duration.isBusinessTime()
         || 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 {
      long millis = duration.getMillis() +
                    1000*( duration.getSeconds() +
View Full Code Here

    return false;
  }
 
  public void handle(ExecutionImpl execution, Exception exception) {
    if (isTransactional) {
      Environment environment = Environment.getCurrent();
      Transaction transaction = (environment!=null ? environment.get(Transaction.class) : null);
      if (transaction!=null) {
        log.trace("registering exception handler to "+transaction);
        CommandService commandService = environment.get(CommandService.class);
        if (commandService==null) {
          throw new JbpmException("environment doesn't have a command service for registering transactional exception handler", exception);
        }
        ExceptionHandlerSynchronization exceptionHandlerSynchronization = new ExceptionHandlerSynchronization(
                this, execution,
View Full Code Here

  public Object construct(WireContext wireContext) {
    if (contextName==null) {
      return wireContext;
    }
    Environment environment = Environment.getCurrent();
    if (environment==null) {
      throw new WireException("can't get context '"+contextName+"': no current environment");
    }
    return environment.getContext(contextName);
  }
View Full Code Here

* @author Tom Baeyens
*/
public class AuthorizationInterceptor extends Interceptor {

  public <T> T execute(Command<T> command) {
    Environment environment = Environment.getCurrent();
    if (environment==null) {
      throw new JbpmException("no environment for verifying authorization");
    }
    AuthorizationSession authorizationSession = environment.get(AuthorizationSession.class);
    if (authorizationSession==null) {
      throw new JbpmException("no AuthorizationSession in environment for verifying authorization");
    }
    authorizationSession.checkPermission(command, environment);
    // if the authorization check succeeded, proceed
View Full Code Here

  public static void fire(HistoryEvent historyEvent) {
    fire(historyEvent, null);
  }
 
  public static void fire(HistoryEvent historyEvent, ExecutionImpl execution) {
    Environment environment = Environment.getCurrent();
    if (environment!=null) {
      HistorySession historySession = environment.get(HistorySession.class);
      if (historySession!=null) {
        historyEvent.setExecution(execution);
        historySession.process(historyEvent);
      }
    }
View Full Code Here

  }

  protected ClobStrategy getClobStrategy() {
    ClobStrategy clobStrategy = null;
   
    Environment environment = Environment.getCurrent();
    if (environment!=null) {
      clobStrategy = environment.get(ClobStrategy.class);
    }

    if (clobStrategy==null) {
      clobStrategy = DEFAULT_CLOB_STRATEGY;
    }
View Full Code Here

public class EnvironmentInterceptor extends Interceptor {

  protected EnvironmentFactory environmentFactory;

  public <T> T execute(Command<T> command) {
    Environment environment;
   
    if (command instanceof AbstractCommand) {
      AbstractCommand abstractCommand = (AbstractCommand) command;
      List<WireObject> txWireObjects = abstractCommand.getTxWireObjects();
      environment = environmentFactory.openEnvironment(txWireObjects);

    } else {
      environment = environmentFactory.openEnvironment();
    }
   
    try {
      return next.execute(command);
     
    } finally {
      environment.close();
    }
  }
View Full Code Here

public class DefaultCommandService implements CommandService {

  private static final Log log = Log.getLog(DefaultCommandService.class.getName());

  public <T> T execute(Command<T> command) {
    Environment environment = Environment.getCurrent();
   
    try {
      return command.execute(environment);
     
    } catch (RuntimeException e) {
View Full Code Here

public class AsyncCommandService implements CommandService {
 
  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.pvm.internal.env.Environment

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.