/** * Convert an Entry to LDIF * @param entry the Entry to convert * @return the corresponding LDIF code as a String * @throws LdapException If a naming exception is encountered. */ public static String convertEntryToLdif( Entry entry ) throws LdapException { return convertEntryToLdif( entry, DEFAULT_LINE_LENGTH ); }
/** * Convert an Attributes as LDIF. The DN is written. * @param attrs the Attributes to convert * @return the corresponding LDIF code as a String * @throws LdapException If a naming exception is encountered. */ public static String convertToLdif( Attributes attrs, DN dn, int length ) throws LdapException { return convertEntryToLdif( AttributeUtils.toClientEntry( attrs, dn ), length ); }
/** * Convert an Attributes as LDIF. The DN is written. * @param attrs the Attributes to convert * @return the corresponding LDIF code as a String * @throws LdapException If a naming exception is encountered. */ public static String convertToLdif( Attributes attrs, DN dn ) throws LdapException { return convertEntryToLdif( AttributeUtils.toClientEntry( attrs, dn ), DEFAULT_LINE_LENGTH ); }
public String dnToLdif( String schemaName ) throws NamingException { StringBuilder sb = new StringBuilder(); String dn = "m-oid=" + oid + ", ou=attributeTypes" + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema"; // First dump the DN only Entry entry = new DefaultClientEntry( new LdapDN( dn ) ); sb.append( LdifUtils.convertEntryToLdif( entry ) ); return sb.toString(); } }
public String dnToLdif( String schemaName ) throws NamingException { StringBuilder sb = new StringBuilder(); String dn = "m-oid=" + oid + ", ou=objectClasses" + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema"; // First dump the DN only Entry entry = new DefaultClientEntry( new LdapDN( dn ) ); sb.append( LdifUtils.convertEntryToLdif( entry ) ); return sb.toString(); } }
out.write( LdifUtils.convertEntryToLdif( entry ) ); out.flush(); out.close(); out.write( LdifUtils.convertEntryToLdif( entry ) ); out.flush(); out.close();