Interface DAO

  • All Known Implementing Classes:
    MockDAO

    public interface DAO
    The core persistence interface. Stores and retrieves domain objects to/from a data store.
    Author:
    Alex Bogdanovski [alex@erudika.com]
    • Method Detail

      • create

        <P extends ParaObjectString create​(String appid,
                                             P object)
        Persists an object to the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        object - the domain object
        Returns:
        the object's id or null if not created.
      • create

        <P extends ParaObjectString create​(P object)
        Persists an object to the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        object - the domain object
        Returns:
        the object's id or null if not created.
      • read

        <P extends ParaObject> P read​(String appid,
                                      String key)
        Retrieves an object from the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        key - an object id
        Returns:
        the object or null if not found
      • read

        <P extends ParaObject> P read​(String key)
        Retrieves an object from the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        key - an object id
        Returns:
        the object or null if not found
      • update

        <P extends ParaObject> void update​(String appid,
                                           P object)
        Updates an object permanently.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        object - the domain object
      • update

        <P extends ParaObject> void update​(P object)
        Updates an object permanently.
        Type Parameters:
        P - the type of object
        Parameters:
        object - the domain object
      • delete

        <P extends ParaObject> void delete​(String appid,
                                           P object)
        Deletes an object permanently.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        object - the domain object
      • delete

        <P extends ParaObject> void delete​(P object)
        Deletes an object permanently.
        Type Parameters:
        P - the type of object
        Parameters:
        object - the domain object
      • createAll

        <P extends ParaObject> void createAll​(String appid,
                                              List<P> objects)
        Saves multiple objects to the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        objects - the list of objects to save
      • createAll

        <P extends ParaObject> void createAll​(List<P> objects)
        Saves multiple objects to the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        objects - the list of objects to save
      • readAll

        <P extends ParaObjectMap<String,​P> readAll​(String appid,
                                                           List<String> keys,
                                                           boolean getAllColumns)
        Retrieves multiple objects from the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        keys - a list of object ids
        getAllColumns - true if all columns must be retrieved. used to save bandwidth.
        Returns:
        a map of ids to objects
      • readAll

        <P extends ParaObjectMap<String,​P> readAll​(List<String> keys,
                                                           boolean getAllColumns)
        Retrieves multiple objects from the data store.
        Type Parameters:
        P - the type of object
        Parameters:
        keys - a list of object ids
        getAllColumns - true if all columns must be retrieved. used to save bandwidth.
        Returns:
        a map of ids to objects
      • readPage

        <P extends ParaObjectList<P> readPage​(String appid,
                                                Pager pager)
        Reads a fixed number of objects. Used for scanning a data store page by page. Calling this method would bypass the read cache and will hit the DB.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        pager - a Pager
        Returns:
        a list of objects
      • readPage

        <P extends ParaObjectList<P> readPage​(Pager pager)
        Reads a fixed number of objects. Used for scanning a data store page by page. Calling this method would bypass the read cache and will hit the DB.
        Type Parameters:
        P - the type of object
        Parameters:
        pager - a Pager
        Returns:
        a list of objects
      • updateAll

        <P extends ParaObject> void updateAll​(String appid,
                                              List<P> objects)
        Updates multiple objects.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        objects - a list of objects to update
      • updateAll

        <P extends ParaObject> void updateAll​(List<P> objects)
        Updates multiple objects.
        Type Parameters:
        P - the type of object
        Parameters:
        objects - a list of objects to update
      • deleteAll

        <P extends ParaObject> void deleteAll​(String appid,
                                              List<P> objects)
        Deletes multiple objects.
        Type Parameters:
        P - the type of object
        Parameters:
        appid - name of the App
        objects - a list of objects to delete
      • deleteAll

        <P extends ParaObject> void deleteAll​(List<P> objects)
        Deletes multiple objects.
        Type Parameters:
        P - the type of object
        Parameters:
        objects - a list of objects to delete