Package org.apache.turbine.util.db

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


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


     * @exception Exception, a generic exception.
     */
    public static PermissionSet retrieveSet( Role role )
        throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.add(RolePermissionPeer.ROLE_ID,
                     ((TurbineRole)role).getPrimaryKey());
        criteria.addJoin(RolePermissionPeer.PERMISSION_ID,
                         PermissionPeer.PERMISSION_ID);
        return retrieveSet(criteria);
    }
View Full Code Here

    /**
     * Builds a criteria object based upon an Permission object
     */
    public static Criteria buildCriteria( Permission permission )
    {
        Criteria criteria = new Criteria();
        if ( !((BaseObject)permission).isNew() )
        {
            criteria.add(PERMISSION_ID,
                         ((BaseObject)permission).getPrimaryKey());
        }
        criteria.add(NAME, ((SecurityObject)permission).getName());
       
        /*
         * This is causing the the removal and updating of
         * a permission to crap out. This addition to the
         * criteria produces something like:
View Full Code Here

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

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

            lockExclusive();
            permissionExists = 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 void save()
        throws Exception
    {
        Criteria criteria = new Criteria(9)
            .add(JobEntryPeer.SECOND, getSecond())
            .add(JobEntryPeer.MINUTE, getMinute())
            .add(JobEntryPeer.HOUR, getHour())
            .add(JobEntryPeer.WEEKDAY, getWeekday())
            .add(JobEntryPeer.DAY_OF_MONTH, getDay_of_month())
            .add(JobEntryPeer.TASK, getTask())
            .add(JobEntryPeer.EMAIL, getEmail())
            .add(JobEntryPeer.PROPERTY, getProperty());

        long key = ((NumberKey)getPrimaryKey()).getBigDecimal().longValue();
        if ( isModified() && key > 0)
        {
            // This is an update.
            criteria.add(JobEntryPeer.OID, getPrimaryKey());
            JobEntryPeer.doUpdate(criteria);
            setModified(false);
        }
        else
        {
View Full Code Here

     *         the data backend.
     */
    public boolean accountExists( String username )
        throws DataBackendException
    {
        Criteria criteria = new Criteria();
        criteria.add(TurbineUserPeer.USERNAME, username);
        Vector users;
        try
        {
            users = TurbineUserPeer.doSelect(criteria);
        }
View Full Code Here

     *            storage.
     */
    public User retrieve( String username )
        throws UnknownEntityException, DataBackendException
    {
        Criteria criteria = new Criteria();
        criteria.add( TurbineUserPeer.USERNAME, username );
        Vector users;
        try
        {
            users = TurbineUserPeer.doSelect(criteria);
        }
View Full Code Here

        if(!accountExists(user))
        {
            throw new UnknownEntityException("The account '" +
                user.getUserName() + "' does not exist");
        }
        Criteria criteria = TurbineUserPeer.buildCriteria(user);
        try
        {
            TurbineUserPeer.doUpdate(criteria);
        }
        catch(Exception e)
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.