List of usage examples for javax.naming.directory SearchResult setAttributes
public void setAttributes(Attributes attrs)
attrs
. From source file:org.openadaptor.auxil.connector.jndi.JNDISearch.java
/** * Retrieve the next match from the array of NamingEnumerations (the call to hasMore() will automagically bump it to * the next enumeration in the array if necessary. * /* www .j a va 2s . com*/ * @return Next Entry if available. * @throws NoSuchElementException * if no more matches remain (i.e. hasMore() would have failed). * @throws NamingException * if any other JNDI exception occurs. */ public Object next() throws NamingException { SearchResult result = null; if (hasMore()) { // Something to return! result = (SearchResult) searchResults[current].next(); if (dnAttributeName != null) {// Stuff in the DN String rdn = result.getName(); // Get the relative dn for this match String dn = rdn + "," + executedSearch.getSearchBases()[current]; // Construct a full dn. Attributes attrs = result.getAttributes(); attrs.put(dnAttributeName, dn); result.setAttributes(attrs); } } else { throw new NoSuchElementException(); } return result; }