/** * Returns an iterator over the elements of this set. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#iterator()"> com.novell.ldap.LDAPAttributeSet.iterator()</a> */ public Iterator iterator() { return new WrappedIterator(this.attrSet.iterator()); }
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()); } }
protected void endElement() { LDAPAttributeSet attrset = new LDAPAttributeSet(); attrset.addAll(valuelist); setObject(attrset); } protected void addValue(String tag, Object value) {
/** * This method does DSML serialization of the instance. * * @param oout Outputstream where the serialzed data has to be written * * @throws IOException if write fails on OutputStream */ public void writeDSML(java.io.OutputStream oout) throws java.io.IOException { java.io.Writer out=new java.io.OutputStreamWriter(oout,"UTF-8"); out.write("<LDAPAttributeSet>"); Iterator i=iterator(); while (i.hasNext()){ writeAttribute((LDAPAttribute) i.next(),out); } newLine(0,out); out.write("</LDAPAttributeSet>"); out.close(); }
/** * Returns a deep copy of this attribute set. * * @return A deep copy of this attribute set. */ public Object clone() { try { Object newObj = super.clone(); ((LDAPAttributeSet)newObj).clear(); Iterator i = this.iterator(); while (i.hasNext()){ ((LDAPAttributeSet)newObj).add( ((LDAPAttribute)i.next()).clone()); } return newObj; } catch( CloneNotSupportedException ce) { throw new RuntimeException("Internal error, cannot create clone"); } }
LDAPAttributeSet tempAttributeSet = new LDAPAttributeSet(); Iterator i = this.iterator(); tempAttributeSet.add(attr.clone());
String attrName = null; StringBuffer currentField; LDAPAttributeSet attrSet = new LDAPAttributeSet(); if ( attrSet.getAttribute(attrName) == null ) { attrSet.add(new LDAPAttribute(attrName)); 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);
buff.append("<LDAPAttributeSet>"); Iterator i=iterator(); while (i.hasNext()){ writeAttribute((LDAPAttribute) i.next(),buff);
/** * Build the attribuite list from an LDAPEntry. * * @param entry The LDAPEntry associated with this add request. */ private static final RfcAttributeList makeRfcAttrList( LDAPEntry entry) { // convert Java-API LDAPEntry to RFC2251 AttributeList LDAPAttributeSet attrSet = entry.getAttributeSet(); RfcAttributeList attrList = new RfcAttributeList(attrSet.size()); Iterator itr = attrSet.iterator(); while (itr.hasNext()) { LDAPAttribute attr = (LDAPAttribute)itr.next(); ASN1SetOf vals = new ASN1SetOf(attr.size()); Enumeration attrEnum = attr.getByteValues(); while(attrEnum.hasMoreElements()) { vals.add(new RfcAttributeValue((byte[])attrEnum.nextElement())); } attrList.add(new RfcAttributeTypeAndValues( new RfcAttributeDescription(attr.getName()), vals)); } return attrList; }
/** * 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); }
Iterator it = attribs.keySet().iterator(); LDAPAttributeSet attribSet = new LDAPAttributeSet(); while (it.hasNext()) { String name = (String) it.next(); attribSet.add(ldapAttrib); } else if (o instanceof List) { List l = (List) attribs.get(name); attribSet.add(ldapAttrib); ldapAttrib.addValue(id.getId()); attribSet.add(ldapAttrib);
case ADD_ATTRIBUTE : LDAPAttribute attr = attrSet.getAttribute(attrName); attrSet.add(attr);
/** * Constructs an empty set of attributes. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#LDAPAttributeSet()"> com.novell.ldap.LDAPAttributeSet.LDAPAttributeSet()</a> */ public LDAPAttributeSet() { attrSet = new com.novell.ldap.LDAPAttributeSet(); return; }
/** * Constructs an empty set of attributes. */ public LDAPAttributeSet() { super(); this.clear(); }
/** * Adds the specified attribute to this attribute set. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#add(java.lang.Object)"> com.novell.ldap.LDAPAttributeSet.add(Object)</a> */ public boolean add(Object attr) { com.novell.ldap.LDAPAttribute a; a = ((org.ietf.ldap.LDAPAttribute)attr).getWrappedObject(); return attrSet.add( a); }
/** * Returns a deep copy of this attribute set. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#clone()"> com.novell.ldap.LDAPAttributeSet.clone()</a> */ public Object clone() throws CloneNotSupportedException { try { Object newObj = super.clone(); ((LDAPAttributeSet)newObj).attrSet = (com.novell.ldap.LDAPAttributeSet)attrSet.clone(); return newObj; } catch( CloneNotSupportedException ce) { throw new RuntimeException("Internal error, cannot create clone"); } }
/** * Adds all the specified attributes to this attribute set. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#addAll(java.util.Collection)"> com.novell.ldap.LDAPAttributeSet.addAll(Collection)</a> */ public boolean addAll(java.util.Collection attrs) { return attrSet.addAll(unwrapCollection(attrs)); }
/** * Returns true if this AttributeSet contains the specified Attribute. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttributeSet.html#contains(java.lang.Object)"> com.novell.ldap.LDAPAttributeSet.contains(Object)</a> */ public boolean contains(Object attr) { com.novell.ldap.LDAPAttribute a; a = ((org.ietf.ldap.LDAPAttribute)attr).getWrappedObject(); return attrSet.contains( a); }
/** * Returns true if this Attribute set contains all the attributes * in the specified collection. */ public boolean containsAll(java.util.Collection attrs) { return attrSet.containsAll(unwrapCollection(attrs)); }