how to create user group and add users in that group in OPENDS using java LDAP api
===

<pre>


below method is used to create User in OpenDS using LDAP java API.

How to modify below method to create user group and also how to add users in that group.

In that method used attributes like surname,first name etc.

</pre>



<code>


public void createNew(String username, String surname, String givenName) {


    try {


      String distinguishedName = "cn=" + username + "dc=xxx,dc=com";


      Attributes newAttributes = new BasicAttributes(true);


      Attribute oc = new BasicAttribute("objectclass");


      oc.add("organizationalPerson"); 
           

      oc.add("inetorgperson"); 
                

      newAttributes.put(oc);
      
      newAttributes.put(new BasicAttribute("cn", username));

      newAttributes.put(new BasicAttribute("sn", surname));

      newAttributes.put(new BasicAttribute("givenName", givenName)); //firstname

      newAttributes.put(new BasicAttribute("displayName", givenName + " " + surname));

      System.out.println("Name: " + username + " Attributes: " + newAttributes);

      ldapContext.createSubcontext(distinguishedName, newAttributes);


    }
    catch (Exception e) {

      System.out.println("create error: " + e);

      e.printStackTrace();

      System.exit(-1);

    }

  }

</code>
