Class UserMultiProvider

    • Constructor Detail

      • UserMultiProvider

        public UserMultiProvider()
    • Method Detail

      • instantiate

        public static UserProvider instantiate​(String propertyName)
        Instantiates a UserProvider based on a property value (that is expected to be a class name). When the property is not set, this method returns null. When the property is set, but an exception occurs while instantiating the class, this method logs the error and returns null. UserProvider classes are required to have a public, no-argument constructor.
        Parameters:
        propertyName - A property name (cannot ben ull).
        Returns:
        A user provider (can be null).
      • getUserCount

        public int getUserCount()
        Description copied from interface: UserProvider
        Returns the number of users in the system.
        Specified by:
        getUserCount in interface UserProvider
        Returns:
        the total number of users.
      • getUsers

        public Collection<User> getUsers()
        Description copied from interface: UserProvider
        Returns an unmodifiable Collections of all users in the system. The UserCollection class can be used to assist in the implementation of this method. It takes a String [] of usernames and presents it as a Collection of User objects (obtained with calls to UserManager.getUser(String).
        Specified by:
        getUsers in interface UserProvider
        Returns:
        an unmodifiable Collection of all users.
      • getUsernames

        public Collection<String> getUsernames()
        Description copied from interface: UserProvider
        Returns an unmodifiable Collection of usernames of all users in the system.
        Specified by:
        getUsernames in interface UserProvider
        Returns:
        an unmodifiable Collection of all usernames in the system.
      • getUsers

        public Collection<User> getUsers​(int startIndex,
                                         int numResults)
        Description copied from interface: UserProvider
        Returns an unmodifiable Collections of users in the system within the specified range. The UserCollection class can be used to assist in the implementation of this method. It takes a String [] of usernames and presents it as a Collection of User objects (obtained with calls to UserManager.getUser(String).

        It is possible that the number of results returned will be less than that specified by numResults if numResults is greater than the number of records left to display.

        Specified by:
        getUsers in interface UserProvider
        Parameters:
        startIndex - the beginning index to start the results at.
        numResults - the total number of results to return.
        Returns:
        an unmodifiable Collection of users within the specified range.
      • findUsers

        public Collection<User> findUsers​(Set<String> fields,
                                          String query)
                                   throws UnsupportedOperationException
        Searches for users based on a set of fields and a query string. The fields must be taken from the values returned by getSearchFields(). The query can include wildcards. For example, a search on the field "Name" with a query of "Ma*" might return user's with the name "Matt", "Martha" and "Madeline". This method throws an UnsupportedOperationException when none of the backing providers support search. When fields are provided that are not supported by a particular provider, those fields are ignored by that provider (but can still be used by other providers).
        Specified by:
        findUsers in interface UserProvider
        Parameters:
        fields - the fields to search on.
        query - the query string.
        Returns:
        a Collection of users that match the search.
        Throws:
        UnsupportedOperationException - When none of the providers support search.
      • findUsers

        public Collection<User> findUsers​(Set<String> fields,
                                          String query,
                                          int startIndex,
                                          int numResults)
                                   throws UnsupportedOperationException
        Searches for users based on a set of fields and a query string. The fields must be taken from the values returned by getSearchFields(). The query can include wildcards. For example, a search on the field "Name" with a query of "Ma*" might return user's with the name "Matt", "Martha" and "Madeline". This method throws an UnsupportedOperationException when none of the backing providers support search. When fields are provided that are not supported by a particular provider, those fields are ignored by that provider (but can still be used by other providers). The startIndex and numResults parameters are used to page through search results. For example, if the startIndex is 0 and numResults is 10, the first 10 search results will be returned. Note that numResults is a request for the number of results to return and that the actual number of results returned may be fewer.
        Specified by:
        findUsers in interface UserProvider
        Parameters:
        fields - the fields to search on.
        query - the query string.
        startIndex - the starting index in the search result to return.
        numResults - the number of users to return in the search result.
        Returns:
        a Collection of users that match the search.
        Throws:
        UnsupportedOperationException - When none of the providers support search.
      • getSearchFields

        public Set<String> getSearchFields()
                                    throws UnsupportedOperationException
        Returns the combination of search fields supported by the backing providers. Note that the returned fields might not be supported by every backing provider.
        Specified by:
        getSearchFields in interface UserProvider
        Returns:
        the valid search fields.
        Throws:
        UnsupportedOperationException - If no search fields are returned, or when at least one of the providers throws UnsupportedOperationException when its #getSearchField() is invoked.
      • isReadOnly

        public boolean isReadOnly()
        Returns whether all backing providers are read-only. When read-only, users can not be created, deleted, or modified. If at least one provider is not read-only, this method returns false.
        Specified by:
        isReadOnly in interface UserProvider
        Returns:
        true when all backing providers are read-only, otherwise false.
      • isNameRequired

        public boolean isNameRequired()
        Returns whether all backing providers require a name to be set on User objects. If at least one proivder does not, this method returns false.
        Specified by:
        isNameRequired in interface UserProvider
        Returns:
        true when all backing providers require a name to be set on User objects, otherwise false.
      • isEmailRequired

        public boolean isEmailRequired()
        Returns whether all backing providers require an email address to be set on User objects. If at least one proivder does not, this method returns false.
        Specified by:
        isEmailRequired in interface UserProvider
        Returns:
        true when all backing providers require an email address to be set on User objects, otherwise false.