public static ChaiGroup createGroup ( final String parentDN , final String name , final ChaiProvider provider ) throws ChaiOperationException , ChaiUnavailableException { //Get a good CN for it final String objectCN = findUniqueName ( name , parentDN , provider ) ; //Concantonate the entryDN final StringBuilder entryDN = new StringBuilder ( ) ; entryDN . append ( "cn=" ) ; entryDN . append ( objectCN ) ; entryDN . append ( ' ' ) ; entryDN . append ( parentDN ) ; //First create the base group. provider . createEntry ( entryDN . toString ( ) , ChaiConstant . OBJECTCLASS_BASE_LDAP_GROUP , Collections . emptyMap ( ) ) ; //Now build an ldapentry object to add attributes to it final ChaiEntry theObject = provider . getEntryFactory ( ) . newChaiEntry ( entryDN . toString ( ) ) ; //Add the description theObject . writeStringAttribute ( ChaiConstant . ATTR_LDAP_DESCRIPTION , name ) ; //Return the newly created group. return provider . getEntryFactory ( ) . newChaiGroup ( entryDN . toString ( ) ) ; }
Creates a new group entry in the ldap directory . A new groupOfNames object is created . The cn and description ldap attributes are set to the supplied name .