Package org.jbpm.pvm.internal.env

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


        String error = scriptContext.getErrorWriter().toString();
        return scriptContext.getWriter().toString().trim();
    }

    private Bindings getBindings(Execution execution) throws RepositoryException {
        EnvironmentImpl environment = EnvironmentImpl.getCurrent();
        final Map<String, Object> vars = ((ExecutionImpl) execution).getVariables();
        Locale locale = (Locale) vars.get("locale");
        final Bindings bindings = new MyBindings(environment);
        ResourceBundle resourceBundle = JahiaResourceBundle.lookupBundle(
                "org.jahia.services.workflow." + ((ExecutionImpl) execution).getProcessDefinition().getKey(), locale);
View Full Code Here


  }

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

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

  protected <T> T executeInExistingEnvironment(Command<T> command) {
    return next.execute(command);
  }

  protected <T> T executeInNewEnvironment(Command<T> command) {
    EnvironmentImpl environment = environmentFactory.openEnvironment();
    try {
      return next.execute(command);
     
    } finally {
      environment.close();
    }
  }
View Full Code Here

    return evaluation;
  }

  private EnvironmentImpl getEnvironment()
  {
    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
    if (environment==null)
      throw new RuntimeException("Failed to access current environment");
    return environment;

  }
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) {
    EnvironmentImpl environment = EnvironmentImpl.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) {
    EnvironmentImpl environment = EnvironmentImpl.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.getAuthenticatedUserId() : null);
    messageSession.send(new AsyncCommandMessage(command, userId));
    return null;
  }
View Full Code Here

  // the default constructor which is used by hibernate
  protected HistoryDetailImpl(String dummy) {
    this.dbid = DbidGenerator.getDbidGenerator().getNextId();
    this.time = Clock.getCurrentTime();
   
    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
    if (environment!=null) {
      this.userId = environment.getAuthenticatedUserId();
    }
  }
View Full Code Here

public class SkipInterceptor extends Interceptor {
 
  static DefaultCommandService defaultCommandService = new DefaultCommandService();

  public <T> T execute(Command<T> command) {
    EnvironmentImpl environment = EnvironmentImpl.getCurrent();
    // if there is an environment active
    if (environment!=null) {
      // skip the rest of the interceptor stack and just execute the command
      return defaultCommandService.execute(command);
    }
View Full Code Here

    this.command = command;
    this.userId = userId;
  }

  public Object execute(Environment environmentInterface) throws Exception {
    EnvironmentImpl environment = (EnvironmentImpl) environmentInterface;
    execution.setState(Execution.STATE_ACTIVE_ROOT);

    if (userId!=null) {
      environment.setAuthenticatedUserId(userId);
    }
    try {
      CommandService commandService = environment.get(CommandService.class);
      commandService.execute(command);
    } finally {
      if (userId!=null) {
        environment.setAuthenticatedUserId(null);
      }
    }
    return null;
  }
View Full Code Here

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

  public <T> T execute(Command<T> command) {
    EnvironmentImpl environment = EnvironmentImpl.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

TOP

Related Classes of org.jbpm.pvm.internal.env.EnvironmentImpl

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.