Class SimpleACIArea

All Implemented Interfaces:
Serializable, Cloneable, Iterable<SimpleACIArea.Region>, Collection<SimpleACIArea.Region>, List<SimpleACIArea.Region>, RandomAccess

public class SimpleACIArea extends ArrayList<SimpleACIArea.Region>
Representation of set of regions in the DIT. The area may be a single region, or may consist of a patchwork of different regions in different parts of the DIT. The overall area is considered the union of all its constituent regions.
Since:
15.0
Author:
jp
See Also:
  • Constructor Details

    • SimpleACIArea

      public SimpleACIArea()
      Construct an empty area.
    • SimpleACIArea

      public SimpleACIArea(SimpleACIArea area)
      Construct a new area copied from another one.
  • Method Details

    • add

      public boolean add(SimpleACIArea.Region region)
      Appends the specified element to this list at the correct position according to the sorting order.
      Specified by:
      add in interface Collection<SimpleACIArea.Region>
      Specified by:
      add in interface List<SimpleACIArea.Region>
      Overrides:
      add in class ArrayList<SimpleACIArea.Region>
      Parameters:
      region - element to be appended to this list
      Returns:
      true if this list changed as a result of the call
    • addAll

      public boolean addAll(Collection<? extends SimpleACIArea.Region> c)
      Appends all of the elements in the specified collection to this list, in the correct sorting order. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)
      Specified by:
      addAll in interface Collection<SimpleACIArea.Region>
      Specified by:
      addAll in interface List<SimpleACIArea.Region>
      Overrides:
      addAll in class ArrayList<SimpleACIArea.Region>
      Parameters:
      c - collection containing elements to be added to this list
      Returns:
      true if this list changed as a result of the call
      Throws:
      NullPointerException - if the specified collection is null
    • add

      public void add(DN base)
      Add a new region to the area. The region consists of a subtree starting at the given DN.
      Parameters:
      base - DN of the entry at the top of the region's subtree
    • add

      public void add(DN base, SimpleACIArea.ChopList chops)
      Add a new region to the area, with the given chop-points. The region consists of a subtree starting at the given DN.
      Parameters:
      base - DN of the entry at the top of the region's subtree
      chops - SimpleACIArea.ChopList containing list of chops to add. Any which aren't descendants of the base DN are discarded
    • add

      public void add(DN base, int min, int max)
      Add a new region to the area, with the given min/max depths. The region consists of a subtree starting at the given DN.
      Parameters:
      base - DN of the entry at the top of the region's subtree
      min - Minimum depth, or 0 for all entries
      max - Maximum depth, or -1 for all entries; 0 means only include the topmost entry
    • add

      public void add(DN base, int min, int max, SimpleACIArea.ChopList chops)
      Add a new region to the area, with the given min/max depths and chop-points. The region consists of a subtree starting at the given DN.
      Parameters:
      base - DN of the entry at the top of the region's subtree
      min - Minimum depth, or 0 for all entries
      max - Maximum depth, or -1 for all entries; 0 means only include the topmost entry
      chops - SimpleACIArea.ChopList containing list of chops to add. Any which aren't descendants of the base DN are discarded
    • makeGlobal

      public void makeGlobal()
      Make this area apply to the whole DIT, from root downwards. Any previously-added regions are lost.
    • set

      public void set(SimpleACIArea area)
      Set the contents of this area to match the contents of the given area. This just copies its list of regions, since regions are immutable.
      Parameters:
      area - SimpleACIArea to copy
    • intersects

      public boolean intersects(SimpleACIArea.Region test)
      Check whether any part of this area intersects the given region.
      Parameters:
      test - Region to test against
    • chopSubtree

      public void chopSubtree(DN chop_dn, boolean after)
      Chop the given subtree out of this area. This adds chop points for the given subtree onto all the regions in this area that are affected, and may exclude some regions entirely.
      Parameters:
      chop_dn - DN of subtree to chop
      after - true: chop-after, false: chop-before
    • chopSubtree

      public void chopSubtree(DN chop_dn, boolean after, List<DN> exc_dns)
      Chop the given subtree, but with exceptions. Keep the sub-regions that belong to the subtrees of the given list of exception DNs as active regions.
      Parameters:
      chop_dn - DN of subtree to chop
      after - true: chop-after, false: chop-before
      exc_dns - List of DNs of subtrees to keep
    • subtreeIntersection

      public void subtreeIntersection(DN keep_dn)
      Chops all areas except the given subtree, i.e. performs an intersection operation with the given subtree.
      Parameters:
      keep_dn - DN of subtree to keep
    • eraseSubtree

      public void eraseSubtree(DN erase_dn)
      This erases any information held about the given subtree. The subtree takes on the same selection status that a miscellaneous subtree at that same level would have (i.e. some subtree with a random name that is not significant to the existing spec in any way). This means that its status will be affected by whether the nearest significant parent is a chop or a selection, and any depth specifications in force.
      Parameters:
      erase_dn - DN of subtree to erase
    • relocate

      public void relocate(DN source, DN target)
      Relocate a subtree. The subtree is effectively chopped out of the area, relocated, and then merged back in.
      Parameters:
      source - Source DN of subtree to relocate
      target - Target DN to relocate to
    • relocate

      public void relocate(DN[] reloc_arr)
      Relocate the area according to a list of source/target pairs. The logical process for relocating a given DN is to go through the 'reloc_arr' and find the first source/target pair in which the DN is within the source subtree. The DN is then relocated according to that pair. If the DN does not match any source/target pair, then it is not relocated.

      Note that where a subtree is relocated out of another subtree, it is cleared with eraseSubtree(com.isode.dsapi.DN) rather than chopSubtree(com.isode.dsapi.DN, boolean), so it inherits its selection state from the parent.

      In the case where two different subtrees are relocated to the same target location, then the second one will overwrite the first one. It is better to avoid this situation. Whilst it would be possible to merge the areas, whether it is safer to merge with 'union' or 'intersection' would depend on whether this is a deny or a grant, i.e. that requires outside knowledge.

      Parameters:
      reloc_arr - Array containing an even number of DNs organized into pairs of DNs: a source DN and a target DN. Each source/target pair specify a subtree relocation. The pairs should be ordered deepest-first by source DN.
    • simplify

      public void simplify()
      Try to simplify the list of regions by merging regions together.
    • dumpXML

      public void dumpXML(com.isode.util.XMLOutput out, String tagname) throws IOException
      Dump the area out to the given XMLOutput stream.
      Throws:
      IOException
    • loadXML

      public static SimpleACIArea loadXML(com.isode.util.XMLInput in, String tagname)
      Try to load up a SimpleACIArea from XML. If not present, null is returned.
    • dup

      public SimpleACIArea dup()
      Copy a SimpleACIArea.
    • equals

      public boolean equals(Object o)
      Check that the two areas are identical. It is necessary to call sort() first if this is going to work on areas that might have been loaded up in a different order.
      Specified by:
      equals in interface Collection<SimpleACIArea.Region>
      Specified by:
      equals in interface List<SimpleACIArea.Region>
      Overrides:
      equals in class ArrayList<SimpleACIArea.Region>
    • toString

      public String toString()
      Debugging dump.
      Overrides:
      toString in class AbstractCollection<SimpleACIArea.Region>