public Map<String, Object> get() { if (handleEndOfResults()) return null; try { Map<String, Object> entry = new LinkedHashMap<>(attributes.size() + 1); LDAPEntry en = null; en = lsr.next(); entry.put("dn", en.getDN()); if (attributes != null && attributes.size() > 0) { for (int col = 0; col < attributes.size(); col++) { Object val = readValue(en.getAttributeSet().getAttribute(attributes.get(col))); if (val != null) entry.put(attributes.get(col),val ); } } else { // make it dynamic Iterator<LDAPAttribute> iter = en.getAttributeSet().iterator(); while (iter.hasNext()) { LDAPAttribute attr = iter.next(); Object val = readValue(attr); if (val != null) entry.put(attr.getName(), readValue(attr)); } } //System.out.println("entry " + entry); return entry; } catch (LDAPException e) { e.printStackTrace(); throw new RuntimeException("Error getting next ldap entry " + e.getLDAPErrorMessage()); } }
/** * Returns the attributes matching the specified attrName. * * @param attrName The name of the attribute or attributes to return. * <br><br> * @return An array of LDAPAttribute objects. */ public LDAPAttribute getAttribute(String attrName) { return attrs.getAttribute(attrName); }
/** * Returns the attribute matching the specified attrName. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#getAttribute(java.lang.String)"> com.novell.ldap.LDAPAttributeSet.getAttribute(String)</a> */ public LDAPAttribute getAttribute(String attrName) { com.novell.ldap.LDAPAttribute attr; if( (attr = attrSet.getAttribute(attrName)) == null) { return null; } return new LDAPAttribute( attr); }
/** * Returns a single best-match attribute, or null if no match is * available in the entry. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#getAttribute(java.lang.String, java.lang.String)"> com.novell.ldap.LDAPAttributeSet.getAttribute(String, String)</a> */ public LDAPAttribute getAttribute(String attrName, String lang) { com.novell.ldap.LDAPAttribute attr; if( (attr = attrSet.getAttribute(attrName, lang)) == null) { return null; } return new LDAPAttribute( attr + ";" + lang); }
if ( attrSet.getAttribute(attrName) == null ) { attrSet.getAttribute(attrName).addBase64Value(currentField. substring(index+2)); attrSet.getAttribute(attrName).addBase64Value(currentField. substring(index+2)); attrSet.getAttribute(attrName).addValue(vals); attrSet.getAttribute(attrName).addValue(vals);
case ADD_ATTRIBUTE : LDAPAttribute attr = attrSet.getAttribute(attrName);