head	1.10;
access;
symbols
	TIGRIS_0_9_2_4:1.3
	TIGRIS_0_9_2_3:1.3
	HELM_PEER_PORT_BRANCH:1.9.0.2
	TURBINE_PEER:1.9
	TIGRIS_0_9_2_1:1.9
	TIGRIS_0_9_2:1.3.0.4
	TIGRIS_0_9_0:1.3.0.2
	TIGRIS_0_8_4:1.1.1.1.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.10
date	2001.02.21.03.23.56;	author edk;	state dead;
branches;
next	1.9;

1.9
date	2001.01.26.18.29.00;	author edk;	state Exp;
branches
	1.9.2.1;
next	1.8;

1.8
date	2001.01.26.05.24.05;	author edk;	state dead;
branches;
next	1.7;

1.7
date	2001.01.25.04.30.00;	author stack;	state Exp;
branches;
next	1.6;

1.6
date	2001.01.25.03.38.06;	author leonardr;	state Exp;
branches;
next	1.5;

1.5
date	2001.01.25.01.37.43;	author leonardr;	state Exp;
branches;
next	1.4;

1.4
date	2001.01.24.20.42.46;	author dlr;	state Exp;
branches;
next	1.3;

1.3
date	2000.12.09.03.27.07;	author leonardr;	state Exp;
branches;
next	1.2;

1.2
date	2000.12.08.02.19.03;	author leonardr;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.12.21.15.12;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.15.12;	author dlr;	state Exp;
branches;
next	;

1.9.2.1
date	2001.01.28.01.02.17;	author dlr;	state dead;
branches;
next	;


desc
@@


1.10
log
@delete stuff from the head which is obsolete in the branch (more changes
are still needed for a clean compile)
@
text
@/* ================================================================
 * Copyright (c) 2000 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by CollabNet (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.database;

import java.util.*;
import java.sql.*;

import org.webmacro.util.*;
import org.webmacro.servlet.*;

import com.workingdogs.village.*;

import org.joist.database.*;
import org.joist.util.*;

/**
 * Manages the Role-Action-Resource three-way join table.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: RoleActionResourceManager.java,v 1.9 2001/01/26 18:29:00 edk Exp $
 *
 * Copyright (c) 2000 CollabNet, Inc.
 */

public class RoleActionResourceManager extends TableManager
{
    /**
     * The name of the database table that this <code>TableManager</code> 
     * manages.
     */
    public static final String TABLE_NAME = "HELM_ROLE_ACTION_RESOURCE";

    /**
     * A database key field.
     */
    public static final String ROLE_ID = "ROLE_ID";   

    /**
     * A database key field.
     */
    public static final String ACTION_ID = "ACTION_ID";   

    /**
     * A database key field.
     */
    public static final String RESOURCE_ID = "RESOURCE_ID";

    /**
     * The logger instance for all instances of this class.
     */
    private static Log log = new Log("rprMgr", 
                                     "RoleActionResourceManager");

    /**
     * Whether we want debugging information.
     */
    private static boolean debug = true;

    /**
     * Creates a new instance.
     *
     * @@param dataMgr The manager of this instance.
     */
    public RoleActionResourceManager(DataManager dataMgr)
    {
        super(dataMgr);
    }

    /**
     * Retrieves actions and resources for a role.
     *
     * @@param	connection A JDBC database connection
     * @@param	roleID     The roleID to obtain actions and resources for.
     * @@return	The actions and resources for the given role.
     * @@exception	SQLException
     * @@exception	DataSetException
     */
    public DataSet getActionsResourcesForRole (Connection connection, 
                                                   String roleID)
	throws SQLException, DataSetException
    {
        TableDataSet rpr = null;
        try
        {
            rpr = new TableDataSet(connection, TABLE_NAME);
            rpr.where(buildWhereClause(roleID, null, null));
            return rpr.fetchRecords();
        }
        catch (DataSetException e)
        {
            log.exception(e);
            if (debug) log.info("Getting Actions and Resources: " + 
                                 e.getMessage());
            throw e;
        }
        catch (SQLException e)
        {
            log.exception(e);
            if (debug) log.info("Getting Actions and Resources: " + 
                                 e.getMessage());
            throw e;
        }
        finally
        {
            registerToClose(rpr);
        }
    }

    /**
     * Retrieves roles which have the given action (regardless of resource).
     *
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to obtain roles for
     * @@param	resourceID    The resourceID associated with the action
     * @@return	a DataSet
     * @@exception	SQLException
     * @@exception	DataSetException
     */
    public DataSet getRolesForActionResource (Connection connection, 
                                                  String actionID,
                                                  String resourceID)
	throws SQLException, DataSetException
    {
        TableDataSet rpr = null;
        try
        {
            rpr = new TableDataSet(connection, TABLE_NAME);
            rpr.where(buildWhereClause(null, actionID, null));
            return rpr.fetchRecords();
        }
        catch (DataSetException e)
        {
            log.exception(e);
            if (debug) log.info("Getting Roles for Action: " + 
                                 e.getMessage());
            throw e;
        }
        catch (SQLException e)
        {
            log.exception(e);
            if (debug) log.info("Getting Roles for Action: " + 
                                 e.getMessage());
            throw e;
        }
        finally
        {
            registerToClose(rpr);
        }
    }

    /**
     * Retrieves roles which have the given action (regardless of 
     * resource).
     *
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to obtain roles for.
     * @@return	a DataSet
     * @@exception	SQLException
     * @@exception	DataSetException
     */
    public DataSet getRolesForAction (Connection connection, 
                                          String actionID)
        throws SQLException, DataSetException
    {
        return getRolesForActionResource(connection, actionID, null);
    }

    /**
     * Grants the given action in the given resource to the given role.
     *
     * @@param	connection    The JDBC database connection to use.
     * @@param	roleID        The roleID which will be granted the action.
     * @@param	actionID  The actionID to grant.
     * @@param	resourceID    The resourceID representing the resource of the 
     *                        action.
     * @@exception	SQLException
     * @@exception	DataSetException
     */
    public void grant (Connection connection, String roleID, String actionID, 
         String resourceID)
	throws SQLException, DataSetException
    {
        TableDataSet rpr = null;
        try
        {
            log.info("Granting " + actionID + " to " + roleID);
            rpr = new TableDataSet(connection, TABLE_NAME, 
                                   new KeyDef().addAttrib(ROLE_ID)
                                       .addAttrib(ACTION_ID)
                                       .addAttrib(RESOURCE_ID));
            rpr.where(buildWhereClause(roleID, actionID, resourceID));

            rpr.fetchRecords();
            if (!rpr.containsRecord(0))
            {
                Record r = rpr.addRecord();
                r.setValue(ROLE_ID, roleID);
                r.setValue(ACTION_ID, actionID);
                r.setValue(RESOURCE_ID, resourceID);
                r.save();
            }
        }
        catch (DataSetException e)
        {
            log.exception(e);
            if (debug) log.info("Getting action to role: " + 
                                 e.getMessage());
            throw e;
        }
        catch (SQLException e)
        {
            log.exception(e);
            if (debug) log.info("Granting action to role: " + 
                                 e.getMessage());
            throw e;
        }
        finally
        {
            registerToClose(rpr);
        }
    }

    /**
     * Revokes the given action with the given resource from the given 
     * role.
     *
     * @@param	connection    A JDBC database connection
     * @@param	roleID        The roleID from which to revoke the action
     * @@param	actionID  The actionID to revoke
     * @@param   resourceID    The resourceID of the action to revoke
     * @@exception	SQLException
     * @@exception	DataSetException
     */
    public void revoke (Connection connection, String roleID, String actionID, 
         String resourceID)
	throws SQLException, DataSetException
    {
        TableDataSet rpr = null;
        try
        {
            rpr = new TableDataSet(connection, TABLE_NAME, 
                                   new KeyDef().addAttrib(ROLE_ID)
                                       .addAttrib(ACTION_ID)
                                       .addAttrib(RESOURCE_ID));
            rpr.where(buildWhereClause(roleID, actionID, resourceID));
            rpr.fetchRecords();
            for (int i = 0; i < rpr.size(); i++)
            {
                rpr.getRecord(i).markToBeDeleted();
            }
            rpr.save();
        }
        catch (DataSetException e)
        {
            log.exception(e);
            String message = "Revoking action: " + e.getMessage();
            if (debug) log.info(message);
            throw e;
        }
        catch (SQLException e)
        {
            log.exception(e);
            String message = "Revoking action: " + e.getMessage();
            if (debug) log.info(message);
            throw e;
        }
        finally
        {
            registerToClose(rpr);
        }
    }

    /**
     * Revokes the given action across the given role.
     *
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to revoke
     * @@param	roleID        The roleID to revoke
     * @@exception	SQLException
     * @@exception	DataSetException
     */
    public void revoke (Connection connection, String roleID, 
                        String actionID)
	throws SQLException, DataSetException
    {
        revoke(connection, actionID, null, roleID);
    }

    /**
     * Revokes the given action unilaterally (across all roles).
     *
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to revoke
     * @@exception	SQLException
     * @@exception	DataSetException
     */
    public void revoke (Connection connection, String actionID)
	throws SQLException, DataSetException
    {
        revoke(connection, actionID, null, null);
    }
    
    /**
     * Creates a SQL <code>where</code> clause.
     */
    protected static String buildWhereClause (String roleID, 
                                              String actionID, 
                                              String resourceID)
    {
        StringBuffer whereClause = new StringBuffer();
        boolean firstClause = true;

        if (roleID != null)
        {
            whereClause.append(ROLE_ID).append('=').append(roleID);
            firstClause = false;
        }
        if (actionID != null)
        {
            if (!firstClause)
            {
                whereClause.append(" AND ");
            }
            whereClause.append(ACTION_ID).append('=').append(actionID);
            firstClause = false;
        }
        if (resourceID != null)
        {
            if (!firstClause)
            {
                whereClause.append(" AND ");
            }
            whereClause.append(RESOURCE_ID).append('=').append(resourceID);
            firstClause = false;
        }
        return whereClause.toString();
    }
}
@


1.9
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d65 1
a65 1
 * @@version $Id: RoleActionResourceManager.java,v 1.3 2000/12/09 03:27:07 leonardr Exp $
@


1.9.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d65 1
a65 1
 * @@version $Id: RoleActionResourceManager.java,v 1.9 2001/01/26 18:29:00 edk Exp $
@


1.8
log
@revert this stuff to its state as of 2001/01/24 12:42:00 GMT -- with
the following exceptions, which have some different modifications so
they'll work with changes which have happened in joist:

ProjectNewsEdit.java
SkinManager.java
SkinStyleElementValueManager.java
StyleElementManager.java
StyleManager.java

it compiles.  i dunno if it works, though.
@
text
@d57 1
a57 3
import org.joist.database.Criterion;
import org.joist.database.DataManager;
import org.joist.database.TableManager;
d65 1
a65 1
 * @@version $Id: RoleActionResourceManager.java,v 1.7 2001/01/25 04:30:00 stack Exp $
a92 3
    private static final String DEFAULT_ORDER_BY = 
        TABLE_NAME + "." + ACTION_ID;

d111 1
a111 2
        super(dataMgr, new KeyDef().addAttrib(ROLE_ID)
            .addAttrib(ACTION_ID).addAttrib(RESOURCE_ID));
a113 4
    ////////////////////////////////////////////////////////////////
    // Accessor methods.
    ////////////////////////////////////////////////////////////////

d120 2
a121 2
     *
     * @@exception DBException
d123 3
a125 2
    public DataSet getActionsResourcesForRole (String roleID)
	throws DBException               
d127 25
a151 2
        Criterion c = new Criterion(ROLE_ID, roleID);
        return getRecords(c);
d155 1
a155 1
     * Returns the first record matching a given Criterion. 
d157 42
a198 1
     * @@param criterion Criterion to use in select.
d200 15
a214 1
     * @@exception DBException if a database error occurs.
d216 7
a222 1
     * @@return Null if no matching record, first record in recordset otherwise.
d224 3
a226 2
    private Record getFirstMatchingRecord(Criterion criterion)
        throws DBException
d228 12
a239 4
        Record r = null;
        try {
            DataSet s = getRecords(criterion);
            if (s != null && s.containsRecord(0))
d241 5
a245 1
                r = s.getRecord(0);
a246 2
        } catch (DataSetException e) {
            throw new DBException(e);
d248 18
a265 2

        return r;
d269 2
a270 1
     * Returns records matching a given criterion.
d272 6
a277 3
     * @@param criterion Criterion to use in select.
     *
     * @@exception DBException if a database error occurs.
d279 3
a281 2
    public DataSet getRecords(Criterion criterion)
        throws DBException
d283 32
a314 5
        DataSet s = null;
        try {
            s = runSelect(TABLE_NAME, criterion, DEFAULT_ORDER_BY);
        } catch (Exception e) {
            throw new DBException(e);
a315 1
        return s;
a317 4
    ////////////////////////////////////////////////////////////////
    // Mutator methods.
    ////////////////////////////////////////////////////////////////

d321 1
d324 2
a325 2
     *
     * @@exception DBException
d327 3
a329 2
    public void revoke (String roleID, String actionID)
	throws DBException
d331 1
a331 3
        Criterion c = new Criterion(ROLE_ID, roleID);
        c.and(new Criterion(ACTION_ID, actionID));
        revoke(c);
d337 1
d339 2
a340 2
     *
     * @@exception DBException
d342 2
a343 2
    public void revoke (String actionID)
	throws DBException
d345 3
a347 4
        Criterion c = new Criterion(ACTION_ID, actionID);
        revoke(c);
    } 

d349 1
a349 10
     * Grants the given action in the given resource to the given role.
     *
     * @@param	identifier    A Criterion which will uniquely identify
     *                        the grant record if it already exists.
     * @@param	roleID        The roleID which will be granted the action.
     * @@param	actionID  The actionID to grant.
     * @@param	resourceID    The resourceID representing the resource of the 
     *                        action.
     *
     * @@exception DBException
d351 6
a356 6
    public void grant (Criterion identifier, String roleID, String actionID, 
                       String resource)
	throws DBException
    {       
        DBConnection dbConn = null;
        TableDataSet rpr = null;
d358 1
a358 2
        Record r = getFirstMatchingRecord(identifier);
        if (record == null)
d360 2
a361 3
            dbConn = TurbineDB.getConnection();
            rpr = new TableDataSet(dbConn.getConnection(), TABLE_NAME, keydef);
            r = rpr.addRecord();
d363 5
a367 17

        try
        {            
            r.setValue(ROLE_ID, roleID);
            r.setValue(ACTION_ID, actionID);
            r.setValue(RESOURCE_ID, resourceID);
            r.save();
        } catch (DataSetException e) {
            throw new DBException(e);
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            registerToClose(rpr);
            try {
                TurbineDB.releaseConnection(dbConn);
            } catch (Exception e) {
                throw new DBException(e);
d369 2
d372 3
a374 17
    }

    /**
     * Revokes all entries which match the given criterion.
     *
     * @@param	roleID        The roleID from which to revoke the action
     * @@param	actionID  The actionID to revoke
     * @@param   resourceID    The resourceID of the action to revoke
     *
     * @@exception DBException
     */
    public void revoke (Criterion c)
	throws DBException
    {        
        DataSet rpr = getRoles(c);
        try {
            for (int i = 0; i < rpr.size(); i++)
d376 1
a376 1
                rpr.getRecord(i).markToBeDeleted();
d378 2
a379 7
            rpr.save();
        } catch (DataSetException e) {
            throw new DBException(e);
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            registerToClose(rpr);
d381 1
@


1.7
log
@Syntax errors (missing semi-colon and misquoting of string concatenation)
@
text
@d67 1
a67 1
 * @@version $Id: RoleActionResourceManager.java,v 1.6 2001/01/25 03:38:06 leonardr Exp $
@


1.6
log
@converted tablemanager.
@
text
@d67 1
a67 1
 * @@version $Id: RoleActionResourceManager.java,v 1.5 2001/01/25 01:37:43 leonardr Exp $
d96 1
a96 1
        "TABLE_NAME + "." + ACTION_ID";
@


1.5
log
@Refactored getActionsResourcesForRole() method to use runSelect().
@
text
@d57 3
a59 1
import org.joist.database.*;
d67 1
a67 1
 * @@version $Id: RoleActionResourceManager.java,v 1.4 2001/01/24 20:42:46 dlr Exp $
d95 3
d116 2
a117 1
        super(dataMgr);
d120 4
d134 17
a150 1
	throws DBException
d152 9
a160 4
        try
        {
            DataSet ar = runSelect(TABLE_NAME, new Criterion(ROLE_ID, roleID));
            return ar.fetchRecords();
d162 18
a179 2
        catch (Exception e)
        {
d182 1
d185 4
d190 1
a190 1
     * Retrieves roles which have the given action (regardless of resource).
d192 2
a193 4
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to obtain roles for
     * @@param	resourceID    The resourceID associated with the action
     * @@return	a DataSet
d197 1
a197 3
    public DataSet getRolesForActionResource (Connection connection, 
                                                  String actionID,
                                                  String resourceID)
d200 3
a202 19
        TableDataSet rpr = null;
        try
        {
            rpr = new TableDataSet(connection, TABLE_NAME);
            rpr.where(buildWhereClause(null, actionID, null));
            return rpr.fetchRecords();
        }
        catch (DataSetException e)
        {
            throw new DBException(e);
        }
        catch (SQLException e)
        {
            throw new DBException(e);
        }
        finally
        {
            registerToClose(rpr);
        }
d206 1
a206 2
     * Retrieves roles which have the given action (regardless of 
     * resource).
d208 1
a208 3
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to obtain roles for.
     * @@return	a DataSet
d212 2
a213 3
    public DataSet getRolesForAction (Connection connection, 
                                          String actionID)
        throws DBException
d215 3
a217 2
        return getRolesForActionResource(connection, actionID, null);
    }
d222 2
a223 1
     * @@param	connection    The JDBC database connection to use.
d231 2
a232 2
    public void grant (Connection connection, String roleID, String actionID, 
                       String resourceID)
d234 2
a235 1
    {
d237 3
a239 1
        try
d241 4
a244 6
            log.info("Granting " + actionID + " to " + roleID);
            rpr = new TableDataSet(connection, TABLE_NAME, 
                                   new KeyDef().addAttrib(ROLE_ID)
                                       .addAttrib(ACTION_ID)
                                       .addAttrib(RESOURCE_ID));
            rpr.where(buildWhereClause(roleID, actionID, resourceID));
d246 7
a252 12
            rpr.fetchRecords();
            if (!rpr.containsRecord(0))
            {
                Record r = rpr.addRecord();
                r.setValue(ROLE_ID, roleID);
                r.setValue(ACTION_ID, actionID);
                r.setValue(RESOURCE_ID, resourceID);
                r.save();
            }
        }
        catch (DataSetException e)
        {
d254 1
a254 3
        }
        catch (SQLException e)
        {
d256 1
a256 3
        }
        finally
        {
d258 5
d267 1
a267 2
     * Revokes the given action with the given resource from the given 
     * role.
a268 1
     * @@param	connection    A JDBC database connection
d275 1
a275 2
    public void revoke (Connection connection, String roleID, String actionID, 
                        String resourceID)
d277 3
a279 10
    {
        TableDataSet rpr = null;
        try
        {
            rpr = new TableDataSet(connection, TABLE_NAME, 
                                   new KeyDef().addAttrib(ROLE_ID)
                                       .addAttrib(ACTION_ID)
                                       .addAttrib(RESOURCE_ID));
            rpr.where(buildWhereClause(roleID, actionID, resourceID));
            rpr.fetchRecords();
d285 1
a285 3
        }
        catch (DataSetException e)
        {
d287 1
a287 3
        }
        catch (SQLException e)
        {
d289 1
a289 3
        }
        finally
        {
a291 66
    }

    /**
     * Revokes the given action across the given role.
     *
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to revoke
     * @@param	roleID        The roleID to revoke
     *
     * @@exception DBException
     */
    public void revoke (Connection connection, String roleID, 
                        String actionID)
	throws DBException
    {
        revoke(connection, actionID, null, roleID);
    }

    /**
     * Revokes the given action unilaterally (across all roles).
     *
     * @@param	connection    A JDBC database connection
     * @@param	actionID  The actionID to revoke
     *
     * @@exception DBException
     */
    public void revoke (Connection connection, String actionID)
	throws DBException
    {
        revoke(connection, actionID, null, null);
    }
    
    /**
     * Creates a SQL <code>where</code> clause.
     */
    protected static String buildWhereClause (String roleID, 
                                              String actionID, 
                                              String resourceID)
    {
        StringBuffer whereClause = new StringBuffer();
        boolean firstClause = true;

        if (roleID != null)
        {
            whereClause.append(ROLE_ID).append('=').append(roleID);
            firstClause = false;
        }
        if (actionID != null)
        {
            if (!firstClause)
            {
                whereClause.append(" AND ");
            }
            whereClause.append(ACTION_ID).append('=').append(actionID);
            firstClause = false;
        }
        if (resourceID != null)
        {
            if (!firstClause)
            {
                whereClause.append(" AND ");
            }
            whereClause.append(RESOURCE_ID).append('=').append(resourceID);
            firstClause = false;
        }
        return whereClause.toString();
@


1.4
log
@Making use of DBException.
@
text
@d65 1
a65 1
 * @@version $Id: RoleActionResourceManager.java,v 1.3 2000/12/09 03:27:07 leonardr Exp $
d123 1
a123 2
    public DataSet getActionsResourcesForRole (Connection connection, 
                                                   String roleID)
a125 1
        TableDataSet rpr = null;
d128 2
a129 3
            rpr = new TableDataSet(connection, TABLE_NAME);
            rpr.where(buildWhereClause(roleID, null, null));
            return rpr.fetchRecords();
d131 1
a131 1
        catch (DataSetException e)
a133 8
        }
        catch (SQLException e)
        {
            throw new DBException(e);
        }
        finally
        {
            registerToClose(rpr);
@


1.3
log
@New servlet: RoleEdit
@
text
@d65 1
a65 1
 * @@version $Id: RoleActionResourceManager.java,v 1.2 2000/12/08 02:19:03 leonardr Exp $
d120 2
a121 2
     * @@exception	SQLException
     * @@exception	DataSetException
d125 1
a125 1
	throws SQLException, DataSetException
d136 1
a136 4
            log.exception(e);
            if (debug) log.info("Getting Actions and Resources: " + 
                                 e.getMessage());
            throw e;
d140 1
a140 4
            log.exception(e);
            if (debug) log.info("Getting Actions and Resources: " + 
                                 e.getMessage());
            throw e;
d155 2
a156 2
     * @@exception	SQLException
     * @@exception	DataSetException
d161 1
a161 1
	throws SQLException, DataSetException
d172 1
a172 4
            log.exception(e);
            if (debug) log.info("Getting Roles for Action: " + 
                                 e.getMessage());
            throw e;
d176 1
a176 4
            log.exception(e);
            if (debug) log.info("Getting Roles for Action: " + 
                                 e.getMessage());
            throw e;
d191 2
a192 2
     * @@exception	SQLException
     * @@exception	DataSetException
d196 1
a196 1
        throws SQLException, DataSetException
d209 2
a210 2
     * @@exception	SQLException
     * @@exception	DataSetException
d213 2
a214 2
         String resourceID)
	throws SQLException, DataSetException
d238 1
a238 4
            log.exception(e);
            if (debug) log.info("Getting action to role: " + 
                                 e.getMessage());
            throw e;
d242 1
a242 4
            log.exception(e);
            if (debug) log.info("Granting action to role: " + 
                                 e.getMessage());
            throw e;
d258 2
a259 2
     * @@exception	SQLException
     * @@exception	DataSetException
d262 2
a263 2
         String resourceID)
	throws SQLException, DataSetException
d282 1
a282 4
            log.exception(e);
            String message = "Revoking action: " + e.getMessage();
            if (debug) log.info(message);
            throw e;
d286 1
a286 4
            log.exception(e);
            String message = "Revoking action: " + e.getMessage();
            if (debug) log.info(message);
            throw e;
d300 2
a301 2
     * @@exception	SQLException
     * @@exception	DataSetException
d305 1
a305 1
	throws SQLException, DataSetException
d315 2
a316 2
     * @@exception	SQLException
     * @@exception	DataSetException
d319 1
a319 1
	throws SQLException, DataSetException
@


1.2
log
@First stab at dynamic role creation.
@
text
@d65 1
a65 1
 * @@version $Id: RoleActionResourceManager.java,v 1.1.1.1 2000/11/12 21:15:12 dlr Exp $
d137 1
a137 1
            if (debug) log.debug("Getting Actions and Resources: " + 
d144 1
a144 1
            if (debug) log.debug("Getting Actions and Resources: " + 
d179 1
a179 1
            if (debug) log.debug("Getting Roles for Action: " + 
d186 1
a186 1
            if (debug) log.debug("Getting Roles for Action: " + 
a240 1
                log.info("Saving.");
a245 1
                log.info("Okay, done.");
d251 1
a251 1
            if (debug) log.debug("Getting action to role: " + 
d258 1
a258 1
            if (debug) log.debug("Granting action to role: " + 
d286 4
a289 1
            rpr = new TableDataSet(connection, TABLE_NAME);
d302 1
a302 1
            if (debug) log.debug(message);
d309 1
a309 1
            if (debug) log.debug(message);
a380 1
        log.info("WhereClause: " + whereClause.toString());
@


1.1
log
@Initial revision
@
text
@d65 1
a65 1
 * @@version $Id: RoleActionResourceManager.java,v 1.2 2000/10/11 03:00:44 leonardr Exp $
d224 2
a225 2
    public void grant (Connection connection, String roleID, 
                       String actionID, String resourceID)
d231 5
a235 1
            rpr = new TableDataSet(connection, TABLE_NAME);
d241 1
d247 1
d281 2
a282 2
    public void revoke (Connection connection, String roleID, 
                        String actionID, String resourceID)
d380 1
a380 1

@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@
