Package org.apache.turbine.util.db

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


        {
            lockExclusive();
            groupExists = checkExists(group);
            if(groupExists)
            {
                Criteria criteria = GroupPeer.buildCriteria(group);
                GroupPeer.doDelete(criteria);
                getAllGroups().remove(group);
                return;
            }
        }
View Full Code Here


            roleExists = checkExists(role);
            if(roleExists)
            {
                // revoke all permissions from the role to be deleted
                revokeAll(role);
                Criteria criteria = RolePeer.buildCriteria(role);
                RolePeer.doDelete(criteria);
                getAllRoles().remove(role);
                return;
            }
        }
View Full Code Here

        {
            lockExclusive();
            permissionExists = checkExists(permission);
            if(permissionExists)
            {
                Criteria criteria = PermissionPeer.buildCriteria(permission);
                PermissionPeer.doDelete(criteria);
                getAllPermissions().remove(permission);
                return;
            }
        }
View Full Code Here

            lockExclusive();
            groupExists = 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 = checkExists(role);
            if(roleExists)
            {
                role.setName(name);
                Criteria criteria = RolePeer.buildCriteria(role);
                RolePeer.doUpdate(criteria);
                return;
            }
        }
        catch(Exception e)
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public static RoleSet retrieveSet( User user, Group group )
        throws Exception
    {
        Criteria criteria = new Criteria();
       
        /*
         * Peer specific methods should absolutely NOT be part
         * of any of the generic interfaces in the security system.
         * this is not good.
         *
         * UserPeer up = TurbineSecurity.getUserPeerInstance();
         */
       
        UserPeer up = ((DBSecurityService)TurbineSecurity.getService())
            .getUserPeerInstance();
       
        criteria.add(up.getFullColumnName(UserPeer.USERNAME),
                     user.getUserName());
        criteria.add(UserGroupRolePeer.GROUP_ID,
                     ((Persistent)group).getPrimaryKey());

        criteria.addJoin(up.getFullColumnName(UserPeer.USER_ID),
                         UserGroupRolePeer.USER_ID);
        criteria.addJoin(UserGroupRolePeer.ROLE_ID, RolePeer.ROLE_ID);
        return retrieveSet(criteria);
    }
View Full Code Here

    /**
     * Builds a criteria object based upon an Role object
     */
    public static Criteria buildCriteria( Role role )
    {
        Criteria criteria = new Criteria();
        if ( !((BaseObject)role).isNew() )
        {
            criteria.add(ROLE_ID, ((BaseObject)role).getPrimaryKey());
        }
        criteria.add(NAME, role.getName());
        // causing the removal and updating of roles to
        // crap out because of the generated SQL.
        //criteria.add(OBJECTDATA, role.getAttributes());
        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( ROLE_ID, criteria.remove(ROLE_ID) );
        BasePeer.doUpdate( selectCriteria, criteria );
    }
View Full Code Here

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

     * @exception Exception, a generic exception.
     */
    public static GroupSet retrieveSet()
        throws Exception
    {
        return retrieveSet(new Criteria());
    }
View Full Code Here

TOP

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

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.