/** * Removes the attribute(s) from this ldap attributes. * * @param attrs collection of ldap attributes to remove */ public void removeAttributes(final Collection<LdapAttribute> attrs) { for (LdapAttribute la : attrs) { removeAttribute(la); } }
/** * Changes the name of an attribute in this entry. The old attribute is removed from this entry, the name is changed * with {@link LdapAttribute#setName(String)}, and the attribute is added back to this entry. If oldName does not * exist, this method does nothing. * * @param oldName attribute name to change from * @param newName attribute name to change to */ public void renameAttribute(final String oldName, final String newName) { final LdapAttribute la = getAttribute(oldName); if (la != null) { removeAttribute(oldName); la.setName(newName); addAttribute(la); } }
/** * Changes the name of an attribute in this entry. The old attribute is removed from this entry, the name is changed * with {@link LdapAttribute#setName(String)}, and the attribute is added back to this entry. If oldName does not * exist, this method does nothing. * * @param oldName attribute name to change from * @param newName attribute name to change to */ public void renameAttribute(final String oldName, final String newName) { final LdapAttribute la = getAttribute(oldName); if (la != null) { removeAttribute(oldName); la.setName(newName); addAttribute(la); } }
/** * Changes the name of an attribute in this entry. The old attribute is removed from this entry, the name is changed * with {@link LdapAttribute#setName(String)}, and the attribute is added back to this entry. If oldName does not * exist, this method does nothing. * * @param oldName attribute name to change from * @param newName attribute name to change to */ public void renameAttribute(final String oldName, final String newName) { final LdapAttribute la = getAttribute(oldName); if (la != null) { removeAttribute(oldName); la.setName(newName); addAttribute(la); } }
charEntry.removeAttribute("col1"); charEntry.removeAttribute("col2"); charEntry.removeAttribute("typeArray1"); charEntry.removeAttribute("typeArray2"); charEntry.removeAttribute("transcoded");
/** * Tests create with a collection. * * @param attr1 ldap attribute * @param attr2 ldap attribute */ @Test(groups = {"bean"}, dataProvider = "attributes") public void createCollection(final LdapAttribute attr1, final LdapAttribute attr2) { final Set<LdapAttribute> s = new HashSet<>(); s.add(attr1); final LdapEntry le = new LdapEntry("uid=1", s); le.addAttribute(attr2); AssertJUnit.assertEquals(attr1, le.getAttribute("GIVENNAME")); AssertJUnit.assertEquals(attr2, le.getAttribute("sn")); AssertJUnit.assertEquals(2, le.getAttributeNames().length); AssertJUnit.assertEquals(2, le.size()); AssertJUnit.assertEquals(le, new LdapEntry("uid=1", attr1, attr2)); le.removeAttribute("GIVENNAME"); AssertJUnit.assertEquals(1, le.size()); le.clear(); AssertJUnit.assertEquals(0, le.size()); }
/** * Tests create with two entries. * * @param attr1 ldap attribute * @param attr2 ldap attribute */ @Test(groups = {"bean"}, dataProvider = "attributes") public void createTwo(final LdapAttribute attr1, final LdapAttribute attr2) { final LdapEntry le = new LdapEntry("uid=1", attr2, attr1); AssertJUnit.assertEquals(attr1, le.getAttribute("givenName")); AssertJUnit.assertEquals(attr2, le.getAttribute("SN")); AssertJUnit.assertEquals(2, le.getAttributeNames().length); AssertJUnit.assertEquals(2, le.size()); AssertJUnit.assertEquals(le, new LdapEntry("uid=1", attr1, attr2)); le.removeAttribute(attr2); AssertJUnit.assertEquals(1, le.size()); le.clear(); AssertJUnit.assertEquals(0, le.size()); }