本文整理匯總了Java中org.apache.directory.shared.ldap.entry.EntryAttribute類的典型用法代碼示例。如果您正苦於以下問題:Java EntryAttribute類的具體用法?Java EntryAttribute怎麽用?Java EntryAttribute使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntryAttribute類屬於org.apache.directory.shared.ldap.entry包,在下文中一共展示了EntryAttribute類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: verify
import org.apache.directory.shared.ldap.entry.EntryAttribute; //導入依賴的package包/類
/**
* Verifies that an entry exists in the directory with the specified attributes.
*
* @param entry
* the entry to verify
* @throws Exception
* if there are problems accessing the entry
*/
protected void verify(LdifEntry entry) throws Exception {
Entry readEntry = getRootDSE().lookup(entry.getDn());
for (EntryAttribute readAttribute : readEntry) {
String id = readAttribute.getId();
EntryAttribute origAttribute = entry.getEntry().get(id);
for (Value<?> value : origAttribute) {
if (!readAttribute.contains(value)) {
LOG.error("Failed to verify entry addition of " + entry.getDn() + ". " + id
+ " attribute in original entry missing from read entry.");
throw new AssertionError("Failed to verify entry addition of " + entry.getDn());
}
}
}
}
示例2: addAttribute
import org.apache.directory.shared.ldap.entry.EntryAttribute; //導入依賴的package包/類
public void addAttribute(String dn, String attrName, String attrValue)
throws Exception {
EntryAttribute attr = new DefaultClientAttribute(attrName, attrValue);
Modification addValue = new ClientModification(
ModificationOperation.ADD_ATTRIBUTE, attr);
service.getAdminSession().modify(new DN(dn),
Collections.singletonList(addValue));
}
示例3: removeAttribute
import org.apache.directory.shared.ldap.entry.EntryAttribute; //導入依賴的package包/類
public void removeAttribute(String dn, String attrName, String attrValue)
throws Exception {
EntryAttribute attr = new DefaultClientAttribute(attrName, attrValue);
Modification removeValue = new ClientModification(
ModificationOperation.REMOVE_ATTRIBUTE, attr);
service.getAdminSession().modify(new DN(dn),
Collections.singletonList(removeValue));
}