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>
  • Constructor Details

  • Method Details

    • getIdentifierParser

      Description copied from interface: ICustomReferencePolicy
      Get the parser to use to parse an entity identifier from the reference text.
      Specified by:
      getIdentifierParser in interface ICustomReferencePolicy<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.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 reference
      reference - the identifier reference object generating the hit
      item - the referenced item
      visitorContext - the reference visitor state, which can be used for further processing
      Returns:
      true if the hit was handled or false otherwise
      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 reference
      reference - the identifier reference object generating the hit
      item - the referenced item
      visitorContext - 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 reference
      reference - the identifier reference object generating the hit
      item - the referenced item
      visitorContext - 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 reference
      reference - the identifier reference object generating the hit
      itemTypes - the possible item types for this reference
      identifier - the parsed identifier
      visitorContext - the reference visitor state, which can be used for further processing
      Returns:
      true if the reference is handled by this method or false otherwise
      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 reference
      reference - the identifier reference object generating the hit
      visitorContext - the reference visitor state, which can be used for further processing
      Returns:
      true if the reference is handled by this method or false 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.core.metapath.item.node.IModelNodeItem<?,?> contextItem, @NonNull TYPE type, @NonNull ReferenceCountingVisitor.Context visitorContext)
      Description copied from interface: IReferencePolicy
      Handle the provided reference.
      Specified by:
      handleReference in interface IReferencePolicy<TYPE>
      Parameters:
      contextItem - the nodes containing the reference
      type - the reference object to process
      visitorContext - used to lookup and resolve items
      Returns:
      true if the reference was handled, or false otherwise
    • 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 provided identifier for a given type of reference.
      Parameters:
      contextItem - the node containing the identifier reference
      type - the item type of the reference
      identifier - the identifier
      visitorContext - the reference visitor state, which can be used for further processing
      Returns:
      true if the reference is handled by this method or false otherwise
      Throws:
      ProfileResolutionEvaluationException - if there was an error handing the reference