Interface IIndexer

    • Method Detail

      • getReferencedEntitiesAsStream

        static Stream<IEntityItemgetReferencedEntitiesAsStream​(@NonNull
                                                                 Collection<IEntityItem> entities)
        Keep entities that have a reference count greater than zero or are required to be kept based on the "keep"="always property.
        Parameters:
        entities - the entity items to filter
        Returns:
        the entities that pass the filter
      • getUnreferencedEntitiesAsStream

        static Stream<IEntityItemgetUnreferencedEntitiesAsStream​(@NonNull
                                                                   Collection<IEntityItem> entities)
        Keep entities that have a reference count of zero or are not required to be kept based on the "keep"="always property.
        Parameters:
        entities - the entity items to filter
        Returns:
        the entities that pass the filter
      • filterDistinct

        static <T,​K> Stream<T> filterDistinct​(@NonNull
                                                    Stream<T> resolvedItems,
                                                    @NonNull
                                                    Collection<IEntityItem> importedEntityItems,
                                                    @NonNull
                                                    Function<? super T,​? extends K> keyMapper)
        Generates a stream of distinct items that have a reference count greater than zero or are required to be kept based on the "keep"="always property.

        Distinct items are determined based on the item's key using the provided keyMapper.

        Type Parameters:
        T - the item type
        K - the key type
        Parameters:
        resolvedItems - a series of previously resolved items to add to prepend to the stream
        importedEntityItems - a collection of new items to filter then append to the stream
        keyMapper - the key mapping function to determine the item's key
        Returns:
        the resulting series of items with duplicate items with the same key removed
      • logIndex

        static void logIndex​(@NonNull
                             IIndexer indexer,
                             @NonNull
                             org.apache.logging.log4j.Level logLevel)
      • addRole

        @NonNull
        IEntityItem addRole​(@NonNull
                            gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem role)
      • addLocation

        @NonNull
        IEntityItem addLocation​(@NonNull
                                gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem location)
      • addParty

        @NonNull
        IEntityItem addParty​(@NonNull
                             gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem party)
      • addGroup

        @Nullable
        IEntityItem addGroup​(@NonNull
                             gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem group)
      • addControl

        @NonNull
        IEntityItem addControl​(@NonNull
                               gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem control)
      • addParameter

        @NonNull
        IEntityItem addParameter​(@NonNull
                                 gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem parameter)
      • addPart

        @Nullable
        IEntityItem addPart​(@NonNull
                            gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem part)
      • addResource

        @NonNull
        IEntityItem addResource​(@NonNull
                                gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem resource)
      • getEntity

        @Nullable
        default IEntityItem getEntity​(@NonNull
                                      IEntityItem.ItemType itemType,
                                      @NonNull
                                      String identifier)
        Lookup an item of the given itemType having the given identifier.

        Will normalize the case of a UUID-based identifier.

        Parameters:
        itemType - the type of item to search for
        identifier - the identifier to lookup
        Returns:
        the matching item or null if no match was found
      • getEntity

        @Nullable
        IEntityItem getEntity​(@NonNull
                              IEntityItem.ItemType itemType,
                              @NonNull
                              String identifier,
                              boolean normalize)
        Lookup an item of the given itemType having the given identifier.

        Will normalize the case of a UUID-based the identifier when requested.

        Parameters:
        itemType - the type of item to search for
        identifier - the identifier to lookup
        normalize - true if the identifier case should be normalized or false otherwise
        Returns:
        the matching item or null if no match was found