/** * Retrieves the number of entries currently held in the server. * * @param includeChangeLog Indicates whether to include entries that are * part of the changelog in the count. * * @return The number of entries currently held in the server. */ public int countEntries(final boolean includeChangeLog) { synchronized (entryMap) { if (includeChangeLog || (maxChangelogEntries == 0)) { return entryMap.size(); } else { int count = 0; for (final DN dn : entryMap.keySet()) { if (! dn.isDescendantOf(changeLogBaseDN, true)) { count++; } } return count; } } }
/** * Indicates whether this DN is a descendant of the DN with the provided * string representation. It will be considered a descendant of the provided * DN if the array of RDN components for this DN ends with the elements that * comprise the RDN components for the provided DN (i.e., if this DN is * subordinate to, or optionally equal to, the provided DN). The null DN will * not be considered a descendant for any other DNs (with the exception of the * null DN if {@code allowEquals} is {@code true}). * * @param s The string representation of the DN for which to make * the determination. * @param allowEquals Indicates whether a DN should be considered a * descendant of itself. * * @return {@code true} if this DN may be considered a descendant of the * provided DN, or {@code false} if not. * * @throws LDAPException If the provided string cannot be parsed as a DN. */ public boolean isDescendantOf(final String s, final boolean allowEquals) throws LDAPException { return isDescendantOf(new DN(s), allowEquals); }
/** * Retrieves the number of entries currently held in the server whose DN * matches or is subordinate to the provided base DN. * * @param baseDN The base DN to use for the determination. * * @return The number of entries currently held in the server whose DN * matches or is subordinate to the provided base DN. * * @throws LDAPException If the provided string cannot be parsed as a valid * DN. */ public int countEntriesBelow(final String baseDN) throws LDAPException { synchronized (entryMap) { final DN parsedBaseDN = new DN(baseDN, schemaRef.get()); int count = 0; for (final DN dn : entryMap.keySet()) { if (dn.isDescendantOf(parsedBaseDN, true)) { count++; } } return count; } }
/** * Indicates whether this DN is a descendant of the DN with the provided * string representation. It will be considered a descendant of the provided * DN if the array of RDN components for this DN ends with the elements that * comprise the RDN components for the provided DN (i.e., if this DN is * subordinate to, or optionally equal to, the provided DN). The null DN will * not be considered a descendant for any other DNs (with the exception of the * null DN if {@code allowEquals} is {@code true}). * * @param s The string representation of the DN for which to make * the determination. * @param allowEquals Indicates whether a DN should be considered a * descendant of itself. * * @return {@code true} if this DN may be considered a descendant of the * provided DN, or {@code false} if not. * * @throws LDAPException If the provided string cannot be parsed as a DN. */ public boolean isDescendantOf(final String s, final boolean allowEquals) throws LDAPException { return isDescendantOf(new DN(s), allowEquals); }
if (e.getKey().isDescendantOf(dn, true))
/** * Indicates whether the DN represented by the first string is a descendant of * the DN represented by the second string. The first DN will be considered a * descendant of the second DN if the array of RDN components for the first DN * ends with the elements that comprise the RDN components for the second DN * (i.e., if the first DN is subordinate to, or optionally equal to, the * second DN). The null DN will not be considered a descendant for any other * DNs (with the exception of the null DN if {@code allowEquals} is * {@code true}). * * @param s1 The string representation of the first DN for which to * make the determination. * @param s2 The string representation of the second DN for which * to make the determination. * @param allowEquals Indicates whether a DN should be considered an * ancestor of itself. * * @return {@code true} if this DN may be considered a descendant of the * provided DN, or {@code false} if not. * * @throws LDAPException If either of the provided strings cannot be parsed * as a DN. */ public static boolean isDescendantOf(final String s1, final String s2, final boolean allowEquals) throws LDAPException { return new DN(s1).isDescendantOf(new DN(s2), allowEquals); }
/** * Indicates whether the DN represented by the first string is a descendant of * the DN represented by the second string. The first DN will be considered a * descendant of the second DN if the array of RDN components for the first DN * ends with the elements that comprise the RDN components for the second DN * (i.e., if the first DN is subordinate to, or optionally equal to, the * second DN). The null DN will not be considered a descendant for any other * DNs (with the exception of the null DN if {@code allowEquals} is * {@code true}). * * @param s1 The string representation of the first DN for which to * make the determination. * @param s2 The string representation of the second DN for which * to make the determination. * @param allowEquals Indicates whether a DN should be considered an * ancestor of itself. * * @return {@code true} if this DN may be considered a descendant of the * provided DN, or {@code false} if not. * * @throws LDAPException If either of the provided strings cannot be parsed * as a DN. */ public static boolean isDescendantOf(final String s1, final String s2, final boolean allowEquals) throws LDAPException { return new DN(s1).isDescendantOf(new DN(s2), allowEquals); }
if (! dn.isDescendantOf(baseDNs.get(0), true)) if (dn.isDescendantOf(baseDN, true))
if (! dn.isDescendantOf(sourceDN, true))
return isDescendantOf(baseDN, true); return isDescendantOf(baseDN, false);
return isDescendantOf(baseDN, true); return isDescendantOf(baseDN, false);
if (dn.isDescendantOf(flattenBaseDN, false)) if (dn.isDescendantOf(flattenBaseDN, false))
if (parsedDN.isNullDN() && dn.isDescendantOf(changeLogBaseDN, true))
(! targetDN.isDescendantOf(parsedEntryDN, true)))
if (dn.isDescendantOf(baseDN, true))
(entry.getParsedDN().isDescendantOf(changeLogBaseDN, true)))
else if (parsedEntryDN.isDescendantOf(parsedBaseDN, false))
if (dn.isDescendantOf(flattenBaseDN, false))
if (excludeChangeLog && dn.isDescendantOf(changeLogBaseDN, true))
if (! dn.isDescendantOf(getSplitBaseDN(), true))