本文整理匯總了Java中org.springframework.ldap.core.DirContextOperations.setAttributeValues方法的典型用法代碼示例。如果您正苦於以下問題:Java DirContextOperations.setAttributeValues方法的具體用法?Java DirContextOperations.setAttributeValues怎麽用?Java DirContextOperations.setAttributeValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.ldap.core.DirContextOperations
的用法示例。
在下文中一共展示了DirContextOperations.setAttributeValues方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mapToContext
import org.springframework.ldap.core.DirContextOperations; //導入方法依賴的package包/類
protected void mapToContext(final UserOrg entry, final DirContextOperations context) {
context.setAttributeValue("cn", entry.getFirstName() + " " + entry.getLastName());
context.setAttributeValue("sn", entry.getLastName());
context.setAttributeValue("givenName", entry.getFirstName());
context.setAttributeValue(uidAttribute, Normalizer.normalize(entry.getId()));
context.setAttributeValues("mail", entry.getMails().toArray(), true);
// Special and also optional attributes
Optional.ofNullable(departmentAttribute).ifPresent(a -> context.setAttributeValue(a, entry.getDepartment()));
Optional.ofNullable(localIdAttribute).ifPresent(a -> context.setAttributeValue(a, entry.getLocalId()));
}
示例2: verifyCompleteReplacementOfUniqueMemberAttribute_Ldap119Workaround
import org.springframework.ldap.core.DirContextOperations; //導入方法依賴的package包/類
@Test
public void verifyCompleteReplacementOfUniqueMemberAttribute_Ldap119Workaround() {
DirContextOperations ctx = tested.lookupContext("cn=ROLE_USER,ou=groups");
ctx.setAttributeValues("uniqueMember",
new String[]{"cn=Some Person,ou=company1,ou=Norway," + base},
true);
ctx.getModificationItems();
tested.modifyAttributes(ctx);
}
示例3: verifyCompleteReplacementOfUniqueMemberAttribute_Ldap119
import org.springframework.ldap.core.DirContextOperations; //導入方法依賴的package包/類
/**
* This test originally failed on ApacheDS complaining that the uniqueMember attribute
* was emptied.
*/
@Test
public void verifyCompleteReplacementOfUniqueMemberAttribute_Ldap119() {
DirContextOperations ctx = tested.lookupContext("cn=ROLE_USER,ou=groups");
ctx.setAttributeValues("uniqueMember",
new String[]{"cn=Some Person,ou=company1,ou=Norway," + base});
ctx.getModificationItems();
tested.modifyAttributes(ctx);
}
示例4: updateLdapEntry
import org.springframework.ldap.core.DirContextOperations; //導入方法依賴的package包/類
@Override
public LdapEntry updateLdapEntry(LdapEntry ldapEntry) {
DirContextOperations context = ldapTemplate.lookupContext(ldapEntry.getDn());
for (Entry<String, List<Object>> entry : ldapEntry.getAttributesAsMap().entrySet()) {
context.setAttributeValues(entry.getKey(), entry.getValue().toArray());
}
log.debug("Updating LdapEntry "+ldapEntry);
ldapTemplate.modifyAttributes(context);
return getLdapEntry(ldapEntry.getDn());
}