本文整理汇总了Java中org.ldaptive.LdapEntry.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java LdapEntry.getAttributes方法的具体用法?Java LdapEntry.getAttributes怎么用?Java LdapEntry.getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ldaptive.LdapEntry
的用法示例。
在下文中一共展示了LdapEntry.getAttributes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLdapEntries
import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
* Creates the given LDAP entries.
*
* @param connection Open LDAP connection used to connect to directory.
* @param entries Collection of LDAP entries.
*
* @throws Exception On LDAP errors.
*/
public static void createLdapEntries(final LDAPConnection connection, final Collection<LdapEntry> entries) throws Exception {
for (final LdapEntry entry : entries) {
final Collection<Attribute> attrs = new ArrayList<>(entry.getAttributeNames().length);
for (final LdapAttribute a : entry.getAttributes()) {
attrs.add(new Attribute(a.getName(), a.getStringValues()));
}
connection.add(new AddRequest(entry.getDn(), attrs));
}
}
示例2: executeModifyOperation
import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
* Execute modify operation boolean.
*
* @param currentDn the current dn
* @param connectionFactory the connection factory
* @param entry the entry
* @return the boolean
*/
public static boolean executeModifyOperation(final String currentDn,
final ConnectionFactory connectionFactory,
final LdapEntry entry) {
final Map<String, Set<String>> attributes = new HashMap<>(entry.getAttribute().size());
for (final LdapAttribute ldapAttribute : entry.getAttributes()) {
attributes.put(ldapAttribute.getName(), ImmutableSet.copyOf(ldapAttribute.getStringValues()));
}
return executeModifyOperation(currentDn, connectionFactory, attributes);
}
示例3: convertLdapEntryToMap
import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
* Converts an ldaptive <code>LdapEntry</code> containing result entry attributes into an attribute map as needed
* by Person Directory components.
*
* @param entry Ldap entry.
*
* @return Attribute map.
*/
private Map<String, List<Object>> convertLdapEntryToMap(final LdapEntry entry) {
final Map<String, List<Object>> attributeMap = new LinkedHashMap<>(entry.size());
for (final LdapAttribute attr : entry.getAttributes()) {
attributeMap.put(attr.getName(), new ArrayList<Object>(attr.getStringValues()));
}
logger.debug("Converted ldap DN entry [{}] to attribute map {}", entry.getDn(), attributeMap.toString());
return attributeMap;
}
示例4: convertLdapEntryToMap
import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
* Converts an ldaptive <code>LdapEntry</code> containing result entry attributes into an attribute map as needed
* by Person Directory components.
*
* @param entry Ldap entry.
*
* @return Attribute map.
*/
private Map<String, List<Object>> convertLdapEntryToMap(final LdapEntry entry) {
final Map<String, List<Object>> attributeMap = new LinkedHashMap<String, List<Object>>(entry.size());
for (final LdapAttribute attr : entry.getAttributes()) {
attributeMap.put(attr.getName(), new ArrayList<Object>(attr.getStringValues()));
}
logger.debug("Converted ldap DN entry [{}] to attribute map {}", entry.getDn(), attributeMap.toString());
return attributeMap;
}
示例5: update
import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
private RegisteredService update(final RegisteredService rs) {
Connection searchConnection = null;
try {
searchConnection = this.connectionFactory.getConnection();
final Response<SearchResult> response = searchForServiceById(searchConnection, rs.getId());
if (hasResults(response)) {
final String currentDn = response.getResult().getEntry().getDn();
Connection modifyConnection = null;
try {
modifyConnection = this.connectionFactory.getConnection();
final ModifyOperation operation = new ModifyOperation(searchConnection);
final List<AttributeModification> mods = new ArrayList<AttributeModification>();
final LdapEntry entry = this.ldapServiceMapper.mapFromRegisteredService(this.searchRequest.getBaseDn(), rs);
for (final LdapAttribute attr : entry.getAttributes()) {
mods.add(new AttributeModification(AttributeModificationType.REPLACE, attr));
}
final ModifyRequest request = new ModifyRequest(currentDn, mods.toArray(new AttributeModification[] {}));
operation.execute(request);
} finally {
LdapUtils.closeConnection(modifyConnection);
}
}
} catch (final LdapException e) {
logger.error(e.getMessage(), e);
} finally {
LdapUtils.closeConnection(searchConnection);
}
return rs;
}