Class TenantRangeParser
java.lang.Object
fr.gouv.vitam.common.model.config.TenantRangeParser
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoRangesIntersect(TenantRange tenantRange1, TenantRange tenantRange2) expandTenantIds(String contractedTenants) Expands a contracted expression (e.g.expandTenantKeyedMap(Map<String, V> contracted) Expands a map whose keys are contracted tenant expressions (e.g.expandTenantObjectList(List<T> items, Function<T, String> tenantRangeExtractor, Function<T, V> valueMapper) Expands a list of objects, each carrying a contracted tenant range, into aMap<tenantId, value>.expandTenantSet(String contractedTenants) Expands every range of a single contracted expression (e.g.static List<TenantRange> parseTenantRanges(String tenantRanges)
-
Method Details
-
parseTenantRanges
- Throws:
IllegalStateException
-
doRangesIntersect
-
expandTenantSet
Expands every range of a single contracted expression (e.g."0,1,3-10") into a sorted set of tenant ids. A single value (e.g."3") yields a one-element set, preserving backward compatibility. -
expandTenantIds
Expands a contracted expression (e.g."0,1,3-10") into a sorted, deduplicated list of tenant ids. Returnsnullwhen the input isnull. -
expandTenantObjectList
public static <T,V> Map<Integer,V> expandTenantObjectList(List<T> items, Function<T, String> tenantRangeExtractor, Function<T, V> valueMapper) Expands a list of objects, each carrying a contracted tenant range, into aMap<tenantId, value>. Replaces theCollectors.toMap(...::getTenantRange, ...)pattern while supporting ranges.- Throws:
IllegalStateException- if a tenant id is covered by more than one entry.
-
expandTenantKeyedMap
Expands a map whose keys are contracted tenant expressions (e.g."5-10") into aMap<tenantId, value>. A plain integer key (e.g."3") keeps working, preserving backward compatibility.- Throws:
IllegalStateException- if a tenant id is covered by more than one key.
-