Class UserRoleTable
- java.lang.Object
-
- org.silverpeas.core.persistence.jdbc.AbstractTable<T>
-
- org.silverpeas.core.admin.persistence.Table<UserRoleRow>
-
- org.silverpeas.core.admin.persistence.UserRoleTable
-
@Repository public class UserRoleTable extends Table<UserRoleRow>
A UserRoleTable object manages the ST_UserRole table.
-
-
Field Summary
Fields Modifier and Type Field Description static String
REQUEST_MSG
static String
SELECT
-
Constructor Summary
Constructors Constructor Description UserRoleTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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 with the given roleName in the given instance.protected void
prepareInsert(String insertQuery, PreparedStatement insert, UserRoleRow row)
protected void
prepareUpdate(String updateQuery, PreparedStatement update, UserRoleRow 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 userRolevoid
updateUserRole(UserRoleRow userRole)
Update a user role.-
Methods inherited from class org.silverpeas.core.admin.persistence.Table
addIdToQuery, addParamToQuery, addParamToQuery, aliasColumns, checkGroupExistence, checkUserExistence, getCount, getCount, getIds, getIds, getIds, getIds, getNotNullString, getRows, performPrepareStatementParams, updateRelation
-
Methods inherited from class org.silverpeas.core.persistence.jdbc.AbstractTable
getInteger, getInteger, getMatchingRows, getNextId, getRows, getRows, getRows, getRows, getRows, getRows, getRows, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, insertRow, truncate, updateRelation, updateRelation, updateRow
-
-
-
-
Field Detail
-
REQUEST_MSG
public static final String REQUEST_MSG
- See Also:
- Constant Field Values
-
SELECT
public static final String SELECT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUserRole
public UserRoleRow getUserRole(int id) throws SQLException
Returns the UserRole whith the given id.- Parameters:
id
-- Returns:
- the UserRole whith the given id.
- Throws:
SQLException
-
getUserRole
public UserRoleRow getUserRole(int instanceId, String roleName, int inherited) throws SQLException
Returns the UserRole with the given roleName in the given instance.- Parameters:
instanceId
-roleName
-- Returns:
- the UserRole with the given roleName in the given instance. the UserRole whith the given roleName in the given instance.
- Throws:
SQLException
-
getAllUserRolesOfInstance
public UserRoleRow[] getAllUserRolesOfInstance(int instanceId) throws SQLException
Returns all the UserRoles of an instance.- Parameters:
instanceId
-- Returns:
- all the UserRoles of an instance.
- Throws:
SQLException
-
getAllUserRoleIdsOfInstance
public String[] getAllUserRoleIdsOfInstance(int instanceId) throws SQLException
Returns all the UserRole ids of an instance.- Parameters:
instanceId
-- Returns:
- all the UserRole ids of an instance.
- Throws:
SQLException
-
getAllObjectUserRoleIdsOfInstance
public String[] getAllObjectUserRoleIdsOfInstance(int instanceId) throws SQLException
- Throws:
SQLException
-
getAllUserRoleIdsOfObject
public String[] getAllUserRoleIdsOfObject(int objectId, String objectType, int instanceId) throws SQLException
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:
SQLException
-
getDirectUserRolesOfUser
public UserRoleRow[] getDirectUserRolesOfUser(int userId) throws SQLException
Returns all the direct UserRoles of user.- Parameters:
userId
-- Returns:
- all the direct UserRoles of user.
- Throws:
SQLException
-
getDirectUserRolesOfGroup
public UserRoleRow[] getDirectUserRolesOfGroup(int groupId) throws SQLException
Returns all the direct UserRoles of a group.- Parameters:
groupId
-- Returns:
- all the direct UserRoles of a group.
- Throws:
SQLException
-
createUserRole
public void createUserRole(UserRoleRow userRole) throws SQLException
Inserts in the database a new userRole row.- Parameters:
userRole
-- Throws:
SQLException
-
prepareInsert
protected void prepareInsert(String insertQuery, PreparedStatement insert, UserRoleRow row) throws SQLException
- Specified by:
prepareInsert
in classAbstractTable<UserRoleRow>
- Throws:
SQLException
-
updateUserRole
public void updateUserRole(UserRoleRow userRole) throws SQLException
Update a user role.- Parameters:
userRole
-- Throws:
SQLException
-
prepareUpdate
protected void prepareUpdate(String updateQuery, PreparedStatement update, UserRoleRow row) throws SQLException
- Specified by:
prepareUpdate
in classAbstractTable<UserRoleRow>
- Throws:
SQLException
-
removeUserRole
public void removeUserRole(int id) throws SQLException
Delete the userRole- Parameters:
id
-- Throws:
SQLException
-
addUserInUserRole
public void addUserInUserRole(int userId, int userRoleId) throws SQLException
Add an user in a userRole.- Parameters:
userId
-userRoleId
-- Throws:
SQLException
AdminException
-
removeUserFromUserRole
public void removeUserFromUserRole(int userId, int userRoleId) throws SQLException
Removes an user from a userRole.- Parameters:
userId
-userRoleId
-- Throws:
SQLException
-
removeAllUsersFromUserRole
public void removeAllUsersFromUserRole(int userRoleId) throws SQLException
Removes all users from a userRole.- Parameters:
userRoleId
-- Throws:
SQLException
-
removeAllGroupsFromUserRole
public void removeAllGroupsFromUserRole(int userRoleId) throws SQLException
Removes all groups from a userRole.- Parameters:
userRoleId
-- Throws:
SQLException
-
addGroupInUserRole
public void addGroupInUserRole(int groupId, int userRoleId) throws SQLException
Adds a group in a userRole.- Parameters:
groupId
-userRoleId
-- Throws:
SQLException
-
removeGroupFromUserRole
public void removeGroupFromUserRole(int groupId, int userRoleId) throws SQLException
Removes a group from a userRole.- Parameters:
groupId
-userRoleId
-- Throws:
SQLException
-
fetchRow
protected UserRoleRow fetchRow(ResultSet rs) throws SQLException
Fetch the current userRole row from a resultSet.- Specified by:
fetchRow
in classAbstractTable<UserRoleRow>
- Parameters:
rs
- the result set from which the row will be fetched.- Returns:
- the entity in the row.
- Throws:
SQLException
- on SQL error.
-
-