Class ConversionUtils

java.lang.Object
com.atlassian.crowd.embedded.core.util.ConversionUtils

public class ConversionUtils extends Object
Utility class for converting between model objects and embedded/application objects.
  • Method Details

    • toEmbeddedGroup

      public static Group toEmbeddedGroup(Group modelGroup)
      Converts a directory-specific model group into a directory-agnostic embedded/application group.
      Parameters:
      modelGroup - model group.
      Returns:
      immutable clone meeting the minimum requirements for an embedded/application group.
    • toEmbeddedGroupWithAttributes

      public static GroupWithAttributes toEmbeddedGroupWithAttributes(GroupWithAttributes modelGroup)
      Converts a directory-specific model group (with attributes) into a directory-agnostic embedded/application group (with attributes).
      Parameters:
      modelGroup - model group with attributes.
      Returns:
      immutable clone meeting the minimum requirements for an embedded/application group with attributes.
    • toEmbeddedGroups

      public static List<Group> toEmbeddedGroups(List<Group> modelGroups)
      Converts a directory-specific model groups into a directory-agnostic embedded/application groups.
      Parameters:
      modelGroups - model groups.
      Returns:
      immutable clones meeting the minimum requirements for an embedded/application group.
    • getEmbeddedGroup

      public static Group getEmbeddedGroup(InvalidGroupException ex)
      Extracts a directory-specific model group from the given InvalidGroupException and converts it into a directory-agnostic embedded/application group.

      This is normally used to construct an embedded InvalidGroupException

      Parameters:
      ex - the InvalidGroupException
      Returns:
      embedded/application group.
    • toModelUserQuery

      public static UserQuery<User> toModelUserQuery(UserQuery embeddedQuery)
      Parameters:
      embeddedQuery - query expected to return an embedded user.
      Returns:
      equivalent query with the return type set to model users.
    • toModelGroupQuery

      public static GroupQuery<Group> toModelGroupQuery(GroupQuery embeddedQuery)
      Parameters:
      embeddedQuery - query expected to return an embedded group.
      Returns:
      equivalent query with the return type set to model groups.
    • toModelUserMembershipQuery

      public static MembershipQuery<User> toModelUserMembershipQuery(MembershipQuery embeddedQuery)
      Parameters:
      embeddedQuery - query expected to return an embedded user.
      Returns:
      equivalent query with the return type set to model users.
    • toModelGroupMembershipQuery

      public static MembershipQuery<Group> toModelGroupMembershipQuery(MembershipQuery embeddedQuery)
      Parameters:
      embeddedQuery - query expected to return an embedded group.
      Returns:
      equivalent query with the return type set to model groups.
    • toEmbeddedUsers

      public static List<User> toEmbeddedUsers(List<User> modelUsers)
      Converts a list of model Users to a list of embedded Users.
      Parameters:
      modelUsers - a list of model Users.
      Returns:
      equivalent list of embedded Users