public List<String> getAttributes(Entry entry, String attName) { List<String> values = new ArrayList<>(); javax.naming.directory.Attribute att = AttributeUtils.toAttributes(entry).get(attName); if (att == null) { return values; } try { NamingEnumeration<?> list = att.getAll(); while (list.hasMore()) { values.add(list.next().toString()); } } catch (NamingException e) { log.warn("Error while processing LDAP attribute {}, result could be incomplete!", attName, e); } return values; }
/** * Convert a LDIF String to a JNDI attributes. * * @param ldif The LDIF string containing an attribute value * @return An Attributes instance * @exception LdapLdifException If the LDIF String cannot be converted to an Attributes */ public static Attributes getJndiAttributesFromLdif( String ldif ) throws LdapLdifException { try ( LdifAttributesReader reader = new LdifAttributesReader() ) { return AttributeUtils.toAttributes( reader.parseEntry( ldif ) ); } catch ( IOException ioe ) { throw new LdapLdifException( ioe.getMessage(), ioe ); } }
/** * Convert a LDIF String to a JNDI attributes. * * @param ldif The LDIF string containing an attribute value * @return An Attributes instance * @exception LdapLdifException If the LDIF String cannot be converted to an Attributes */ public static Attributes getJndiAttributesFromLdif( String ldif ) throws LdapLdifException { try ( LdifAttributesReader reader = new LdifAttributesReader() ) { return AttributeUtils.toAttributes( reader.parseEntry( ldif ) ); } catch ( IOException ioe ) { throw new LdapLdifException( ioe.getMessage(), ioe ); } }
/** * Convert a LDIF String to a JNDI attributes. * * @param ldif The LDIF string containing an attribute value * @return An Attributes instance * @exception LdapLdifException If the LDIF String cannot be converted to an Attributes */ public static Attributes getJndiAttributesFromLdif( String ldif ) throws LdapLdifException { try ( LdifAttributesReader reader = new LdifAttributesReader() ) { return AttributeUtils.toAttributes( reader.parseEntry( ldif ) ); } catch ( IOException ioe ) { throw new LdapLdifException( ioe.getMessage(), ioe ); } }
return AttributeUtils.toAttributes( reader.parseEntry( sb.toString() ) );
return AttributeUtils.toAttributes( reader.parseEntry( sb.toString() ) );
return AttributeUtils.toAttributes( reader.parseEntry( sb.toString() ) );
AttributeUtils.toAttributes( currentSearchResultEntry.getEntry() ) ); sr.setNameInNamespace( currentSearchResultEntry.getObjectName().toString() );