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
Constructors Modifier Constructor Description protected
AbstractCustomReferencePolicy(IIdentifierParser identifierParser)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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.IIdentifierParser
getIdentifierParser()
Get the parser to use to parse an entity identifier from the reference text.protected boolean
handleIdentifier(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, TYPE type, String identifier, ReferenceCountingVisitor.Context visitorContext)
Handle the providedidentifier
for a giventype
of reference.protected boolean
handleIdentifierNonMatch(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, TYPE reference, ReferenceCountingVisitor.Context visitorContext)
Handle the case where the identifier was not a syntax match for an expected identifier.protected boolean
handleIndexHit(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, TYPE reference, IEntityItem item, ReferenceCountingVisitor.Context visitorContext)
Handle an index hit.protected boolean
handleIndexMiss(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, TYPE reference, List<IEntityItem.ItemType> itemTypes, String identifier, ReferenceCountingVisitor.Context visitorContext)
Handle an index miss for a reference.boolean
handleReference(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, TYPE type, ReferenceCountingVisitor.Context visitorContext)
Handle the providedreference
.protected void
handleSelected(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, TYPE reference, IEntityItem item, ReferenceCountingVisitor.Context visitorContext)
Handle an index hit against an item related to an selected control.protected void
handleUnselected(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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, wait
-
Methods inherited from interface gov.nist.secauto.oscal.lib.profile.resolver.policy.ICustomReferencePolicy
getReferenceText, setReferenceText
-
-
-
-
Constructor Detail
-
AbstractCustomReferencePolicy
protected AbstractCustomReferencePolicy(@NonNull IIdentifierParser identifierParser)
-
-
Method Detail
-
getIdentifierParser
@NonNull public IIdentifierParser getIdentifierParser()
Description copied from interface:ICustomReferencePolicy
Get the parser to use to parse an entity identifier from the reference text.- Specified by:
getIdentifierParser
in interfaceICustomReferencePolicy<TYPE>
- Returns:
- the parser
-
getEntityItemTypes
@NonNull protected abstract List<IEntityItem.ItemType> getEntityItemTypes(@NonNull TYPE reference)
Get the possible item types that can be searched in the order in which the identifier will be looked up.The
reference
object 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.model.common.metapath.item.IRequiredValueModelNodeItem 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:
true
if the hit was handled orfalse
otherwise- Throws:
ProfileResolutionEvaluationException
- if there was an error handing the index hit
-
handleUnselected
protected void handleUnselected(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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.model.common.metapath.item.IRequiredValueModelNodeItem 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.model.common.metapath.item.IRequiredValueModelNodeItem 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:
true
if the reference is handled by this method orfalse
otherwise- Throws:
ProfileResolutionEvaluationException
- if there was an error handing the index miss
-
handleIdentifierNonMatch
protected boolean handleIdentifierNonMatch(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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:
true
if the reference is handled by this method orfalse
otherwise- 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.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, @NonNull TYPE type, @NonNull ReferenceCountingVisitor.Context visitorContext)
Description copied from interface:IReferencePolicy
Handle the providedreference
.- Specified by:
handleReference
in interfaceIReferencePolicy<TYPE>
- Parameters:
contextItem
- the nodes containing the referencetype
- the reference object to processvisitorContext
- used to lookup and resolve items- Returns:
true
if the reference was handled, orfalse
otherwise
-
handleIdentifier
protected boolean handleIdentifier(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem contextItem, @NonNull TYPE type, @Nullable String identifier, @NonNull ReferenceCountingVisitor.Context visitorContext)
Handle the providedidentifier
for a giventype
of 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:
true
if the reference is handled by this method orfalse
otherwise- Throws:
ProfileResolutionEvaluationException
- if there was an error handing the reference
-
-