Package org.openbp.server.persistence

Examples of org.openbp.server.persistence.PersistenceContext


      if (processor.getSourceMgrType().equalsIgnoreCase(processor.getTargetMgrType()))
      {
        printError("Source and target model manager classes may not be identical.");
      }

      PersistenceContext pc = processor.getProcessServer().getEngine().getPersistenceContextProvider().obtainPersistenceContext();
      TransactionGuard tg = new TransactionGuard(pc);
      try
      {
        processor.perform();
      }
View Full Code Here


   * @param context Token context to associate with the workflow task @return
   * The new workflow task
   */
  public WorkflowTask createWorkflowTask(final TokenContext context)
  {
    PersistenceContext pc = getPersistenceContextProvider().obtainPersistenceContext();
    WorkflowTask workflowTask = (WorkflowTask) pc.createEntity(WorkflowTask.class);

    // Link workflow task and context
    workflowTask.setTokenContext(context);

    return workflowTask;
View Full Code Here

    {
      PersistentObjectReference por = (PersistentObjectReference) ret;
      Object id = por.getObjectId();
      Class cls = ReflectUtil.loadClass(por.getClassName());

      PersistenceContext pc = pcp.obtainPersistenceContext();
      if (pc == null)
      {
        String msg = LogUtil.error(PersistenceContextObjectSerializer.class, "Error obtaining persistence context for deserialization of a persistent object of type $0 (id: $1, variable: $2). [{3}]", cls.getName(), id, key, context);
        throw new EngineException("ContextDeserialization", msg);
      }

      Object loaded = pc.findById(id, cls);
      if (loaded == null)
      {
        String msg = LogUtil.error(PersistenceContextObjectSerializer.class, "Persistent object of type $0 not found when deserializing token (id: $1, variable: $2). [{3}]", cls.getName(), id, key, context);
        throw new EngineException("ContextDeserialization", msg);
      }
View Full Code Here

            }

            try
            {
              // Retrieve the bean according to the given id value
              PersistenceContext pc = persistenceContextProvider.obtainPersistenceContext();
              value = pc.findById(value, targetType.getJavaClass());
            }
            catch (Exception e)
            {
              throw newError("AutoRetrieval", "Auto-retrieval of bean of expression '" + ExpressionConstants.REFERENCE_KEY_OPERATOR + "" + ident + "' by id value '" + value + "' failed.", e, sp);
            }
View Full Code Here

   * The shutdown method releases the persistence context.
   */
  @Override
  public void shutdown()
  {
    PersistenceContext pc = getExistingPersistenceContext();
    if (pc != null)
    {
      pc.release();
    }
    getPersistenceContextProvider().shutdown();
  }
View Full Code Here

  /**
   * Rolls back the recent changes (if supported).
   */
  public void rollback()
  {
    PersistenceContext pc = getPersistenceContext();
    pc.rollbackTransaction();
    pc.release();
  }
View Full Code Here

  /**
   * Clears any this token context service might have.
   */
  public void clearCache()
  {
    PersistenceContext pc = getExistingPersistenceContext();
    if (pc != null)
    {
      pc.release();
    }
  }
View Full Code Here

    else
    {
      LogUtil.debug(getClass(), "Performing token query (all tokens).");
    }

    PersistenceContext pc = getPersistenceContext();
    PersistenceQuery query = pc.createQuery(TokenContext.class);

    if (criteria != null)
    {
      configureCriterion(query, criteria);
    }

    Iterator it = pc.runQuery(query);
    return new ContextIterator(it);
  }
View Full Code Here

   */
  @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
  public Iterator getExecutableContexts(int maxResults)
  {
    LogUtil.debug(getClass(), "Performing query for executable tokens.");
    PersistenceContext pc = getPersistenceContext();

    // Construct search search criterion for executable token contexts;
    // don't cache this, depends on current session.
    PersistenceQuery query = pc.createQuery(TokenContext.class);
    query.eq("lifecycleRequest", new Integer(LifecycleRequest.RESUME));
    query.neq("lifecycleState", new Integer(LifecycleState.SELECTED));
    query.addOrdering("priority");

    int max = maxResults;
    if (getIsolationLevel() == ISOLATION_LEVEL_SINGLE)
    {
      max = 1;
    }
    if (max > 0)
    {
      query.setMaxResults(max);
    }

    // TODO Fix 2 A 'select for update' might be advisable; we won't need to refresh the context then...
    Iterator it = pc.runQuery(query);
    return new ExecutableContextIterator(it);
  }
View Full Code Here

   */
  @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
  public Iterator getworkflowTasks(final WorkflowTaskCriteria criteria)
  {
    LogUtil.debug(getClass(), "Performing workflow task query $0.", criteria);
    PersistenceContext pc = getPersistenceContext();
    PersistenceQuery query = pc.createQuery(WorkflowTask.class);

    if (criteria != null)
    {
      configureCriterion(query, criteria);
    }

    Iterator it = pc.runQuery(query);
    return it;
  }
View Full Code Here

TOP

Related Classes of org.openbp.server.persistence.PersistenceContext

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.