public interface ExtendedMetadata
SessionFactory
. During
construction, the metadata is created and cached for later use.SessionFactory
Modifier and Type | Interface and Description |
---|---|
static class |
ExtendedMetadata.Immutables |
static class |
ExtendedMetadata.Impl
Sole implementation of ExtendedMetadata.
|
static class |
ExtendedMetadata.Locks
inner class which wraps the information (index number, path, etc) related to
what fields a particular object can lock.
|
static class |
ExtendedMetadata.Relationship
Simple value class to maintain all of the state for use by
getRelationship(String, String) and
getSQLJoin(String, String, String, String) . |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Long> |
countLocks(org.hibernate.Session session,
java.lang.Long id,
java.lang.String[][] lockChecks,
java.lang.String clause)
Takes the lock checks returned by
getLockChecks(Class) and
performs the actual check returning a map from class to total number
of locks. |
java.util.Set<java.lang.Class<IAnnotated>> |
getAnnotatableTypes()
Returns all the classes which implement
IAnnotated |
java.util.Set<java.lang.Class<Annotation>> |
getAnnotationTypes()
Returns all the classes which subclass
Annotation |
java.util.Set<java.lang.String> |
getClasses() |
java.lang.String |
getCountQuery(java.lang.String field)
Returns the query for obtaining the number of collection items to a
particular instance.
|
java.lang.Class<IObject> |
getHibernateClass(java.lang.String table)
Given the name of a database table or alternatively the simple class name
(non-fully qualified) of an IObject, this method returns the class which
Hibernate will map that table to.
|
java.lang.String[][] |
getLockCandidateChecks(java.lang.Class<? extends IObject> klass,
boolean onlyWithGroups)
Rather than iterating over an
IObject like
getLockCandidates(IObject) this method returns type/field name
pairs (like getLockChecks(Class) ) to allow performing the
queries manually. |
IObject[] |
getLockCandidates(IObject iObject)
|
java.lang.String[][] |
getLockChecks(java.lang.Class<? extends IObject> klass)
returns all class/field name pairs which may possibly link to an object
of type
klass . |
java.util.Set<java.lang.String> |
getMapProperties(java.lang.String className)
Get the names of any String→RString map properties this class has, otherwise an empty set if none.
|
java.lang.String |
getRelationship(java.lang.String from,
java.lang.String to)
Walks the data on what locks what
for "from" argument to see if there is any direct relationship to the
"to" argument.
|
java.lang.String |
getSQLJoin(java.lang.String fromType,
java.lang.String fromAlias,
java.lang.String toType,
java.lang.String toAlias)
provides the link between two tables similar to
{link
getRelationship(String, String) . |
boolean |
mayHaveMapProperties(java.lang.Class<? extends IObject> iObjectClass)
Check if an object of this class may have map properties.
|
java.util.Set<java.lang.String> getClasses()
java.util.Set<java.lang.Class<IAnnotated>> getAnnotatableTypes()
IAnnotated
java.util.Set<java.lang.Class<Annotation>> getAnnotationTypes()
Annotation
java.lang.String getCountQuery(java.lang.String field) throws ApiUsageException
field
- Field name as specified in the class.ApiUsageException
- if return value would be null.java.lang.Class<IObject> getHibernateClass(java.lang.String table)
table
- a database table name, or simple class name of a model objectjava.lang.String[][] getLockCandidateChecks(java.lang.Class<? extends IObject> klass, boolean onlyWithGroups)
IObject
like
getLockCandidates(IObject)
this method returns type/field name
pairs (like getLockChecks(Class)
) to allow performing the
queries manually.
If onlyWithGroups is true, then only checks which point to non-IGlobal
objects will be returned.klass
- Not null.onlyWithGroups
- if should omit checks that point to IGlobal
sjava.lang.String[][] getLockChecks(java.lang.Class<? extends IObject> klass)
klass
.java.util.Map<java.lang.String,java.lang.Long> countLocks(org.hibernate.Session session, java.lang.Long id, java.lang.String[][] lockChecks, java.lang.String clause)
getLockChecks(Class)
and
performs the actual check returning a map from class to total number
of locks. The key "*" contains the total value.
If the id argument is null, then checks will be against all rows rather
than individual objects, e.g.
select count(x) from Linker x, Linked y where x.$FIELD.id = y.id $CLAUSE;otherwise
select count(x) from Linker x where x.$FIELD.id = :id $CLAUSE'If the clause argument is null or empty it will be omitted.
java.lang.String getRelationship(java.lang.String from, java.lang.String to)
java.lang.String getSQLJoin(java.lang.String fromType, java.lang.String fromAlias, java.lang.String toType, java.lang.String toAlias)
getRelationship(String, String)
. However, whereas
getRelationship(String, String)
needs to be called twice, once
for each of the Hibernate directions,
getSQLJoin(String, String, String, String)
need only ever be
called once since there will be only one correct SQL join.
For example, getRelationship("Image", "DatasetImageLink") returns
"datasetLinks" while getRelationship("DatasetImageLink", "Image")
returns "child". getSQLJoin("Image", "I", "DatasetImageLink", "L"),
however, will always return "I.id = L.child" (though the order may be
reversed).boolean mayHaveMapProperties(java.lang.Class<? extends IObject> iObjectClass)
iObjectClass
- a classjava.util.Set<java.lang.String> getMapProperties(java.lang.String className)
className
- the name of a class, as from Class.getName()
Version: 5.4.6-ice35-b87
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.