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 typeR
- 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 gov.nist.secauto.metaschema.model.common.metapath.MetapathExpression
CHILD_PART_METAPATH
-
Constructor Summary
Constructors Constructor Description AbstractCatalogEntityVisitor(Set<IEntityItem.ItemType> itemTypesToVisit)
Create a new visitor that will visit the item types identified byitemTypesToVisit
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<IEntityItem.ItemType>
getItemTypesToVisit()
protected boolean
isVisitedItemType(IEntityItem.ItemType type)
protected void
visitBackMatter(gov.nist.secauto.metaschema.model.common.metapath.item.IRootAssemblyNodeItem rootItem, T state)
Called when visiting the "back-matter" section of an OSCAL document.R
visitCatalog(gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, T state)
protected R
visitControlContainer(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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.model.common.metapath.item.IRequiredValueModelNodeItem item, R childResult, T state)
Called when visiting a control after visiting it's children.protected R
visitGroupContainer(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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.model.common.metapath.item.IRequiredValueModelNodeItem item, R childResult, T state)
Called when visiting a group after visiting it's children.protected void
visitLocation(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem metadataItem, T state)
Called when visiting a location in the "metadata" section of an OSCAL document.protected void
visitMetadata(gov.nist.secauto.metaschema.model.common.metapath.item.IRootAssemblyNodeItem rootItem, T state)
Called when visiting the "metadata" section of an OSCAL document.protected R
visitParameter(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem catalogOrGroupOrControl, T state)
Called when visiting a parameter.protected void
visitPart(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem groupOrControl, T state)
Called when visiting a part.protected void
visitParts(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem groupOrControlItem, T state)
protected void
visitParty(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem metadataItem, T state)
Called when visiting a party in the "metadata" section of an OSCAL document.protected void
visitResource(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, gov.nist.secauto.metaschema.model.common.metapath.item.IRootAssemblyNodeItem backMatterItem, T state)
Called when visiting a resource in the "back-matter" section of an OSCAL document.protected void
visitRole(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 Detail
-
CHILD_PART_METAPATH
@NonNull public static final gov.nist.secauto.metaschema.model.common.metapath.MetapathExpression CHILD_PART_METAPATH
-
-
Constructor Detail
-
AbstractCatalogEntityVisitor
public AbstractCatalogEntityVisitor(@NonNull Set<IEntityItem.ItemType> itemTypesToVisit)
Create a new visitor that will visit the item types identified byitemTypesToVisit
.- Parameters:
itemTypesToVisit
- the item type the visitor will visit
-
-
Method Detail
-
getItemTypesToVisit
public Set<IEntityItem.ItemType> getItemTypesToVisit()
-
isVisitedItemType
protected boolean isVisitedItemType(@NonNull IEntityItem.ItemType type)
-
visitCatalog
public R visitCatalog(gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, T state)
- Overrides:
visitCatalog
in classAbstractCatalogVisitor<T,R>
-
visitGroupContainer
protected R visitGroupContainer(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 classAbstractCatalogVisitor<T,R>
- Parameters:
catalogOrGroup
- the catalog or group Metapath item currently being visitedinitialResult
- the initial result value to use when aggregating child resultsstate
- the current visitor state- Returns:
- a meaningful result of the given type
-
visitControlContainer
protected R visitControlContainer(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 classAbstractCatalogVisitor<T,R>
- Parameters:
catalogOrGroupOrControl
- the catalog, group, or control Metapath item currently being visitedinitialResult
- the initial result value to use when aggregating child resultsstate
- the current visitor state- Returns:
- a meaningful result of the given type
-
visitParts
protected void visitParts(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem groupOrControlItem, T state)
-
visitGroupInternal
protected R visitGroupInternal(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, R childResult, T state)
Description copied from class:AbstractCatalogVisitor
Called when visiting a group after visiting it's children.- Overrides:
visitGroupInternal
in classAbstractCatalogVisitor<T,R>
- Parameters:
item
- the group Metapath item currently being visitedchildResult
- the result of visiting the group's childrenstate
- the current visitor state- Returns:
- a meaningful result of the given type
-
visitControlInternal
protected R visitControlInternal(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, R childResult, T state)
Description copied from class:AbstractCatalogVisitor
Called when visiting a control after visiting it's children.- Overrides:
visitControlInternal
in classAbstractCatalogVisitor<T,R>
- Parameters:
item
- the Metapath item for the control currently being visitedchildResult
- the result of visiting the control's childrenstate
- the calling context information- Returns:
- a meaningful result of the given type
-
visitParameter
protected R visitParameter(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, @NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 parametercatalogOrGroupOrControl
- the parameter's parent Metapath itemstate
- the calling context information- Returns:
- a meaningful result of the given type
-
visitPart
protected void visitPart(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, @NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 partgroupOrControl
- the part's parent Metapath itemstate
- the calling context information
-
visitMetadata
protected void visitMetadata(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.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 Metaschema node item containing the "metadata" nodestate
- the calling context information
-
visitRole
protected void visitRole(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, @NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 Metaschema node item which is a child of the "metadata" nodemetadataItem
- the "metadata" Metaschema node item containing the rolestate
- the calling context information
-
visitLocation
protected void visitLocation(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, @NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 Metaschema node item which is a child of the "metadata" nodemetadataItem
- the "metadata" Metaschema node item containing the locationstate
- the calling context information
-
visitParty
protected void visitParty(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, @NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem 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 Metaschema node item which is a child of the "metadata" nodemetadataItem
- the "metadata" Metaschema node item containing the partystate
- the calling context information
-
visitBackMatter
protected void visitBackMatter(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRootAssemblyNodeItem rootItem, T state)
Called when visiting the "back-matter" section of an OSCAL document.Visits each contained resource.
- Parameters:
rootItem
- the root Metaschema node item containing the "back-matter" nodestate
- the calling context information
-
visitResource
protected void visitResource(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem item, @NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IRootAssemblyNodeItem backMatterItem, 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:
item
- the resource Metaschema node item which is a child of the "metadata" nodebackMatterItem
- the resource Metaschema node item containing the partystate
- the calling context information
-
-