Liferay 6.1.2-ce-ga3

com.liferay.portal.service
Interface RoleLocalService

All Superinterfaces:
BaseLocalService, PersistedModelLocalService
All Known Implementing Classes:
RoleLocalServiceBaseImpl, RoleLocalServiceImpl, RoleLocalServiceWrapper

@Transactional(isolation=PORTAL,
               rollbackFor={PortalException.class,SystemException.class})
public interface RoleLocalService
extends BaseLocalService, PersistedModelLocalService

The interface for the role local service.

This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.

See Also:
RoleLocalServiceUtil, RoleLocalServiceBaseImpl, RoleLocalServiceImpl
ServiceBuilder generated this class. Modifications in this class will be overwritten the next time it is generated.

Method Summary
 void addGroupRole(long groupId, long roleId)
           
 void addGroupRole(long groupId, Role role)
           
 void addGroupRoles(long groupId, List<Role> Roles)
           
 void addGroupRoles(long groupId, long[] roleIds)
           
 void addPermissionRole(long permissionId, long roleId)
           
 void addPermissionRole(long permissionId, Role role)
           
 void addPermissionRoles(long permissionId, List<Role> Roles)
           
 void addPermissionRoles(long permissionId, long[] roleIds)
           
 Role addRole(long userId, long companyId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type)
          Deprecated. addRole(long, String, long, String, Map, Map, int, String)
 Role addRole(long userId, long companyId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type, String className, long classPK)
          Deprecated. addRole(long, String, long, String, Map, Map, int, String)
 Role addRole(long userId, String className, long classPK, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type, String subType)
          Adds a role with additional parameters.
 Role addRole(Role role)
          Adds the role to the database.
 void addUserRole(long userId, long roleId)
           
 void addUserRole(long userId, Role role)
           
 void addUserRoles(long userId, List<Role> Roles)
           
 void addUserRoles(long userId, long[] roleIds)
           
 void checkSystemRoles()
          Checks to ensure that the system roles map has appropriate default roles in each company.
 void checkSystemRoles(long companyId)
          Checks to ensure that the system roles map has appropriate default roles in the company.
 void clearGroupRoles(long groupId)
           
 void clearPermissionRoles(long permissionId)
           
 void clearUserRoles(long userId)
           
 Role createRole(long roleId)
          Creates a new role with the primary key.
 void deleteGroupRole(long groupId, long roleId)
           
 void deleteGroupRole(long groupId, Role role)
           
 void deleteGroupRoles(long groupId, List<Role> Roles)
           
 void deleteGroupRoles(long groupId, long[] roleIds)
           
 void deletePermissionRole(long permissionId, long roleId)
           
 void deletePermissionRole(long permissionId, Role role)
           
 void deletePermissionRoles(long permissionId, List<Role> Roles)
           
 void deletePermissionRoles(long permissionId, long[] roleIds)
           
 Role deleteRole(long roleId)
          Deletes the role with the primary key from the database.
 Role deleteRole(Role role)
          Deletes the role from the database.
 void deleteUserRole(long userId, long roleId)
           
 void deleteUserRole(long userId, Role role)
           
 void deleteUserRoles(long userId, List<Role> Roles)
           
 void deleteUserRoles(long userId, long[] roleIds)
           
 DynamicQuery dynamicQuery()
           
 List dynamicQuery(DynamicQuery dynamicQuery)
          Performs a dynamic query on the database and returns the matching rows.
 List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
          Performs a dynamic query on the database and returns a range of the matching rows.
 List dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator)
          Performs a dynamic query on the database and returns an ordered range of the matching rows.
 long dynamicQueryCount(DynamicQuery dynamicQuery)
          Returns the number of rows that match the dynamic query.
 Role fetchRole(long roleId)
           
 Role fetchRole(long companyId, String name)
          Returns the role with the name in the company.
 String getBeanIdentifier()
          Returns the Spring bean ID for this bean.
 Role getDefaultGroupRole(long groupId)
          Returns the default role for the group with the primary key.
 List<Role> getGroupRoles(long groupId)
           
 List<Role> getGroupRoles(long groupId, int start, int end)
           
 List<Role> getGroupRoles(long groupId, int start, int end, OrderByComparator orderByComparator)
           
 int getGroupRolesCount(long groupId)
           
 List<Role> getPermissionRoles(long permissionId)
           
 List<Role> getPermissionRoles(long permissionId, int start, int end)
           
 List<Role> getPermissionRoles(long permissionId, int start, int end, OrderByComparator orderByComparator)
           
 int getPermissionRolesCount(long permissionId)
           
 PersistedModel getPersistedModel(Serializable primaryKeyObj)
           
 List<Role> getResourceBlockRoles(long resourceBlockId, String className, String actionId)
           
 Map<String,List<String>> getResourceRoles(long companyId, String name, int scope, String primKey)
          Returns a map of role names to associated action IDs for the named resource in the company within the permission scope.
 List<Role> getResourceRoles(long companyId, String name, int scope, String primKey, String actionId)
          Returns all the roles associated with the action ID in the company within the permission scope.
 Role getRole(long roleId)
          Returns the role with the primary key.
 Role getRole(long companyId, String name)
          Returns the role with the name in the company.
 List<Role> getRoles(int start, int end)
          Returns a range of all the roles.
 List<Role> getRoles(int type, String subtype)
          Returns all the roles of the type and subtype.
 List<Role> getRoles(long companyId)
          Returns all the roles in the company.
 List<Role> getRoles(long[] roleIds)
          Returns all the roles with the primary keys.
 int getRolesCount()
          Returns the number of roles.
 List<Role> getSubtypeRoles(String subtype)
          Returns all the roles of the subtype.
 int getSubtypeRolesCount(String subtype)
          Returns the number of roles of the subtype.
 Role getTeamRole(long companyId, long teamId)
          Returns the team role in the company.
 List<Role> getUserGroupGroupRoles(long userId, long groupId)
          Returns all the user's roles within the user group.
 List<Role> getUserGroupRoles(long userId, long groupId)
          Returns all the user's roles within the user group.
 List<Role> getUserRelatedRoles(long userId, List<Group> groups)
          Returns the union of all the user's roles within the groups.
 List<Role> getUserRelatedRoles(long userId, long groupId)
          Returns all the user's roles within the group.
 List<Role> getUserRelatedRoles(long userId, long[] groupIds)
          Returns the union of all the user's roles within the groups.
 List<Role> getUserRoles(long userId)
           
 List<Role> getUserRoles(long userId, int start, int end)
           
 List<Role> getUserRoles(long userId, int start, int end, OrderByComparator orderByComparator)
           
 int getUserRolesCount(long userId)
           
 boolean hasGroupRole(long groupId, long roleId)
           
 boolean hasGroupRoles(long groupId)
           
 boolean hasPermissionRole(long permissionId, long roleId)
           
 boolean hasPermissionRoles(long permissionId)
           
 boolean hasUserRole(long userId, long roleId)
           
 boolean hasUserRole(long userId, long companyId, String name, boolean inherited)
          Returns true if the user is associated with the named regular role.
 boolean hasUserRoles(long userId)
           
 boolean hasUserRoles(long userId, long companyId, String[] names, boolean inherited)
          Returns true if the user has any one of the named regular roles.
 Role loadFetchRole(long companyId, String name)
          Returns a role with the name in the company.
 Role loadGetRole(long companyId, String name)
          Returns a role with the name in the company.
 List<Role> search(long companyId, String keywords, Integer[] types, int start, int end, OrderByComparator obc)
          Returns an ordered range of all the roles that match the keywords and types.
 List<Role> search(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator obc)
          Returns an ordered range of all the roles that match the keywords, types, and params.
 List<Role> search(long companyId, String name, String description, Integer[] types, int start, int end, OrderByComparator obc)
          Returns an ordered range of all the roles that match the name, description, and types.
 List<Role> search(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator obc)
          Returns an ordered range of all the roles that match the name, description, types, and params.
 int searchCount(long companyId, String keywords, Integer[] types)
          Returns the number of roles that match the keywords and types.
 int searchCount(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params)
          Returns the number of roles that match the keywords, types and params.
 int searchCount(long companyId, String name, String description, Integer[] types)
          Returns the number of roles that match the name, description, and types.
 int searchCount(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params)
          Returns the number of roles that match the name, description, types, and params.
 void setBeanIdentifier(String beanIdentifier)
          Sets the Spring bean ID for this bean.
 void setGroupRoles(long groupId, long[] roleIds)
           
 void setPermissionRoles(long permissionId, long[] roleIds)
           
 void setUserRoles(long userId, long[] roleIds)
           
 void unsetUserRoles(long userId, long[] roleIds)
          Removes the matching roles associated with the user.
 Role updateRole(long roleId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, String subtype)
          Updates the role with the primary key.
 Role updateRole(Role role)
          Updates the role in the database or adds it if it does not yet exist.
 Role updateRole(Role role, boolean merge)
          Updates the role in the database or adds it if it does not yet exist.
 

Method Detail

addRole

Role addRole(Role role)
             throws SystemException
Adds the role to the database. Also notifies the appropriate model listeners.

Parameters:
role - the role
Returns:
the role that was added
Throws:
SystemException - if a system exception occurred

createRole

Role createRole(long roleId)
Creates a new role with the primary key. Does not add the role to the database.

Parameters:
roleId - the primary key for the new role
Returns:
the new role

deleteRole

Role deleteRole(long roleId)
                throws PortalException,
                       SystemException
Deletes the role with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
roleId - the primary key of the role
Returns:
the role that was removed
Throws:
PortalException - if a role with the primary key could not be found
SystemException - if a system exception occurred

deleteRole

Role deleteRole(Role role)
                throws PortalException,
                       SystemException
Deletes the role from the database. Also notifies the appropriate model listeners.

Parameters:
role - the role
Returns:
the role that was removed
Throws:
PortalException
SystemException - if a system exception occurred

dynamicQuery

DynamicQuery dynamicQuery()

dynamicQuery

List dynamicQuery(DynamicQuery dynamicQuery)
                  throws SystemException
Performs a dynamic query on the database and returns the matching rows.

Parameters:
dynamicQuery - the dynamic query
Returns:
the matching rows
Throws:
SystemException - if a system exception occurred

dynamicQuery

List dynamicQuery(DynamicQuery dynamicQuery,
                  int start,
                  int end)
                  throws SystemException
Performs a dynamic query on the database and returns a range of the matching rows.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
Returns:
the range of matching rows
Throws:
SystemException - if a system exception occurred

dynamicQuery

List dynamicQuery(DynamicQuery dynamicQuery,
                  int start,
                  int end,
                  OrderByComparator orderByComparator)
                  throws SystemException
Performs a dynamic query on the database and returns an ordered range of the matching rows.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching rows
Throws:
SystemException - if a system exception occurred

dynamicQueryCount

long dynamicQueryCount(DynamicQuery dynamicQuery)
                       throws SystemException
Returns the number of rows that match the dynamic query.

Parameters:
dynamicQuery - the dynamic query
Returns:
the number of rows that match the dynamic query
Throws:
SystemException - if a system exception occurred

fetchRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role fetchRole(long roleId)
               throws SystemException
Throws:
SystemException

getRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getRole(long roleId)
             throws PortalException,
                    SystemException
Returns the role with the primary key.

Parameters:
roleId - the primary key of the role
Returns:
the role
Throws:
PortalException - if a role with the primary key could not be found
SystemException - if a system exception occurred

getPersistedModel

@Transactional(propagation=SUPPORTS,
               readOnly=true)
PersistedModel getPersistedModel(Serializable primaryKeyObj)
                                 throws PortalException,
                                        SystemException
Specified by:
getPersistedModel in interface PersistedModelLocalService
Throws:
PortalException
SystemException

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(int start,
                                                             int end)
                    throws SystemException
Returns a range of all the roles.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
start - the lower bound of the range of roles
end - the upper bound of the range of roles (not inclusive)
Returns:
the range of roles
Throws:
SystemException - if a system exception occurred

getRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getRolesCount()
                  throws SystemException
Returns the number of roles.

Returns:
the number of roles
Throws:
SystemException - if a system exception occurred

updateRole

Role updateRole(Role role)
                throws SystemException
Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
role - the role
Returns:
the role that was updated
Throws:
SystemException - if a system exception occurred

updateRole

Role updateRole(Role role,
                boolean merge)
                throws SystemException
Updates the role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
role - the role
merge - whether to merge the role with the current session. See BatchSession.update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean) for an explanation.
Returns:
the role that was updated
Throws:
SystemException - if a system exception occurred

addGroupRole

void addGroupRole(long groupId,
                  long roleId)
                  throws SystemException
Throws:
SystemException - if a system exception occurred

addGroupRole

void addGroupRole(long groupId,
                  Role role)
                  throws SystemException
Throws:
SystemException - if a system exception occurred

addGroupRoles

void addGroupRoles(long groupId,
                   long[] roleIds)
                   throws SystemException
Throws:
SystemException - if a system exception occurred

addGroupRoles

void addGroupRoles(long groupId,
                   List<Role> Roles)
                   throws SystemException
Throws:
SystemException - if a system exception occurred

clearGroupRoles

void clearGroupRoles(long groupId)
                     throws SystemException
Throws:
SystemException - if a system exception occurred

deleteGroupRole

void deleteGroupRole(long groupId,
                     long roleId)
                     throws SystemException
Throws:
SystemException - if a system exception occurred

deleteGroupRole

void deleteGroupRole(long groupId,
                     Role role)
                     throws SystemException
Throws:
SystemException - if a system exception occurred

deleteGroupRoles

void deleteGroupRoles(long groupId,
                      long[] roleIds)
                      throws SystemException
Throws:
SystemException - if a system exception occurred

deleteGroupRoles

void deleteGroupRoles(long groupId,
                      List<Role> Roles)
                      throws SystemException
Throws:
SystemException - if a system exception occurred

getGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getGroupRoles(long groupId)
                         throws SystemException
Throws:
SystemException - if a system exception occurred

getGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getGroupRoles(long groupId,
                                                                  int start,
                                                                  int end)
                         throws SystemException
Throws:
SystemException - if a system exception occurred

getGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getGroupRoles(long groupId,
                                                                  int start,
                                                                  int end,
                                                                  OrderByComparator orderByComparator)
                         throws SystemException
Throws:
SystemException - if a system exception occurred

getGroupRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getGroupRolesCount(long groupId)
                       throws SystemException
Throws:
SystemException - if a system exception occurred

hasGroupRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasGroupRole(long groupId,
                                                              long roleId)
                     throws SystemException
Throws:
SystemException - if a system exception occurred

hasGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasGroupRoles(long groupId)
                      throws SystemException
Throws:
SystemException - if a system exception occurred

setGroupRoles

void setGroupRoles(long groupId,
                   long[] roleIds)
                   throws SystemException
Throws:
SystemException - if a system exception occurred

addPermissionRole

void addPermissionRole(long permissionId,
                       long roleId)
                       throws SystemException
Throws:
SystemException - if a system exception occurred

addPermissionRole

void addPermissionRole(long permissionId,
                       Role role)
                       throws SystemException
Throws:
SystemException - if a system exception occurred

addPermissionRoles

void addPermissionRoles(long permissionId,
                        long[] roleIds)
                        throws SystemException
Throws:
SystemException - if a system exception occurred

addPermissionRoles

void addPermissionRoles(long permissionId,
                        List<Role> Roles)
                        throws SystemException
Throws:
SystemException - if a system exception occurred

clearPermissionRoles

void clearPermissionRoles(long permissionId)
                          throws SystemException
Throws:
SystemException - if a system exception occurred

deletePermissionRole

void deletePermissionRole(long permissionId,
                          long roleId)
                          throws SystemException
Throws:
SystemException - if a system exception occurred

deletePermissionRole

void deletePermissionRole(long permissionId,
                          Role role)
                          throws SystemException
Throws:
SystemException - if a system exception occurred

deletePermissionRoles

void deletePermissionRoles(long permissionId,
                           long[] roleIds)
                           throws SystemException
Throws:
SystemException - if a system exception occurred

deletePermissionRoles

void deletePermissionRoles(long permissionId,
                           List<Role> Roles)
                           throws SystemException
Throws:
SystemException - if a system exception occurred

getPermissionRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getPermissionRoles(long permissionId)
                              throws SystemException
Throws:
SystemException - if a system exception occurred

getPermissionRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getPermissionRoles(long permissionId,
                                                                       int start,
                                                                       int end)
                              throws SystemException
Throws:
SystemException - if a system exception occurred

getPermissionRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getPermissionRoles(long permissionId,
                                                                       int start,
                                                                       int end,
                                                                       OrderByComparator orderByComparator)
                              throws SystemException
Throws:
SystemException - if a system exception occurred

getPermissionRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getPermissionRolesCount(long permissionId)
                            throws SystemException
Throws:
SystemException - if a system exception occurred

hasPermissionRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasPermissionRole(long permissionId,
                                                                   long roleId)
                          throws SystemException
Throws:
SystemException - if a system exception occurred

hasPermissionRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasPermissionRoles(long permissionId)
                           throws SystemException
Throws:
SystemException - if a system exception occurred

setPermissionRoles

void setPermissionRoles(long permissionId,
                        long[] roleIds)
                        throws SystemException
Throws:
SystemException - if a system exception occurred

addUserRole

void addUserRole(long userId,
                 long roleId)
                 throws SystemException
Throws:
SystemException - if a system exception occurred

addUserRole

void addUserRole(long userId,
                 Role role)
                 throws SystemException
Throws:
SystemException - if a system exception occurred

addUserRoles

void addUserRoles(long userId,
                  long[] roleIds)
                  throws PortalException,
                         SystemException
Throws:
PortalException
SystemException - if a system exception occurred

addUserRoles

void addUserRoles(long userId,
                  List<Role> Roles)
                  throws PortalException,
                         SystemException
Throws:
PortalException
SystemException - if a system exception occurred

clearUserRoles

void clearUserRoles(long userId)
                    throws SystemException
Throws:
SystemException - if a system exception occurred

deleteUserRole

void deleteUserRole(long userId,
                    long roleId)
                    throws SystemException
Throws:
SystemException - if a system exception occurred

deleteUserRole

void deleteUserRole(long userId,
                    Role role)
                    throws SystemException
Throws:
SystemException - if a system exception occurred

deleteUserRoles

void deleteUserRoles(long userId,
                     long[] roleIds)
                     throws SystemException
Throws:
SystemException - if a system exception occurred

deleteUserRoles

void deleteUserRoles(long userId,
                     List<Role> Roles)
                     throws SystemException
Throws:
SystemException - if a system exception occurred

getUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRoles(long userId)
                        throws SystemException
Throws:
SystemException - if a system exception occurred

getUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRoles(long userId,
                                                                 int start,
                                                                 int end)
                        throws SystemException
Throws:
SystemException - if a system exception occurred

getUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRoles(long userId,
                                                                 int start,
                                                                 int end,
                                                                 OrderByComparator orderByComparator)
                        throws SystemException
Throws:
SystemException - if a system exception occurred

getUserRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getUserRolesCount(long userId)
                      throws SystemException
Throws:
SystemException - if a system exception occurred

hasUserRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRole(long userId,
                                                             long roleId)
                    throws SystemException
Throws:
SystemException - if a system exception occurred

hasUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRoles(long userId)
                     throws SystemException
Throws:
SystemException - if a system exception occurred

setUserRoles

void setUserRoles(long userId,
                  long[] roleIds)
                  throws PortalException,
                         SystemException
Throws:
PortalException
SystemException - if a system exception occurred

getBeanIdentifier

String getBeanIdentifier()
Returns the Spring bean ID for this bean.

Returns:
the Spring bean ID for this bean

setBeanIdentifier

void setBeanIdentifier(String beanIdentifier)
Sets the Spring bean ID for this bean.

Parameters:
beanIdentifier - the Spring bean ID for this bean

addRole

Role addRole(long userId,
             long companyId,
             String name,
             Map<Locale,String> titleMap,
             Map<Locale,String> descriptionMap,
             int type)
             throws PortalException,
                    SystemException
Deprecated. addRole(long, String, long, String, Map, Map, int, String)

Adds a role. The user is reindexed after role is added.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
name - the role's name
titleMap - the role's localized titles (optionally null)
descriptionMap - the role's localized descriptions (optionally null)
type - the role's type (optionally 0)
Returns:
the role
Throws:
PortalException - if the class name or the role name were invalid, if the role is a duplicate, or if a user with the primary key could not be found
SystemException - if a system exception occurred

addRole

Role addRole(long userId,
             long companyId,
             String name,
             Map<Locale,String> titleMap,
             Map<Locale,String> descriptionMap,
             int type,
             String className,
             long classPK)
             throws PortalException,
                    SystemException
Deprecated. addRole(long, String, long, String, Map, Map, int, String)

Adds a role with additional parameters. The user is reindexed after role is added.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
name - the role's name
titleMap - the role's localized titles (optionally null)
descriptionMap - the role's localized descriptions (optionally null)
type - the role's type (optionally 0)
className - the name of the class for which the role is created (optionally null)
classPK - the primary key of the class for which the role is created (optionally 0)
Returns:
the role
Throws:
PortalException - if the class name or the role name were invalid, if the role is a duplicate, or if a user with the primary key could not be found
SystemException - if a system exception occurred

addRole

Role addRole(long userId,
             String className,
             long classPK,
             String name,
             Map<Locale,String> titleMap,
             Map<Locale,String> descriptionMap,
             int type,
             String subType)
             throws PortalException,
                    SystemException
Adds a role with additional parameters. The user is reindexed after role is added.

Parameters:
userId - the primary key of the user
className - the name of the class for which the role is created (optionally null)
classPK - the primary key of the class for which the role is created (optionally 0)
name - the role's name
titleMap - the role's localized titles (optionally null)
descriptionMap - the role's localized descriptions (optionally null)
type - the role's type (optionally 0)
subType - the role's subtype (optionally null)
Returns:
the role
Throws:
PortalException - if the class name or the role name were invalid, if the role is a duplicate, or if a user with the primary key could not be found
SystemException - if a system exception occurred

checkSystemRoles

void checkSystemRoles()
                      throws PortalException,
                             SystemException
Checks to ensure that the system roles map has appropriate default roles in each company.

Throws:
PortalException - if the current user did not have permission to set applicable permissions on a role
SystemException - if a system exception occurred

checkSystemRoles

void checkSystemRoles(long companyId)
                      throws PortalException,
                             SystemException
Checks to ensure that the system roles map has appropriate default roles in the company.

Parameters:
companyId - the primary key of the company
Throws:
PortalException - if the current user did not have permission to set applicable permissions on a role
SystemException - if a system exception occurred

fetchRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role fetchRole(long companyId,
                                                        String name)
               throws SystemException
Returns the role with the name in the company.

The method searches the system roles map first for default roles. If a role with the name is not found, then the method will query the database.

Parameters:
companyId - the primary key of the company
name - the role's name
Returns:
Returns the role with the name or null if a role with the name could not be found in the company
Throws:
SystemException - if a system exception occurred

getDefaultGroupRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getDefaultGroupRole(long groupId)
                         throws PortalException,
                                SystemException
Returns the default role for the group with the primary key.

If the group is a site, then the default role is RoleConstants.SITE_MEMBER. If the group is an organization, then the default role is RoleConstants.ORGANIZATION_USER. If the group is a user or user group, then the default role is RoleConstants.POWER_USER. For all other group types, the default role is RoleConstants.USER.

Parameters:
groupId - the primary key of the group
Returns:
the default role for the group with the primary key
Throws:
PortalException - if a group with the primary key could not be found, or if a default role could not be found for the group
SystemException - if a system exception occurred

getResourceBlockRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getResourceBlockRoles(long resourceBlockId,
                                                                          String className,
                                                                          String actionId)
                                 throws SystemException
Throws:
SystemException

getResourceRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Map<String,List<String>> getResourceRoles(long companyId,
                                                                                   String name,
                                                                                   int scope,
                                                                                   String primKey)
                                          throws SystemException
Returns a map of role names to associated action IDs for the named resource in the company within the permission scope.

Parameters:
companyId - the primary key of the company
name - the resource name
scope - the permission scope
primKey - the primary key of the resource's class
Returns:
the role names and action IDs
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder.findByC_N_S_P( long, String, int, String)

getResourceRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getResourceRoles(long companyId,
                                                                     String name,
                                                                     int scope,
                                                                     String primKey,
                                                                     String actionId)
                            throws SystemException
Returns all the roles associated with the action ID in the company within the permission scope.

Parameters:
companyId - the primary key of the company
name - the resource name
scope - the permission scope
primKey - the primary key of the resource's class
actionId - the name of the resource action
Returns:
the roles
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder.findByC_N_S_P_A( long, String, int, String, String)

getRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getRole(long companyId,
                                                      String name)
             throws PortalException,
                    SystemException
Returns the role with the name in the company.

The method searches the system roles map first for default roles. If a role with the name is not found, then the method will query the database.

Parameters:
companyId - the primary key of the company
name - the role's name
Returns:
the role with the name
Throws:
PortalException - if a role with the name could not be found in the company
SystemException - if a system exception occurred

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(int type,
                                                             String subtype)
                    throws SystemException
Returns all the roles of the type and subtype.

Parameters:
type - the role's type (optionally 0)
subtype - the role's subtype (optionally null)
Returns:
the roles of the type and subtype
Throws:
SystemException - if a system exception occurred

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(long companyId)
                    throws SystemException
Returns all the roles in the company.

Parameters:
companyId - the primary key of the company
Returns:
the roles in the company
Throws:
SystemException - if a system exception occurred

getRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getRoles(long[] roleIds)
                    throws PortalException,
                           SystemException
Returns all the roles with the primary keys.

Parameters:
roleIds - the primary keys of the roles
Returns:
the roles with the primary keys
Throws:
PortalException - if any one of the roles with the primary keys could not be found
SystemException - if a system exception occurred

getSubtypeRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getSubtypeRoles(String subtype)
                           throws SystemException
Returns all the roles of the subtype.

Parameters:
subtype - the role's subtype (optionally null)
Returns:
the roles of the subtype
Throws:
SystemException - if a system exception occurred

getSubtypeRolesCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int getSubtypeRolesCount(String subtype)
                         throws SystemException
Returns the number of roles of the subtype.

Parameters:
subtype - the role's subtype (optionally null)
Returns:
the number of roles of the subtype
Throws:
SystemException - if a system exception occurred

getTeamRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role getTeamRole(long companyId,
                                                          long teamId)
                 throws PortalException,
                        SystemException
Returns the team role in the company.

Parameters:
companyId - the primary key of the company
teamId - the primary key of the team
Returns:
the team role in the company
Throws:
PortalException - if a role could not be found in the team and company
SystemException - if a system exception occurred

getUserGroupGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserGroupGroupRoles(long userId,
                                                                           long groupId)
                                  throws SystemException
Returns all the user's roles within the user group.

Parameters:
userId - the primary key of the user
groupId - the primary key of the group
Returns:
the user's roles within the user group
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder.findByUserGroupGroupRole( long, long)

getUserGroupRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserGroupRoles(long userId,
                                                                      long groupId)
                             throws SystemException
Returns all the user's roles within the user group.

Parameters:
userId - the primary key of the user
groupId - the primary key of the group
Returns:
the user's roles within the user group
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder.findByUserGroupRole( long, long)

getUserRelatedRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRelatedRoles(long userId,
                                                                        List<Group> groups)
                               throws SystemException
Returns the union of all the user's roles within the groups.

Parameters:
userId - the primary key of the user
groups - the groups (optionally null)
Returns:
the union of all the user's roles within the groups
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder.findByU_G( long, List)

getUserRelatedRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRelatedRoles(long userId,
                                                                        long groupId)
                               throws SystemException
Returns all the user's roles within the group.

Parameters:
userId - the primary key of the user
groupId - the primary key of the group
Returns:
the user's roles within the group
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder.findByU_G( long, long)

getUserRelatedRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> getUserRelatedRoles(long userId,
                                                                        long[] groupIds)
                               throws SystemException
Returns the union of all the user's roles within the groups.

Parameters:
userId - the primary key of the user
groupIds - the primary keys of the groups
Returns:
the union of all the user's roles within the groups
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder.findByU_G( long, long[])

hasUserRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRole(long userId,
                                                             long companyId,
                                                             String name,
                                                             boolean inherited)
                    throws PortalException,
                           SystemException
Returns true if the user is associated with the named regular role.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
name - the name of the role
inherited - whether to include the user's inherited roles in the search
Returns:
true if the user is associated with the regular role; false otherwise
Throws:
PortalException - if a role with the name could not be found in the company or if a default user for the company could not be found
SystemException - if a system exception occurred

hasUserRoles

@Transactional(propagation=SUPPORTS,
               readOnly=true)
boolean hasUserRoles(long userId,
                                                              long companyId,
                                                              String[] names,
                                                              boolean inherited)
                     throws PortalException,
                            SystemException
Returns true if the user has any one of the named regular roles.

Parameters:
userId - the primary key of the user
companyId - the primary key of the company
names - the names of the roles
inherited - whether to include the user's inherited roles in the search
Returns:
true if the user has any one of the regular roles; false otherwise
Throws:
PortalException - if any one of the roles with the names could not be found in the company or if the default user for the company could not be found
SystemException - if a system exception occurred

loadFetchRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role loadFetchRole(long companyId,
                                                            String name)
                   throws SystemException
Returns a role with the name in the company.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
Returns:
the role with the name, or null if a role with the name could not be found in the company
Throws:
SystemException - if a system exception occurred

loadGetRole

@Transactional(propagation=SUPPORTS,
               readOnly=true)
Role loadGetRole(long companyId,
                                                          String name)
                 throws PortalException,
                        SystemException
Returns a role with the name in the company.

Parameters:
companyId - the primary key of the company
name - the role's name
Returns:
the role with the name in the company
Throws:
PortalException - if a role with the name could not be found in the company
SystemException - if a system exception occurred

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String keywords,
                                                           Integer[] types,
                                                           int start,
                                                           int end,
                                                           OrderByComparator obc)
                  throws SystemException
Returns an ordered range of all the roles that match the keywords and types.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
start - the lower bound of the range of roles to return
end - the upper bound of the range of roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String keywords,
                                                           Integer[] types,
                                                           LinkedHashMap<String,Object> params,
                                                           int start,
                                                           int end,
                                                           OrderByComparator obc)
                  throws SystemException
Returns an ordered range of all the roles that match the keywords, types, and params.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
params - the finder parameters. Can specify values for "permissionsResourceId" and "usersRoles" keys. For more information, see RoleFinder
start - the lower bound of the range of roles to return
end - the upper bound of the range of roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String name,
                                                           String description,
                                                           Integer[] types,
                                                           int start,
                                                           int end,
                                                           OrderByComparator obc)
                  throws SystemException
Returns an ordered range of all the roles that match the name, description, and types.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
start - the lower bound of the range of the roles to return
end - the upper bound of the range of the roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder

search

@Transactional(propagation=SUPPORTS,
               readOnly=true)
List<Role> search(long companyId,
                                                           String name,
                                                           String description,
                                                           Integer[] types,
                                                           LinkedHashMap<String,Object> params,
                                                           int start,
                                                           int end,
                                                           OrderByComparator obc)
                  throws SystemException
Returns an ordered range of all the roles that match the name, description, types, and params.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
params - the finder's parameters. Can specify values for "permissionsResourceId" and "usersRoles" keys. For more information, see RoleFinder
start - the lower bound of the range of the roles to return
end - the upper bound of the range of the roles to return (not inclusive)
obc - the comparator to order the roles (optionally null)
Returns:
the ordered range of the matching roles, ordered by obc
Throws:
SystemException - if a system exception occurred
See Also:
RoleFinder

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String keywords,
                                                         Integer[] types)
                throws SystemException
Returns the number of roles that match the keywords and types.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
Returns:
the number of matching roles
Throws:
SystemException - if a system exception occurred

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String keywords,
                                                         Integer[] types,
                                                         LinkedHashMap<String,Object> params)
                throws SystemException
Returns the number of roles that match the keywords, types and params.

Parameters:
companyId - the primary key of the company
keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
types - the role types (optionally null)
params - the finder parameters. For more information, see RoleFinder
Returns:
the number of matching roles
Throws:
SystemException - if a system exception occurred

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String name,
                                                         String description,
                                                         Integer[] types)
                throws SystemException
Returns the number of roles that match the name, description, and types.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
Returns:
the number of matching roles
Throws:
SystemException - if a system exception occurred

searchCount

@Transactional(propagation=SUPPORTS,
               readOnly=true)
int searchCount(long companyId,
                                                         String name,
                                                         String description,
                                                         Integer[] types,
                                                         LinkedHashMap<String,Object> params)
                throws SystemException
Returns the number of roles that match the name, description, types, and params.

Parameters:
companyId - the primary key of the company
name - the role's name (optionally null)
description - the role's description (optionally null)
types - the role types (optionally null)
params - the finder parameters. Can specify values for "permissionsResourceId" and "usersRoles" keys. For more information, see RoleFinder
Returns:
the number of matching roles
Throws:
SystemException - if a system exception occurred

unsetUserRoles

void unsetUserRoles(long userId,
                    long[] roleIds)
                    throws PortalException,
                           SystemException
Removes the matching roles associated with the user. The user is reindexed after the roles are removed.

Parameters:
userId - the primary key of the user
roleIds - the primary keys of the roles
Throws:
PortalException - if a user with the primary key could not be found or if a role with any one of the primary keys could not be found
SystemException - if a system exception occurred

updateRole

Role updateRole(long roleId,
                String name,
                Map<Locale,String> titleMap,
                Map<Locale,String> descriptionMap,
                String subtype)
                throws PortalException,
                       SystemException
Updates the role with the primary key.

Parameters:
roleId - the primary key of the role
name - the role's new name
titleMap - the new localized titles (optionally null) to replace those existing for the role
descriptionMap - the new localized descriptions (optionally null) to replace those existing for the role
subtype - the role's new subtype (optionally null)
Returns:
the role with the primary key
Throws:
PortalException - if a role with the primary could not be found or if the role's name was invalid
SystemException - if a system exception occurred

Liferay 6.1.2-ce-ga3