java.lang.Object
com.inductiveautomation.ignition.gateway.storeforward.data.util.PersistentDataUtil

public class PersistentDataUtil extends Object
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 Details

    • size

      public static <T extends PersistentData> int size(Collection<T> data)
      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 group
      defaultStorageId - 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 any PersistentDataBundle instances, and groups the data by their associated PersistentFlavor.
      Parameters:
      dataList - the list of PersistentData objects to process; may include PersistentDataBundle instances
      Returns:
      a set of map entries where each key is a PersistentFlavor and the value is a list of PersistentData objects associated with that flavor