Class PathCompletion
- All Implemented Interfaces:
Cloneable
PathCompletion holds this information and even allows to
change it.
It's possible to define more than one completion for a certain entity type of
which all of them have to be evaluated. Basically this means that if more
than one completion exists, the whole path up to this point has to be
duplicated and followed for each completion. These new paths must be combined
using OR.
It may even be that there are no completions for a certain entity type at
all, which may of course cause OrgPolicies to fail.
In any case, one should be careful about changing the default behaviour of
PathCompletion as any change may have a great impact on the
results of existing OrgPolicies or may even cause them to be no longer
resolvable at all (as opposed to policies that can be resolved but produce an
empty result list).
There can't be a completion for Agent as this entity type obviously doesn't need one.
- Author:
- Patrick Schmidt, Ulrich Kreher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<EntityType,NavFunction[]> holds all path completions -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newPathCompletionwith these default values: Path completions per entity type. end of pathcompleted to OrgPosition.getAgents() OrgUnit.getOrgPositions() OrgGroup.getOrgUnits() ProjectGroup.getOrgUnits() + .getOrgPositions() Ability.getRoles() + .getAgents() Role.getOrgPositions() SubstitutionRule.getSubstitute()PathCompletion(Map<EntityType, NavFunction[]> completions) Constructs a newPathCompletionwith the designated values. -
Method Summary
Modifier and TypeMethodDescriptionChecks the consistency of this path completion, that is, whether it contains a cycle.voidclearCompletionsFor(EntityType entType, boolean resetToDefaults) Clears the completions for the given entity type and optionally resets them back to the default values.Clones this path completion by returning a new path completion object having the same path completions as this object.getCompletionsFor(EntityType entType) Returns the path completion(s) for the given entity type ornullif there is no completion defined.voidsetCompletionsFor(EntityType entType, NavFunction... functions) Sets the path completions for the given entity type.
-
Field Details
-
completions
holds all path completions
-
-
Constructor Details
-
PathCompletion
public PathCompletion()Constructs a newPathCompletionwith these default values:Path completions per entity type. end of path completed to OrgPosition .getAgents() OrgUnit .getOrgPositions() OrgGroup .getOrgUnits() ProjectGroup .getOrgUnits() + .getOrgPositions() Ability .getRoles() + .getAgents() Role .getOrgPositions() SubstitutionRule .getSubstitute() -
PathCompletion
Constructs a newPathCompletionwith the designated values. Entity types that do not have a completion in the designated map will be set to the default path completion.- Parameters:
completions- The path completions for entity types. The functions are not chained but OR’ed. Not all entity types need to be set here. For unset completions the default will be used.
-
-
Method Details
-
getCompletionsFor
Returns the path completion(s) for the given entity type ornullif there is no completion defined. See the class description for more information on what theNavFunctionarray contains.- Parameters:
entType- the entity type for which to return the completions- Returns:
- the path completion(s) for the given entity type or
nullif there is no completion defined
-
clearCompletionsFor
Clears the completions for the given entity type and optionally resets them back to the default values.- Parameters:
entType- the entity type for which the path completions should be cleared or resetresetToDefaults- whether the completions should be reset to the default values
-
checkConsistency
Checks the consistency of this path completion, that is, whether it contains a cycle. This has to be done before actually incorporating the path completion in theOrgModelManager.- Returns:
- Whether this path completion has consistency problems (which
returns a describing text) or not (which returns
null).
-
clonePathCompletion
Clones this path completion by returning a new path completion object having the same path completions as this object.- Returns:
- A new path completion object having the same path completions as this object.
-