本文整理汇总了Java中javax.naming.directory.SearchResult.getName方法的典型用法代码示例。如果您正苦于以下问题:Java SearchResult.getName方法的具体用法?Java SearchResult.getName怎么用?Java SearchResult.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.directory.SearchResult
的用法示例。
在下文中一共展示了SearchResult.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeSearchResult
import javax.naming.directory.SearchResult; //导入方法依赖的package包/类
/**
* Converts a JNDI SearchResult into our LdapEntry object.
*/
private LdapEntry decodeSearchResult(
SearchResult sr,
String contextBase,
String[] attrNames)
throws LdapException
{
// print dn == distinguished name
String dn;
if (sr.getName() == null || sr.getName().length() == 0)
dn = contextBase;
else dn = sr.getName() + "," + contextBase;
Attributes attrraw = sr.getAttributes();
return decodeAttributes( dn, attrNames, attrraw);
}
示例2: retrieveName
import javax.naming.directory.SearchResult; //导入方法依赖的package包/类
String retrieveName(Properties ldapProps, SearchResult res) {
String name = "";
if (res.isRelative()) {
name = res.getName();
} else {
name = res.getNameInNamespace();
String urlName = res.getName();
int index = urlName.lastIndexOf("/");
if (index > 0) {
ldapProps.put(Context.PROVIDER_URL,
urlName.substring(0, index));
}
}
return name;
}
示例3: formatGroupId
import javax.naming.directory.SearchResult; //导入方法依赖的package包/类
private String formatGroupId(SearchResult sResult) {
if (null == sResult) {
return "";
}
String groupId = "";
String userDN = sResult.getName();
if (userDN.length() <= 0) {
return "";
}
String[] strings = userDN.split(",");
String loginbaseDN = ldapConfig.get("loginbasedn");
String rootOU = loginbaseDN.substring(loginbaseDN.indexOf("=") + 1, loginbaseDN.indexOf(","));
for (int i = 1; i < strings.length; i++) {
String s = strings[i];
s = s.substring(s.indexOf("=") + 1);
if (s.equals(rootOU)) {
break;
}
groupId = s + "/" + groupId;
}
groupId = groupId.substring(0, groupId.length() - 1);
return groupId;
}