private void addEntryIfNotExists(CoreSession session, String dnString, String... objectClasses) throws LdapException { final Dn dn = new Dn(dnString); final Rdn rdn = dn.getRdn(); final Entry entryRoda = service.newEntry(dn).add(OBJECT_CLASS, objectClasses).add(rdn.getType(), rdn.getValue()); try { session.add(entryRoda); } catch (LdapEntryAlreadyExistsException e) { LOGGER.debug("Error injecting the context entry for {}: {}", dnString, e.getMessage()); } }
private void injectRdnAttributeValues( Dn target, Entry serverEntry ) throws NamingException { // Add all the Rdn attributes and their values to this entry Rdn rdn = target.getRdn(); if ( rdn.size() == 1 ) { serverEntry.put( rdn.getType(), rdn.getValue() ); } else { for ( Ava atav : rdn ) { serverEntry.put( atav.getType(), atav.getValue() ); } } }
serverEntry.put( rdn.getType(), rdn.getValue() );
context.add(partitionDn.getRdn().getType(), dnName); partition.setContextEntry(context); service.addPartition(partition);