Class ControlSelectionVisitor
- 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>
-
- gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractIndexingVisitor<IControlSelectionState,Boolean>
-
- gov.nist.secauto.oscal.lib.profile.resolver.selection.ControlSelectionVisitor
-
- All Implemented Interfaces:
ICatalogVisitor<IControlSelectionState,Boolean>
public class ControlSelectionVisitor extends AbstractIndexingVisitor<IControlSelectionState,Boolean>
Walks aCatalog
indexing all nodes that can be referenced.For each
CatalogGroup
,Control
, andControlPart
, determine if that object isIIndexer.SelectionStatus.SELECTED
orIIndexer.SelectionStatus.UNSELECTED
.A
Control
isIIndexer.SelectionStatus.SELECTED
if it matches the configuredIControlFilter
, otherwise it isIIndexer.SelectionStatus.UNSELECTED
.A
CatalogGroup
isIIndexer.SelectionStatus.SELECTED
if it contains aIIndexer.SelectionStatus.SELECTED
descendantControl
, otherwise it isIIndexer.SelectionStatus.UNSELECTED
.A
ControlPart
isIIndexer.SelectionStatus.SELECTED
if its containing control isIIndexer.SelectionStatus.SELECTED
.All other indexed nodes will have the
IIndexer.SelectionStatus.UNKNOWN
, since these nodes require reference counting to determine if they are to be kept or not.
-
-
Field Summary
-
Fields inherited from class gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractCatalogEntityVisitor
CHILD_PART_METAPATH
-
-
Constructor Summary
Constructors Constructor Description ControlSelectionVisitor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Boolean
aggregateResults(Boolean first, Boolean second, IControlSelectionState state)
protected IIndexer
getIndexer(IControlSelectionState state)
static ControlSelectionVisitor
instance()
protected Boolean
newDefaultResult(IControlSelectionState state)
void
visit(gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, IControlSelectionState state)
Boolean
visitCatalog(gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, IControlSelectionState state)
Boolean
visitControl(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem controlItem, Boolean childResult, IControlSelectionState state)
Called when visiting a control.Boolean
visitGroup(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem groupItem, Boolean childSelected, IControlSelectionState state)
Called when visiting a group.void
visitProfile(gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem profileDocument, IControlSelectionState state)
-
Methods inherited from class gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractIndexingVisitor
visitLocation, visitParameter, visitPart, visitParty, visitResource, visitRole
-
Methods inherited from class gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractCatalogEntityVisitor
getItemTypesToVisit, isVisitedItemType, visitBackMatter, visitControlContainer, visitControlInternal, visitGroupContainer, visitGroupInternal, visitMetadata, visitParts
-
Methods inherited from class gov.nist.secauto.oscal.lib.profile.resolver.support.AbstractCatalogVisitor
visitControlItem, visitGroupItem
-
-
-
-
Constructor Detail
-
ControlSelectionVisitor
public ControlSelectionVisitor()
-
-
Method Detail
-
instance
public static ControlSelectionVisitor instance()
-
getIndexer
protected IIndexer getIndexer(IControlSelectionState state)
- Specified by:
getIndexer
in classAbstractIndexingVisitor<IControlSelectionState,Boolean>
-
newDefaultResult
protected Boolean newDefaultResult(IControlSelectionState state)
- Specified by:
newDefaultResult
in classAbstractCatalogVisitor<IControlSelectionState,Boolean>
-
aggregateResults
protected Boolean aggregateResults(Boolean first, Boolean second, IControlSelectionState state)
- Specified by:
aggregateResults
in classAbstractCatalogVisitor<IControlSelectionState,Boolean>
-
visit
public void visit(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, @NonNull IControlSelectionState state)
-
visitProfile
public void visitProfile(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, @NonNull gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem profileDocument, @NonNull IControlSelectionState state)
-
visitCatalog
public Boolean visitCatalog(gov.nist.secauto.metaschema.model.common.metapath.item.IDocumentNodeItem catalogDocument, IControlSelectionState state)
- Overrides:
visitCatalog
in classAbstractCatalogEntityVisitor<IControlSelectionState,Boolean>
-
visitGroup
public Boolean visitGroup(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem groupItem, Boolean childSelected, IControlSelectionState state)
Description copied from interface:ICatalogVisitor
Called when visiting a group.Can be overridden by classes extending this interface to support processing of the visited object.
- Specified by:
visitGroup
in interfaceICatalogVisitor<IControlSelectionState,Boolean>
- Overrides:
visitGroup
in classAbstractIndexingVisitor<IControlSelectionState,Boolean>
- Parameters:
groupItem
- the Metapath item for the groupchildSelected
- the result of evaluating the group's childrenstate
- the calling context information- Returns:
- a meaningful result of the given type
-
visitControl
public Boolean visitControl(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem controlItem, Boolean childResult, IControlSelectionState state)
Description copied from interface:ICatalogVisitor
Called when visiting a control.Can be overridden by classes extending this interface to support processing of the visited object.
- Specified by:
visitControl
in interfaceICatalogVisitor<IControlSelectionState,Boolean>
- Overrides:
visitControl
in classAbstractIndexingVisitor<IControlSelectionState,Boolean>
- Parameters:
controlItem
- the Metapath item for the controlchildResult
- the result of evaluating the control's childrenstate
- the calling context information- Returns:
- a meaningful result of the given type
-
-