本文整理汇总了Java中com.unboundid.ldap.sdk.SearchResultEntry.getAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:Java SearchResultEntry.getAttributeValue方法的具体用法?Java SearchResultEntry.getAttributeValue怎么用?Java SearchResultEntry.getAttributeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.unboundid.ldap.sdk.SearchResultEntry
的用法示例。
在下文中一共展示了SearchResultEntry.getAttributeValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
public UserLdapDetails get(SearchResultEntry entry) {
String company = "";
try {
company = getCompanyByDn(entry.getParentDNString());
} catch (LDAPException e) {
logger.warn("Failed to extract company from entry");
}
return new UserLdapDetails(
entry.getAttributeValue("givenName"),
entry.getAttributeValue("sn"),
entry.getAttributeValue("mail"),
entry.getAttributeValue("telephoneNumber"),
entry.getAttributeValue("l"),
entry.getAttributeValue("title"),
company
);
}
示例2: searchAlternateNames
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
private Set<AuthorName> searchAlternateNames(String uid, AuthorName primaryName) {
Set<AuthorName> alternateNames = new HashSet<AuthorName>();
String filter = "(&(objectClass=weillCornellEduSORRecord)(weillCornellEduCWID=" + uid + "))";
List<SearchResultEntry> results = searchWithBaseDN(filter, "ou=sors,dc=weill,dc=cornell,dc=edu");
for (SearchResultEntry entry : results) {
AuthorName authorName = new AuthorName(
entry.getAttributeValue("givenName"),
entry.getAttributeValue("weillCornellEduMiddleName"),
entry.getAttributeValue("sn").replace("- M.D.", "")); //Added fix for some surnames having degree in their surnames - M.D.
if (!primaryName.equals(authorName)) {
alternateNames.add(authorName);
}
}
return alternateNames;
}
示例3: getUserInfo
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
private UserInfo getUserInfo(SearchResultEntry entry) {
UserInfo result = new UserInfo();
result.setUserId(entry.getAttributeValue("cn"));
String name = entry.getAttributeValue(givenNameAttribute);
String name2 = entry.getAttributeValue(surNameAttribute);
if (null != name) {
if (null != name2) {
name = name + " " + name2;
}
} else {
name = name2;
}
result.setUserName(name);
result.setUserLocale(entry.getAttributeValue(localeAttribute));
result.setUserOrganization(entry.getAttributeValue(organizationAttribute));
result.setUserDivision(entry.getAttributeValue(divisionAttribute));
result.setRoles(getRoles(entry));
return result;
}
示例4: searchEmails
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
private Set<String> searchEmails(String uid) {
String filter = "(&(objectClass=weillCornellEduSORRecord)(weillCornellEduCWID=" + uid + "))";
List<SearchResultEntry> results = searchWithBaseDN(filter, "ou=sors,dc=weill,dc=cornell,dc=edu");
Set<String> emails = new HashSet<>();
if (results != null) {
for (SearchResultEntry entry : results) {
if (entry.getAttributeValue("mail") != null && !entry.getAttributeValue("mail").isEmpty()) {
emails.add(entry.getAttributeValue("mail"));
}
}
}
return emails;
}
示例5: getProgramsForStudents
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
private Set<String> getProgramsForStudents(String uid) {
Set<String> departments = new HashSet<>();
String filter = "(&(objectClass=weillCornellEduSORRecord)(weillCornellEduCWID=" + uid + "))";
List<SearchResultEntry> results = searchWithBaseDN(filter, "ou=students,ou=sors,dc=weill,dc=cornell,dc=edu");
for (SearchResultEntry entry : results) {
if(entry.getAttributeValue("weillCornellEduProgram") != null && !entry.getAttributeValue("weillCornellEduProgram").isEmpty()) {
departments.add(entry.getAttributeValue("weillCornellEduProgram"));
}
}
return departments;
}
示例6: getHrRelationship
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
private void getHrRelationship(String uid) {
String filter = "| ldapsearch domain=ED search='(&(objectClass=eduPerson)"
+ "(|(weillCornellEduPersonTypeCode=academic-faculty-weillfulltime)"
+ "(weillCornellEduPersonTypeCode=academic-faculty-weillparttime)"
+ "(weillCornellEduPersonTypeCode=student-phd-*)"
+ "(weillCornellEduPersonTypeCode=student-md-phd-tri-i)))' attrs='weillCornellEduCWID' "
+ "| fields weillCornellEduCWID "
+ "| join weillCornellEduCWID type=inner ["
+ "| ldapsearch domain=ED search='(&(ou=employees)"
+ "(objectClass=weillCornellEduSORRecord))' "
+ "attrs='weillCornellEduCWID,weillCornellEduPrimaryDepartment,weillCornellEduPrimaryDepartmentCode' "
+ "| fields weillCornellEduCWID,weillCornellEduPrimaryDepartment,weillCornellEduPrimaryDepartmentCode] "
+ "| rename weillCornellEduCWID as targetCWID "
+ "| join weillCornellEduPrimaryDepartmentCode type=inner ["
+ "| ldapsearch domain=ED search='(&(ou=employees)(objectClass=weillCornellEduSORRecord))' "
+ "attrs='weillCornellEduPrimaryDepartmentCode,weillCornellEduCWID' "
+ "| stats dc(weillCornellEduCWID) AS count by weillCornellEduPrimaryDepartmentCode "
+ "| where count < 90] "
+ "| join weillCornellEduPrimaryDepartmentCode type=left max=0 ["
+ "| ldapsearch domain=ED search='(&(ou=employees)(objectClass=weillCornellEduSORRecord))' "
+ "attrs='weillCornellEduPrimaryDepartmentCode,weillCornellEduCWID,sn,givenName' "
+ "| rename weillCornellEduCWID AS relationshipCWID "
+ "| fields relationshipCWID, weillCornellEduPrimaryDepartmentCode, sn, givenName] "
+ "| fields - _* "
+ "| fields targetCWID, relationshipCWID, sn, givenName, count, "
+ "weillCornellEduPrimaryDepartmentCode, weillCornellEduPrimaryDepartment "
+ "| where targetCWID != relationshipCWID";
List<SearchResultEntry> results = searchWithBaseDN(filter, "ou=students,ou=sors,dc=weill,dc=cornell,dc=edu");
for (SearchResultEntry entry : results) {
if(entry.getAttributeValue("firstname") != null && !entry.getAttributeValue("firstname").isEmpty()) {
}
}
}
示例7: searchByCwid
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
/**
* Search LDAP to retrieve name for a given uid.
*
* @param uid
*
* @return AuthorName if found, otherwise null.
*/
private AuthorName searchByCwid(String uid) {
String filter = "(&(objectClass=eduPerson)" + "(weillCornellEduCWID=" + uid + "))";
List<SearchResultEntry> results = searchWithBaseDN(filter, "ou=people,dc=weill,dc=cornell,dc=edu");
if (results != null && !results.isEmpty()) {
SearchResultEntry entry = results.get(0);
if(entry.getAttributeValue("weillCornellEduCWID") != null && !entry.getAttributeValue("weillCornellEduCWID").isEmpty()) {
return new AuthorName(entry.getAttributeValue("givenName"),
entry.getAttributeValue("weillCornellEduMiddleName"),
entry.getAttributeValue("sn").replace("- M.D.", ""));
}
}
return null;
}
示例8: createTeamFromLdap
import com.unboundid.ldap.sdk.SearchResultEntry; //导入方法依赖的package包/类
private TeamModel createTeamFromLdap(SearchResultEntry teamEntry) {
TeamModel answer = new TeamModel(teamEntry.getAttributeValue("cn"));
// potentially retrieve other attributes here in the future
return answer;
}