Package org.apache.ojb.broker.query

Examples of org.apache.ojb.broker.query.QueryByCriteria


            Criteria allElementsCriteria = this.getPkCriteriaForAllElements(broker);
            // join selection of elements with predicate criteria:
            pCrit.addAndCriteria(allElementsCriteria);
            Class clazz = this.getElementsExtentClass(broker);
            Query q = new QueryByCriteria(clazz, pCrit);
            if (log.isDebugEnabled()) log.debug(q.toString());
            // 2. perfom query
            return (DSetImpl) broker.getCollectionByQuery(DSetImpl.class, q);
        }
        catch (PersistenceBrokerException e)
        {
View Full Code Here


        {
            log.debug("Retrieving all products");
        }

        // 1. build a query that select all objects of Class Product, without any further criteria
        Query             query  = new QueryByCriteria(Product.class, null);
        PersistenceBroker broker = null;
        Collection        result = null;

        try
        {
View Full Code Here

          Map<Object, Object> row = new HashMap<Object, Object>();
          // TODO: optimize, just retrieve the id from the DB and setup
          // a JetspeedPrincipal template on that.
          rr.readObjectArrayFrom(rs, row);
          PersistentJetspeedPrincipal p = (PersistentJetspeedPrincipal) rr.readObjectFrom(row);
          QueryByCriteria query = new QueryByCriteria(p);
          p = (PersistentJetspeedPrincipal) PersistenceBrokerFactory.defaultPersistenceBroker()
              .getObjectByQuery(query);
          results.add(p);
          if (!rs.next()) {
            break;
View Full Code Here

    // JetspeedPermissionAccessManager interface implementation
    //
    @SuppressWarnings("unchecked")
    public List<PersistentJetspeedPermission> getPermissions()
    {
        QueryByCriteria query = QueryFactory.newQuery(PersistentJetspeedPermissionImpl.class, new Criteria());
        query.addOrderByAscending("type");
        query.addOrderByAscending("name");
        return (List<PersistentJetspeedPermission>)getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
    }
View Full Code Here

        criteria.addEqualTo("type", type);
        if (nameFilter != null && nameFilter.length() > 0)
        {
            criteria.addLike("name", nameFilter+"%");
        }
        QueryByCriteria query = QueryFactory.newQuery(PersistentJetspeedPermissionImpl.class, criteria);
        query.addOrderByAscending("name");
        return (List<PersistentJetspeedPermission>)getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public List<PersistentJetspeedPermission> getPermissions(PersistentJetspeedPrincipal principal)
    {
        Criteria criteria = new Criteria();
        criteria.addEqualTo("principals.principalId", principal.getId());
        QueryByCriteria query = QueryFactory.newQuery(PersistentJetspeedPermissionImpl.class, criteria);
        query.addOrderByAscending("type");
        query.addOrderByAscending("name");
        return (List<PersistentJetspeedPermission>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
    }
View Full Code Here

        if (principalType != null)
        {
            criteria.addEqualTo("type", principalType);
        }
        criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
        QueryByCriteria query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
        query.addOrderByAscending("type");
        query.addOrderByAscending("name");
        return (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
    }
View Full Code Here

        if (principalType != null)
        {
            criteria.addEqualTo("type", principalType);
        }
        criteria.addEqualTo("domainId", getDefaultSecurityDomainId());
        QueryByCriteria query = QueryFactory.newQuery(PersistentJetspeedPrincipal.class, criteria);
        List<JetspeedPrincipal> currentList = (List<JetspeedPrincipal>) getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
        List<JetspeedPrincipal> targetList = new ArrayList<JetspeedPrincipal>(principals);
        for (Iterator<JetspeedPrincipal> i = currentList.iterator(); i.hasNext(); )
        {
            JetspeedPrincipal current = i.next();
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public Collection<SecurityDomain> getAllDomains()
    {
        QueryByCriteria query = QueryFactory.newQuery(SecurityDomainImpl.class, new Criteria());
        query.addOrderByAscending("name");
        return (List<SecurityDomain>)getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public Collection<SecurityDomain> getDomainsOwnedBy(Long ownerDomainId)
    {
        Criteria criteria = new Criteria();
        criteria.addEqualTo("ownerDomainId", ownerDomainId);
        QueryByCriteria query = QueryFactory.newQuery(SecurityDomainImpl.class, criteria);
        query.addOrderByAscending("name");
        return (List<SecurityDomain>)getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query));
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.query.QueryByCriteria

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.