Package org.apache.turbine.util.db

Examples of org.apache.turbine.util.db.Criteria$Criterion


     * @exception Exception, a generic exception.
     */
    public static void doUpdate(Criteria criteria)
        throws Exception
    {
        Criteria selectCriteria = new Criteria(2);
        selectCriteria.put( GROUP_ID, criteria.remove(GROUP_ID) );
        BasePeer.doUpdate( selectCriteria, criteria );
    }
View Full Code Here


     * @throws Exception, a generic exception.
     */
    public static boolean checkExists( Group group )
        throws DataBackendException, Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(GROUP_ID);
        criteria.add(NAME, ((SecurityObject)group).getName());
        Vector results = BasePeer.doSelect(criteria);
        if(results.size() > 1)
        {
            throw new DataBackendException("Multiple groups named '" +
                ((TurbineGroup)group).getName() + "' exist!");
View Full Code Here

    /**
     * Builds a criteria object based upon an Group object
     */
    public static Criteria buildCriteria( Group group )
    {
        Criteria criteria = new Criteria();
        criteria.add(NAME, ((SecurityObject)group).getName());
        if ( !((BaseObject)group).isNew() )
        {
            criteria.add(GROUP_ID, ((BaseObject)group).getPrimaryKey());
        }
        // Causing the removal and updating of a group to
        // crap out.
        //criteria.add(OBJECTDATA, group.getAttributes());
        return criteria;
View Full Code Here

    public static void doUpdate(Criteria updateValues,
                                DBConnection dbCon)
        throws Exception
    {
        ColumnMap pk = getPrimaryKey(updateValues);
        Criteria selectCriteria = null;

        if ( pk != null &&
             updateValues.containsKey(pk.getFullyQualifiedName()) )
        {
            selectCriteria = new Criteria(2);
            selectCriteria.put( pk.getFullyQualifiedName(),
                                updateValues.remove(pk.getFullyQualifiedName()) );
        }
        else
        {
            throw new Exception("BasePeer.doUpdate(criteria) - no PK specified");
View Full Code Here

     * Builds a criteria object based upon an User object
     */
    public static Criteria buildCriteria(User user)
    {
        Hashtable permData = (Hashtable) user.getPermStorage().clone();
        Criteria criteria = new Criteria();
        if ( !((Persistent)user).isNew() )
        {
            criteria.add(USER_ID, ((Persistent)user).getPrimaryKey());
        }

        for (int i=1; i<TurbineUserPeer.columnNames.length; i++ )
        {
            if ( permData.containsKey(TurbineUserPeer.columnNames[i]) )
            {
                criteria.add( TurbineUserPeer.criteriaKeys[i],
                              permData.remove(TurbineUserPeer.columnNames[i]) );
            }
        }
        criteria.add( TurbineUserPeer.OBJECT_DATA, permData );
        return criteria;
    }
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static void doUpdate(Criteria criteria)
        throws Exception
    {
        Criteria selectCriteria = new Criteria(2);
        selectCriteria.put( USER_ID, criteria.remove(USER_ID) );
        BasePeer.doUpdate( selectCriteria, criteria );
    }
View Full Code Here

     * @throws Exception, a generic exception.
     */
    public static boolean checkExists( User user )
        throws DataBackendException, Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(USER_ID);
        criteria.add(USERNAME, user.getUserName());
        Vector results = BasePeer.doSelect(criteria);
        if(results.size() > 1)
        {
            throw new DataBackendException("Multiple users named '" +
                user.getUserName() + "' exist!");
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static Vector selectAllUsers()
        throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addAscendingOrderByColumn(TurbineUserPeer.LAST_NAME);
        criteria.addAscendingOrderByColumn(TurbineUserPeer.FIRST_NAME);
        criteria.setIgnoreCase(true);
        return TurbineUserPeer.doSelect(criteria);
    }
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static Vector selectAllConfirmedUsers()
        throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.add ( User.CONFIRM_VALUE, User.CONFIRM_DATA );
        criteria.addAscendingOrderByColumn(TurbineUserPeer.LAST_NAME);
        criteria.addAscendingOrderByColumn(TurbineUserPeer.FIRST_NAME);
        criteria.setIgnoreCase(true);
        return TurbineUserPeer.doSelect(criteria);
    }
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static void deleteRole(int role_id)
        throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.add(ROLE_ID, role_id);
        doDelete(criteria);
    }
View Full Code Here

TOP

Related Classes of org.apache.turbine.util.db.Criteria$Criterion

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.