當前位置: 首頁>>代碼示例>>Java>>正文


Java DirContextOperations.setAttributeValues方法代碼示例

本文整理匯總了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()));
}
 
開發者ID:ligoj,項目名稱:plugin-id-ldap,代碼行數:12,代碼來源:UserLdapRepository.java

示例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);
}
 
開發者ID:spring-projects,項目名稱:spring-ldap,代碼行數:11,代碼來源:LdapTemplateModifyITest.java

示例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);
}
 
開發者ID:spring-projects,項目名稱:spring-ldap,代碼行數:14,代碼來源:LdapTemplateModifyITest.java

示例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());
}
 
開發者ID:lgangloff,項目名稱:ldap2rest,代碼行數:17,代碼來源:LdapDAOImpl.java


注:本文中的org.springframework.ldap.core.DirContextOperations.setAttributeValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。