Class PersistentDataUtil
java.lang.Object
com.inductiveautomation.ignition.gateway.storeforward.data.util.PersistentDataUtil
Utility class for operating on collections of
PersistentData
.
This class provides static methods to perform operations such as grouping,
flattening, and size computation for persistent data objects.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends PersistentData>
Collection<List<T>>collectGroupedDataByFlavor
(List<T> dataList) Collects the given list of persistent data by flavor and returns a collection of lists, where each list contains all the data with the same flavor.static Set<Map.Entry<PersistentFlavor<?>,
List<PersistentData>>> flattenAndGroupByFlavor
(List<PersistentData> dataList) Flattens a list of persistent data, unwrapping anyPersistentDataBundle
instances, and groups the data by their associatedPersistentFlavor
.static Map<StorageId,
List<PersistentData>> groupAndFlattenDataByStorageId
(List<PersistentData> dataList, StorageId defaultStorageId) Groups data by storage id, flattening tagged data to access inner data.static Set<Map.Entry<PersistentFlavor<?>,
List<PersistentData>>> groupDataByFlavor
(List<PersistentData> dataList) Groups the given list of persistent data by flavor and returns a set of entries, where each entry is a mapping from a flavor to a list of data with that flavor.static <T extends PersistentData>
intsize
(Collection<T> data) Returns the size for the given list of persistent data, which is the sum of the data counts for each flavor.
-
Method Details
-
size
Returns the size for the given list of persistent data, which is the sum of the data counts for each flavor.- Parameters:
data
- the list of persistent data to check- Returns:
- the total size of the data
-
groupDataByFlavor
public static Set<Map.Entry<PersistentFlavor<?>,List<PersistentData>>> groupDataByFlavor(List<PersistentData> dataList) Groups the given list of persistent data by flavor and returns a set of entries, where each entry is a mapping from a flavor to a list of data with that flavor.- Parameters:
dataList
- the list of persistent data to group- Returns:
- a set of entries, where each entry is a mapping from a flavor to a list of data with that flavor
-
collectGroupedDataByFlavor
public static <T extends PersistentData> Collection<List<T>> collectGroupedDataByFlavor(List<T> dataList) Collects the given list of persistent data by flavor and returns a collection of lists, where each list contains all the data with the same flavor.- Parameters:
dataList
- the list of persistent data to collect- Returns:
- a collection of lists, where each list contains all the data with the same flavor
-
groupAndFlattenDataByStorageId
public static Map<StorageId,List<PersistentData>> groupAndFlattenDataByStorageId(List<PersistentData> dataList, StorageId defaultStorageId) Groups data by storage id, flattening tagged data to access inner data.- Parameters:
dataList
- the list of data to groupdefaultStorageId
- the default storage id for non-tagged data- Returns:
- a map containing mappings from a storage id to their associated data lists
-
flattenAndGroupByFlavor
public static Set<Map.Entry<PersistentFlavor<?>,List<PersistentData>>> flattenAndGroupByFlavor(List<PersistentData> dataList) Flattens a list of persistent data, unwrapping anyPersistentDataBundle
instances, and groups the data by their associatedPersistentFlavor
.- Parameters:
dataList
- the list ofPersistentData
objects to process; may includePersistentDataBundle
instances- Returns:
- a set of map entries where each key is a
PersistentFlavor
and the value is a list ofPersistentData
objects associated with that flavor
-