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 an attribute set from the entry, consisting of only those * attributes matching the specified subtypes. * * @see <a href="../../../../api/com/novell/ldap/LDAPEntry.html#getAttributeSet(java.lang.String)"> com.novell.ldap.LDAPEntry.getAttributeSet(String)</a> */ public LDAPAttributeSet getAttributeSet(String subtype) { return new LDAPAttributeSet( entry.getAttributeSet( subtype)); }
/** * Returns the attribute set of the entry. * * @see <a href="../../../../api/com/novell/ldap/LDAPEntry.html#getAttributeSet()"> com.novell.ldap.LDAPEntry.getAttributeSet()</a> */ public LDAPAttributeSet getAttributeSet() { return new LDAPAttributeSet( entry.getAttributeSet()); }
LDAPEntry entry1 = searchResults.next(); System.out.println("\n" + entry1.getDN()); System.out.println(" Attributes: "); LDAPAttributeSet attributeSet1 = entry1.getAttributeSet(); Iterator allAttributes1 = attributeSet1.iterator(); while(allAttributes1.hasNext()) { LDAPAttribute attribute = (LDAPAttribute)allAttributes1.next(); String attrName = attribute.getName(); System.out.println(" " + attrName); Enumeration allValues1 = attribute.getStringValues(); while(allValues1.hasMoreElements()) { oid = (String) allValues1.nextElement(); if ( (attrName.equalsIgnoreCase("supportedExtension")) || (attrName.equalsIgnoreCase("supportedControl"))) { System.out.println(" " + oid); } } }
private Element myWriteEntry( LDAPEntry entry, LDAPControl[] controls ) { Element e = doc.createElement("searchResultEntry"); e.setAttribute("dn", entry.getDN()); LDAPAttributeSet set = entry.getAttributeSet(); Iterator iterator = set.iterator(); while (iterator.hasNext()){ LDAPAttribute attr = (LDAPAttribute)iterator.next(); Element attribute = doc.createElement("attr"); writeAttribute(attribute, attr); e.appendChild(attribute); } if (controls != null) { writeControls(e, controls); } searchNode.appendChild( e); return e; }
/** * 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("<LDAPEntry dn=\""); out.write(getDN()); out.write("\">"); Iterator i = getAttributeSet().iterator(); while (i.hasNext()){ writeAttribute( (LDAPAttribute) i.next(),out); } newLine(0,out); out.write("</LDAPEntry>"); out.close(); } /**
this.attrs = readObject.getAttributeSet();
buff.append("\">"); Iterator i = getAttributeSet().iterator(); while (i.hasNext()){ writeAttribute( (LDAPAttribute) i.next(),buff);
LDAPAttributeSet attributeSet = nextEntry.getAttributeSet();
private void writeAddRequestEntry( LDAPAddRequest request, LDAPControl[] controls, String requestID) throws IOException, LDAPLocalException { checkState(false); LDAPEntry entry=request.getEntry(); LDAPAttributeSet set = entry.getAttributeSet(); Iterator i = set.iterator(); while (i.hasNext()){ writeAttribute( (LDAPAttribute) i.next()); } if( (controls !=null) && (controls.length != 0)) { writeControls(controls, 3); } newLine(1); out.write("</addRequest>"); return; }
return Collections.<String, String>emptyMap(); LDAPAttributeSet attrSet = userEntry.getAttributeSet(); if (attrSet == null) return Collections.<String, String>emptyMap();
LDAPAttributeSet set = entry.getAttributeSet(); Iterator i = set.iterator(); while (i.hasNext()){
buff.append("\">"); Iterator i = entry.getAttributeSet().iterator(); while (i.hasNext()){ writeAttribute( (LDAPAttribute) i.next(),buff);
LDAPAttributeSet attributeSet = nextEntry.getAttributeSet();
/** * 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; }
LDAPAttributeSet attrSet = entry.getAttributeSet();
/** * Creates a ASN Encoded Sequence for the specified entry. * @param entry The LDAPEntry to be encoded. * @return ASN Encoded representation of the entry. */ private static ASN1Sequence getEntrySequence(LDAPEntry entry) { if (entry == null) { throw new IllegalArgumentException("Argument \"entry\" cannot be null"); } Iterator entryiterator = entry.getAttributeSet().iterator(); ASN1Sequence attributelistsequence = new ASN1Sequence(); while (entryiterator.hasNext()) { ASN1Sequence attributesequence = new ASN1Sequence(); LDAPAttribute attribute = (LDAPAttribute) entryiterator.next(); attributesequence.add(new ASN1OctetString(attribute.getName())); ASN1Set valueset = new ASN1Set(); String[] valueArray = attribute.getStringValueArray(); if (valueArray != null) for (int i = 0; i < valueArray.length; i++) { valueset.add(new ASN1OctetString(valueArray[i])); } attributesequence.add(valueset); attributelistsequence.add(attributesequence); } return attributelistsequence; } /**
LDAPAttributeSet attrSet = entry.getAttributeSet(); Iterator allAttrs = attrSet.iterator();
Set<LDAPAttribute> ldapAttributeSet = ldapEntry.getAttributeSet(); for (LDAPAttribute ldapAttribute : ldapAttributeSet) {
add.setObjectClass(objectClass); Iterator it = entry.getAttributeSet().iterator();