Package org.apache.turbine.util.db

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


            lockExclusive();
            groupExists = GroupPeer.checkExists(group);
            if(groupExists)
            {
                ((SecurityObject)group).setName(name);
                Criteria criteria = GroupPeer.buildCriteria(group);
                GroupPeer.doUpdate(criteria);
                return;
            }
        }
        catch(Exception e)
View Full Code Here


            lockExclusive();
            roleExists = RolePeer.checkExists(role);
            if(roleExists)
            {
                role.setName(name);
                Criteria criteria = RolePeer.buildCriteria(role);
                RolePeer.doUpdate(criteria);
                return;
            }
        }
        catch(Exception e)
View Full Code Here

            lockExclusive();
            permissionExists = PermissionPeer.checkExists(permission);
            if(permissionExists)
            {
                ((SecurityObject)permission).setName(name);
                Criteria criteria = PermissionPeer.buildCriteria(permission);
                PermissionPeer.doUpdate(criteria);
                return;
            }
        }
        catch(Exception e)
View Full Code Here

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

    public static JobEntry getJob(int oid)
        throws Exception
    {
        JobEntry je = null;

        Criteria c = new Criteria(9);
        c.add(OID,new Integer(oid));

        Vector results = JobEntryPeer.doSelect(c);

        if ( results != null  )
        {
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 ( !((BaseObject)user).isNew() )
        {
            criteria.add(USER_ID, ((BaseObject)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

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.