Class HalCachingLinkResolver
- java.lang.Object
-
- org.camunda.bpm.engine.rest.hal.cache.HalCachingLinkResolver
-
- All Implemented Interfaces:
HalLinkResolver
- Direct Known Subclasses:
HalIdentityLinkResolver
,HalIdResourceCacheLinkResolver
public abstract class HalCachingLinkResolver extends java.lang.Object implements HalLinkResolver
-
-
Constructor Summary
Constructors Constructor Description HalCachingLinkResolver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Cache
getCache()
protected abstract java.lang.Class<?>
getHalResourceClass()
protected java.util.Comparator<HalResource<?>>
getResourceComparator()
protected abstract java.lang.String
getResourceId(HalResource<?> resource)
protected void
putIntoCache(java.util.List<HalResource<?>> notCachedResources)
Put a resource into the cache.protected java.util.List<HalResource<?>>
resolveCachedLinks(java.lang.String[] linkedIds, Cache cache, java.util.List<java.lang.String> notCachedLinkedIds)
Returns a list with all resources which are cached.java.util.List<HalResource<?>>
resolveLinks(java.lang.String[] linkedIds, ProcessEngine processEngine)
Resolve resources for linked ids, if configured uses a cache.protected abstract java.util.List<HalResource<?>>
resolveNotCachedLinks(java.lang.String[] linkedIds, ProcessEngine processEngine)
protected void
sortResolvedResources(java.util.List<HalResource<?>> resolvedResources)
Sort the resolved resources to ensure consistent order of resolved resources.
-
-
-
Method Detail
-
resolveLinks
public java.util.List<HalResource<?>> resolveLinks(java.lang.String[] linkedIds, ProcessEngine processEngine)
Resolve resources for linked ids, if configured uses a cache.- Specified by:
resolveLinks
in interfaceHalLinkResolver
-
sortResolvedResources
protected void sortResolvedResources(java.util.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 java.util.List<HalResource<?>> resolveCachedLinks(java.lang.String[] linkedIds, Cache cache, java.util.List<java.lang.String> notCachedLinkedIds)
Returns a list with all resources which are cached.- Parameters:
linkedIds
- the ids to resolvecache
- the cache to usenotCachedLinkedIds
- a list with ids which are not found in the cache- Returns:
- the cached resources
-
putIntoCache
protected void putIntoCache(java.util.List<HalResource<?>> notCachedResources)
Put a resource into the cache.
-
getHalResourceClass
protected abstract java.lang.Class<?> getHalResourceClass()
- Returns:
- the class of the entity which is resolved
-
getResourceComparator
protected java.util.Comparator<HalResource<?>> getResourceComparator()
- Returns:
- a comparator for this HAL resource if not overridden sorting is skipped
-
resolveNotCachedLinks
protected abstract java.util.List<HalResource<?>> resolveNotCachedLinks(java.lang.String[] linkedIds, ProcessEngine processEngine)
- Returns:
- the resolved resources which are currently not cached
-
getResourceId
protected abstract java.lang.String getResourceId(HalResource<?> resource)
- Returns:
- the id which identifies a resource in the cache
-
-