本文整理汇总了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));
}