/** * Retrieves the parsed new RDN value for the entry. * * @return The parsed new RDN value for the entry. * * @throws LDAPException If a problem occurs while trying to parse the new * RDN. */ public RDN getParsedNewRDN() throws LDAPException { if (parsedNewRDN == null) { parsedNewRDN = new RDN(newRDN); } return parsedNewRDN; }
/** * Retrieves the parsed new RDN value for the entry. * * @return The parsed new RDN value for the entry. * * @throws LDAPException If a problem occurs while trying to parse the new * RDN. */ public RDN getParsedNewRDN() throws LDAPException { if (parsedNewRDN == null) { parsedNewRDN = new RDN(newRDN); } return parsedNewRDN; }
/** * Indicates whether the provided string represents a valid RDN. * * @param s The string for which to make the determination. It must not be * {@code null}. * * @return {@code true} if the provided string represents a valid RDN, or * {@code false} if not. */ public static boolean isValidRDN(final String s) { try { new RDN(s); return true; } catch (LDAPException le) { return false; } }
/** * Indicates whether the provided string represents a valid RDN. * * @param s The string for which to make the determination. It must not be * {@code null}. * * @return {@code true} if the provided string represents a valid RDN, or * {@code false} if not. */ public static boolean isValidRDN(final String s) { try { new RDN(s); return true; } catch (LDAPException le) { return false; } }
/** * Indicates whether the two provided strings represent the same RDN. * * @param s1 The string representation of the first RDN for which to make * the determination. It must not be {@code null}. * @param s2 The string representation of the second RDN for which to make * the determination. It must not be {@code null}. * * @return {@code true} if the provided strings represent the same RDN, or * {@code false} if not. * * @throws LDAPException If either of the provided strings cannot be parsed * as an RDN. */ public static boolean equals(final String s1, final String s2) throws LDAPException { return new RDN(s1).equals(new RDN(s2)); }
/** * Indicates whether the two provided strings represent the same RDN. * * @param s1 The string representation of the first RDN for which to make * the determination. It must not be {@code null}. * @param s2 The string representation of the second RDN for which to make * the determination. It must not be {@code null}. * * @return {@code true} if the provided strings represent the same RDN, or * {@code false} if not. * * @throws LDAPException If either of the provided strings cannot be parsed * as an RDN. */ public static boolean equals(final String s1, final String s2) throws LDAPException { return new RDN(s1).equals(new RDN(s2)); }
/** * Compares the RDN values with the provided string representations to * determine their relative order in a sorted list. * * @param s1 The string representation of the first RDN to be compared. * It must not be {@code null}. * @param s2 The string representation of the second RDN to be compared. * It must not be {@code null}. * @param schema The schema to use to generate the normalized string * representations of the RDNs. It may be {@code null} if no * schema is available. * * @return A negative integer if the first RDN should come before the second * RDN in a sorted list, a positive integer if the first RDN should * come after the second RDN in a sorted list, or zero if the two RDN * values can be considered equal. * * @throws LDAPException If either of the provided strings cannot be parsed * as an RDN. */ public static int compare(final String s1, final String s2, final Schema schema) throws LDAPException { return new RDN(s1, schema).compareTo(new RDN(s2, schema)); } }
/** * Compares the RDN values with the provided string representations to * determine their relative order in a sorted list. * * @param s1 The string representation of the first RDN to be compared. * It must not be {@code null}. * @param s2 The string representation of the second RDN to be compared. * It must not be {@code null}. * @param schema The schema to use to generate the normalized string * representations of the RDNs. It may be {@code null} if no * schema is available. * * @return A negative integer if the first RDN should come before the second * RDN in a sorted list, a positive integer if the first RDN should * come after the second RDN in a sorted list, or zero if the two RDN * values can be considered equal. * * @throws LDAPException If either of the provided strings cannot be parsed * as an RDN. */ public static int compare(final String s1, final String s2, final Schema schema) throws LDAPException { return new RDN(s1, schema).compareTo(new RDN(s2, schema)); } }
/** * Retrieves a normalized string representation of the RDN with the provided * string representation. * * @param s The string representation of the RDN to normalize. It must * not be {@code null}. * @param schema The schema to use to generate the normalized string * representation of the RDN. It may be {@code null} if no * schema is available. * * @return The normalized string representation of the RDN with the provided * string representation. * * @throws LDAPException If the provided string cannot be parsed as an RDN. */ public static String normalize(final String s, final Schema schema) throws LDAPException { return new RDN(s, schema).toNormalizedString(); }
/** * Indicates whether the RDN with the provided string representation is equal * to this RDN. * * @param s The string representation of the DN to compare with this RDN. * * @return {@code true} if the DN with the provided string representation is * equal to this RDN, or {@code false} if not. * * @throws LDAPException If the provided string cannot be parsed as an RDN. */ public boolean equals(final String s) throws LDAPException { if (s == null) { return false; } return equals(new RDN(s, schema)); }
/** * Retrieves a normalized string representation of the RDN with the provided * string representation. * * @param s The string representation of the RDN to normalize. It must * not be {@code null}. * @param schema The schema to use to generate the normalized string * representation of the RDN. It may be {@code null} if no * schema is available. * * @return The normalized string representation of the RDN with the provided * string representation. * * @throws LDAPException If the provided string cannot be parsed as an RDN. */ public static String normalize(final String s, final Schema schema) throws LDAPException { return new RDN(s, schema).toNormalizedString(); }
/** * Indicates whether the RDN with the provided string representation is equal * to this RDN. * * @param s The string representation of the DN to compare with this RDN. * * @return {@code true} if the DN with the provided string representation is * equal to this RDN, or {@code false} if not. * * @throws LDAPException If the provided string cannot be parsed as an RDN. */ public boolean equals(final String s) throws LDAPException { if (s == null) { return false; } return equals(new RDN(s, schema)); }
final RDN rdnObject = new RDN(rdn);
return new RDN(names, scrambledValues, schema);
@Override public void addGroupMember(String accountDN, String groupName) throws LdapSystemException { try (LDAPConnection conn = ldapPool.getConnection()) { LdapGroup group = getGroup(groupName, conn); if (group != null && group.getMembersDn().contains(accountDN)) { log.info("Nothing to do. Account {} is already member of group {}", accountDN, group.getName()); } else { if (group == null) { log.debug("Creating group {}", groupName); DN groupDN = new DN(new RDN(GROUP_NAME_ATTR, groupName), new DN(config.getLdapGroupsBaseDN())); Entry groupEntry = new Entry(groupDN); groupEntry.addAttribute("objectClass", config.getLdapGroupsObjectClass()); groupEntry.addAttribute(config.getLdapGroupsMemberAttr(), accountDN); conn.add(groupEntry); log.info("Group {} added", groupDN); } else { Modification mod = new Modification(ADD, config.getLdapGroupsMemberAttr(), accountDN); conn.modify(new ModifyRequest(group.getDn(), mod)); log.info("Added membership {} to {}", accountDN, group.getName()); } } } catch (LDAPException e) { throw new LdapSystemException(e); } }
final Collection<Attribute> additionalAttributes) final RDN rdn = new RDN(rdnAttr, rdnValue);
new RDN(newNames, originalRDNs[i].getByteArrayAttributeValues());
newRDNs[i] = new RDN(names, newValues, schema);
final RDN parsedNewRDN = new RDN(newRDN);