From c0ca5ba9649fb7c1b09ecad9fb781dbf9074ae3f Mon Sep 17 00:00:00 2001 From: selenaxiao-nist <142448406+selenaxiao-nist@users.noreply.github.com> Date: Fri, 4 Sep 2026 10:27:09 -0400 Subject: [PATCH] Commit mvn install reformatting to prevent git status clutter --- .../control/catalog/IControlContainer.java | 9 ++-- .../control/catalog/IGroupContainer.java | 3 +- .../resolver/ProfileResolutionException.java | 4 +- .../lib/profile/resolver/ProfileResolver.java | 6 ++- .../profile/resolver/alter/AddVisitor.java | 21 ++++---- .../profile/resolver/alter/RemoveVisitor.java | 14 +++--- .../merge/FlatteningStructuringVisitor.java | 6 ++- .../policy/AbstractCustomReferencePolicy.java | 43 ++++++++++------- .../policy/ICustomReferencePolicyHandler.java | 21 ++++---- .../resolver/policy/IIdentifierParser.java | 3 +- .../resolver/policy/IReferenceVisitor.java | 26 ++++++---- .../policy/ReferenceCountingVisitor.java | 15 ++++-- .../selection/ControlSelectionVisitor.java | 19 ++++---- .../DefaultControlSelectionFilter.java | 12 +++-- .../selection/FilterNonSelectedVisitor.java | 6 ++- .../resolver/selection/IControlFilter.java | 25 +++++----- .../selection/IControlSelectionFilter.java | 11 +++-- .../support/AbstractCatalogEntityVisitor.java | 48 +++++++++++-------- .../support/AbstractCatalogVisitor.java | 12 +++-- .../resolver/support/AbstractEntityItem.java | 3 +- .../resolver/support/BasicIndexer.java | 16 ++++--- .../resolver/support/ICatalogVisitor.java | 14 +++--- .../profile/resolver/support/IEntityItem.java | 16 ++++--- .../profile/resolver/support/IIndexer.java | 30 +++++++----- .../oscal/java/MetaschemaVisitorTest.java | 27 +++++++---- .../oscal/java/OscalBindingContextTest.java | 3 +- .../DefaultControlSelectionFilterTest.java | 3 +- 27 files changed, 252 insertions(+), 164 deletions(-) diff --git a/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IControlContainer.java b/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IControlContainer.java index d554ab67..35cd1c44 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IControlContainer.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IControlContainer.java @@ -48,7 +48,8 @@ public interface IControlContainer { boolean addControl(@NonNull Control item); /** - * Remove the first matching {@link Control} item from the underlying collection. + * Remove the first matching {@link Control} item from the underlying + * collection. * * @param item * the item to remove @@ -68,7 +69,8 @@ public interface IControlContainer { boolean addParam(@NonNull Parameter item); /** - * Remove the first matching {@link Parameter} item from the underlying collection. + * Remove the first matching {@link Parameter} item from the underlying + * collection. * * @param item * the item to remove @@ -77,7 +79,8 @@ public interface IControlContainer { boolean removeParam(@NonNull Parameter item); /** - * Get the parameter identifiers referenced in the object's context, but not by their child objects. + * Get the parameter identifiers referenced in the object's context, but not by + * their child objects. * * @return a stream of identifiers */ diff --git a/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IGroupContainer.java b/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IGroupContainer.java index 6162c613..8f9f7ed7 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IGroupContainer.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/model/control/catalog/IGroupContainer.java @@ -46,7 +46,8 @@ public interface IGroupContainer extends IControlContainer { boolean addGroup(@NonNull CatalogGroup item); /** - * Remove the first matching {@link CatalogGroup} item from the underlying collection. + * Remove the first matching {@link CatalogGroup} item from the underlying + * collection. * * @param item * the item to remove diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolutionException.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolutionException.java index 06694c1f..55e75870 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolutionException.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolutionException.java @@ -47,8 +47,8 @@ public ProfileResolutionException(String message) { } /** - * Create a new profile resolution exception with the provided {@code message} based on the provided - * {@code cause}. + * Create a new profile resolution exception with the provided {@code message} + * based on the provided {@code cause}. * * @param message * a description of the error that occurred diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolver.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolver.java index 33766311..b9c7ce0f 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolver.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolver.java @@ -115,7 +115,8 @@ public enum StructuringDirective { private DynamicContext dynamicContext; /** - * Gets the configured loader or creates a new default loader if no loader was configured. + * Gets the configured loader or creates a new default loader if no loader was + * configured. * * @return the bound loader */ @@ -340,7 +341,8 @@ protected IIndexer resolveImport( IDocumentNodeItem document = getDynamicContext().getDocumentLoader().loadAsNodeItem(source); IDocumentNodeItem importedCatalog = resolve(document, importHistory); - // Create a defensive deep copy of the document and associated values, since we will be making + // Create a defensive deep copy of the document and associated values, since we + // will be making // changes to the data. try { importedCatalog = DefaultNodeItemFactory.instance().newDocumentNodeItem( diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/AddVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/AddVisitor.java index 6fdd7015..4bb14ca8 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/AddVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/AddVisitor.java @@ -95,8 +95,8 @@ public enum TargetType { * * @param clazz * the class to identify the target type for - * @return the associated target type or {@code null} if the class is not associated with a target - * type + * @return the associated target type or {@code null} if the class is not + * associated with a target type */ @Nullable public static TargetType forClass(@NonNull Class clazz) { @@ -114,8 +114,8 @@ public static TargetType forClass(@NonNull Class clazz) { * * @param name * the field name to identify the target type for - * @return the associated target type or {@code null} if the name is not associated with a target - * type + * @return the associated target type or {@code null} if the name is not + * associated with a target type */ @Nullable public static TargetType forFieldName(@Nullable String name) { @@ -168,7 +168,8 @@ public enum Position { * * @param name * the name to identify the position for - * @return the associated position or {@code null} if the name is not associated with a position + * @return the associated position or {@code null} if the name is not associated + * with a position */ @Nullable public static Position forName(@Nullable String name) { @@ -257,8 +258,8 @@ public Boolean visitGroup(CatalogGroup group, Context context) { *
  • the context matches if: * *
  • * @@ -268,7 +269,8 @@ public Boolean visitGroup(CatalogGroup group, Context context) { * @param targetItem * the current target to process * @param titleConsumer - * a consumer to apply a title to or {@code null} if the object has no title field + * a consumer to apply a title to or {@code null} if the object has no + * title field * @param paramsSupplier * a supplier for the child {@link Parameter} collection * @param propsSupplier @@ -332,7 +334,8 @@ private static void handleCollection( // boolean handleChildren = !Collections.disjoint(context.getTargetItemTypes(), // getApplicableTypes(itemType)); // if (handleChildren && handler != null) { - // // if the child item type is applicable and there is a handler, iterate over children + // // if the child item type is applicable and there is a handler, iterate over + // children // Iterator iter = collectionSupplier.get().iterator(); // while (iter.hasNext()) { // T item = iter.next(); diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/RemoveVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/RemoveVisitor.java index effb8fd0..1e96e9dc 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/RemoveVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/alter/RemoveVisitor.java @@ -93,8 +93,8 @@ public enum TargetType { * * @param clazz * the class to identify the target type for - * @return the associated target type or {@code null} if the class is not associated with a target - * type + * @return the associated target type or {@code null} if the class is not + * associated with a target type */ @Nullable public static TargetType forClass(@NonNull Class clazz) { @@ -112,8 +112,8 @@ public static TargetType forClass(@NonNull Class clazz) { * * @param name * the field name to identify the target type for - * @return the associated target type or {@code null} if the name is not associated with a target - * type + * @return the associated target type or {@code null} if the name is not + * associated with a target type */ @Nullable public static TargetType forFieldName(@Nullable String name) { @@ -184,7 +184,8 @@ private static boolean handle( } } } else if (handleChildren && handler != null) { - // if the child item type is applicable and there is a handler, iterate over children + // if the child item type is applicable and there is a handler, iterate over + // children Iterator iter = supplier.get().iterator(); while (iter.hasNext()) { T item = iter.next(); @@ -394,7 +395,8 @@ private Context( @Nullable TargetType itemType) { // determine the set of effective item types to search for - // this helps with short-circuit searching for parts of the graph that cannot match + // this helps with short-circuit searching for parts of the graph that cannot + // match @NonNull Set targetItemTypes = ObjectUtils.notNull(EnumSet.allOf(TargetType.class)); filterTypes(targetItemTypes, "by-name", NAME_TYPES, objectName, itemType); filterTypes(targetItemTypes, "by-class", CLASS_TYPES, objectClass, itemType); diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/merge/FlatteningStructuringVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/merge/FlatteningStructuringVisitor.java index 322bd5f1..94ad8efe 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/merge/FlatteningStructuringVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/merge/FlatteningStructuringVisitor.java @@ -238,8 +238,10 @@ public DefaultResult visitControl(IRequiredValueModelNodeItem item, DefaultResul if (parent.getValue() instanceof Control && SelectionStatus.SELECTED.equals(index.getSelectionStatus(parent))) { retval.removeControl(control); } - // Cancel promotion of this control if control is already at the top level (control's parent is Catalog) - // If already at top level, then promotion is not needed because it was added by Import class + // Cancel promotion of this control if control is already at the top level + // (control's parent is Catalog) + // If already at top level, then promotion is not needed because it was added by + // Import class if (parent.getValue() instanceof Catalog) { retval.removeControl(control); } diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/AbstractCustomReferencePolicy.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/AbstractCustomReferencePolicy.java index 519c0ac4..143f0df1 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/AbstractCustomReferencePolicy.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/AbstractCustomReferencePolicy.java @@ -57,10 +57,11 @@ public IIdentifierParser getIdentifierParser() { } /** - * Get the possible item types that can be searched in the order in which the identifier will be - * looked up. + * Get the possible item types that can be searched in the order in which the + * identifier will be looked up. *

    - * The {@code reference} object is provided to allow for context sensitive item type tailoring. + * The {@code reference} object is provided to allow for context sensitive item + * type tailoring. * * @param reference * the reference object @@ -79,7 +80,8 @@ public IIdentifierParser getIdentifierParser() { * @param item * the referenced item * @param visitorContext - * the reference visitor state, which can be used for further processing + * the reference visitor state, which can be used for further + * processing * @return {@code true} if the hit was handled or {@code false} otherwise * @throws ProfileResolutionEvaluationException * if there was an error handing the index hit @@ -149,7 +151,8 @@ protected void handleUnselected( // NOPMD noop default * @param item * the referenced item * @param visitorContext - * the reference visitor state, which can be used for further processing + * the reference visitor state, which can be used for further + * processing * @throws ProfileResolutionEvaluationException * if there was an error handing the index hit */ @@ -162,8 +165,8 @@ protected void handleSelected( // NOPMD noop default } /** - * Handle an index miss for a reference. This occurs when the referenced item was not found in the - * index. + * 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. * @@ -176,8 +179,10 @@ protected void handleSelected( // NOPMD noop default * @param identifier * the parsed identifier * @param visitorContext - * the reference visitor state, which can be used for further processing - * @return {@code true} if the reference is handled by this method or {@code false} otherwise + * the reference visitor state, which can be used for further + * processing + * @return {@code true} if the reference is handled by this method or + * {@code false} otherwise * @throws ProfileResolutionEvaluationException * if there was an error handing the index miss */ @@ -192,8 +197,9 @@ protected boolean handleIndexMiss( } /** - * 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. + * 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. * @@ -202,8 +208,10 @@ protected boolean handleIndexMiss( * @param reference * the identifier reference object generating the hit * @param visitorContext - * the reference visitor state, which can be used for further processing - * @return {@code true} if the reference is handled by this method or {@code false} otherwise + * the reference visitor state, which can be used for further + * processing + * @return {@code true} if the reference is handled by this method or + * {@code false} otherwise * @throws ProfileResolutionEvaluationException * if there was an error handing the index miss due to a non match */ @@ -222,7 +230,8 @@ public boolean handleReference( @NonNull ReferenceCountingVisitor.Context visitorContext) { String referenceText = getReferenceText(type); - // if the reference text does not exist, ignore the reference; otherwise, handle it. + // if the reference text does not exist, ignore the reference; otherwise, handle + // it. return referenceText == null || handleIdentifier(contextItem, type, getIdentifierParser().parse(referenceText), visitorContext); } @@ -237,8 +246,10 @@ public boolean handleReference( * @param identifier * the identifier * @param visitorContext - * the reference visitor state, which can be used for further processing - * @return {@code true} if the reference is handled by this method or {@code false} otherwise + * the reference visitor state, which can be used for further + * processing + * @return {@code true} if the reference is handled by this method or + * {@code false} otherwise * @throws ProfileResolutionEvaluationException * if there was an error handing the reference */ diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ICustomReferencePolicyHandler.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ICustomReferencePolicyHandler.java index 833af774..b9c73c97 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ICustomReferencePolicyHandler.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ICustomReferencePolicyHandler.java @@ -48,8 +48,8 @@ public boolean handleIndexMiss( }; /** - * A callback used to handle the case where an identifier could not be parsed from the reference - * text. + * A callback used to handle the case where an identifier could not be parsed + * from the reference text. * * @param policy * the reference policy for this reference @@ -57,7 +57,8 @@ public boolean handleIndexMiss( * the reference object * @param visitor * the reference visitor used to resolve referenced objects - * @return {@code true} if the reference is considered handled, or {@code false} otherwise + * @return {@code true} if the reference is considered handled, or {@code false} + * otherwise */ default boolean handleIdentifierNonMatch( @NonNull ICustomReferencePolicy policy, @@ -67,8 +68,8 @@ default boolean handleIdentifierNonMatch( } /** - * A callback used to handle the case where an identifier could be parsed from the reference text, - * but the index didn't contain a matching entity. + * A callback used to handle the case where an identifier could be parsed from + * the reference text, but the index didn't contain a matching entity. * * @param policy * the reference policy for this reference @@ -80,7 +81,8 @@ default boolean handleIdentifierNonMatch( * the parsed identifier * @param visitor * the reference visitor used to resolve referenced objects - * @return {@code true} if the reference is considered handled, or {@code false} otherwise + * @return {@code true} if the reference is considered handled, or {@code false} + * otherwise */ default boolean handleIndexMiss( @NonNull ICustomReferencePolicy policy, @@ -92,8 +94,8 @@ default boolean handleIndexMiss( } /** - * A callback used to handle the case where an identifier could be parsed and the index contains a - * matching entity. + * A callback used to handle the case where an identifier could be parsed and + * the index contains a matching entity. * * @param policy * the reference policy for this reference @@ -103,7 +105,8 @@ default boolean handleIndexMiss( * the entity that is referenced * @param visitor * the reference visitor used to resolve referenced objects - * @return {@code true} if the reference is considered handled, or {@code false} otherwise + * @return {@code true} if the reference is considered handled, or {@code false} + * otherwise */ default boolean handleIndexHit( @NonNull ICustomReferencePolicy policy, diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IIdentifierParser.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IIdentifierParser.java index 3fa99ea6..b21b362e 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IIdentifierParser.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IIdentifierParser.java @@ -59,7 +59,8 @@ public String update(@NonNull String reference, @NonNull String newIdentifier) { String parse(@NonNull String referenceText); /** - * Substitute the provided {@code newIdentifier} with the identifier in the {@code referenceText}. + * Substitute the provided {@code newIdentifier} with the identifier in the + * {@code referenceText}. * * @param referenceText * the reference text containing the original identifier diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IReferenceVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IReferenceVisitor.java index 9afc8730..3ce95ade 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IReferenceVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/IReferenceVisitor.java @@ -43,8 +43,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { /** - * Visit the provided {@code item} representing an OSCAL {@link CatalogGroup} and handle any - * enclosed references. + * Visit the provided {@code item} representing an OSCAL {@link CatalogGroup} + * and handle any enclosed references. * * @param item * the Metapath node item containing reference nodes @@ -55,8 +55,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { Void visitGroup(@NonNull IRequiredValueModelNodeItem item, Void childResult, T context); /** - * Visit the provided {@code item} representing an OSCAL {@link Control} and handle any enclosed - * references. + * Visit the provided {@code item} representing an OSCAL {@link Control} and + * handle any enclosed references. * * @param item * the Metapath node item containing reference nodes @@ -67,7 +67,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { Void visitControl(@NonNull IRequiredValueModelNodeItem item, Void childResult, T context); // // /** - // * Visit the provided {@code item} representing an OSCAL {@link Parameter} and handle any enclosed + // * Visit the provided {@code item} representing an OSCAL {@link Parameter} and + // handle any enclosed // * references. // * // * @param item @@ -78,7 +79,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { // void resolveParameter(@NonNull IRequiredValueModelNodeItem item); // // /** - // * Visit the provided {@code item} representing an OSCAL {@link ControlPart} and handle any + // * Visit the provided {@code item} representing an OSCAL {@link ControlPart} + // and handle any // enclosed // * references. // * @@ -90,7 +92,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { // void resolvePart(@NonNull IRequiredValueModelNodeItem item, T context); // // /** - // * Visit the provided {@code item} representing an OSCAL {@link Role} and handle any enclosed + // * Visit the provided {@code item} representing an OSCAL {@link Role} and + // handle any enclosed // * references. // * // * @param item @@ -101,7 +104,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { // void resolveRole(@NonNull IRequiredValueModelNodeItem item); // // /** - // * Visit the provided {@code item} representing an OSCAL {@link Party} and handle any enclosed + // * Visit the provided {@code item} representing an OSCAL {@link Party} and + // handle any enclosed // * references. // * // * @param item @@ -112,7 +116,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { // void resolveParty(@NonNull IRequiredValueModelNodeItem item); // // /** - // * Visit the provided {@code item} representing an OSCAL {@link Location} and handle any enclosed + // * Visit the provided {@code item} representing an OSCAL {@link Location} and + // handle any enclosed // * references. // * // * @param item @@ -123,7 +128,8 @@ public interface IReferenceVisitor extends ICatalogVisitor { // void resolveLocation(@NonNull IRequiredValueModelNodeItem item); // // /** - // * Visit the provided {@code item} representing an OSCAL {@link Resource} and handle any enclosed + // * Visit the provided {@code item} representing an OSCAL {@link Resource} and + // handle any enclosed // * references. // * // * @param item diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ReferenceCountingVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ReferenceCountingVisitor.java index 112cdc32..17a0d8e2 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ReferenceCountingVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/policy/ReferenceCountingVisitor.java @@ -134,7 +134,8 @@ public static ReferenceCountingVisitor instance() { } public ReferenceCountingVisitor() { - // visit everything except parts, roles, locations, parties, parameters, and resources, which are + // visit everything except parts, roles, locations, parties, parameters, and + // resources, which are // handled differently by this visitor super(ObjectUtils.notNull(EnumSet.complementOf( EnumSet.of( @@ -168,7 +169,8 @@ protected Void aggregateResults(Void first, Void second, Context context) { // // BackMatter backMatter = profile.getBackMatter(); // if (backMatter != null) { - // for (BackMatter.Resource resource : CollectionUtil.listOrEmpty(backMatter.getResources())) { + // for (BackMatter.Resource resource : + // CollectionUtil.listOrEmpty(backMatter.getResources())) { // visitResource(resource); // } // } @@ -206,7 +208,8 @@ public void visitCatalog(@NonNull IDocumentNodeItem catalogItem, @NonNull IIndex public Void visitGroup(@NonNull IRequiredValueModelNodeItem item, Void childResult, Context context) { IIndexer index = context.getIndexer(); // handle the group if it is selected - // a group will only be selected if it contains a descendant control that is selected + // a group will only be selected if it contains a descendant control that is + // selected if (IIndexer.SelectionStatus.SELECTED.equals(index.getSelectionStatus(item))) { CatalogGroup group = (CatalogGroup) item.getValue(); String id = group.getId(); @@ -385,7 +388,8 @@ private static void resolvePart( item.getModelItemsByName("prop").forEach(child -> handleProperty(ObjectUtils.notNull(child), context)); item.getModelItemsByName("link").forEach(child -> handleLink(ObjectUtils.notNull(child), context)); item.getModelItemsByName("prose").forEach(child -> handleMarkup(ObjectUtils.notNull(child), context)); - // item.getModelItemsByName("part").forEach(child -> visitor.visitPart(ObjectUtils.notNull(child), + // item.getModelItemsByName("part").forEach(child -> + // visitor.visitPart(ObjectUtils.notNull(child), // context)); } @@ -536,7 +540,8 @@ protected void entityDispatch(@NonNull IEntityItem entity, @NonNull Context cont // } // // @Override - // protected Void aggregateResults(Object first, Object second, Object context) { + // protected Void aggregateResults(Object first, Object second, Object context) + // { // return null; // } diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/ControlSelectionVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/ControlSelectionVisitor.java index 8aecb410..c22a2e85 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/ControlSelectionVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/ControlSelectionVisitor.java @@ -47,21 +47,24 @@ /** * Walks a {@link Catalog} indexing all nodes that can be referenced. *

    - * For each {@link CatalogGroup}, {@link Control}, and {@link ControlPart}, determine if that object - * is {@link SelectionStatus#SELECTED} or {@link SelectionStatus#UNSELECTED}. + * For each {@link CatalogGroup}, {@link Control}, and {@link ControlPart}, + * determine if that object is {@link SelectionStatus#SELECTED} or + * {@link SelectionStatus#UNSELECTED}. *

    - * A {@link Control} is {@link SelectionStatus#SELECTED} if it matches the configured - * {@link IControlFilter}, otherwise it is {@link SelectionStatus#UNSELECTED}. + * A {@link Control} is {@link SelectionStatus#SELECTED} if it matches the + * configured {@link IControlFilter}, otherwise it is + * {@link SelectionStatus#UNSELECTED}. *

    * A {@link CatalogGroup} is {@link SelectionStatus#SELECTED} if it contains a * {@link SelectionStatus#SELECTED} descendant {@link Control}, otherwise it is * {@link SelectionStatus#UNSELECTED}. *

    - * A {@link ControlPart} is {@link SelectionStatus#SELECTED} if its containing control is - * {@link SelectionStatus#SELECTED}. + * A {@link ControlPart} is {@link SelectionStatus#SELECTED} if its containing + * control is {@link SelectionStatus#SELECTED}. *

    - * All other indexed nodes will have the {@link SelectionStatus#UNKNOWN}, since these nodes require - * reference counting to determine if they are to be kept or not. + * All other indexed nodes will have the {@link SelectionStatus#UNKNOWN}, since + * these nodes require reference counting to determine if they are to be kept or + * not. */ public class ControlSelectionVisitor extends AbstractIndexingVisitor { diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/DefaultControlSelectionFilter.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/DefaultControlSelectionFilter.java index e34f5838..ba77f06e 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/DefaultControlSelectionFilter.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/DefaultControlSelectionFilter.java @@ -52,7 +52,8 @@ public class DefaultControlSelectionFilter implements IControlSelectionFilter { private final List selections; /** - * Construct a new selection filter based on the provided list of select criteria. + * Construct a new selection filter based on the provided list of select + * criteria. * * @param selections * a list of select criteria @@ -78,13 +79,14 @@ public Pair apply(IControl control) { } /** - * Checks if the provided control identifier matches the criteria defined by this object. + * Checks if the provided control identifier matches the criteria defined by + * this object. * * @param id * the control identifier to match - * @return a {@link Pair} whose first member is {@code true} for a match or {@code false} otherwise, - * and whose second member is {@code true} if the match applies to any child controls or - * {@code false} otherwise + * @return a {@link Pair} whose first member is {@code true} for a match or + * {@code false} otherwise, and whose second member is {@code true} if + * the match applies to any child controls or {@code false} otherwise */ @SuppressWarnings("null") @NonNull diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/FilterNonSelectedVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/FilterNonSelectedVisitor.java index d4f07ea5..b8526be4 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/FilterNonSelectedVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/FilterNonSelectedVisitor.java @@ -207,8 +207,10 @@ public DefaultResult visitControl( control.setId(entity.getIdentifier()); if (!SelectionStatus.SELECTED.equals(index.getSelectionStatus(parent))) { - // promote this control if control is not already at the top level (control's parent is Catalog) - // If already at top level, then promotion is not needed because it was added by Import class + // promote this control if control is not already at the top level (control's + // parent is Catalog) + // If already at top level, then promotion is not needed because it was added by + // Import class if (!(parent.getValue() instanceof Catalog)) { retval.promoteControl(control); } diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlFilter.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlFilter.java index d5c41b9e..626f3871 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlFilter.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlFilter.java @@ -77,7 +77,8 @@ public interface IControlFilter { }; /** - * Construct a new filter instance based on the provided profile import statement. + * Construct a new filter instance based on the provided profile import + * statement. * * @param profileImport * an OSCAL profile import statement @@ -95,14 +96,15 @@ static IControlFilter newInstance(@NonNull IControlSelectionFilter includes, } /** - * Determines if the control is matched by this filter. This method returns a {@link Pair} where the - * first member of the pair indicates if the control matches, and the second indicates if the match - * applies to child controls as well. + * Determines if the control is matched by this filter. This method returns a + * {@link Pair} where the first member of the pair indicates if the control + * matches, and the second indicates if the match applies to child controls as + * well. * * @param control * the control to check for a match - * @return a pair indicating the status of the match ({@code true} for a match or {@code false} - * otherwise), and if a match applies to child controls + * @return a pair indicating the status of the match ({@code true} for a match + * or {@code false} otherwise), and if a match applies to child controls */ @NonNull default Pair match(@NonNull IControl control) { @@ -110,16 +112,17 @@ default Pair match(@NonNull IControl control) { } /** - * Determines if the control is matched by this filter. This method returns a {@link Pair} where the - * first member of the pair indicates if the control matches, and the second indicates if the match - * applies to child controls as well. + * Determines if the control is matched by this filter. This method returns a + * {@link Pair} where the first member of the pair indicates if the control + * matches, and the second indicates if the match applies to child controls as + * well. * * @param control * the control to check for a match * @param defaultMatch * the match status to use if the filter doesn't have an explicit hit - * @return a pair indicating the status of the match ({@code true} for a match or {@code false} - * otherwise), and if a match applies to child controls + * @return a pair indicating the status of the match ({@code true} for a match + * or {@code false} otherwise), and if a match applies to child controls */ @NonNull Pair match(@NonNull IControl control, boolean defaultMatch); diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlSelectionFilter.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlSelectionFilter.java index 48c5c527..9f00330f 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlSelectionFilter.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/selection/IControlSelectionFilter.java @@ -75,14 +75,15 @@ static IControlSelectionFilter matchIds(@NonNull String... identifiers) { } /** - * Determines if the control is matched by this filter. This method returns a {@link Pair} where the - * first member of the pair indicates if the control matches, and the second indicates if the match - * applies to child controls as well. + * Determines if the control is matched by this filter. This method returns a + * {@link Pair} where the first member of the pair indicates if the control + * matches, and the second indicates if the match applies to child controls as + * well. * * @param control * the control to check for a match - * @return a pair indicating the status of the match ({@code true} for a match or {@code false} - * otherwise), and if a match applies to child controls + * @return a pair indicating the status of the match ({@code true} for a match + * or {@code false} otherwise), and if a match applies to child controls */ @NonNull @Override diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogEntityVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogEntityVisitor.java index 94e27496..8b63f66d 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogEntityVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogEntityVisitor.java @@ -42,7 +42,8 @@ /** * Visits a catalog document and its children as designated. *

    - * This implementation is stateless. The {@code T} parameter can be used to convey state as needed. + * This implementation is stateless. The {@code T} parameter can be used to + * convey state as needed. * * @param * the state type @@ -74,7 +75,8 @@ public abstract class AbstractCatalogEntityVisitor private final Set itemTypesToVisit; /** - * Create a new visitor that will visit the item types identified by {@code itemTypesToVisit}. + * Create a new visitor that will visit the item types identified by + * {@code itemTypesToVisit}. * * @param itemTypesToVisit * the item type the visitor will visit @@ -173,8 +175,8 @@ protected R visitControlInternal(IRequiredValueModelNodeItem item, R childResult /** * Called when visiting a parameter. *

    - * Can be overridden by classes extending this interface to support processing of the visited - * object. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item * the Metapath item for the parameter @@ -195,8 +197,8 @@ protected R visitParameter( /** * Called when visiting a part. *

    - * Can be overridden by classes extending this interface to support processing of the visited - * object. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item * the Metapath item for the part @@ -247,11 +249,12 @@ protected void visitMetadata(@NonNull IRootAssemblyNodeItem rootItem, 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. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item - * the role Metaschema node item which is a child of the "metadata" node + * the role Metaschema node item which is a child of the "metadata" + * node * @param metadataItem * the "metadata" Metaschema node item containing the role * @param state @@ -265,13 +268,15 @@ protected void visitRole( // NOPMD noop default } /** - * Called when visiting a location in the "metadata" section of an OSCAL document. + * 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. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item - * the location Metaschema node item which is a child of the "metadata" node + * the location Metaschema node item which is a child of the "metadata" + * node * @param metadataItem * the "metadata" Metaschema node item containing the location * @param state @@ -287,11 +292,12 @@ protected void visitLocation( // NOPMD noop default /** * 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. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item - * the party Metaschema node item which is a child of the "metadata" node + * the party Metaschema node item which is a child of the "metadata" + * node * @param metadataItem * the "metadata" Metaschema node item containing the party * @param state @@ -325,13 +331,15 @@ protected void visitBackMatter(@NonNull IRootAssemblyNodeItem rootItem, T state) } /** - * Called when visiting a resource in the "back-matter" section of an OSCAL document. + * 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. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item - * the resource Metaschema node item which is a child of the "metadata" node + * the resource Metaschema node item which is a child of the "metadata" + * node * @param backMatterItem * the resource Metaschema node item containing the party * @param state diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogVisitor.java index 696d8fa3..d004f603 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractCatalogVisitor.java @@ -36,9 +36,11 @@ * Used to visit a catalog containing groups and controls. * * @param - * the type of the state object used to pass calling context information + * the type of the state object used to pass calling context + * information * @param - * the type of the result for visiting a collection of groups and/or controls + * the type of the result for visiting a collection of groups and/or + * controls */ public abstract class AbstractCatalogVisitor implements ICatalogVisitor { @@ -51,7 +53,8 @@ protected R visitCatalog(@NonNull IDocumentNodeItem catalogDocument, T state) { } /** - * Visit the child groups and controls (in that order) of a given catalog or group container. + * Visit the child groups and controls (in that order) of a given catalog or + * group container. * * @param catalogOrGroup * the catalog or group Metapath item currently being visited @@ -108,7 +111,8 @@ protected R visitGroupInternal( } /** - * Visit the child controls (in that order) of a given catalog, group, or control container. + * Visit the child controls (in that order) of a given catalog, group, or + * control container. * * @param catalogOrGroupOrControl * the catalog, group, or control Metapath item currently being visited diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractEntityItem.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractEntityItem.java index 733484c0..c40a7d7f 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractEntityItem.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/AbstractEntityItem.java @@ -66,7 +66,8 @@ public String getOriginalIdentifier() { // @NonNull // public String getIdentifier() { // final String checkedReassignedIdentifier = reassignedIdentifier; - // return checkedReassignedIdentifier == null ? originalIdentifier : checkedReassignedIdentifier; + // return checkedReassignedIdentifier == null ? originalIdentifier : + // checkedReassignedIdentifier; // } @Override diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/BasicIndexer.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/BasicIndexer.java index 90e866ac..31b8cc0a 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/BasicIndexer.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/BasicIndexer.java @@ -190,11 +190,14 @@ public Collection getEntitiesByItemType(@NonNull IEntityItem.ItemTy return entityGroup == null ? CollectionUtil.emptyList() : ObjectUtils.notNull(entityGroup.values()); } // - // public EntityItem getEntity(@NonNull ItemType itemType, @NonNull UUID identifier) { - // return getEntity(itemType, ObjectUtils.notNull(identifier.toString()), false); + // public EntityItem getEntity(@NonNull ItemType itemType, @NonNull UUID + // identifier) { + // return getEntity(itemType, ObjectUtils.notNull(identifier.toString()), + // false); // } // - // public EntityItem getEntity(@NonNull ItemType itemType, @NonNull String identifier) { + // public EntityItem getEntity(@NonNull ItemType itemType, @NonNull String + // identifier) { // return getEntity(itemType, identifier, itemType.isUuid()); // } @@ -327,10 +330,11 @@ protected final AbstractEntityItem.Builder newBuilder( /** * Create a new builder with the provided info. *

    - * This method can be overloaded to support applying additional data to the returned builder. + * This method can be overloaded to support applying additional data to the + * returned builder. *

    - * When working with identifiers that are case insensitve, it is important to ensure that the - * identifiers are normalized to lower case. + * When working with identifiers that are case insensitve, it is important to + * ensure that the identifiers are normalized to lower case. * * @param item * the Metapath node to associate with the entity diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/ICatalogVisitor.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/ICatalogVisitor.java index 96842848..c5409e7f 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/ICatalogVisitor.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/ICatalogVisitor.java @@ -34,17 +34,19 @@ * Used to visit a catalog containing groups and controls. * * @param - * the type of the context object used to pass calling context information + * the type of the context object used to pass calling context + * information * @param - * the type of the result for visiting a collection of groups and/or controls + * the type of the result for visiting a collection of groups and/or + * controls */ public interface ICatalogVisitor { /** * Called when visiting a group. *

    - * Can be overridden by classes extending this interface to support processing of the visited - * object. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item * the Metapath item for the group @@ -62,8 +64,8 @@ default R visitGroup(@NonNull IRequiredValueModelNodeItem item, R childResult, T /** * Called when visiting a control. *

    - * Can be overridden by classes extending this interface to support processing of the visited - * object. + * Can be overridden by classes extending this interface to support processing + * of the visited object. * * @param item * the Metapath item for the control diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IEntityItem.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IEntityItem.java index afeacf98..146e4b48 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IEntityItem.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IEntityItem.java @@ -58,13 +58,14 @@ public boolean isUuid() { /** * Get the identifier originally assigned to this entity. *

    - * If the identifier value was reassigned, the return value of this method will be different than - * value returned by {@link #getIdentifier()}. In such cases, a call to - * {@link #isIdentifierReassigned()} is expected to return {@code true}. + * If the identifier value was reassigned, the return value of this method will + * be different than value returned by {@link #getIdentifier()}. In such cases, + * a call to {@link #isIdentifierReassigned()} is expected to return + * {@code true}. *

    - * If the value was not reassigned, the return value of this method will be the same value returned - * by {@link #getIdentifier()}. In this case, {@link #isIdentifierReassigned()} is expected to - * return {@code false}. + * If the value was not reassigned, the return value of this method will be the + * same value returned by {@link #getIdentifier()}. In this case, + * {@link #isIdentifierReassigned()} is expected to return {@code false}. * * @return the original identifier value before reassignment */ @@ -82,7 +83,8 @@ public boolean isUuid() { /** * Determine if the identifier was reassigned. * - * @return {@code true} if the identifier was reassigned, or {@code false} otherwise + * @return {@code true} if the identifier was reassigned, or {@code false} + * otherwise */ boolean isIdentifierReassigned(); diff --git a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IIndexer.java b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IIndexer.java index f91ed7e9..7fac07e2 100644 --- a/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IIndexer.java +++ b/src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/IIndexer.java @@ -76,8 +76,8 @@ static boolean isReferencedEntity(@NonNull IEntityItem entity) { } /** - * Keep entities that have a reference count greater than zero or are required to be kept based on - * the "keep"="always property. + * Keep entities that have a reference count greater than zero or are required + * to be kept based on the "keep"="always property. * * @param entities * the entity items to filter @@ -88,8 +88,8 @@ static Stream getReferencedEntitiesAsStream(@NonNull Collection