/** * Construct a new <code>DistinguishedName</code> from a String. * * @param path a String corresponding to a (syntactically) valid LDAP path. */ public DistinguishedName(String path) { if (!StringUtils.hasText(path)) { names = new LinkedList(); } else { parse(path); } }
/** * Construct a new <code>DistinguishedName</code> from a String. * * @param path a String corresponding to a (syntactically) valid LDAP path. */ public DistinguishedName(String path) { if (!StringUtils.hasText(path)) { names = new LinkedList(); } else { parse(path); } }
/** * Construct a new <code>DistinguishedName</code> from a String. * * @param path a String corresponding to a (syntactically) valid LDAP path. */ public DistinguishedName(String path) { if (!StringUtils.hasText(path)) { names = new LinkedList(); } else { parse(path); } }
/** * Construct a new <code>DistinguishedName</code> from a String. * * @param path a String corresponding to a (syntactically) valid LDAP path. */ public DistinguishedName(String path) { if (!StringUtils.hasText(path)) { names = new LinkedList(); } else { parse(path); } }
/** * Construct a new <code>DistinguishedName</code> from the supplied * {@link Name}. The parts of the supplied {@link Name} must be * syntactically correct {@link LdapRdn}s. * * @param name the {@link Name} to construct a new * <code>DistinguishedName</code> from. */ public DistinguishedName(Name name) { Assert.notNull(name, "name cannot be null"); if (name instanceof CompositeName) { parse(LdapUtils.convertCompositeNameToString((CompositeName) name)); return; } names = new LinkedList(); for (int i = 0; i < name.size(); i++) { names.add(new LdapRdn(name.get(i))); } }
/** * Construct a new <code>DistinguishedName</code> from the supplied * {@link Name}. The parts of the supplied {@link Name} must be * syntactically correct {@link LdapRdn}s. * * @param name the {@link Name} to construct a new * <code>DistinguishedName</code> from. */ public DistinguishedName(Name name) { Assert.notNull(name, "name cannot be null"); if (name instanceof CompositeName) { parse(LdapUtils.convertCompositeNameToString((CompositeName) name)); return; } names = new LinkedList(); for (int i = 0; i < name.size(); i++) { names.add(new LdapRdn(name.get(i))); } }
/** * Construct a new <code>DistinguishedName</code> from the supplied * {@link Name}. The parts of the supplied {@link Name} must be * syntactically correct {@link LdapRdn}s. * * @param name the {@link Name} to construct a new * <code>DistinguishedName</code> from. */ public DistinguishedName(Name name) { Assert.notNull(name, "name cannot be null"); if (name instanceof CompositeName) { parse(LdapUtils.convertCompositeNameToString((CompositeName) name)); return; } names = new LinkedList(); for (int i = 0; i < name.size(); i++) { names.add(new LdapRdn(name.get(i))); } }
/** * Construct a new <code>DistinguishedName</code> from the supplied * {@link Name}. The parts of the supplied {@link Name} must be * syntactically correct {@link LdapRdn}s. * * @param name the {@link Name} to construct a new * <code>DistinguishedName</code> from. */ public DistinguishedName(Name name) { Assert.notNull(name, "name cannot be null"); if (name instanceof CompositeName) { parse(LdapUtils.convertCompositeNameToString((CompositeName) name)); return; } names = new LinkedList(); for (int i = 0; i < name.size(); i++) { names.add(new LdapRdn(name.get(i))); } }
/** * Test for http://forum.springsource.org/showthread.php?t=86640. */ @Test public void testDistinguishedNameWithDotParsesProperly() { DistinguishedName name = new DistinguishedName("cn=first.last,OU=DevTest Users,DC=xyz,DC=com"); assertThat(name.toCompactString()).isEqualTo("cn=first.last,ou=DevTest Users,dc=xyz,dc=com"); DistinguishedName dn = new DistinguishedName(); dn.parse("cn=first.last,OU=DevTest Users,DC=xyz,DC=com"); assertThat(dn.getValue("cn")).isEqualTo("first.last"); assertThat(dn.getValue("ou")).isEqualTo("DevTest Users"); assertThat(dn.getLdapRdn(1).getValue()).isEqualTo("xyz"); assertThat(dn.getLdapRdn(0).getValue()).isEqualTo("com"); }