public class

UserFilterUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.user.UserFilterUtils

Class Overview

Some utility functions for dealing with UserFilter instances.

Summary

Fields
public static final Function<ProjectRoleLong> GET_ROLE_ID_FUNCTION
Public Constructors
UserFilterUtils()
Public Methods
static Set<String> filterRemovedGroups(Set<String> groups, Collection<Group> allGroups)
static UserFilter fromJson(JSONObject json)
static UserFilter fromJsonString(String jsonString)
static UserFilter getFilterWithoutRemovedGroupsAndRoles(UserFilter filter, Collection<Group> allGroups, ProjectRoleManager projectRoleManager)
static List<ProjectRole> getProjectRoles(ProjectRoleManager projectRoleManager, Set<Long> roleIds)
Get the ProjectRole objects sorted by role name.
static UserFilter intersectGroups(UserFilter userFilter, Set<String> groups)
Intersect the groups of the userFilter with groups.
static List<String> sortGroups(Collection<String> groups)
static JSONObject toJson(UserFilter userFilter, ProjectRoleManager projectRoleManager)
Convert the userFilter to JSONObject
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final Function<ProjectRoleLong> GET_ROLE_ID_FUNCTION

Public Constructors

public UserFilterUtils ()

Public Methods

public static Set<String> filterRemovedGroups (Set<String> groups, Collection<Group> allGroups)

public static UserFilter fromJson (JSONObject json)

Throws
JSONException

public static UserFilter fromJsonString (String jsonString)

Throws
JSONException

public static UserFilter getFilterWithoutRemovedGroupsAndRoles (UserFilter filter, Collection<Group> allGroups, ProjectRoleManager projectRoleManager)

public static List<ProjectRole> getProjectRoles (ProjectRoleManager projectRoleManager, Set<Long> roleIds)

Get the ProjectRole objects sorted by role name.

public static UserFilter intersectGroups (UserFilter userFilter, Set<String> groups)

Intersect the groups of the userFilter with groups.

If the filter is disabled and groups is not empty, a new filter that's enabled and with the groups will be returned.

If the filter is enabled, its groups will be intersected with the incoming one and a new filter with the intersection will be returned.

Parameters
userFilter the user filter to applied the intersection of groups. Will not be changed
groups a set of groups to be intersected with the filter
Returns
  • the updated filter or the original one, if no changes.

public static List<String> sortGroups (Collection<String> groups)

public static JSONObject toJson (UserFilter userFilter, ProjectRoleManager projectRoleManager)

Convert the userFilter to JSONObject

Parameters
userFilter the user filter to be converted
projectRoleManager optional, if provided, will be used to filter invalid project roles
Throws
JSONException