Interface StorageClient


  • public interface StorageClient
    Data Access interface used to store and load Accounts, Mechanisms and Notifications. Encapsulates a backing storage mechanism, and provides a standard set of functions for operating on the data.
    • Method Detail

      • getAccount

        Account getAccount​(java.lang.String accountId)
        Get the Account object with its id
        Parameters:
        accountId - The account unique ID
        Returns:
        The account object.
      • getAllAccounts

        java.util.List<Account> getAllAccounts()
        Get all accounts stored in the system.
        Returns:
        The complete list of accounts.
      • removeAccount

        boolean removeAccount​(Account account)
        Delete the Account that was passed in.
        Parameters:
        account - The account object to delete.
        Returns:
        boolean as result of the operation
      • setAccount

        boolean setAccount​(Account account)
        Add or Update the Account to the storage system.
        Parameters:
        account - The Account to store or update.
        Returns:
        boolean as result of the operation
      • getMechanismsForAccount

        java.util.List<Mechanism> getMechanismsForAccount​(Account account)
        Get the mechanisms associated with an account.
        Parameters:
        account - The Account object
        Returns:
        The list of mechanisms for the account.
      • getMechanismByUUID

        Mechanism getMechanismByUUID​(java.lang.String mechanismUID)
        Get the mechanism by UUID.
        Parameters:
        mechanismUID - The uniquely identifiable UUID for the mechanism
        Returns:
        The mechanism object.
      • removeMechanism

        boolean removeMechanism​(Mechanism mechanism)
        Delete the mechanism uniquely identified by an id.
        Parameters:
        mechanism - The mechanism object to delete.
        Returns:
        boolean as result of the operation
      • setMechanism

        boolean setMechanism​(Mechanism mechanism)
        Add or update the mechanism to the storage system. If the owning Account is not yet stored, store that as well.
        Parameters:
        mechanism - The mechanism to store or update.
        Returns:
        boolean as result of the operation
      • getAllNotifications

        java.util.List<PushNotification> getAllNotifications()
        Get all notifications from the storage system.
        Returns:
        The complete list of notifications.
      • getAllNotificationsForMechanism

        java.util.List<PushNotification> getAllNotificationsForMechanism​(Mechanism mechanism)
        Get all notifications for within the mechanism.
        Parameters:
        mechanism - The mechanism object
        Returns:
        The list of notifications for the mechanism.
      • removeNotification

        boolean removeNotification​(PushNotification pushNotification)
        Delete the pushNotification uniquely identified by an id.
        Parameters:
        pushNotification - The pushNotification object to delete.
      • setNotification

        boolean setNotification​(PushNotification pushNotification)
        Add or update the pushNotification to the storage system.
        Parameters:
        pushNotification - The pushNotification to store.
        Returns:
        boolean as result of the operation
      • getNotification

        PushNotification getNotification​(java.lang.String notificationId)
        Get the PushNotification object with its id
        Parameters:
        notificationId - The PushNotification unique ID
        Returns:
        The PushNotification object.
      • isEmpty

        boolean isEmpty()
        Whether the storage system currently contains any data.
        Returns:
        True if the storage system is empty, false otherwise.