本文整理匯總了Java中javax.naming.directory.DirContext.ADD_ATTRIBUTE屬性的典型用法代碼示例。如果您正苦於以下問題:Java DirContext.ADD_ATTRIBUTE屬性的具體用法?Java DirContext.ADD_ATTRIBUTE怎麽用?Java DirContext.ADD_ATTRIBUTE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.naming.directory.DirContext
的用法示例。
在下文中一共展示了DirContext.ADD_ATTRIBUTE屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateMemberDn
/**
* Update the uniqueMember attribute of the user having changed DN. Cache is not updated since.
*
* @param oldUniqueMemberDn
* Old DN of the member to update.
* @param newUniqueMemberDn
* New DN of the member to update. UID of the DN should unchanged.
* @param group
* CN of the group to update.
*/
public void updateMemberDn(final String group, final String oldUniqueMemberDn, final String newUniqueMemberDn) {
final GroupOrg groupLdap = findById(group);
final ModificationItem[] mods = new ModificationItem[2];
mods[0] = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, new BasicAttribute(UNIQUE_MEMBER, oldUniqueMemberDn));
mods[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute(UNIQUE_MEMBER, newUniqueMemberDn));
template.modifyAttributes(org.springframework.ldap.support.LdapUtils.newLdapName(groupLdap.getDn()), mods);
}