Class MemoryStorage

  • All Implemented Interfaces:
    Storage

    public class MemoryStorage
    extends Object
    implements Storage
    Sample storage implementation that stores data into a volatile memory store
    Author:
    vanderw
    • Constructor Detail

      • MemoryStorage

        public MemoryStorage()
    • Method Detail

      • get

        public Map<String,​Object> get​(String id)
        Description copied from interface: Storage
        Gets a entity by id
        Specified by:
        get in interface Storage
        Parameters:
        id - the id of the entity
        Returns:
        the entity
      • get

        public Map<String,​Object> get​(String id,
                                            String version)
        Description copied from interface: Storage
        Gets a antity by id and version
        Specified by:
        get in interface Storage
        Parameters:
        id - the id of the entity
        version - the version of the entity
        Returns:
        the entity
      • getVersions

        public List<String> getVersions​(String id)
        Description copied from interface: Storage
        Gets the version of a specific entity
        Specified by:
        getVersions in interface Storage
        Parameters:
        id - the id of the entity
        Returns:
        a list containing the versions
      • delete

        public boolean delete​(String id)
        Description copied from interface: Storage
        Deletes a entity by id
        Specified by:
        delete in interface Storage
        Parameters:
        id - the id of the entity
        Returns:
        boolean indicating success
      • search

        public List<Map> search​(be.personify.util.SearchCriteria searchCriteria,
                                int start,
                                int count,
                                String sortBy,
                                String sortOrderString)
        Specified by:
        search in interface Storage
      • search

        public List<Map> search​(be.personify.util.SearchCriteria searchCriteria,
                                int start,
                                int count,
                                String sortBy,
                                String sortOrderString,
                                List<String> includeAttributes)
        Description copied from interface: Storage
        Searches entities
        Specified by:
        search in interface Storage
        Parameters:
        searchCriteria - the searchcriteria
        start - the start position
        count - the number of results to returm
        sortBy - the sortby attributes separated by a comma
        sortOrderString - the sortorder ( ascending or descending )
        Returns:
        a list containing the entities
      • count

        public long count​(be.personify.util.SearchCriteria searchCriteria)
        Description copied from interface: Storage
        Counts the results giving a searchcrtieria
        Specified by:
        count in interface Storage
        Parameters:
        searchCriteria - the searchcriteria
        Returns:
        a long indicating the number of results
      • initialize

        public void initialize​(String type)
        Description copied from interface: Storage
        Bootstrap your storage here
        Specified by:
        initialize in interface Storage
        Parameters:
        type - the type
      • flush

        public void flush()
        Description copied from interface: Storage
        Optional to implement : persist
        Specified by:
        flush in interface Storage
      • deleteAll

        public boolean deleteAll()
        Description copied from interface: Storage
        Deletes all entities
        Specified by:
        deleteAll in interface Storage
        Returns:
        boolean indicating success