|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectome.services.graphs.BaseGraphSpec
public class BaseGraphSpec
GraphSpec
which takes the id of some id as the root of deletion.
IGraph
Nested Class Summary | |
---|---|
static class |
BaseGraphSpec.SubSpecIterator
Iterator which walks returns all GraphSpec s which are
reachable from the given spec, depth first including the spec itself. |
Field Summary | |
---|---|
protected List<GraphEntry> |
entries
The paths which make up this delete specification. |
protected long |
id
The id of the root type which will be deleted. |
protected Map<String,String> |
options
Options passed to the #initialize(long, Map) method, which may be
used during #delete(Session, int) to alter behavior. |
protected String |
superspec
Path of the superspec. |
Constructor Summary | |
---|---|
BaseGraphSpec(List<String> entries)
|
|
BaseGraphSpec(String name,
String... entries)
Simplified constructor, primarily used for testing. |
Method Summary | |
---|---|
void |
close()
|
List<GraphEntry> |
entries()
Returns a copy of the list of GraphEntry instances contained in
this GraphSpec |
CurrentDetails |
getCurrentDetails()
|
Class<ome.model.IObject> |
getHibernateClass(String table)
Return the Hibernate type (ome.model.*) for the given table. |
String |
getName()
The name of this specification. |
String |
getSuperSpec()
Specification of where this GraphSpec is attached under another
. |
int |
initialize(long id,
String superspec,
Map<String,String> options)
Called as each delete command is started. |
protected void |
join(QueryBuilder qb,
String from,
String fromAlias,
String to,
String toAlias)
Used to generate a join statement on the QueryBuilder making use
of {@link ExtendedMetadata#getRelationship(String, String). |
boolean |
overrideKeep()
Always returns false. |
void |
postProcess(org.springframework.beans.factory.ListableBeanFactory factory)
Gives all specs a chance to reference subspecs. |
long[][] |
queryBackupIds(org.hibernate.Session session,
int step,
GraphEntry subpath,
QueryBuilder and)
If a given path is deleted before its sub-path, this points to a one-to-one relationship. |
void |
runTopLevel(org.hibernate.Session session,
List<Long> ids)
Workaround for the removal of GraphSpec#delete when refactoring to GraphState . |
void |
setBeanName(String beanName)
|
void |
setCurrentDetails(CurrentDetails details)
|
void |
setExtendedMetadata(ExtendedMetadata em)
|
String |
toString()
|
Iterator<GraphSpec> |
walk()
Returns an iterator over all subspecs and their subspecs, depth-first. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final List<GraphEntry> entries
#delete(Session, int)
protected long id
protected String superspec
protected Map<String,String> options
#initialize(long, Map)
method, which may be
used during #delete(Session, int)
to alter behavior.
Constructor Detail |
---|
public BaseGraphSpec(String name, String... entries)
public BaseGraphSpec(List<String> entries)
Method Detail |
---|
public void setBeanName(String beanName)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public void setExtendedMetadata(ExtendedMetadata em)
public void setCurrentDetails(CurrentDetails details)
public CurrentDetails getCurrentDetails()
getCurrentDetails
in interface GraphSpec
public String getName()
GraphSpec
getName
in interface GraphSpec
public String getSuperSpec()
GraphSpec
GraphSpec
is attached under another
. The reverse of
GraphEntry.getSubSpec()
.
getSuperSpec
in interface GraphSpec
public Class<ome.model.IObject> getHibernateClass(String table)
GraphSpec
getHibernateClass
in interface GraphSpec
public void postProcess(org.springframework.beans.factory.ListableBeanFactory factory)
GraphSpec
postProcess
in interface GraphSpec
public int initialize(long id, String superspec, Map<String,String> options) throws GraphException
GraphSpec
#delete(Session, int)
can take clean up actions.
initialize
in interface GraphSpec
id
- identifier of the root object which defines the graph to be
deleted.superspec
- points to the relationship between the root object and the
current graph. In many cases, this value will be null so that
the current object is taken to be the root, but if this is a
subspec, or a non-standard naming is being used, then the
supersec will be used.options
- possibly null or empty map of options which can override the
operations provided in the definition of the specification.
For example, if the spec "/Image" defines "/Image/Annotation"
as "HARD" (the default), then the options map could contain
{"/Image/Annotation":"ORPHAN"}to modify that setting.
GraphException
public Iterator<GraphSpec> walk()
GraphSpec
walk
in interface GraphSpec
public List<GraphEntry> entries()
GraphSpec
GraphEntry
instances contained in
this GraphSpec
entries
in interface GraphSpec
public void close()
close
in interface GraphSpec
public boolean overrideKeep()
overrideKeep
in interface GraphSpec
public long[][] queryBackupIds(org.hibernate.Session session, int step, GraphEntry subpath, QueryBuilder and) throws GraphException
GraphSpec
#initialize(long, Map)
so that foreign key
constraints which require a higher level object to be deleted first, can
be removed.
For example,
/Channel /Channel/StatsInforequires the Channel to be deleted first, but without the Channel, there's no way to detect which StatsInfo should be removed. Therefore,
#backupIds
in this case would contain:
[ null, # Nothing for Channel. [1,2,3], # The ids of all StatsInfo object which should be removed. ]
queryBackupIds
in interface GraphSpec
GraphException
public void runTopLevel(org.hibernate.Session session, List<Long> ids)
GraphSpec
GraphState
. If more logic is needed by subclasses, then
GraphSpec.queryBackupIds(Session, int, GraphEntry, QueryBuilder)
should no longer return list of ids, but rather a "Action" class
so that it can inject its own logic as needed, though it would be necessary
to give that method its place in the graph to detect "top-ness".
runTopLevel
in interface GraphSpec
protected void join(QueryBuilder qb, String from, String fromAlias, String to, String toAlias) throws GraphException
QueryBuilder
making use
of ExtendedMetadata#getRelationship(String, String). If the value
returned by that value is null, a {@link GraphException} will be thrown.
Otherwise something of the form:
join FROM.rel as TOwill be added to the {@link QueryBuilder}
GraphException
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: 4.3.3-00d1137e-b2894
Copyright © 2009 The University of Dundee. All Rights Reserved.