/** * Transform a schema name to a Dn pointing to the correct position in the DIT * * @param schemaName The schema name * @return the Dn associated with this schema in the DIT */ public String dnToLdif( String schemaName ) throws LdapException { StringBuilder sb = new StringBuilder(); String dn = "m-oid=" + oid + ", " + SchemaConstants.ATTRIBUTE_TYPES_PATH + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema"; // First dump the Dn only Entry entry = new DefaultEntry( dn ); sb.append( LdifUtils.convertToLdif( entry ) ); return sb.toString(); } }
/** * Transform a schema name to a Dn pointing to the correct position in the DIT * * @param schemaName The schema name * @return the Dn associated with this schema in the DIT */ public String dnToLdif( String schemaName ) throws LdapException { StringBuilder sb = new StringBuilder(); String dn = "m-oid=" + oid + ", " + SchemaConstants.OBJECT_CLASSES_PATH + ", cn=" + Rdn.escapeValue( schemaName ) + ", ou=schema"; // First dump the Dn only Entry entry = new DefaultEntry( dn ); sb.append( LdifUtils.convertToLdif( entry ) ); return sb.toString(); } }
/** * Return the extensions formated as Ldif lines * * @param id The attributeId : can be m-objectClassExtension or * m-attributeTypeExtension * @return The extensions formated as ldif lines * @throws org.apache.directory.shared.ldap.model.exception.LdapException If the conversion goes wrong */ protected String extensionsToLdif( String id ) throws LdapException { StringBuilder sb = new StringBuilder(); Entry entry = new DefaultEntry(); Attribute attribute = new DefaultAttribute( id ); for ( String extension : extensions.keySet() ) { attribute.add( extension ); } sb.append( LdifUtils.convertAttributesToLdif( entry ) ); return sb.toString(); }
/** * @return the Names as Ldif lines * @throws org.apache.directory.shared.ldap.model.exception.LdapException If the conversion goes wrong */ private String nameToLdif() throws LdapException { if ( names.size() == 0 ) { return ""; } else { Entry entry = new DefaultEntry(); Attribute attribute = new DefaultAttribute( "m-name" ); for ( String name : names ) { attribute.add( name ); } entry.put( attribute ); return LdifUtils.convertAttributesToLdif( entry ); } }
/** * @return The description as a ldif line * @throws org.apache.directory.shared.ldap.model.exception.LdapException If the conversion goes wrong */ private String descToLdif() throws LdapException { if ( Strings.isEmpty( description ) ) { return ""; } else { Entry entry = new DefaultEntry(); Attribute attribute = new DefaultAttribute( "m-description", description ); entry.put( attribute ); return LdifUtils.convertAttributesToLdif( entry ); } }