Package ome.services.query
Class HierarchyNavigatorWrap<T,E>
- java.lang.Object
-
- ome.services.query.HierarchyNavigator
-
- ome.services.query.HierarchyNavigatorWrap<T,E>
-
public abstract class HierarchyNavigatorWrap<T,E> extends HierarchyNavigator
Convenience class for creating versions ofHierarchyNavigatorwith different model object representations.- Since:
- 5.0
-
-
Field Summary
-
Fields inherited from class ome.services.query.HierarchyNavigator
iQuery
-
-
Constructor Summary
Constructors Constructor Description HierarchyNavigatorWrap(ome.api.IQuery iQuery)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableSet<E>doLookup(T toType, E from)Look up which objects of a given type relate to the given query object.protected abstract java.util.Map.Entry<java.lang.String,java.lang.Long>entityToStringLong(E entity)Convert a model object to the type string and database ID expected byHierarchyNavigator.voidprepareLookups(T toType, java.util.Collection<E> from)Batch bulk database queries to prime the cache fordoLookup(Object, Object).protected abstract EstringLongToEntity(java.lang.String typeName, long id)Convert the given type string and database ID to the model object.protected abstract TstringToType(java.lang.String typeName)Convert the given type string to the object type.protected abstract java.lang.StringtypeToString(T type)Convert the given object type to the type strings expected byHierarchyNavigator.-
Methods inherited from class ome.services.query.HierarchyNavigator
doLookup, prepareLookups
-
-
-
-
Method Detail
-
typeToString
protected abstract java.lang.String typeToString(T type)
Convert the given object type to the type strings expected byHierarchyNavigator.- Parameters:
type- an object type- Returns:
- the corresponding type string
-
stringToType
protected abstract T stringToType(java.lang.String typeName)
Convert the given type string to the object type.- Parameters:
typeName- a type string- Returns:
- the corresponding object type
-
entityToStringLong
protected abstract java.util.Map.Entry<java.lang.String,java.lang.Long> entityToStringLong(E entity)
Convert a model object to the type string and database ID expected byHierarchyNavigator.- Parameters:
entity- a model object- Returns:
- the corresponding type string and database ID
-
stringLongToEntity
protected abstract E stringLongToEntity(java.lang.String typeName, long id)
Convert the given type string and database ID to the model object.- Parameters:
typeName- a type stringid- a database ID- Returns:
- the corresponding model object
-
prepareLookups
public void prepareLookups(T toType, java.util.Collection<E> from)
Batch bulk database queries to prime the cache fordoLookup(Object, Object). It is not necessary to call this method, but it is advised if many lookups are anticipated. WrapsHierarchyNavigator.prepareLookups(String, String, Collection).- Parameters:
toType- the type of the objects to which the query objects may be related, notnullfrom- the query objects, nonenull, may be of differing types
-
doLookup
public com.google.common.collect.ImmutableSet<E> doLookup(T toType, E from)
Look up which objects of a given type relate to the given query object. Caches results, and one may bulk-cache results in advance usingprepareLookups(Object, Collection). WrapsHierarchyNavigator.doLookup(String, String, Long).- Parameters:
toType- the type of the objects to which the query object may be related, notnullfrom- the query object, notnull- Returns:
- the related objects, never
null
-
-