Class AbstractCatalogEntityVisitor<T,R>

java.lang.Object
gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractCatalogVisitor<T,R>
gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractCatalogEntityVisitor<T,R>
Type Parameters:
T - the state type
R - the result type
All Implemented Interfaces:
ICatalogVisitor<T,R>
Direct Known Subclasses:
AbstractIndexingVisitor, FilterNonSelectedVisitor, FlatteningStructuringVisitor, ReferenceCountingVisitor

public abstract class AbstractCatalogEntityVisitor<T,R> extends AbstractCatalogVisitor<T,R>
Visits a catalog document and its children as designated.

This implementation is stateless. The T parameter can be used to convey state as needed.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final gov.nist.secauto.metaschema.core.metapath.MetapathExpression
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new visitor that will visit the item types identified by itemTypesToVisit.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected boolean
     
    protected void
    visitBackMatter(gov.nist.secauto.metaschema.core.metapath.item.node.IRootAssemblyNodeItem rootItem, T state)
    Called when visiting the "back-matter" section of an OSCAL document.
    visitCatalog(gov.nist.secauto.metaschema.core.metapath.item.node.IDocumentNodeItem catalogDocument, T state)
     
    protected R
    visitControlContainer(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem catalogOrGroupOrControl, R initialResult, T state)
    Visit the child controls (in that order) of a given catalog, group, or control container.
    protected R
    visitControlInternal(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, R childResult, T state)
    Called when visiting a control after visiting it's children.
    protected R
    visitGroupContainer(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem catalogOrGroup, R initialResult, T state)
    Visit the child groups and controls (in that order) of a given catalog or group container.
    protected R
    visitGroupInternal(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, R childResult, T state)
    Called when visiting a group after visiting it's children.
    protected void
    visitLocation(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem metadataItem, T state)
    Called when visiting a location in the "metadata" section of an OSCAL document.
    protected void
    visitMetadata(gov.nist.secauto.metaschema.core.metapath.item.node.IRootAssemblyNodeItem rootItem, T state)
    Called when visiting the "metadata" section of an OSCAL document.
    protected R
    visitParameter(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem catalogOrGroupOrControl, T state)
    Called when visiting a parameter.
    protected void
    visitPart(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem groupOrControl, T state)
    Called when visiting a part.
    protected void
    visitParts(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem groupOrControlItem, T state)
     
    protected void
    visitParty(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem metadataItem, T state)
    Called when visiting a party in the "metadata" section of an OSCAL document.
    protected void
    visitResource(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem resource, gov.nist.secauto.metaschema.core.metapath.item.node.IRootAssemblyNodeItem backMatter, T state)
    Called when visiting a resource in the "back-matter" section of an OSCAL document.
    protected void
    visitRole(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem metadataItem, T state)
    Called when visiting a role in the "metadata" section of an OSCAL document.

    Methods inherited from class gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractCatalogVisitor

    aggregateResults, newDefaultResult, visitControlItem, visitGroupItem

    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.support.ICatalogVisitor

    visitControl, visitGroup
  • Field Details

    • CHILD_PART_METAPATH

      @NonNull public static final gov.nist.secauto.metaschema.core.metapath.MetapathExpression CHILD_PART_METAPATH
  • Constructor Details

    • AbstractCatalogEntityVisitor

      public AbstractCatalogEntityVisitor(@NonNull Set<IEntityItem.ItemType> itemTypesToVisit)
      Create a new visitor that will visit the item types identified by itemTypesToVisit.
      Parameters:
      itemTypesToVisit - the item type the visitor will visit
  • Method Details

    • getItemTypesToVisit

    • isVisitedItemType

      protected boolean isVisitedItemType(@NonNull IEntityItem.ItemType type)
    • visitCatalog

      public R visitCatalog(gov.nist.secauto.metaschema.core.metapath.item.node.IDocumentNodeItem catalogDocument, T state)
      Overrides:
      visitCatalog in class AbstractCatalogVisitor<T,R>
    • visitGroupContainer

      protected R visitGroupContainer(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem catalogOrGroup, R initialResult, T state)
      Description copied from class: AbstractCatalogVisitor
      Visit the child groups and controls (in that order) of a given catalog or group container.
      Overrides:
      visitGroupContainer in class AbstractCatalogVisitor<T,R>
      Parameters:
      catalogOrGroup - the catalog or group Metapath item currently being visited
      initialResult - the initial result value to use when aggregating child results
      state - the current visitor state
      Returns:
      a meaningful result of the given type
    • visitControlContainer

      protected R visitControlContainer(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem catalogOrGroupOrControl, R initialResult, T state)
      Description copied from class: AbstractCatalogVisitor
      Visit the child controls (in that order) of a given catalog, group, or control container.
      Overrides:
      visitControlContainer in class AbstractCatalogVisitor<T,R>
      Parameters:
      catalogOrGroupOrControl - the catalog, group, or control Metapath item currently being visited
      initialResult - the initial result value to use when aggregating child results
      state - the current visitor state
      Returns:
      a meaningful result of the given type
    • visitParts

      protected void visitParts(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem groupOrControlItem, T state)
    • visitGroupInternal

      protected R visitGroupInternal(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, R childResult, T state)
      Description copied from class: AbstractCatalogVisitor
      Called when visiting a group after visiting it's children.
      Overrides:
      visitGroupInternal in class AbstractCatalogVisitor<T,R>
      Parameters:
      item - the group Metapath item currently being visited
      childResult - the result of visiting the group's children
      state - the current visitor state
      Returns:
      a meaningful result of the given type
    • visitControlInternal

      protected R visitControlInternal(gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, R childResult, T state)
      Description copied from class: AbstractCatalogVisitor
      Called when visiting a control after visiting it's children.
      Overrides:
      visitControlInternal in class AbstractCatalogVisitor<T,R>
      Parameters:
      item - the Metapath item for the control currently being visited
      childResult - the result of visiting the control's children
      state - the calling context information
      Returns:
      a meaningful result of the given type
    • visitParameter

      protected R visitParameter(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, @NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem catalogOrGroupOrControl, T state)
      Called when visiting a parameter.

      Can be overridden by classes extending this interface to support processing of the visited object.

      Parameters:
      item - the Metapath item for the parameter
      catalogOrGroupOrControl - the parameter's parent Metapath item
      state - the calling context information
      Returns:
      a meaningful result of the given type
    • visitPart

      protected void visitPart(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, @NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem groupOrControl, T state)
      Called when visiting a part.

      Can be overridden by classes extending this interface to support processing of the visited object.

      Parameters:
      item - the Metapath item for the part
      groupOrControl - the part's parent Metapath item
      state - the calling context information
    • visitMetadata

      protected void visitMetadata(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IRootAssemblyNodeItem rootItem, T state)
      Called when visiting the "metadata" section of an OSCAL document.

      Visits each contained role, location, and party.

      Parameters:
      rootItem - the root Module node item containing the "metadata" node
      state - the calling context information
    • visitRole

      protected void visitRole(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, @NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem metadataItem, T state)
      Called when visiting a role in the "metadata" section of an OSCAL document.

      Can be overridden by classes extending this interface to support processing of the visited object.

      Parameters:
      item - the role Module node item which is a child of the "metadata" node
      metadataItem - the "metadata" Module node item containing the role
      state - the calling context information
    • visitLocation

      protected void visitLocation(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, @NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem metadataItem, T state)
      Called when visiting a location in the "metadata" section of an OSCAL document.

      Can be overridden by classes extending this interface to support processing of the visited object.

      Parameters:
      item - the location Module node item which is a child of the "metadata" node
      metadataItem - the "metadata" Module node item containing the location
      state - the calling context information
    • visitParty

      protected void visitParty(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem item, @NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem metadataItem, T state)
      Called when visiting a party in the "metadata" section of an OSCAL document.

      Can be overridden by classes extending this interface to support processing of the visited object.

      Parameters:
      item - the party Module node item which is a child of the "metadata" node
      metadataItem - the "metadata" Module node item containing the party
      state - the calling context information
    • visitBackMatter

      protected void visitBackMatter(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IRootAssemblyNodeItem rootItem, T state)
      Called when visiting the "back-matter" section of an OSCAL document.

      Visits each contained resource.

      Parameters:
      rootItem - the root Module node item containing the "back-matter" node
      state - the calling context information
    • visitResource

      protected void visitResource(@NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem resource, @NonNull gov.nist.secauto.metaschema.core.metapath.item.node.IRootAssemblyNodeItem backMatter, T state)
      Called when visiting a resource in the "back-matter" section of an OSCAL document.

      Can be overridden by classes extending this interface to support processing of the visited object.

      Parameters:
      resource - the resource Module node item which is a child of the "metadata" node
      backMatter - the resource Module node item containing the party
      state - the calling context information