Example usage for com.liferay.portal.kernel.service RoleLocalServiceUtil getTeamRoleMap

List of usage examples for com.liferay.portal.kernel.service RoleLocalServiceUtil getTeamRoleMap

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service RoleLocalServiceUtil getTeamRoleMap.

Prototype

public static java.util.Map<com.liferay.portal.kernel.model.Team, com.liferay.portal.kernel.model.Role> getTeamRoleMap(
        long groupId) throws com.liferay.portal.kernel.exception.PortalException 

Source Link

Document

Returns the team role map for the group.

Usage

From source file:com.liferay.exportimport.lar.LayoutCache.java

License:Open Source License

protected List<Role> getGroupRoles(long groupId, String resourceName) throws PortalException {

    List<Role> roles = groupRolesMap.get(groupId);

    if (roles != null) {
        return roles;
    }// w  w w .j  a va2 s. c om

    Group group = GroupLocalServiceUtil.getGroup(groupId);

    roles = ListUtil.copy(ResourceActionsUtil.getRoles(group.getCompanyId(), group, resourceName, null));

    Map<Team, Role> teamRoleMap = RoleLocalServiceUtil.getTeamRoleMap(groupId);

    for (Map.Entry<Team, Role> entry : teamRoleMap.entrySet()) {
        Team team = entry.getKey();
        Role teamRole = entry.getValue();

        teamRole.setName(ExportImportPermissionUtil.getTeamRoleName(team.getName()));
        teamRole.setDescription(team.getDescription());

        roles.add(teamRole);
    }

    groupRolesMap.put(groupId, roles);

    return roles;
}