|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.connector.store.jpa.model.simple.SubgraphQuery
public class SubgraphQuery
Represents a temporary working area for a query that efficiently retrieves the nodes in a subgraph. This class uses the database to build up the content of the subgraph, and therefore requires write privilege on the database. The benefit is that it minimizes the amount of memory required to process the subgraph, plus the set of nodes that make up the subgraph can be produced with database joins.
The use of database joins also produces another benefit: the number of SQL statements necessary to build the set of nodes in a subgraph is equal to the depth of the subgraph, regardless of the number of child nodes at any level.
Constructor Summary | |
---|---|
protected |
SubgraphQuery(javax.persistence.EntityManager manager,
Long workspaceId,
SubgraphQueryEntity query,
int maxDepth)
|
Method Summary | |
---|---|
void |
close()
Close this query object and clean up all in-database records associated with this query. |
static SubgraphQuery |
create(javax.persistence.EntityManager entities,
Long workspaceId,
UUID subgraphRootUuid,
int maxDepth)
Create a query that returns a subgraph at and below the node with the supplied path and the supplied UUID. |
void |
deleteSubgraph(boolean includeRoot)
Delete the nodes in the subgraph. |
javax.persistence.EntityManager |
getEntityManager()
|
int |
getMaxDepth()
|
NodeEntity |
getNode()
Get the root node of the subgraph. |
List<NodeEntity> |
getNodes(boolean includeRoot,
boolean includeChildrenOfMaxDepthNodes)
Get the nodes in the subgraph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SubgraphQuery(javax.persistence.EntityManager manager, Long workspaceId, SubgraphQueryEntity query, int maxDepth)
Method Detail |
---|
public static SubgraphQuery create(javax.persistence.EntityManager entities, Long workspaceId, UUID subgraphRootUuid, int maxDepth)
entities
- the entity manager; may not be nullworkspaceId
- the ID of the workspace; may not be nullsubgraphRootUuid
- the UUID (in string form) of the root node in the subgraphmaxDepth
- the maximum depth of the subgraph, or 0 if there is no maximum depth
public int getMaxDepth()
public javax.persistence.EntityManager getEntityManager()
public NodeEntity getNode()
root node
of the subgraph. This must be called before the query is closed
.
public List<NodeEntity> getNodes(boolean includeRoot, boolean includeChildrenOfMaxDepthNodes)
nodes
in the subgraph. This must be called before the query is closed
.
includeRoot
- true if the subgraph's root node is to be included, or false otherwiseincludeChildrenOfMaxDepthNodes
- true if the method is to include nodes that are children of nodes that are at the
maximum depth, or false if only nodes up to the maximum depth are to be included
public void deleteSubgraph(boolean includeRoot)
includeRoot
- true if the root node should also be deletedpublic void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |