本文整理汇总了Java中com.novell.ldap.LDAPEntry.getAttributeSet方法的典型用法代码示例。如果您正苦于以下问题:Java LDAPEntry.getAttributeSet方法的具体用法?Java LDAPEntry.getAttributeSet怎么用?Java LDAPEntry.getAttributeSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.novell.ldap.LDAPEntry
的用法示例。
在下文中一共展示了LDAPEntry.getAttributeSet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapEntry
import com.novell.ldap.LDAPEntry; //导入方法依赖的package包/类
public LDAPEntry mapEntry(LDAPEntry origEntry,boolean outbound) {
NamingUtils util = new NamingUtils();
LDAPAttributeSet nattribs = new LDAPAttributeSet();
LDAPAttributeSet origAttribs = origEntry.getAttributeSet();
Iterator it = origAttribs.iterator();
while (it.hasNext()) {
LDAPAttribute origAttrib = (LDAPAttribute) it.next();
LDAPAttribute nattrib = mapAttribute(outbound, util, origAttrib);
nattribs.add(nattrib);
}
return new LDAPEntry(origEntry.getDN(),nattribs);
}
示例2: toLDIF
import com.novell.ldap.LDAPEntry; //导入方法依赖的package包/类
public static String toLDIF(LDAPEntry entry) {
StringBuffer buf = new StringBuffer();
buf.append("dn: ").append(entry.getDN()).append('\n');
LDAPAttributeSet attrs = entry.getAttributeSet();
Iterator<LDAPAttribute> it = attrs.iterator();
while (it.hasNext()) {
LDAPAttribute attr = it.next();
Enumeration enumer = attr.getStringValues();
while (enumer.hasMoreElements()) {
buf.append(attr.getName()).append(": ").append(enumer.nextElement()).append('\n');
}
}
return buf.toString();
}
示例3: compareEntry
import com.novell.ldap.LDAPEntry; //导入方法依赖的package包/类
public static boolean compareEntry(LDAPEntry entry1,LDAPEntry entry2) {
if (! entry1.getDN().equalsIgnoreCase(entry2.getDN())) {
return false;
}
LDAPAttributeSet attribs1 = entry1.getAttributeSet();
LDAPAttributeSet attribs2 = entry2.getAttributeSet();
Iterator<?> it = attribs1.iterator();
int size = attribs2.size();
while (it.hasNext()) {
LDAPAttribute attrib1 = (LDAPAttribute) it.next();
LDAPAttribute attrib2 = attribs2.getAttribute(attrib1.getName());
if (attrib2 == null ) {
System.err.println("not found: " + attrib1.getName() + "\n" + "In Compare: Entries don't match : \nFrom Server\n" + toLDIF(entry1) + "\n\nFrom LDIF\n" + toLDIF(entry2));
return false;
}
size--;
String[] vals1 = attrib1.getStringValueArray();
String[] vals2 = attrib2.getStringValueArray();
if (vals2.length != vals1.length) {
System.err.println(attrib1.getName() + "\n" + "In Compare: Entries don't match : \nFrom Server\n" + toLDIF(entry1) + "\n\nFrom LDIF\n" + toLDIF(entry2));
return false;
}
for (int i=0,m=vals1.length;i<m;i++) {
boolean found = false;
for (int j=0,n=vals2.length;j<n;j++) {
if (vals1[i].equalsIgnoreCase(vals2[j])) {
found = true;
}
}
if (! found) {
System.err.println(attrib1.getName() + "/" + vals1[i] + "\n" + "In Compare: Entries don't match : \nFrom Server\n" + toLDIF(entry1) + "\n\nFrom LDIF\n" + toLDIF(entry2));
return false;
}
}
}
if (size != 0) {
return false;
}
return true;
}
示例4: get
import com.novell.ldap.LDAPEntry; //导入方法依赖的package包/类
@Override
public Entry get() throws CursorException {
try {
LDAPEntry nentry = null;
if (buffer != null) {
nentry = buffer.getEntry();
buffer = null;
} else {
nentry = res.next().getEntry();
}
Entry entry = new DefaultEntry();
entry.setDn(nentry.getDN());
LDAPAttributeSet attrs = nentry.getAttributeSet();
for (Object o : attrs) {
LDAPAttribute a = (LDAPAttribute) o;
String oid = "";
AttributeType at;
byte[][] vals = a.getByteValueArray();
DefaultAttribute attr = new DefaultAttribute(a.getName());
attr.add(vals);
entry.add(attr);
}
return entry;
} catch (Exception e) {
throw new CursorException(e);
}
}