/** * Add an LDAP path last in this DistinguishedName. E.g.: * * <pre> * DistinguishedName name1 = new DistinguishedName("c=SE, dc=jayway, dc=se"); * DistinguishedName name2 = new DistinguishedName("ou=people"); * name1.append(name2); * </pre> * * will result in <code>ou=people, c=SE, dc=jayway, dc=se</code> * * @param path the path to append. * @return this instance. */ public DistinguishedName append(DistinguishedName path) { getNames().addAll(path.getNames()); return this; }
/** * Add an LDAP path last in this DistinguishedName. E.g.: * * <pre> * DistinguishedName name1 = new DistinguishedName("c=SE, dc=jayway, dc=se"); * DistinguishedName name2 = new DistinguishedName("ou=people"); * name1.append(name2); * </pre> * * will result in <code>ou=people, c=SE, dc=jayway, dc=se</code> * * @param path the path to append. * @return this instance. */ public DistinguishedName append(DistinguishedName path) { getNames().addAll(path.getNames()); return this; }
/** * Add an LDAP path last in this DistinguishedName. E.g.: * * <pre> * DistinguishedName name1 = new DistinguishedName("c=SE, dc=jayway, dc=se"); * DistinguishedName name2 = new DistinguishedName("ou=people"); * name1.append(name2); * </pre> * * will result in <code>ou=people, c=SE, dc=jayway, dc=se</code> * * @param path the path to append. * @return this instance. */ public DistinguishedName append(DistinguishedName path) { getNames().addAll(path.getNames()); return this; }
/** * Add an LDAP path last in this DistinguishedName. E.g.: * * <pre> * DistinguishedName name1 = new DistinguishedName("c=SE, dc=jayway, dc=se"); * DistinguishedName name2 = new DistinguishedName("ou=people"); * name1.append(name2); * </pre> * * will result in <code>ou=people, c=SE, dc=jayway, dc=se</code> * * @param path the path to append. * @return this instance. */ public DistinguishedName append(DistinguishedName path) { getNames().addAll(path.getNames()); return this; }
/** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { // A subclass with identical values should NOT be considered equal. // EqualsBuilder in commons-lang cannot handle subclasses correctly. if (obj == null || obj.getClass() != this.getClass()) { return false; } DistinguishedName name = (DistinguishedName) obj; // compare the lists return getNames().equals(name.getNames()); }
/** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { // A subclass with identical values should NOT be considered equal. // EqualsBuilder in commons-lang cannot handle subclasses correctly. if (obj == null || obj.getClass() != this.getClass()) { return false; } DistinguishedName name = (DistinguishedName) obj; // compare the lists return getNames().equals(name.getNames()); }
/** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { // A subclass with identical values should NOT be considered equal. // EqualsBuilder in commons-lang cannot handle subclasses correctly. if (obj == null || obj.getClass() != this.getClass()) { return false; } DistinguishedName name = (DistinguishedName) obj; // compare the lists return getNames().equals(name.getNames()); }
/** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { // A subclass with identical values should NOT be considered equal. // EqualsBuilder in commons-lang cannot handle subclasses correctly. if (obj == null || obj.getClass() != this.getClass()) { return false; } DistinguishedName name = (DistinguishedName) obj; // compare the lists return getNames().equals(name.getNames()); }
/** * @see java.lang.Object#hashCode() */ public int hashCode() { return this.getClass().hashCode() ^ getNames().hashCode(); }
/** * @see java.lang.Object#hashCode() */ public int hashCode() { return this.getClass().hashCode() ^ getNames().hashCode(); }
/** * @see java.lang.Object#hashCode() */ public int hashCode() { return this.getClass().hashCode() ^ getNames().hashCode(); }
/** * @see java.lang.Object#hashCode() */ public int hashCode() { return this.getClass().hashCode() ^ getNames().hashCode(); }
/** * Add an LDAP path first in this DistinguishedName. E.g.: * * <pre> * DistinguishedName name1 = new DistinguishedName("ou=people"); * DistinguishedName name2 = new DistinguishedName("c=SE, dc=jayway, dc=se"); * name1.prepend(name2); * </pre> * * will result in <code>ou=people, c=SE, dc=jayway, dc=se</code> * * @param path the path to prepend. */ public void prepend(DistinguishedName path) { ListIterator i = path.getNames().listIterator(path.getNames().size()); while (i.hasPrevious()) { names.add(0, i.previous()); } }
/** * Add an LDAP path first in this DistinguishedName. E.g.: * * <pre> * DistinguishedName name1 = new DistinguishedName("ou=people"); * DistinguishedName name2 = new DistinguishedName("c=SE, dc=jayway, dc=se"); * name1.prepend(name2); * </pre> * * will result in <code>ou=people, c=SE, dc=jayway, dc=se</code> * * @param path the path to prepend. */ public void prepend(DistinguishedName path) { ListIterator i = path.getNames().listIterator(path.getNames().size()); while (i.hasPrevious()) { names.add(0, i.previous()); } }
public Name addAll(int arg0, Name name) throws InvalidNameException { DistinguishedName distinguishedName = null; try { distinguishedName = (DistinguishedName) name; } catch (ClassCastException e) { throw new InvalidNameException("Invalid name type"); } names.addAll(arg0, distinguishedName.getNames()); return this; }
public Name addAll(int arg0, Name name) throws InvalidNameException { DistinguishedName distinguishedName = null; try { distinguishedName = (DistinguishedName) name; } catch (ClassCastException e) { throw new InvalidNameException("Invalid name type"); } names.addAll(arg0, distinguishedName.getNames()); return this; }
public Name addAll(int arg0, Name name) throws InvalidNameException { DistinguishedName distinguishedName = null; try { distinguishedName = (DistinguishedName) name; } catch (ClassCastException e) { throw new InvalidNameException("Invalid name type"); } names.addAll(arg0, distinguishedName.getNames()); return this; }
public Name addAll(int arg0, Name name) throws InvalidNameException { DistinguishedName distinguishedName = null; try { distinguishedName = (DistinguishedName) name; } catch (ClassCastException e) { throw new InvalidNameException("Invalid name type"); } names.addAll(arg0, distinguishedName.getNames()); return this; }
@SuppressWarnings("unchecked") public List<Long> groups(String username, LdapConfig config, LdapOperations ldap, RoleProvider provider, final AttributeSet attrSet) { final List<Long> groups = new ArrayList<Long>(); final List<LdapRdn> names = dn.getNames(); for (int i = names.size(); i > 0; i--) { LdapRdn name = names.get(i-1); if ("ou".equals(name.getKey())) { final String grpName = name.getValue("ou"); groups.add(provider.createGroup(grpName, null, false, true)); break; } } return groups; }
@Test public void testSetAsText() throws Exception { String expectedDn = "dc=jayway, dc=se"; tested.setAsText(expectedDn); DistinguishedName result = (DistinguishedName) tested.getValue(); assertThat(result).isEqualTo(new DistinguishedName(expectedDn)); try { result.getNames().add(new LdapRdn("cn", "john doe")); fail("UnsupportedOperationException expected"); } catch (UnsupportedOperationException expected) { assertThat(true).isTrue(); } }