Class AbstractCustomReferencePolicy<TYPE>
java.lang.Object
gov.nist.secauto.oscal.lib.profile.resolver.policy.AbstractCustomReferencePolicy<TYPE>
- All Implemented Interfaces:
ICustomReferencePolicy<TYPE>,IReferencePolicy<TYPE>
- Direct Known Subclasses:
AbstractMultiItemTypeReferencePolicy,AnchorReferencePolicy,InsertReferencePolicy
public abstract class AbstractCustomReferencePolicy<TYPE>
extends Object
implements ICustomReferencePolicy<TYPE>
-
Field Summary
Fields inherited from interface gov.nist.secauto.oscal.lib.profile.resolver.policy.IReferencePolicy
IGNORE_POLICY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCustomReferencePolicy(IIdentifierParser identifierParser) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract List<IEntityItem.ItemType>getEntityItemTypes(TYPE reference) Get the possible item types that can be searched in the order in which the identifier will be looked up.Get the parser to use to parse an entity identifier from the reference text.protected booleanhandleIdentifier(gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, TYPE type, String identifier, ReferenceCountingVisitor.Context visitorContext) Handle the providedidentifierfor a giventypeof reference.protected booleanhandleIdentifierNonMatch(gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, TYPE reference, ReferenceCountingVisitor.Context visitorContext) Handle the case where the identifier was not a syntax match for an expected identifier.protected booleanhandleIndexHit(gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, TYPE reference, IEntityItem item, ReferenceCountingVisitor.Context visitorContext) Handle an index hit.protected booleanhandleIndexMiss(gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, TYPE reference, List<IEntityItem.ItemType> itemTypes, String identifier, ReferenceCountingVisitor.Context visitorContext) Handle an index miss for a reference.booleanhandleReference(gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, TYPE type, ReferenceCountingVisitor.Context visitorContext) Handle the providedreference.protected voidhandleSelected(gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, TYPE reference, IEntityItem item, ReferenceCountingVisitor.Context visitorContext) Handle an index hit against an item related to an selected control.protected voidhandleUnselected(gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, TYPE reference, IEntityItem item, ReferenceCountingVisitor.Context visitorContext) Handle an index hit against an item related to an unselected control.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.nist.secauto.oscal.lib.profile.resolver.policy.ICustomReferencePolicy
getReferenceText, setReferenceText
-
Constructor Details
-
AbstractCustomReferencePolicy
-
-
Method Details
-
getIdentifierParser
Description copied from interface:ICustomReferencePolicyGet the parser to use to parse an entity identifier from the reference text.- Specified by:
getIdentifierParserin interfaceICustomReferencePolicy<TYPE>- Returns:
- the parser
-
getEntityItemTypes
Get the possible item types that can be searched in the order in which the identifier will be looked up.The
referenceobject is provided to allow for context sensitive item type tailoring.- Parameters:
reference- the reference object- Returns:
- a list of item types to search for
-
handleIndexHit
protected boolean handleIndexHit(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, @NonNull TYPE reference, @NonNull IEntityItem item, @NonNull ReferenceCountingVisitor.Context visitorContext) Handle an index hit.- Parameters:
contextItem- the node containing the identifier referencereference- the identifier reference object generating the hititem- the referenced itemvisitorContext- the reference visitor state, which can be used for further processing- Returns:
trueif the hit was handled orfalseotherwise- Throws:
ProfileResolutionEvaluationException- if there was an error handing the index hit
-
handleUnselected
protected void handleUnselected(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, @NonNull TYPE reference, @NonNull IEntityItem item, @NonNull ReferenceCountingVisitor.Context visitorContext) Handle an index hit against an item related to an unselected control.Subclasses can override this method to perform extra processing.
- Parameters:
contextItem- the node containing the identifier referencereference- the identifier reference object generating the hititem- the referenced itemvisitorContext- the reference visitor, which can be used for further processing- Throws:
ProfileResolutionEvaluationException- if there was an error handing the index hit
-
handleSelected
protected void handleSelected(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, @NonNull TYPE reference, @NonNull IEntityItem item, @NonNull ReferenceCountingVisitor.Context visitorContext) Handle an index hit against an item related to an selected control.Subclasses can override this method to perform extra processing.
- Parameters:
contextItem- the node containing the identifier referencereference- the identifier reference object generating the hititem- the referenced itemvisitorContext- the reference visitor state, which can be used for further processing- Throws:
ProfileResolutionEvaluationException- if there was an error handing the index hit
-
handleIndexMiss
protected boolean handleIndexMiss(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, @NonNull TYPE reference, @NonNull List<IEntityItem.ItemType> itemTypes, @NonNull String identifier, @NonNull ReferenceCountingVisitor.Context visitorContext) Handle an index miss for a reference. This occurs when the referenced item was not found in the index.Subclasses can override this method to perform extra processing.
- Parameters:
contextItem- the node containing the identifier referencereference- the identifier reference object generating the hititemTypes- the possible item types for this referenceidentifier- the parsed identifiervisitorContext- the reference visitor state, which can be used for further processing- Returns:
trueif the reference is handled by this method orfalseotherwise- Throws:
ProfileResolutionEvaluationException- if there was an error handing the index miss
-
handleIdentifierNonMatch
protected boolean handleIdentifierNonMatch(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, @NonNull TYPE reference, @NonNull ReferenceCountingVisitor.Context visitorContext) Handle the case where the identifier was not a syntax match for an expected identifier. This can occur when the reference is malformed, using an unrecognized syntax.Subclasses can override this method to perform extra processing.
- Parameters:
contextItem- the node containing the identifier referencereference- the identifier reference object generating the hitvisitorContext- the reference visitor state, which can be used for further processing- Returns:
trueif the reference is handled by this method orfalseotherwise- Throws:
ProfileResolutionEvaluationException- if there was an error handing the index miss due to a non match
-
handleReference
public boolean handleReference(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, @NonNull TYPE type, @NonNull ReferenceCountingVisitor.Context visitorContext) Description copied from interface:IReferencePolicyHandle the providedreference.- Specified by:
handleReferencein interfaceIReferencePolicy<TYPE>- Parameters:
contextItem- the nodes containing the referencetype- the reference object to processvisitorContext- used to lookup and resolve items- Returns:
trueif the reference was handled, orfalseotherwise
-
handleIdentifier
protected boolean handleIdentifier(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IModelNodeItem<?, ?> contextItem, @NonNull TYPE type, @Nullable String identifier, @NonNull ReferenceCountingVisitor.Context visitorContext) Handle the providedidentifierfor a giventypeof reference.- Parameters:
contextItem- the node containing the identifier referencetype- the item type of the referenceidentifier- the identifiervisitorContext- the reference visitor state, which can be used for further processing- Returns:
trueif the reference is handled by this method orfalseotherwise- Throws:
ProfileResolutionEvaluationException- if there was an error handing the reference
-