From 19e4ca4b1372619d70da03b7d341eb2b6b2eff71 Mon Sep 17 00:00:00 2001 From: "A.J. Stein" Date: Thu, 1 Feb 2024 09:45:08 -0500 Subject: [PATCH] Fix unselected control handling for #232 This may be a business logic error or perhaps at one time there was/is a valid reason, but as it stands the BasicIndexer would detect unselected controls for resolution of the profile but only drop them when their parent was selected for the default strategy of flattening. For simple trees where c1 is the root control and c1.1 is the child, so c1 -> c1.1, c1 was not being correctly removed. NOTE: Logging indicates a double index of c1.1 even with this change so that still needs to be fixed most likely to resolve this issue. --- .../profile/resolver/support/BasicIndexer.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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