Class DataManager

java.lang.Object
com.blukii.sdk.config.DataManager

public final class DataManager extends Object
This class is the central logic to handle all data driven actions.

From here you can start calls to blukii cloud and handle BlukiiData actions.

Get the DataManager instance by calling BlukiiController.getConfigDataManager()

Important: Most of DataManager class functions need to be logged in. See BlukiiCloud for more information.

See Also:
  • Method Details

    • reset

      public void reset()
      Clears all blukii data and flags
    • getBlukiiData

      public BlukiiData getBlukiiData(String blukiiId)
      Gets a BlukiiData object via blukii id.
      Parameters:
      blukiiId - id of blukii
      Returns:
      a BlukiiData object
    • getBlukiiDataList

      public List<String> getBlukiiDataList()
      Gets a list of keys of all available BlukiiData objects.
      Returns:
      a list of String keys
    • getFullDataSyncedBlukiiDataList

      public List<String> getFullDataSyncedBlukiiDataList()
      Gets a list of keys of all available BlukiiData objects, which are full data synced.
      Returns:
      a list of String keys
    • getSyncedBlukiiDataList

      public List<String> getSyncedBlukiiDataList()
      Gets a list of keys of all available BlukiiData objects, which are status synced or full data synced.
      Returns:
      a list of String keys
    • isDataModified

      public boolean isDataModified()
      Checks if any BlukiiData object is modified.
      Returns:
      true if there is modified data, otherwise false
    • getLastDataSyncTime

      public long getLastDataSyncTime()
      Gets timestamp of last full data sync.
      Returns:
      timestamp of last full data sync
    • getLastStatusSyncTime

      public long getLastStatusSyncTime()
      Gets timestamp of last status sync.
      Returns:
      timestamp of last status sync
    • isStatusLoaded

      public boolean isStatusLoaded()
      Checks if status has been loaded since user has been logged in.
      Returns:
      timestamp of last status sync
    • loadBlukii

      @Deprecated public void loadBlukii(String blukiiId, @NonNull DataManager.OnLoadBlukiiListener listener)
      Deprecated.
      please use sync(OnSyncListener, List) instead!
      Loads a specific blukii from blukii cloud.
      Parameters:
      blukiiId - id of blukii
      listener - OnLoadBlukiiListener which is called if load is done or on error
      See Also:
    • sync

      public void sync(@NonNull DataManager.OnSyncListener listener)
      Synchronizes local blukii data with blukii cloud.
      Parameters:
      listener - OnSyncListener which is called if sync is done or on error
    • sync

      public void sync(@NonNull DataManager.OnSyncListener listener, @Nullable List<String> blukiiIds)
      Synchronizes local blukii data with blukii cloud.

      Parameter blukiiIds define the set of blukiis that should be synchronized from now on. Blukiis that are not in this list will not be synchronized any more.

      If parameter blukiiIds is null, the current sync ids retrieved by getFullDataSyncedBlukiiDataList() are synced.

      Parameters:
      listener - OnSyncListener which is called if sync is done or on error
      blukiiIds - blukii ids that should be synced
    • loadStatus

      public void loadStatus(@NonNull DataManager.OnLoadStatusListener listener)
      Load status data for all user owned blukiis from blukii cloud.
      Parameters:
      listener - OnLoadStatusListener which is called if load is done or on error
    • assignBlukiis

      public void assignBlukiis(String orderCode, @NonNull DataManager.OnAssignBlukiiListener listener)
      Assigns blukiis via order code to a user in blukii cloud.
      Parameters:
      orderCode - order code which verifies the assignment
      listener - OnAssignBlukiiListener which is called if assign is done or on error