} else { try { return new Dn(dn).getNormName(); } catch (LdapInvalidDnException e) { LOG.debug("Invalid DN", e);
protected String getRdnValue( String dn ) { try { return new Dn( dn ).getRdn().getNormValue(); } catch ( LdapInvalidDnException lide ) { return null; } }
/** * Parses a Dn from a String * * @param name The Dn to parse * @return A valid Dn * @throws org.apache.directory.api.ldap.model.exception.LdapException If the Dn was invalid */ /* No protection*/static Dn parse( String name ) throws LdapException { Dn dn = new Dn(); parseDn( null, name, dn ); return dn; }
/** * Creates a new instance of DefaultEntry, with a Dn. * * @param dn The String Dn for this serverEntry. Can be null. * @throws LdapInvalidDnException If the Dn is invalid */ public DefaultEntry( String dn ) throws LdapInvalidDnException { this.dn = new Dn( dn ); }
/** * Returns the first name from a DN (Distinguished Name). Ex: for * <i>DN=cn=administrators,ou=groups,dc=roda,dc=org</i> returns * <i>administrators</i>. * * @param dn * the Distinguished Name. * @return a {@link String} with the first name. */ private String getFirstNameFromDN(final Dn dn) { return dn.getRdn().getValue(); }
/** * Check if a DistinguishedName is null or empty. * * @param dn The Dn to check * @return <code>true</code> if the Dn is null or empty, <code>false</code> * otherwise */ public static boolean isNullOrEmpty( Dn dn ) { return ( dn == null ) || dn.isEmpty(); }
/** * Returns the normalized distinguished name of the principal as a String. */ @Override public String getName() { return dn.getNormName(); }
/** * Parses a Dn from a String * * @param name The Dn to parse * @return A valid Dn * @throws org.apache.directory.api.ldap.model.exception.LdapException If the Dn was invalid */ /* No protection*/static Dn parse( String name ) throws LdapException { Dn dn = new Dn(); parseDn( null, name, dn ); return dn; }
/** * {@inheritDoc} */ @Override public String normalize( String value ) throws LdapException { Dn dn = new Dn( schemaManager, value ); return dn.getNormName(); }
/** * Creates a new instance of DefaultEntry, with a Dn. * * @param dn The String Dn for this serverEntry. Can be null. * @throws LdapInvalidDnException If the Dn is invalid */ public DefaultEntry( String dn ) throws LdapInvalidDnException { this.dn = new Dn( dn ); }
/** * @see Object#toString() */ public String toString() { String name = ( dn == null ? "null" : ( dn == Dn.EMPTY_DN ? "\"\"" : dn.getName() ) ); return "ServerSearchResult : " + name + "\n" + serverEntry; } }
/** * Check if a DistinguishedName is null or empty. * * @param dn The Dn to check * @return <code>true</code> if the Dn is null or empty, <code>false</code> * otherwise */ public static boolean isNullOrEmpty( Dn dn ) { return ( dn == null ) || dn.isEmpty(); }
/** * Parses a Dn from a String * * @param name The Dn to parse * @return A valid Dn * @throws org.apache.directory.api.ldap.model.exception.LdapException If the Dn was invalid */ /* No protection*/static Dn parse( String name ) throws LdapException { Dn dn = new Dn(); parseDn( null, name, dn ); return dn; }
/** * {@inheritDoc} */ @Override public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException { Dn dn = new Dn( schemaManager, value ); return dn.getNormName(); }
/** * @see javax.naming.Context#getNameInNamespace() */ public String getNameInNamespace() throws NamingException { return dn.getName(); }
/** * Parses a Dn from a String * * @param schemaManager The SchemaManager * @param name The Dn to parse * @return A valid Dn * @throws LdapException If the Dn was invalid */ /* No protection*/static Dn parse( SchemaManager schemaManager, String name ) throws LdapException { Dn dn = new Dn( schemaManager ); parseDn( schemaManager, name, dn ); return dn; }
/** * Parses a Dn from a String * * @param schemaManager The SchemaManager * @param name The Dn to parse * @return A valid Dn * @throws LdapException If the Dn was invalid */ /* No protection*/static Dn parse( SchemaManager schemaManager, String name ) throws LdapException { Dn dn = new Dn( schemaManager ); parseDn( schemaManager, name, dn ); return dn; }
/** * Parses a Dn from a String * * @param schemaManager The SchemaManager * @param name The Dn to parse * @return A valid Dn * @throws LdapException If the Dn was invalid */ /* No protection*/static Dn parse( SchemaManager schemaManager, String name ) throws LdapException { Dn dn = new Dn( schemaManager ); parseDn( schemaManager, name, dn ); return dn; }