public class UserFilterUtils extends Object
UserFilter
instances.Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Function<ProjectRole,Long> |
GET_ROLE_ID_FUNCTION |
Constructor and Description |
---|
UserFilterUtils() |
Modifier and Type | Method and Description |
---|---|
static Set<String> |
filterRemovedGroups(Set<String> groups,
Collection<com.atlassian.crowd.embedded.api.Group> allGroups) |
static UserFilter |
fromJson(JSONObject json) |
static UserFilter |
fromJsonString(String jsonString) |
static UserFilter |
getFilterWithoutRemovedGroupsAndRoles(UserFilter filter,
Collection<com.atlassian.crowd.embedded.api.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 |
public static final com.google.common.base.Function<ProjectRole,Long> GET_ROLE_ID_FUNCTION
public static UserFilter intersectGroups(UserFilter userFilter, Set<String> groups)
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.
userFilter
- the user filter to applied the intersection of groups. Will not be changedgroups
- a set of groups to be intersected with the filterpublic static JSONObject toJson(UserFilter userFilter, ProjectRoleManager projectRoleManager) throws JSONException
userFilter
to JSONObject
userFilter
- the user filter to be convertedprojectRoleManager
- optional, if provided, will be used to filter invalid project rolesJSONException
public static UserFilter fromJson(JSONObject json) throws JSONException
JSONException
public static UserFilter fromJsonString(String jsonString) throws JSONException
JSONException
public static UserFilter getFilterWithoutRemovedGroupsAndRoles(UserFilter filter, Collection<com.atlassian.crowd.embedded.api.Group> allGroups, ProjectRoleManager projectRoleManager)
public static Set<String> filterRemovedGroups(Set<String> groups, Collection<com.atlassian.crowd.embedded.api.Group> allGroups)
public static List<ProjectRole> getProjectRoles(ProjectRoleManager projectRoleManager, Set<Long> roleIds)
ProjectRole
objects sorted by role name.public static List<String> sortGroups(Collection<String> groups)
Copyright © 2002-2021 Atlassian. All Rights Reserved.