Package com.isode.dsapi.aci
Class SimpleACIRule
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<SimpleACIRule.Tuple>,Collection<SimpleACIRule.Tuple>,List<SimpleACIRule.Tuple>,RandomAccess
Representation a rule, which is a list of ACI tuples without role
or area information. Note, however, that these rule tuples do
include some area-related filters: objectclass filters
(refinements) and also a flag that indicates that the rule only
applies to the user's own entry.
The fields of this class may be accessed directly. There are also methods available to simplify access to some of the fields.
- Since:
- 15.0
- Author:
- jp
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresentation of one rule tuple -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanAre these grant rules (true) or deny rules (false)?Label of this rule.Note to explain intended usage of rule, or ""static final Comparator<SimpleACIRule>Comparator to order SimpleACIRules by label.Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionSimpleACIRule(String label, boolean isGrant) Construct a rule with the given label and grant/deny status. -
Method Summary
Modifier and TypeMethodDescriptionAdd a new tuple to the list of tuples making up the rule, with the given label.booleanTest whether the contents of two rules is identical; that is, that all the data is the same apart from the labels.intGenerate a hashcode which is based on the contents (as tested by contentsEqual()) and is not dependent on the order of the rules or the name.voidcopyFrom(SimpleACIRule rule) Copy data from the given rule.deepCopy()Copy the rule, but not the 'original' references.voiddumpXML(com.isode.util.XMLOutput out) Dump rule as XML.booleanTest whether two rules are identical.Get the original SimpleACIRule associated with this role.booleanTest whether there have been changes compared to the original rule.inthashCode()Generate a hashcode which is based on both the contents and the name.static SimpleACIRuleloadXML(com.isode.util.XMLInput in) Try to load up SimpleACIRule from XML.voidSet the note.voidsetOriginal(SimpleACIRule rule) Change the original SimpleACIRule used to support hasChanges().voidsort()Sort the rule tuples into a consistent order.toString()Debugging dump.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Field Details
-
label
Label of this rule. -
note
Note to explain intended usage of rule, or "" -
isGrant
public boolean isGrantAre these grant rules (true) or deny rules (false)? -
ORDER
Comparator to order SimpleACIRules by label.
-
-
Constructor Details
-
SimpleACIRule
Construct a rule with the given label and grant/deny status.- Parameters:
label- Name of ruleisGrant- Is this a grant rule (true) or deny rule (false)?
-
-
Method Details
-
setNote
Set the note. This tidies the note before putting it into 'note', stripping off spaces and tabs at the beginnings or ends of lines.- Parameters:
note- Note to set, or "". Should never be null.
-
addTuple
Add a new tuple to the list of tuples making up the rule, with the given label.- Parameters:
label- Name of tuple- Returns:
- The new SimpleACIRule.Tuple created
-
setOriginal
Change the original SimpleACIRule used to support hasChanges(). -
getOriginal
Get the original SimpleACIRule associated with this role. -
hasChanges
public boolean hasChanges()Test whether there have been changes compared to the original rule. The rule is sorted internally to allow the comparison. If the original rule was not set, this method returns false.- Returns:
- TRUE if there have been changes compared to the original rule; FALSE otherwise or if the original rule was not set.
-
equals
Test whether two rules are identical. The sort() method should have been called on both SimpleACIRule instances first or else the comparison may fail due to ordering issues.- Specified by:
equalsin interfaceCollection<SimpleACIRule.Tuple>- Specified by:
equalsin interfaceList<SimpleACIRule.Tuple>- Overrides:
equalsin classArrayList<SimpleACIRule.Tuple>- Parameters:
o- Object to compare to- Returns:
- Test result
-
contentsHashCode
public int contentsHashCode()Generate a hashcode which is based on the contents (as tested by contentsEqual()) and is not dependent on the order of the rules or the name.- Returns:
- Hash code
-
hashCode
public int hashCode()Generate a hashcode which is based on both the contents and the name.- Specified by:
hashCodein interfaceCollection<SimpleACIRule.Tuple>- Specified by:
hashCodein interfaceList<SimpleACIRule.Tuple>- Overrides:
hashCodein classArrayList<SimpleACIRule.Tuple>- Returns:
- Hash code
-
contentsEqual
Test whether the contents of two rules is identical; that is, that all the data is the same apart from the labels. The sort() method should have been called on both SimpleACIRule instances first or else the comparison may fail due to ordering issues.- Parameters:
bb- SimpleACIRule to compare to- Returns:
- Test result
-
sort
public void sort()Sort the rule tuples into a consistent order. If all SimpleACIRule instances are sorted, then .equals() and .contentEqual() will work consistently even if the tuples were originally loaded in a different order. Otherwise comparisons are sensitive to the loading order. -
dumpXML
Dump rule as XML.- Throws:
IOException
-
loadXML
Try to load up SimpleACIRule from XML. Returns null if not found. -
copyFrom
Copy data from the given rule.- Parameters:
rule- Rule to copy data from, must not be null.
-
deepCopy
Copy the rule, but not the 'original' references. This is cheap slow code -- it copies the tuples by converting them via XML. It could perhaps be improved if there was ever a need to do a lot of copying. -
toString
Debugging dump.- Overrides:
toStringin classAbstractCollection<SimpleACIRule.Tuple>- Returns:
- Debugging dump
-