Package org.openbp.server.persistence

Examples of org.openbp.server.persistence.PersistenceQuery


   * @param cls Cls
   * @return The new query descriptor object
   */
  public PersistenceQuery createQuery(Class cls)
  {
    return new PersistenceQuery(this, cls);
  }
View Full Code Here


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

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

    if (criteria != null)
    {
      configureCriterion(query, criteria);
    }
View Full Code Here

    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);
    }
View Full Code Here

    }
  }

  private void readModelsFromDatabase(PersistenceContext pc)
  {
    PersistenceQuery query = pc.createQuery(DbModel.class);
    for (Iterator it = pc.runQuery(query); it.hasNext();)
    {
      DbModel dbModel = (DbModel) it.next();

      if (! shouldLoadModel(dbModel.getName()))
View Full Code Here

    }
  }

  private void readItemsFromDatabase(PersistenceContext pc)
  {
    PersistenceQuery query = pc.createQuery(DbModelItem.class);
    for (Iterator it = pc.runQuery(query); it.hasNext();)
    {
      DbModelItem dbModelItem = (DbModelItem) it.next();

      if (! shouldLoadModel(dbModelItem.getModelName()))
View Full Code Here

          model.getName(), getClass().getName(), e
        });
        return null;
      }

      PersistenceQuery query = pc.createQuery(DbModelItem.class);
      query.eq("modelName", model.getName());
      for (Iterator it = pc.runQuery(query); it.hasNext();)
      {
        DbModelItem dbModelItem = (DbModelItem) it.next();

        registerDbModelItem(dbModelItem, model);
View Full Code Here

    return item;
  }

  private DbModel findDbModel(PersistenceContext pc, String name)
  {
    PersistenceQuery query = pc.createQuery(DbModel.class);
    query.eq("name", name);
    Iterator it = pc.runQuery(query);
    if (! it.hasNext())
      throw new ModelException("DatabaseOperation", "Model '" + name + "' not found. Maybe the model has been deleted from the database.");
    DbModel dbModel = (DbModel) it.next();
    return dbModel;
View Full Code Here

    return findDbModelItem(pc, item.getModel().getName(), item.getName(), item.getItemType());
  }

  private DbModelItem findDbModelItem(PersistenceContext pc, String modelName, String itemName, String itemType)
  {
    PersistenceQuery query = pc.createQuery(DbModelItem.class);
    query.eq("modelName", modelName);
    query.eq("itemName", itemName);
    query.eq("itemType", itemType);
    Iterator it = pc.runQuery(query);
    if (! it.hasNext())
      throw new ModelException("DatabaseOperation", "Component '" + new ModelQualifier(modelName, itemName, itemType).toUntypedString()
        + "' not found. Maybe the component has been deleted from the database.");
    DbModelItem dbModelItem = (DbModelItem) it.next();
View Full Code Here

TOP

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

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.