com.stratelia.webactiv.organization
Class UserRoleTable

java.lang.Object
  extended by com.stratelia.webactiv.organization.Table<UserRoleRow>
      extended by com.stratelia.webactiv.organization.UserRoleTable

public class UserRoleTable
extends Table<UserRoleRow>

A UserRoleTable object manages the ST_UserRole table.


Constructor Summary
UserRoleTable(OrganizationSchema organization)
           
 
Method Summary
 void addGroupInUserRole(int groupId, int userRoleId)
          Adds a group in a userRole.
 void addUserInUserRole(int userId, int userRoleId)
          Add an user in a userRole.
 void createUserRole(UserRoleRow userRole)
          Inserts in the database a new userRole row.
protected  UserRoleRow fetchRow(ResultSet rs)
          Fetch the current userRole row from a resultSet.
protected  UserRoleRow fetchUserRole(ResultSet rs)
          Fetch the current userRole row from a resultSet.
 String[] getAllObjectUserRoleIdsOfInstance(int instanceId)
           
 String[] getAllUserRoleIdsOfInstance(int instanceId)
          Returns all the UserRole ids of an instance.
 String[] getAllUserRoleIdsOfObject(int objectId, String objectType, int instanceId)
          Returns all the UserRole ids of an object in a given instance.
 UserRoleRow[] getAllUserRolesOfInstance(int instanceId)
          Returns all the UserRoles of an instance.
 UserRoleRow[] getDirectUserRolesOfGroup(int groupId)
          Returns all the direct UserRoles of a group.
 UserRoleRow[] getDirectUserRolesOfUser(int userId)
          Returns all the direct UserRoles of user.
 UserRoleRow getUserRole(int id)
          Returns the UserRole whith the given id.
 UserRoleRow getUserRole(int instanceId, String roleName, int inherited)
          Returns the UserRole whith the given roleName in the given instance.
 boolean isGroupDirectlyInRole(int groupId, int userRoleId)
          Tests if a group has a given role (not recursive).
 boolean isUserDirectlyInRole(int userId, int userRoleId)
          Tests if a user has a given role (not recursive).
protected  void prepareInsert(String insertQuery, PreparedStatement insert, UserRoleRow row)
          Set all the parameters of the insert PreparedStatement built from the insertQuery in order to insert the given row.
protected  void prepareUpdate(String updateQuery, PreparedStatement update, UserRoleRow row)
          Set all the parameters of the update PreparedStatement built from the updateQuery in order to update the given row.
 void removeAllGroupsFromUserRole(int userRoleId)
          Removes all groups from a userRole.
 void removeAllUsersFromUserRole(int userRoleId)
          Removes all users from a userRole.
 void removeGroupFromUserRole(int groupId, int userRoleId)
          Removes a group from a userRole.
 void removeUserFromUserRole(int userId, int userRoleId)
          Removes an user from a userRole.
 void removeUserRole(int id)
          Delete the userRole
 void updateUserRole(UserRoleRow userRole)
          Update a user role.
 
Methods inherited from class com.stratelia.webactiv.organization.Table
addIdToQuery, addParamToQuery, addParamToQuery, addParamToQuery, aliasColumns, getCount, getCount, getIds, getIds, getIds, getIds, getInteger, getInteger, getMatchingRows, getNextId, getRows, getRows, getRows, getRows, getUniqueRow, getUniqueRow, getUniqueRow, insertRow, performPrepareStatementParams, truncate, updateRelation, updateRelation, updateRelation, updateRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserRoleTable

public UserRoleTable(OrganizationSchema organization)
Method Detail

fetchUserRole

protected UserRoleRow fetchUserRole(ResultSet rs)
                             throws SQLException
Fetch the current userRole row from a resultSet.

Parameters:
rs -
Returns:
the current userRole row from a resultSet.
Throws:
SQLException

getUserRole

public UserRoleRow getUserRole(int id)
                        throws AdminPersistenceException
Returns the UserRole whith the given id.

Parameters:
id -
Returns:
the UserRole whith the given id.
Throws:
AdminPersistenceException

getUserRole

public UserRoleRow getUserRole(int instanceId,
                               String roleName,
                               int inherited)
                        throws AdminPersistenceException
Returns the UserRole whith the given roleName in the given instance.

Parameters:
instanceId -
roleName -
Returns:
the UserRole whith the given roleName in the given instance. the UserRole whith the given roleName in the given instance.
Throws:
AdminPersistenceException

getAllUserRolesOfInstance

public UserRoleRow[] getAllUserRolesOfInstance(int instanceId)
                                        throws AdminPersistenceException
Returns all the UserRoles of an instance.

Parameters:
instanceId -
Returns:
all the UserRoles of an instance.
Throws:
AdminPersistenceException

getAllUserRoleIdsOfInstance

public String[] getAllUserRoleIdsOfInstance(int instanceId)
                                     throws AdminPersistenceException
Returns all the UserRole ids of an instance.

Parameters:
instanceId -
Returns:
all the UserRole ids of an instance.
Throws:
AdminPersistenceException

getAllObjectUserRoleIdsOfInstance

public String[] getAllObjectUserRoleIdsOfInstance(int instanceId)
                                           throws AdminPersistenceException
Throws:
AdminPersistenceException

getAllUserRoleIdsOfObject

public String[] getAllUserRoleIdsOfObject(int objectId,
                                          String objectType,
                                          int instanceId)
                                   throws AdminPersistenceException
Returns all the UserRole ids of an object in a given instance.

Parameters:
objectId -
objectType -
instanceId -
Returns:
all the UserRole ids of an object in a given instance.
Throws:
AdminPersistenceException

getDirectUserRolesOfUser

public UserRoleRow[] getDirectUserRolesOfUser(int userId)
                                       throws AdminPersistenceException
Returns all the direct UserRoles of user.

Parameters:
userId -
Returns:
all the direct UserRoles of user.
Throws:
AdminPersistenceException

getDirectUserRolesOfGroup

public UserRoleRow[] getDirectUserRolesOfGroup(int groupId)
                                        throws AdminPersistenceException
Returns all the direct UserRoles of a group.

Parameters:
groupId -
Returns:
all the direct UserRoles of a group.
Throws:
AdminPersistenceException

createUserRole

public void createUserRole(UserRoleRow userRole)
                    throws AdminPersistenceException
Inserts in the database a new userRole row.

Parameters:
userRole -
Throws:
AdminPersistenceException

prepareInsert

protected void prepareInsert(String insertQuery,
                             PreparedStatement insert,
                             UserRoleRow row)
                      throws SQLException
Description copied from class: Table
Set all the parameters of the insert PreparedStatement built from the insertQuery in order to insert the given row.

Specified by:
prepareInsert in class Table<UserRoleRow>
Throws:
SQLException

updateUserRole

public void updateUserRole(UserRoleRow userRole)
                    throws AdminPersistenceException
Update a user role.

Parameters:
userRole -
Throws:
AdminPersistenceException

prepareUpdate

protected void prepareUpdate(String updateQuery,
                             PreparedStatement update,
                             UserRoleRow row)
                      throws SQLException
Description copied from class: Table
Set all the parameters of the update PreparedStatement built from the updateQuery in order to update the given row.

Specified by:
prepareUpdate in class Table<UserRoleRow>
Throws:
SQLException

removeUserRole

public void removeUserRole(int id)
                    throws AdminPersistenceException
Delete the userRole

Parameters:
id -
Throws:
AdminPersistenceException

isUserDirectlyInRole

public boolean isUserDirectlyInRole(int userId,
                                    int userRoleId)
                             throws AdminPersistenceException
Tests if a user has a given role (not recursive).

Parameters:
userId -
userRoleId -
Returns:
Throws:
AdminPersistenceException

addUserInUserRole

public void addUserInUserRole(int userId,
                              int userRoleId)
                       throws AdminPersistenceException
Add an user in a userRole.

Parameters:
userId -
userRoleId -
Throws:
AdminPersistenceException

removeUserFromUserRole

public void removeUserFromUserRole(int userId,
                                   int userRoleId)
                            throws AdminPersistenceException
Removes an user from a userRole.

Parameters:
userId -
userRoleId -
Throws:
AdminPersistenceException

removeAllUsersFromUserRole

public void removeAllUsersFromUserRole(int userRoleId)
                                throws AdminPersistenceException
Removes all users from a userRole.

Parameters:
userRoleId -
Throws:
AdminPersistenceException

removeAllGroupsFromUserRole

public void removeAllGroupsFromUserRole(int userRoleId)
                                 throws AdminPersistenceException
Removes all groups from a userRole.

Parameters:
userRoleId -
Throws:
AdminPersistenceException

isGroupDirectlyInRole

public boolean isGroupDirectlyInRole(int groupId,
                                     int userRoleId)
                              throws AdminPersistenceException
Tests if a group has a given role (not recursive).

Parameters:
groupId -
userRoleId -
Returns:
Throws:
AdminPersistenceException

addGroupInUserRole

public void addGroupInUserRole(int groupId,
                               int userRoleId)
                        throws AdminPersistenceException
Adds a group in a userRole.

Parameters:
groupId -
userRoleId -
Throws:
AdminPersistenceException

removeGroupFromUserRole

public void removeGroupFromUserRole(int groupId,
                                    int userRoleId)
                             throws AdminPersistenceException
Removes a group from a userRole.

Parameters:
groupId -
userRoleId -
Throws:
AdminPersistenceException

fetchRow

protected UserRoleRow fetchRow(ResultSet rs)
                        throws SQLException
Fetch the current userRole row from a resultSet.

Specified by:
fetchRow in class Table<UserRoleRow>
Returns:
Throws:
SQLException


Copyright © 2016 Silverpeas. All Rights Reserved.