Class DataUpdateTransaction


  • public class DataUpdateTransaction
    extends java.lang.Object
    • Constructor Detail

      • DataUpdateTransaction

        public DataUpdateTransaction()
        Create an instance of this class to add data for multiple feature functions with validation happening for the state after all data is added. Runs update only after when runUpdate() is called. Notifies subscribers for each update.
    • Method Detail

      • addSingleData

        public <DATA> void addSingleData​(ReadListFeatureFunction<DATA,​?,​?,​?,​?> featureFunction,
                                         DATA data,
                                         DataUpdateTransaction.AfterUpdateSingleCall afterUpdateListCall)
        Add a single data object to the given function for this transaction. Each call of this method notifies the subscribers separately for the added data when runUpdate() is called.
        Type Parameters:
        DATA - the data type of the feature function
        Parameters:
        featureFunction - the feature function to add the data to
        data - the data to add
        afterUpdateListCall - method that is called with the index where the data was added to in the feature function when runUpdate() is called
      • addSingleData

        public <DATA> void addSingleData​(ReadSingleFeatureFunction<DATA,​?,​?> featureFunction,
                                         DATA update)
      • addDataList

        public <DATA> void addDataList​(ReadListFeatureFunction<DATA,​?,​?,​?,​?> featureFunction,
                                       java.util.List<DATA> dataList,
                                       DataUpdateTransaction.AfterUpdateListCall afterUpdateListCall)
        Add a list of data objects that should be added to the feature function for this transaction. Notifies subscribers once for the added data when runUpdate() is called.
        Type Parameters:
        DATA - the data type of the feature function
        Parameters:
        featureFunction - the feature function to add the data to
        dataList - the data to add
        afterUpdateListCall - method that is called with a list of indices where the data was added to in the feature function when runUpdate() is called (in order of the given data list)
      • runUpdate

        public void runUpdate()
                       throws DataValidationException
        Runs the update by adding the new data, validating it and notifying the subscribers. If validation fails the whole transaction will terminate without any data changed.
        Throws:
        DataValidationException - if the validation fails