Package com.isode.dsapi.aci
Class SimpleACIArea
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<SimpleACIArea.Region>
,Collection<SimpleACIArea.Region>
,List<SimpleACIArea.Region>
,RandomAccess
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Chop-point within a Region.static class
List of chop-points.static class
Representation of a region of the DIT. -
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty area.SimpleACIArea
(SimpleACIArea area) Construct a new area copied from another one. -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(SimpleACIArea.Region region) Appends the specified element to this list at the correct position according to the sorting order.void
Add a new region to the area.void
Add a new region to the area, with the given min/max depths.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.void
add
(DN base, SimpleACIArea.ChopList chops) Add a new region to the area, with the given chop-points.boolean
addAll
(Collection<? extends SimpleACIArea.Region> c) Appends all of the elements in the specified collection to this list, in the correct sorting order.void
chopSubtree
(DN chop_dn, boolean after) Chop the given subtree out of this area.void
chopSubtree
(DN chop_dn, boolean after, List<DN> exc_dns) Chop the given subtree, but with exceptions.void
Dump the area out to the given XMLOutput stream.dup()
Copy a SimpleACIArea.boolean
Check that the two areas are identical.void
eraseSubtree
(DN erase_dn) This erases any information held about the given subtree.boolean
Check whether any part of this area intersects the given region.static SimpleACIArea
Try to load up a SimpleACIArea from XML.void
Make this area apply to the whole DIT, from root downwards.void
Relocate the area according to a list of source/target pairs.void
Relocate a subtree.void
set
(SimpleACIArea area) Set the contents of this area to match the contents of the given area.void
simplify()
Try to simplify the list of regions by merging regions together.void
subtreeIntersection
(DN keep_dn) Chops all areas except the given subtree, i.e.toString()
Debugging dump.Methods inherited from class java.util.ArrayList
add, addAll, clear, clone, contains, ensureCapacity, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Constructor Details
-
SimpleACIArea
public SimpleACIArea()Construct an empty area. -
SimpleACIArea
Construct a new area copied from another one.
-
-
Method Details
-
add
Appends the specified element to this list at the correct position according to the sorting order.- Specified by:
add
in interfaceCollection<SimpleACIArea.Region>
- Specified by:
add
in interfaceList<SimpleACIArea.Region>
- Overrides:
add
in classArrayList<SimpleACIArea.Region>
- Parameters:
region
- element to be appended to this list- Returns:
- true if this list changed as a result of the call
-
addAll
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 interfaceCollection<SimpleACIArea.Region>
- Specified by:
addAll
in interfaceList<SimpleACIArea.Region>
- Overrides:
addAll
in classArrayList<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
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
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 subtreechops
-SimpleACIArea.ChopList
containing list of chops to add. Any which aren't descendants of the base DN are discarded
-
add
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 subtreemin
- Minimum depth, or 0 for all entriesmax
- Maximum depth, or -1 for all entries; 0 means only include the topmost entry
-
add
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 subtreemin
- Minimum depth, or 0 for all entriesmax
- Maximum depth, or -1 for all entries; 0 means only include the topmost entrychops
-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
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
Check whether any part of this area intersects the given region.- Parameters:
test
- Region to test against
-
chopSubtree
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 chopafter
- true: chop-after, false: chop-before
-
chopSubtree
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 chopafter
- true: chop-after, false: chop-beforeexc_dns
- List of DNs of subtrees to keep
-
subtreeIntersection
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
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
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 relocatetarget
- Target DN to relocate to
-
relocate
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 thanchopSubtree(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
Dump the area out to the given XMLOutput stream.- Throws:
IOException
-
loadXML
Try to load up a SimpleACIArea from XML. If not present, null is returned. -
dup
Copy a SimpleACIArea. -
equals
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 interfaceCollection<SimpleACIArea.Region>
- Specified by:
equals
in interfaceList<SimpleACIArea.Region>
- Overrides:
equals
in classArrayList<SimpleACIArea.Region>
-
toString
Debugging dump.- Overrides:
toString
in classAbstractCollection<SimpleACIArea.Region>
-