Class DataCommunicator.ActiveDataHandler

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ActiveDataHandler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addActiveData​(java.util.stream.Stream<T> dataObjects)
      Adds given objects as currently active objects.
      void cleanUp​(java.util.stream.Stream<T> dataObjects)
      Executes the data destruction for dropped data that is not sent to the client.
      void destroyAllData()
      Informs the DataGenerator that all data has been dropped.
      void destroyData​(T data)
      Informs the DataGenerator that the given data item has been dropped and is no longer needed.
      void dropActiveData​(java.lang.String key)
      Marks a data object identified by given key string to be dropped.
      void dropAllActiveData()
      Marks all currently active data objects to be dropped.
      void generateData​(T data, elemental.json.JsonObject jsonObject)
      Adds custom data for the given item to its serialized JsonObject representation.
      java.util.Map<java.lang.Object,​T> getActiveData()
      Returns all currently active data mapped by their id from DataProvider.
      protected java.util.Map<java.lang.Object,​T> getDroppedData()
      Returns all dropped data mapped by their id from DataProvider.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ActiveDataHandler

        protected ActiveDataHandler()
    • Method Detail

      • addActiveData

        public void addActiveData​(java.util.stream.Stream<T> dataObjects)
        Adds given objects as currently active objects.
        Parameters:
        dataObjects - collection of new active data objects
      • cleanUp

        public void cleanUp​(java.util.stream.Stream<T> dataObjects)
        Executes the data destruction for dropped data that is not sent to the client. This method takes most recently sent data objects in a collection. Doing the clean up like this prevents the DataCommunicator.ActiveDataHandler from creating new keys for rows that were dropped but got re-requested by the client-side. In the case of having all data at the client, the collection should be all the data in the back end.
        Parameters:
        dataObjects - collection of most recently sent data to the client
      • dropAllActiveData

        public void dropAllActiveData()
        Marks all currently active data objects to be dropped.
        Since:
        8.6.0
      • dropActiveData

        public void dropActiveData​(java.lang.String key)
        Marks a data object identified by given key string to be dropped.
        Parameters:
        key - key string
      • getDroppedData

        protected java.util.Map<java.lang.Object,​T> getDroppedData()
        Returns all dropped data mapped by their id from DataProvider.
        Returns:
        map of ids to dropped data objects
        Since:
        8.6.0
      • getActiveData

        public java.util.Map<java.lang.Object,​T> getActiveData()
        Returns all currently active data mapped by their id from DataProvider.
        Returns:
        map of ids to active data objects
      • generateData

        public void generateData​(T data,
                                 elemental.json.JsonObject jsonObject)
        Description copied from interface: DataGenerator
        Adds custom data for the given item to its serialized JsonObject representation. This JSON object will be sent to client-side DataProvider.
        Specified by:
        generateData in interface DataGenerator<T>
        Parameters:
        data - the data item being serialized
        jsonObject - the JSON object being sent to the client
      • destroyData

        public void destroyData​(T data)
        Description copied from interface: DataGenerator
        Informs the DataGenerator that the given data item has been dropped and is no longer needed. This method should clean up any unneeded information stored for this item.
        Specified by:
        destroyData in interface DataGenerator<T>
        Parameters:
        data - the dropped data item
      • destroyAllData

        public void destroyAllData()
        Description copied from interface: DataGenerator
        Informs the DataGenerator that all data has been dropped. This method should clean up any unneeded information stored for items.
        Specified by:
        destroyAllData in interface DataGenerator<T>