Interface IIndexer
-
- All Known Implementing Classes:
BasicIndexer
,ReassignmentIndexer
public interface IIndexer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IIndexer.SelectionStatus
-
Field Summary
Fields Modifier and Type Field Description static gov.nist.secauto.metaschema.model.common.metapath.MetapathExpression
HAS_PROP_KEEP_METAPATH
static Predicate<IEntityItem>
KEEP_ENTITY_PREDICATE
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description IEntityItem
addControl(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem control)
IEntityItem
addGroup(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem group)
IEntityItem
addLocation(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem location)
IEntityItem
addParameter(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem parameter)
IEntityItem
addPart(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem part)
IEntityItem
addParty(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem party)
IEntityItem
addResource(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem resource)
IEntityItem
addRole(gov.nist.secauto.metaschema.model.common.metapath.item.IRequiredValueModelNodeItem role)
void
append(IIndexer result)
static <T,K>
Stream<T>filterDistinct(Stream<T> resolvedItems, Collection<IEntityItem> importedEntityItems, 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.Map<IEntityItem.ItemType,Map<String,IEntityItem>>
getEntities()
Get a copy of the entity map.Collection<IEntityItem>
getEntitiesByItemType(IEntityItem.ItemType itemType)
default IEntityItem
getEntity(IEntityItem.ItemType itemType, String identifier)
Lookup an item of the givenitemType
having the givenidentifier
.IEntityItem
getEntity(IEntityItem.ItemType itemType, String identifier, boolean normalize)
Lookup an item of the givenitemType
having the givenidentifier
.default IEntityItem
getEntity(IEntityItem.ItemType itemType, UUID identifier)
static Stream<IEntityItem>
getReferencedEntitiesAsStream(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.IIndexer.SelectionStatus
getSelectionStatus(gov.nist.secauto.metaschema.model.common.metapath.item.INodeItem item)
Map<gov.nist.secauto.metaschema.model.common.metapath.item.INodeItem,IIndexer.SelectionStatus>
getSelectionStatusMap()
static Stream<IEntityItem>
getUnreferencedEntitiesAsStream(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.static boolean
isReferencedEntity(IEntityItem entity)
boolean
isSelected(IEntityItem entity)
static void
logIndex(IIndexer indexer, org.apache.logging.log4j.Level logLevel)
boolean
removeItem(IEntityItem entity)
void
resetSelectionStatus()
void
setSelectionStatus(gov.nist.secauto.metaschema.model.common.metapath.item.INodeItem item, IIndexer.SelectionStatus selectionStatus)
-
-
-
Field Detail
-
HAS_PROP_KEEP_METAPATH
static final gov.nist.secauto.metaschema.model.common.metapath.MetapathExpression HAS_PROP_KEEP_METAPATH
-
KEEP_ENTITY_PREDICATE
static final Predicate<IEntityItem> KEEP_ENTITY_PREDICATE
-
-
Method Detail
-
isReferencedEntity
static boolean isReferencedEntity(@NonNull IEntityItem entity)
-
getReferencedEntitiesAsStream
static Stream<IEntityItem> getReferencedEntitiesAsStream(@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<IEntityItem> getUnreferencedEntitiesAsStream(@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 typeK
- the key type- Parameters:
resolvedItems
- a series of previously resolved items to add to prepend to the streamimportedEntityItems
- a collection of new items to filter then append to the streamkeyMapper
- 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)
-
getEntitiesByItemType
@NonNull Collection<IEntityItem> getEntitiesByItemType(@NonNull IEntityItem.ItemType itemType)
-
getEntity
@Nullable default IEntityItem getEntity(@NonNull IEntityItem.ItemType itemType, @NonNull UUID identifier)
-
getEntity
@Nullable default IEntityItem getEntity(@NonNull IEntityItem.ItemType itemType, @NonNull String identifier)
Lookup an item of the givenitemType
having the givenidentifier
.Will normalize the case of a UUID-based identifier.
- Parameters:
itemType
- the type of item to search foridentifier
- 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 givenitemType
having the givenidentifier
.Will normalize the case of a UUID-based the identifier when requested.
- Parameters:
itemType
- the type of item to search foridentifier
- the identifier to lookupnormalize
-true
if the identifier case should be normalized orfalse
otherwise- Returns:
- the matching item or
null
if no match was found
-
removeItem
boolean removeItem(@NonNull IEntityItem entity)
-
isSelected
boolean isSelected(@NonNull IEntityItem entity)
-
getSelectionStatusMap
Map<gov.nist.secauto.metaschema.model.common.metapath.item.INodeItem,IIndexer.SelectionStatus> getSelectionStatusMap()
-
getSelectionStatus
@NonNull IIndexer.SelectionStatus getSelectionStatus(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.INodeItem item)
-
setSelectionStatus
void setSelectionStatus(@NonNull gov.nist.secauto.metaschema.model.common.metapath.item.INodeItem item, @NonNull IIndexer.SelectionStatus selectionStatus)
-
resetSelectionStatus
void resetSelectionStatus()
-
getEntities
@NonNull Map<IEntityItem.ItemType,Map<String,IEntityItem>> getEntities()
Get a copy of the entity map.- Returns:
- the copy
-
-