Class MdmExpansionCacheSvc


  • public class MdmExpansionCacheSvc
    extends Object
    The purpose of this class is to share context between steps of a given GroupBulkExport job. This cache allows you to port state between reader/processor/writer. In this case, we are maintaining a cache of Source Resource ID -> Golden Resource ID, so that we can annotate outgoing resources with their golden owner if applicable.
    • Method Detail

      • getGoldenResourceId

        public String getGoldenResourceId​(String theSourceId)
        Lookup a given resource's golden resource ID in the cache. Note that if you pass this function the resource ID of a golden resource, it will just return itself.
        Parameters:
        theSourceId - the resource ID of the source resource ,e.g. PAT123
        Returns:
        the resource ID of the associated golden resource.
      • buildLogMessage

        public String buildLogMessage​(String message,
                                      boolean theAddCacheContentContent)
        Builds a log message, potentially enriched with the cache content.
        Parameters:
        message - The log message
        theAddCacheContentContent - If true, will annotate the log message with the current cache contents.
        Returns:
        a built log message, which may include the cache content.
      • setCacheContents

        public void setCacheContents​(Map<String,​String> theSourceResourceIdToGoldenResourceIdMap)
        Populate the cache
        Parameters:
        theSourceResourceIdToGoldenResourceIdMap - the source ID -> golden ID map to populate the cache with.
      • hasBeenPopulated

        public boolean hasBeenPopulated()
        Since this cache is used at @JobScope, we can skip a whole whack of expansions happening by simply checking if one of our child steps has populated the cache yet. .