Class DIHCacheSupport


  • public class DIHCacheSupport
    extends Object
    • Field Detail

      • CACHE_DELETE_PRIOR_DATA

        public static final String CACHE_DELETE_PRIOR_DATA

        If the cache supports persistent data, set to "true" to delete any prior persisted data before running the entity.

        See Also:
        Constant Field Values
      • CACHE_FOREIGN_KEY

        public static final String CACHE_FOREIGN_KEY

        Specify the Foreign Key from the parent entity to join on. Use if the cache is on a child entity.

        See Also:
        Constant Field Values
      • CACHE_PRIMARY_KEY

        public static final String CACHE_PRIMARY_KEY

        Specify the Primary Key field from this Entity to map the input records with

        See Also:
        Constant Field Values
      • CACHE_READ_ONLY

        public static final String CACHE_READ_ONLY

        If true, a pre-existing cache is re-opened for read-only access.

        See Also:
        Constant Field Values
    • Constructor Detail

      • DIHCacheSupport

        public DIHCacheSupport​(Context context,
                               String cacheImplName)
    • Method Detail

      • initNewParent

        public void initNewParent​(Context context)
      • destroyAll

        public void destroyAll()
      • populateCache

        public void populateCache​(String query,
                                  Iterator<Map<String,​Object>> rowIterator)

        Get all the rows from the datasource for the given query and cache them

      • getIdCacheData

        protected Map<String,​Object> getIdCacheData​(Context context,
                                                          String query,
                                                          Iterator<Map<String,​Object>> rowIterator)
        If the where clause is present the cache is sql Vs Map of key Vs List of Rows.
        Parameters:
        query - the query string for which cached data is to be returned
        Returns:
        the cached row corresponding to the given query after all variables have been resolved
      • getSimpleCacheData

        protected Map<String,​Object> getSimpleCacheData​(Context context,
                                                              String query,
                                                              Iterator<Map<String,​Object>> rowIterator)
        If where clause is not present the cache is a Map of query vs List of Rows.
        Parameters:
        query - string for which cached row is to be returned
        Returns:
        the cached row corresponding to the given query
      • getFromRowCacheTransformed

        protected Map<String,​Object> getFromRowCacheTransformed()