Show TOC

Searching for Groups with Simple SearchLocate this document in the navigation structure

Use

Use this procedure to create you custom search application, when you want to search the standard group attributes defined by simple search.

More information: Standard Search and Simple Search .

Prerequisites

You have imported the required interfaces and gotten the required factories.

More information: User Management Functions for Groups .

Procedure
  1. Use the simplePrincipalSearch() method to get the search results and store them in a search result object.

    Use the following parameters to define your search:

    • String to search for

    • Factory to search in

    • Search type

      Choose a search type from the following table.

      Search Type

      Description

      EQUALS_OPERATOR

      This search returns only an exact match of the value searched for. The search function interprets all characters literally.

      LIKE_OPERATOR

      This search interprets wildcards in the search value. The asterisk ( * ) is always interpreted as a wildcard. The question mark ( ? ) is not supported for all data sources. Searches of the database of SAP NetWeaver Application Server (AS) Java supports the use of the question mark. Searches of AS ABAP user management and LDAP data sources do not support the use of question mark as a wildcard.

      GREATER_THAN_OPERATOR

      This search returns all objects that are greater than and not equal to the search value. Value of a string depends ultimately on the Unicode value.

      LESS_THAN_OPERATOR

      This search returns all objects that are less than and not equal to the search value. Value of a string depends ultimately on the Unicode value.

    • Case sensitivity

      Enter the parameter true to make the search case sensitive.

    • Null

      The last parameter must always be null .

  2. Read the unique ID of the group from the search result object.

  3. Use the getGroup() method to get the group object with the unique ID.

Example

The following example searches the simple search attributes for groups with search term demo_group . The search is case insensitive and otherwise searches for an exact match. The results are stored in an object. The class iterates through the results and gets the unique ID. Next the method gets the group based on the unique ID.

            public static void groupSimpleSearch(String groupName) {

        try {
                        
                /*
                 * Search for a group with the unique name "demo_group", ignoring case and without  
                 * using wildcards. Store the result in the object "searchResult".
                 */ 

                

                                                

                                                

                                                

                                                

                                                


                //Check if the results are valid.

                


                        // Loop through the search results in the object "searchResult".

                        

                                

                                


                                /*
                                 * TODO: Process the object "group" returned by the search.
                                 * For example, get the display name of the user and display it on the screen. 
                                 * Or use it in the next example: showGroup(group, "com.example", "myAttributeName");
                                 */
                        }
                } else {
                        // TODO: Handle incomplete or undefined results.
                }
        } catch (UMException umex) {
                // TODO: Handle UMException.
        } catch (UMRuntimeException umrex) {
                // TODO: Handle UMRuntimeException.
        }
}