org.camunda.bpm.engine.rest.hal.cache
Class HalCachingLinkResolver

java.lang.Object
  extended by org.camunda.bpm.engine.rest.hal.cache.HalCachingLinkResolver
All Implemented Interfaces:
HalLinkResolver
Direct Known Subclasses:
HalIdentityLinkResolver, HalIdResourceCacheLinkResolver

public abstract class HalCachingLinkResolver
extends Object
implements HalLinkResolver


Constructor Summary
HalCachingLinkResolver()
           
 
Method Summary
protected  Cache getCache()
           
protected abstract  Class<?> getHalResourceClass()
           
protected  Comparator<HalResource<?>> getResourceComparator()
           
protected abstract  String getResourceId(HalResource<?> resource)
           
protected  void putIntoCache(List<HalResource<?>> notCachedResources)
          Put a resource into the cache.
protected  List<HalResource<?>> resolveCachedLinks(String[] linkedIds, Cache cache, List<String> notCachedLinkedIds)
          Returns a list with all resources which are cached.
 List<HalResource<?>> resolveLinks(String[] linkedIds, ProcessEngine processEngine)
          Resolve resources for linked ids, if configured uses a cache.
protected abstract  List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine)
           
protected  void sortResolvedResources(List<HalResource<?>> resolvedResources)
          Sort the resolved resources to ensure consistent order of resolved resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HalCachingLinkResolver

public HalCachingLinkResolver()
Method Detail

resolveLinks

public List<HalResource<?>> resolveLinks(String[] linkedIds,
                                         ProcessEngine processEngine)
Resolve resources for linked ids, if configured uses a cache.

Specified by:
resolveLinks in interface HalLinkResolver

sortResolvedResources

protected void sortResolvedResources(List<HalResource<?>> resolvedResources)
Sort the resolved resources to ensure consistent order of resolved resources.


getCache

protected Cache getCache()
Returns:
the cache for this resolver

resolveCachedLinks

protected List<HalResource<?>> resolveCachedLinks(String[] linkedIds,
                                                  Cache cache,
                                                  List<String> notCachedLinkedIds)
Returns a list with all resources which are cached.

Parameters:
linkedIds - the ids to resolve
cache - the cache to use
notCachedLinkedIds - a list with ids which are not found in the cache
Returns:
the cached resources

putIntoCache

protected void putIntoCache(List<HalResource<?>> notCachedResources)
Put a resource into the cache.


getHalResourceClass

protected abstract Class<?> getHalResourceClass()
Returns:
the class of the entity which is resolved

getResourceComparator

protected Comparator<HalResource<?>> getResourceComparator()
Returns:
a comparator for this HAL resource if not overridden sorting is skipped

resolveNotCachedLinks

protected abstract List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds,
                                                              ProcessEngine processEngine)
Returns:
the resolved resources which are currently not cached

getResourceId

protected abstract String getResourceId(HalResource<?> resource)
Returns:
the id which identifies a resource in the cache


Copyright © 2016 camunda services GmbH. All rights reserved.