Creating Groups

You can use the Directory Manager Service API (Java and web service) to programmatically create LiveCycle groups. After you create a group, you can use that group to perform a service operation that requires a group. For example, you can assign a user to the new group. (See Managing Users and Groups.)

Summary of steps

To create a group, perform the following steps:

  1. Include project files.

  2. Create a DirectoryManagerService client.

  3. Determine that the group does not exist.

  4. Create the group.

  5. Perform an action with the group.

Include project files

Include necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files.

The following JAR files must be added to your project’s classpath:

  • adobe-livecycle-client.jar

  • adobe-usermanager-client.jar

  • adobe-utilities.jar (Required if LiveCycle is deployed on JBoss)

  • jbossall-client.jar (Required if LiveCycle is deployed on JBoss)

For information about the location of these JAR files, see Including LiveCycle Java library files.

Create a DirectoryManagerService client

Before you can programmatically perform a Directory Manager service operation, create a Directory Manager Service API client.

Determine whether the group exists

When you create a group, ensure that the group does not exist in the same domain. That is, two groups cannot have the same name within the same domain. To perform this task, perform a search and filter the search results based on two values. Set the principal type to com.adobe.idp.um.api.infomodel.Principal.PRINCIPALTYPE_GROUP to ensure that only groups are returned. Also, sure that you specify the domain name.

Create the group

After you determine that the group does not exist in the domain, create the group and specify the following attributes:

  • CommonName: The name of the group.

  • Domain: The domain in which the group is added.

  • Description: A description of the group.

Perform an action with the group

After you create a group, you can perform an action using the group. For example, you can add a user to the group. To add a user to a group, retrieve the unique identifier value of both the user and the group. Pass these values to the addPrincipalToLocalGroup method.

Create groups using the Java API

Create a group by using the Directory Manager Service API (Java):

  1. Include project files.

    Include client JAR files, such as adobe-usermanager-client.jar, in your Java project’s class path.

  2. Create a DirectoryManagerService client.

    Create a DirectoryManagerServiceClient object by using its constructor and passing a ServiceClientFactory object that contains connection properties.

  3. Determine whether the group exists.

    • Create a PrincipalSearchFilter object by using its constructor.

    • Set the principal type by invoking the PrincipalSearchFilter object’s setPrincipalType object. Pass the value com.adobe.idp.um.api.infomodel.Principal.PRINCIPALTYPE_GROUP.

    • Set the domain by invoking the PrincipalSearchFilter object’s setSpecificDomainName object. Pass a string value that specifies the domain name.

    • To find a group, invoke the DirectoryManagerServiceClient object’s findPrincipals method (a principal can be a group). Pass the PrincipalSearchFilter object that specifies the principal type and the domain name. This method returns a java.util.List instance where each element is a Group instance. Each group instance conforms to the filter specified by using the PrincipalSearchFilter object.

    • Iterate through the java.util.List instance. For each element, retrieve the group name. Ensure that the group name does not equal the new group name.

  4. Create the group.

    • If the group does not exist, invoke the Group object’s setCommonName method and pass a string value that specifies the group name.

    • Invoke the Group object’s setDescription method and pass a string value that specifies the group description.

    • Invoke the Group object’s setDomainName method and pass a string value that specifies the domain name.

    • Invoke the DirectoryManagerServiceClient object’s createLocalGroup method and pass the Group instance.

    The createLocalUser method returns a string value that specifies the local user identifier value.

  5. Perform an action with the group.

    • Create a PrincipalSearchFilter object by using its constructor.

    • Set the user identifier value by invoking the PrincipalSearchFilter object’s setUserId method. Pass a string value that represents the user identifier value.

    • Invoke the DirectoryManagerServiceClient object’s findPrincipals method and pass the PrincipalSearchFilter object. This method returns a java.util.List instance, where each element is a User object. Iterate through the java.util.List instance to locate the user.

    • Add a user to the group by invoking the DirectoryManagerServiceClient object’s addPrincipalToLocalGroup method. Pass the return value of the User object’s getOid method. Pass the return value of the Group objects’s getOid method (use the Group instance that represents the new group).

// Ethnio survey code removed