/** * Returns a search entry using the supplied jndi search result. * * @param result jndi search result * * @return search entry * * @throws NamingException if the search result cannot be read */ public SearchEntry toSearchEntry(final SearchResult result) throws NamingException { final SearchEntry se = new SearchEntry(-1, null, sortBehavior); se.setDn(result.getName()); final Attributes a = result.getAttributes(); final NamingEnumeration<? extends Attribute> ne = a.getAll(); while (ne.hasMore()) { se.addAttribute(toLdapAttribute(ne.next())); } return se; }
newAttr = new LdapAttribute(la.getSortBehavior(), la.isBinary()); newAttr.setName(attrTypeName); entry.addAttribute(newAttr);
/** * Returns a search entry using the supplied jndi search result. * * @param result jndi search result * * @return search entry * * @throws NamingException if the search result cannot be read */ public SearchEntry toSearchEntry(final SearchResult result) throws NamingException { final SearchEntry se = new SearchEntry(-1, null, sortBehavior); se.setDn(result.getName()); final Attributes a = result.getAttributes(); final NamingEnumeration<? extends Attribute> ne = a.getAll(); while (ne.hasMore()) { se.addAttribute(toLdapAttribute(ne.next())); } return se; }
newAttr = new LdapAttribute(la.getSortBehavior(), la.isBinary()); newAttr.setName(attrTypeName); entry.addAttribute(newAttr);
/** * Returns a search entry using the supplied jndi search result. * * @param result jndi search result * * @return search entry * * @throws NamingException if the search result cannot be read */ public SearchEntry toSearchEntry(final SearchResult result) throws NamingException { final SearchEntry se = new SearchEntry(-1, null, sortBehavior); se.setDn(result.getName()); final Attributes a = result.getAttributes(); final NamingEnumeration<? extends Attribute> ne = a.getAll(); while (ne.hasMore()) { se.addAttribute(toLdapAttribute(ne.next())); } return se; }
newAttr = new LdapAttribute(la.getSortBehavior(), la.isBinary()); newAttr.setName(attrTypeName); entry.addAttribute(newAttr);
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { if (entry.getAttribute(dnAttributeName) == null) { entry.addAttribute(new LdapAttribute(dnAttributeName, entry.getDn())); } else if (addIfExists) { entry.getAttribute(dnAttributeName).addStringValue(entry.getDn()); } }
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { if (entry.getAttribute(dnAttributeName) == null) { entry.addAttribute(new LdapAttribute(dnAttributeName, entry.getDn())); } else if (addIfExists) { entry.getAttribute(dnAttributeName).addStringValue(entry.getDn()); } }
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { if (entry.getAttribute(dnAttributeName) == null) { entry.addAttribute(new LdapAttribute(dnAttributeName, entry.getDn())); } else if (addIfExists) { entry.getAttribute(dnAttributeName).addStringValue(entry.getDn()); } }
/** * Returns a search entry using the supplied apache ldap entry. * * @param e apache ldap entry * @param c response controls * @param id message id * * @return search entry */ public SearchEntry toSearchEntry(final Entry e, final ResponseControl[] c, final int id) { final SearchEntry se = new SearchEntry(id, c, sortBehavior); se.setDn(e.getDn().getName()); for (Attribute a : e) { se.addAttribute(toLdapAttribute(a)); } return se; }
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { for (LdapAttribute la : entry.getAttributes()) { if (attributeName.equalsIgnoreCase(la.getName())) { if (la.isBinary()) { final LdapAttribute newAttr = new LdapAttribute(la.getSortBehavior()); newAttr.setName(la.getName()); for (byte[] b : la.getBinaryValues()) { newAttr.addStringValue(convertValue(b)); } entry.addAttribute(newAttr); logger.debug("Processed attribute {}", newAttr); handleAttribute(conn, request, newAttr); } else { logger.warn("Attribute {} must be set as a binary attribute", attributeName); handleAttribute(conn, request, la); } } else { handleAttribute(conn, request, la); } } }
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { for (LdapAttribute la : entry.getAttributes()) { if (attributeName.equalsIgnoreCase(la.getName())) { if (la.isBinary()) { final LdapAttribute newAttr = new LdapAttribute(la.getSortBehavior()); newAttr.setName(la.getName()); for (byte[] b : la.getBinaryValues()) { newAttr.addStringValue(convertValue(b)); } entry.addAttribute(newAttr); logger.debug("Processed attribute {}", newAttr); handleAttribute(conn, request, newAttr); } else { logger.warn("Attribute {} must be set as a binary attribute", attributeName); handleAttribute(conn, request, la); } } else { handleAttribute(conn, request, la); } } }
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { for (LdapAttribute la : entry.getAttributes()) { if (attributeName.equalsIgnoreCase(la.getName())) { if (la.isBinary()) { final LdapAttribute newAttr = new LdapAttribute(la.getSortBehavior()); newAttr.setName(la.getName()); for (byte[] b : la.getBinaryValues()) { newAttr.addStringValue(convertValue(b)); } entry.addAttribute(newAttr); logger.debug("Processed attribute {}", newAttr); handleAttribute(conn, request, newAttr); } else { logger.warn("Attribute {} must be set as a binary attribute", attributeName); handleAttribute(conn, request, la); } } else { handleAttribute(conn, request, la); } } }
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { boolean newAttribute = false; LdapAttribute mergedAttribute = entry.getAttribute(mergeAttributeName); if (mergedAttribute == null) { mergedAttribute = new LdapAttribute(mergeAttributeName); newAttribute = true; } for (String s : attributeNames) { final LdapAttribute la = entry.getAttribute(s); if (la != null) { if (la.isBinary()) { mergedAttribute.addBinaryValues(la.getBinaryValues()); } else { mergedAttribute.addStringValues(la.getStringValues()); } } } if (mergedAttribute.size() > 0 && newAttribute) { entry.addAttribute(mergedAttribute); } }
if (memberOf == null) { memberOf = new LdapAttribute("memberOf"); entry.addAttribute(memberOf);
if (memberOf == null) { memberOf = new LdapAttribute("memberOf"); entry.addAttribute(memberOf);
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { boolean newAttribute = false; LdapAttribute mergedAttribute = entry.getAttribute(mergeAttributeName); if (mergedAttribute == null) { mergedAttribute = new LdapAttribute(mergeAttributeName); newAttribute = true; } for (String s : attributeNames) { final LdapAttribute la = entry.getAttribute(s); if (la != null) { if (la.isBinary()) { mergedAttribute.addBinaryValues(la.getBinaryValues()); } else { mergedAttribute.addStringValues(la.getStringValues()); } } } if (mergedAttribute.size() > 0 && newAttribute) { entry.addAttribute(mergedAttribute); } }
if (memberOf == null) { memberOf = new LdapAttribute("memberOf"); entry.addAttribute(memberOf);
@Override protected void handleAttributes(final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { boolean newAttribute = false; LdapAttribute mergedAttribute = entry.getAttribute(mergeAttributeName); if (mergedAttribute == null) { mergedAttribute = new LdapAttribute(mergeAttributeName); newAttribute = true; } for (String s : attributeNames) { final LdapAttribute la = entry.getAttribute(s); if (la != null) { if (la.isBinary()) { mergedAttribute.addBinaryValues(la.getBinaryValues()); } else { mergedAttribute.addStringValues(la.getStringValues()); } } } if (mergedAttribute.size() > 0 && newAttribute) { entry.addAttribute(mergedAttribute); } }