Liferay 6.1.2-ce-ga3

com.liferay.portal.service.impl
Class RoleLocalServiceImpl

java.lang.Object
  extended by com.liferay.portal.service.BaseLocalServiceImpl
      extended by com.liferay.portal.service.base.RoleLocalServiceBaseImpl
          extended by com.liferay.portal.service.impl.RoleLocalServiceImpl
All Implemented Interfaces:
IdentifiableBean, BaseLocalService, PersistedModelLocalService, RoleLocalService

public class RoleLocalServiceImpl
extends RoleLocalServiceBaseImpl

The implementation of the role local service.


Field Summary
 
Fields inherited from class com.liferay.portal.service.base.RoleLocalServiceBaseImpl
accountLocalService, accountPersistence, accountService, addressLocalService, addressPersistence, addressService, browserTrackerLocalService, browserTrackerPersistence, classNameLocalService, classNamePersistence, classNameService, clusterGroupLocalService, clusterGroupPersistence, cmisRepositoryLocalService, companyLocalService, companyPersistence, companyService, contactLocalService, contactPersistence, contactService, counterLocalService, countryPersistence, countryService, emailAddressLocalService, emailAddressPersistence, emailAddressService, groupFinder, groupLocalService, groupPersistence, groupService, imageLocalService, imagePersistence, imageService, layoutBranchLocalService, layoutBranchPersistence, layoutBranchService, layoutFinder, layoutLocalService, layoutPersistence, layoutPrototypeLocalService, layoutPrototypePersistence, layoutPrototypeService, layoutRevisionLocalService, layoutRevisionPersistence, layoutRevisionService, layoutService, layoutSetBranchLocalService, layoutSetBranchPersistence, layoutSetBranchService, layoutSetLocalService, layoutSetPersistence, layoutSetPrototypeLocalService, layoutSetPrototypePersistence, layoutSetPrototypeService, layoutSetService, layoutTemplateLocalService, listTypePersistence, listTypeService, lockFinder, lockLocalService, lockPersistence, membershipRequestLocalService, membershipRequestPersistence, membershipRequestService, organizationFinder, organizationLocalService, organizationPersistence, organizationService, orgGroupPermissionFinder, orgGroupPermissionPersistence, orgGroupRolePersistence, orgLaborLocalService, orgLaborPersistence, orgLaborService, passwordPolicyFinder, passwordPolicyLocalService, passwordPolicyPersistence, passwordPolicyRelLocalService, passwordPolicyRelPersistence, passwordPolicyService, passwordTrackerLocalService, passwordTrackerPersistence, permissionFinder, permissionLocalService, permissionPersistence, permissionService, persistedModelLocalServiceRegistry, phoneLocalService, phonePersistence, phoneService, pluginSettingLocalService, pluginSettingPersistence, pluginSettingService, portalLocalService, portalPreferencesLocalService, portalPreferencesPersistence, portalService, portletItemLocalService, portletItemPersistence, portletLocalService, portletPersistence, portletPreferencesFinder, portletPreferencesLocalService, portletPreferencesPersistence, portletPreferencesService, portletService, quartzLocalService, regionPersistence, regionService, releaseLocalService, releasePersistence, repositoryEntryLocalService, repositoryEntryPersistence, repositoryLocalService, repositoryPersistence, repositoryService, resourceActionLocalService, resourceActionPersistence, resourceBlockFinder, resourceBlockLocalService, resourceBlockPermissionLocalService, resourceBlockPermissionPersistence, resourceBlockPersistence, resourceBlockService, resourceCodeLocalService, resourceCodePersistence, resourceFinder, resourceLocalService, resourcePermissionFinder, resourcePermissionLocalService, resourcePermissionPersistence, resourcePermissionService, resourcePersistence, resourceService, resourceTypePermissionFinder, resourceTypePermissionLocalService, resourceTypePermissionPersistence, roleFinder, roleLocalService, rolePersistence, roleService, serviceComponentLocalService, serviceComponentPersistence, shardLocalService, shardPersistence, subscriptionLocalService, subscriptionPersistence, teamFinder, teamLocalService, teamPersistence, teamService, themeLocalService, themeService, ticketLocalService, ticketPersistence, userFinder, userGroupFinder, userGroupGroupRoleLocalService, userGroupGroupRolePersistence, userGroupGroupRoleService, userGroupLocalService, userGroupPersistence, userGroupRoleFinder, userGroupRoleLocalService, userGroupRolePersistence, userGroupRoleService, userGroupService, userIdMapperLocalService, userIdMapperPersistence, userLocalService, userNotificationEventLocalService, userNotificationEventPersistence, userPersistence, userService, userTrackerLocalService, userTrackerPathLocalService, userTrackerPathPersistence, userTrackerPersistence, virtualHostLocalService, virtualHostPersistence, webDAVPropsLocalService, webDAVPropsPersistence, websiteLocalService, websitePersistence, websiteService, workflowDefinitionLinkLocalService, workflowDefinitionLinkPersistence, workflowInstanceLinkLocalService, workflowInstanceLinkPersistence
 
Constructor Summary
RoleLocalServiceImpl()
           
 
Method Summary
 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.
 void addUserRoles(long userId, long[] roleIds)
          Adds the roles to the user.
protected  void checkSystemRole(long companyId, String name, Map<Locale,String> descriptionMap, int type)
           
 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.
 Role deleteRole(long roleId)
          Deletes the role with the primary key and its associated permissions.
 Role deleteRole(Role role)
          Deletes the role and its associated permissions.
 Role fetchRole(long companyId, String name)
          Returns the role with the name in the company.
protected  String[] getDefaultControlPanelPortlets()
           
 Role getDefaultGroupRole(long groupId)
          Returns the default role for the group with the primary key.
 List<Role> getGroupRoles(long groupId)
          Returns all the roles associated with the group.
 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 companyId, String name)
          Returns the role with the name in the company.
 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.
 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)
          Returns all the roles associated with the user.
 boolean hasUserRole(long userId, long roleId)
          Returns true if the user is associated with the role.
 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, long companyId, String[] names, boolean inherited)
          Returns true if the user has any one of the named regular roles.
protected  void initPersonalControlPanelPortletsPermissions(Role role)
           
 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.
protected  void setRolePermissions(Role role, String name, String[] actionIds)
           
 void setUserRoles(long userId, long[] roleIds)
          Sets the roles associated with the user, replacing the user's existing roles.
 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.
protected  void validate(long roleId, long companyId, long classNameId, String name)
           
 
Methods inherited from class com.liferay.portal.service.base.RoleLocalServiceBaseImpl
addGroupRole, addGroupRole, addGroupRoles, addGroupRoles, addPermissionRole, addPermissionRole, addPermissionRoles, addPermissionRoles, addRole, addUserRole, addUserRole, addUserRoles, afterPropertiesSet, clearGroupRoles, clearPermissionRoles, clearUserRoles, createRole, deleteGroupRole, deleteGroupRole, deleteGroupRoles, deleteGroupRoles, deletePermissionRole, deletePermissionRole, deletePermissionRoles, deletePermissionRoles, deleteUserRole, deleteUserRole, deleteUserRoles, deleteUserRoles, destroy, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, fetchRole, getAccountLocalService, getAccountPersistence, getAccountService, getAddressLocalService, getAddressPersistence, getAddressService, getBeanIdentifier, getBrowserTrackerLocalService, getBrowserTrackerPersistence, getClassNameLocalService, getClassNamePersistence, getClassNameService, getClusterGroupLocalService, getClusterGroupPersistence, getCMISRepositoryLocalService, getCompanyLocalService, getCompanyPersistence, getCompanyService, getContactLocalService, getContactPersistence, getContactService, getCounterLocalService, getCountryPersistence, getCountryService, getEmailAddressLocalService, getEmailAddressPersistence, getEmailAddressService, getGroupFinder, getGroupLocalService, getGroupPersistence, getGroupRoles, getGroupRoles, getGroupRolesCount, getGroupService, getImageLocalService, getImagePersistence, getImageService, getLayoutBranchLocalService, getLayoutBranchPersistence, getLayoutBranchService, getLayoutFinder, getLayoutLocalService, getLayoutPersistence, getLayoutPrototypeLocalService, getLayoutPrototypePersistence, getLayoutPrototypeService, getLayoutRevisionLocalService, getLayoutRevisionPersistence, getLayoutRevisionService, getLayoutService, getLayoutSetBranchLocalService, getLayoutSetBranchPersistence, getLayoutSetBranchService, getLayoutSetLocalService, getLayoutSetPersistence, getLayoutSetPrototypeLocalService, getLayoutSetPrototypePersistence, getLayoutSetPrototypeService, getLayoutSetService, getLayoutTemplateLocalService, getListTypePersistence, getListTypeService, getLockFinder, getLockLocalService, getLockPersistence, getMembershipRequestLocalService, getMembershipRequestPersistence, getMembershipRequestService, getModelClass, getModelClassName, getOrganizationFinder, getOrganizationLocalService, getOrganizationPersistence, getOrganizationService, getOrgGroupPermissionFinder, getOrgGroupPermissionPersistence, getOrgGroupRolePersistence, getOrgLaborLocalService, getOrgLaborPersistence, getOrgLaborService, getPasswordPolicyFinder, getPasswordPolicyLocalService, getPasswordPolicyPersistence, getPasswordPolicyRelLocalService, getPasswordPolicyRelPersistence, getPasswordPolicyService, getPasswordTrackerLocalService, getPasswordTrackerPersistence, getPermissionFinder, getPermissionLocalService, getPermissionPersistence, getPermissionRoles, getPermissionRoles, getPermissionRoles, getPermissionRolesCount, getPermissionService, getPersistedModel, getPhoneLocalService, getPhonePersistence, getPhoneService, getPluginSettingLocalService, getPluginSettingPersistence, getPluginSettingService, getPortalLocalService, getPortalPreferencesLocalService, getPortalPreferencesPersistence, getPortalService, getPortletItemLocalService, getPortletItemPersistence, getPortletLocalService, getPortletPersistence, getPortletPreferencesFinder, getPortletPreferencesLocalService, getPortletPreferencesPersistence, getPortletPreferencesService, getPortletService, getQuartzLocalService, getRegionPersistence, getRegionService, getReleaseLocalService, getReleasePersistence, getRepositoryEntryLocalService, getRepositoryEntryPersistence, getRepositoryLocalService, getRepositoryPersistence, getRepositoryService, getResourceActionLocalService, getResourceActionPersistence, getResourceBlockFinder, getResourceBlockLocalService, getResourceBlockPermissionLocalService, getResourceBlockPermissionPersistence, getResourceBlockPersistence, getResourceBlockService, getResourceCodeLocalService, getResourceCodePersistence, getResourceFinder, getResourceLocalService, getResourcePermissionFinder, getResourcePermissionLocalService, getResourcePermissionPersistence, getResourcePermissionService, getResourcePersistence, getResourceService, getResourceTypePermissionFinder, getResourceTypePermissionLocalService, getResourceTypePermissionPersistence, getRole, getRoleFinder, getRoleLocalService, getRolePersistence, getRoles, getRolesCount, getRoleService, getServiceComponentLocalService, getServiceComponentPersistence, getShardLocalService, getShardPersistence, getSubscriptionLocalService, getSubscriptionPersistence, getTeamFinder, getTeamLocalService, getTeamPersistence, getTeamService, getThemeLocalService, getThemeService, getTicketLocalService, getTicketPersistence, getUserFinder, getUserGroupFinder, getUserGroupGroupRoleLocalService, getUserGroupGroupRolePersistence, getUserGroupGroupRoleService, getUserGroupLocalService, getUserGroupPersistence, getUserGroupRoleFinder, getUserGroupRoleLocalService, getUserGroupRolePersistence, getUserGroupRoleService, getUserGroupService, getUserIdMapperLocalService, getUserIdMapperPersistence, getUserLocalService, getUserNotificationEventLocalService, getUserNotificationEventPersistence, getUserPersistence, getUserRoles, getUserRoles, getUserRolesCount, getUserService, getUserTrackerLocalService, getUserTrackerPathLocalService, getUserTrackerPathPersistence, getUserTrackerPersistence, getVirtualHostLocalService, getVirtualHostPersistence, getWebDAVPropsLocalService, getWebDAVPropsPersistence, getWebsiteLocalService, getWebsitePersistence, getWebsiteService, getWorkflowDefinitionLinkLocalService, getWorkflowDefinitionLinkPersistence, getWorkflowInstanceLinkLocalService, getWorkflowInstanceLinkPersistence, hasGroupRole, hasGroupRoles, hasPermissionRole, hasPermissionRoles, hasUserRoles, runSQL, setAccountLocalService, setAccountPersistence, setAccountService, setAddressLocalService, setAddressPersistence, setAddressService, setBeanIdentifier, setBrowserTrackerLocalService, setBrowserTrackerPersistence, setClassNameLocalService, setClassNamePersistence, setClassNameService, setClusterGroupLocalService, setClusterGroupPersistence, setCMISRepositoryLocalService, setCompanyLocalService, setCompanyPersistence, setCompanyService, setContactLocalService, setContactPersistence, setContactService, setCounterLocalService, setCountryPersistence, setCountryService, setEmailAddressLocalService, setEmailAddressPersistence, setEmailAddressService, setGroupFinder, setGroupLocalService, setGroupPersistence, setGroupRoles, setGroupService, setImageLocalService, setImagePersistence, setImageService, setLayoutBranchLocalService, setLayoutBranchPersistence, setLayoutBranchService, setLayoutFinder, setLayoutLocalService, setLayoutPersistence, setLayoutPrototypeLocalService, setLayoutPrototypePersistence, setLayoutPrototypeService, setLayoutRevisionLocalService, setLayoutRevisionPersistence, setLayoutRevisionService, setLayoutService, setLayoutSetBranchLocalService, setLayoutSetBranchPersistence, setLayoutSetBranchService, setLayoutSetLocalService, setLayoutSetPersistence, setLayoutSetPrototypeLocalService, setLayoutSetPrototypePersistence, setLayoutSetPrototypeService, setLayoutSetService, setLayoutTemplateLocalService, setListTypePersistence, setListTypeService, setLockFinder, setLockLocalService, setLockPersistence, setMembershipRequestLocalService, setMembershipRequestPersistence, setMembershipRequestService, setOrganizationFinder, setOrganizationLocalService, setOrganizationPersistence, setOrganizationService, setOrgGroupPermissionFinder, setOrgGroupPermissionPersistence, setOrgGroupRolePersistence, setOrgLaborLocalService, setOrgLaborPersistence, setOrgLaborService, setPasswordPolicyFinder, setPasswordPolicyLocalService, setPasswordPolicyPersistence, setPasswordPolicyRelLocalService, setPasswordPolicyRelPersistence, setPasswordPolicyService, setPasswordTrackerLocalService, setPasswordTrackerPersistence, setPermissionFinder, setPermissionLocalService, setPermissionPersistence, setPermissionRoles, setPermissionService, setPhoneLocalService, setPhonePersistence, setPhoneService, setPluginSettingLocalService, setPluginSettingPersistence, setPluginSettingService, setPortalLocalService, setPortalPreferencesLocalService, setPortalPreferencesPersistence, setPortalService, setPortletItemLocalService, setPortletItemPersistence, setPortletLocalService, setPortletPersistence, setPortletPreferencesFinder, setPortletPreferencesLocalService, setPortletPreferencesPersistence, setPortletPreferencesService, setPortletService, setQuartzLocalService, setRegionPersistence, setRegionService, setReleaseLocalService, setReleasePersistence, setRepositoryEntryLocalService, setRepositoryEntryPersistence, setRepositoryLocalService, setRepositoryPersistence, setRepositoryService, setResourceActionLocalService, setResourceActionPersistence, setResourceBlockFinder, setResourceBlockLocalService, setResourceBlockPermissionLocalService, setResourceBlockPermissionPersistence, setResourceBlockPersistence, setResourceBlockService, setResourceCodeLocalService, setResourceCodePersistence, setResourceFinder, setResourceLocalService, setResourcePermissionFinder, setResourcePermissionLocalService, setResourcePermissionPersistence, setResourcePermissionService, setResourcePersistence, setResourceService, setResourceTypePermissionFinder, setResourceTypePermissionLocalService, setResourceTypePermissionPersistence, setRoleFinder, setRoleLocalService, setRolePersistence, setRoleService, setServiceComponentLocalService, setServiceComponentPersistence, setShardLocalService, setShardPersistence, setSubscriptionLocalService, setSubscriptionPersistence, setTeamFinder, setTeamLocalService, setTeamPersistence, setTeamService, setThemeLocalService, setThemeService, setTicketLocalService, setTicketPersistence, setUserFinder, setUserGroupFinder, setUserGroupGroupRoleLocalService, setUserGroupGroupRolePersistence, setUserGroupGroupRoleService, setUserGroupLocalService, setUserGroupPersistence, setUserGroupRoleFinder, setUserGroupRoleLocalService, setUserGroupRolePersistence, setUserGroupRoleService, setUserGroupService, setUserIdMapperLocalService, setUserIdMapperPersistence, setUserLocalService, setUserNotificationEventLocalService, setUserNotificationEventPersistence, setUserPersistence, setUserService, setUserTrackerLocalService, setUserTrackerPathLocalService, setUserTrackerPathPersistence, setUserTrackerPersistence, setVirtualHostLocalService, setVirtualHostPersistence, setWebDAVPropsLocalService, setWebDAVPropsPersistence, setWebsiteLocalService, setWebsitePersistence, setWebsiteService, setWorkflowDefinitionLinkLocalService, setWorkflowDefinitionLinkPersistence, setWorkflowInstanceLinkLocalService, setWorkflowInstanceLinkPersistence, updateRole, updateRole
 
Methods inherited from class com.liferay.portal.service.BaseLocalServiceImpl
getClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoleLocalServiceImpl

public RoleLocalServiceImpl()
Method Detail

addRole

public 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

public 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

public 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

addUserRoles

public void addUserRoles(long userId,
                         long[] roleIds)
                  throws PortalException,
                         SystemException
Adds the roles to the user. The user is reindexed after the roles are added.

Specified by:
addUserRoles in interface RoleLocalService
Overrides:
addUserRoles in class RoleLocalServiceBaseImpl
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
SystemException - if a system exception occurred
See Also:
UserPersistence.addRoles( long, long[])

checkSystemRoles

public 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

@Transactional(propagation=SUPPORTS,
               readOnly=true)
public 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

deleteRole

public Role deleteRole(long roleId)
                throws PortalException,
                       SystemException
Deletes the role with the primary key and its associated permissions.

Specified by:
deleteRole in interface RoleLocalService
Overrides:
deleteRole in class RoleLocalServiceBaseImpl
Parameters:
roleId - the primary key of the role
Returns:
the deleted role
Throws:
PortalException - if a role with the primary key could not be found, if the role is a default system role, or if the role's resource could not be found
SystemException - if a system exception occurred

deleteRole

public Role deleteRole(Role role)
                throws PortalException,
                       SystemException
Deletes the role and its associated permissions.

Specified by:
deleteRole in interface RoleLocalService
Overrides:
deleteRole in class RoleLocalServiceBaseImpl
Parameters:
role - the role
Returns:
the deleted role
Throws:
PortalException - if the role is a default system role or if the role's resource could not be found
SystemException - if a system exception occurred

fetchRole

@Skip
public 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

public 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

getGroupRoles

public List<Role> getGroupRoles(long groupId)
                         throws SystemException
Returns all the roles associated with the group.

Specified by:
getGroupRoles in interface RoleLocalService
Overrides:
getGroupRoles in class RoleLocalServiceBaseImpl
Parameters:
groupId - the primary key of the group
Returns:
the roles associated with the group
Throws:
SystemException - if a system exception occurred

getResourceBlockRoles

public List<Role> getResourceBlockRoles(long resourceBlockId,
                                        String className,
                                        String actionId)
                                 throws SystemException
Throws:
SystemException

getResourceRoles

public 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

public 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

@Skip
public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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[])

getUserRoles

public List<Role> getUserRoles(long userId)
                        throws SystemException
Returns all the roles associated with the user.

Specified by:
getUserRoles in interface RoleLocalService
Overrides:
getUserRoles in class RoleLocalServiceBaseImpl
Parameters:
userId - the primary key of the user
Returns:
the roles associated with the user
Throws:
SystemException - if a system exception occurred

hasUserRole

public boolean hasUserRole(long userId,
                           long roleId)
                    throws SystemException
Returns true if the user is associated with the role.

Specified by:
hasUserRole in interface RoleLocalService
Overrides:
hasUserRole in class RoleLocalServiceBaseImpl
Parameters:
userId - the primary key of the user
roleId - the primary key of the role
Returns:
true if the user is associated with the role; false otherwise
Throws:
SystemException - if a system exception occurred

hasUserRole

@ThreadLocalCachable
public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

setUserRoles

public void setUserRoles(long userId,
                         long[] roleIds)
                  throws PortalException,
                         SystemException
Sets the roles associated with the user, replacing the user's existing roles. The user is reindexed after the roles are set.

Specified by:
setUserRoles in interface RoleLocalService
Overrides:
setUserRoles in class RoleLocalServiceBaseImpl
Parameters:
userId - the primary key of the user
roleIds - the primary keys of the roles
Throws:
PortalException - if a user with the primary could not be found or if any one of the roles with the primary keys could not be found
SystemException - if a system exception occurred

unsetUserRoles

public 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

public 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

checkSystemRole

protected void checkSystemRole(long companyId,
                               String name,
                               Map<Locale,String> descriptionMap,
                               int type)
                        throws PortalException,
                               SystemException
Throws:
PortalException
SystemException

getDefaultControlPanelPortlets

protected String[] getDefaultControlPanelPortlets()

initPersonalControlPanelPortletsPermissions

protected void initPersonalControlPanelPortletsPermissions(Role role)
                                                    throws PortalException,
                                                           SystemException
Throws:
PortalException
SystemException

setRolePermissions

protected void setRolePermissions(Role role,
                                  String name,
                                  String[] actionIds)
                           throws PortalException,
                                  SystemException
Throws:
PortalException
SystemException

validate

protected void validate(long roleId,
                        long companyId,
                        long classNameId,
                        String name)
                 throws PortalException,
                        SystemException
Throws:
PortalException
SystemException

Liferay 6.1.2-ce-ga3