|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.request.RequestBuilder
public abstract class RequestBuilder
A component that can be used to build requests while allowing different strategies for how requests are handled. Subclasses can
simply override the process(Request)
method to define what happens with each request.
Constructor Summary | |
---|---|
protected |
RequestBuilder()
Create a new builder. |
Method Summary | ||
---|---|---|
UpdateValuesRequest |
addValues(String workspaceName,
Location on,
Name property,
List<Object> values)
Add a request to add values to a property on an existing node |
|
FunctionRequest |
applyFunction(Function function,
Map<String,Serializable> inputs,
Location to,
String workspaceName)
Create a request to run the supplied function at the given location in the named workspace, using the supplied inputs. |
|
CloneBranchRequest |
cloneBranch(Location from,
String fromWorkspace,
Location into,
String intoWorkspace,
Name nameForClone,
Path.Segment exactSegmentForClone,
boolean removeExisting)
Add a request to clone a branch to another. |
|
CloneWorkspaceRequest |
cloneWorkspace(String nameOfWorkspaceToBeCloned,
String desiredNameOfTargetWorkspace,
CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior,
CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior)
Add a request to clone an existing workspace to create a new workspace, and specify the behavior should a workspace already exists with a name that matches the desired name for the new workspace. |
|
CopyBranchRequest |
copyBranch(Location from,
String fromWorkspace,
Location into,
String intoWorkspace,
Name nameForCopy,
NodeConflictBehavior conflictBehavior)
Add a request to copy a branch to another. |
|
CreateNodeRequest |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Iterator<Property> properties)
Add a request to create a node with the given properties under the supplied location. |
|
CreateNodeRequest |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Iterator<Property> properties,
NodeConflictBehavior conflictBehavior)
Add a request to create a node with the given properties under the supplied location. |
|
CreateNodeRequest |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Property[] properties)
Add a request to create a node with the given properties under the supplied location. |
|
CreateNodeRequest |
createNode(Location parentLocation,
String workspaceName,
Name childName,
Property[] properties,
NodeConflictBehavior conflictBehavior)
Add a request to create a node with the given properties under the supplied location. |
|
CreateWorkspaceRequest |
createWorkspace(String desiredNameOfNewWorkspace,
CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior)
Add a request to create a new workspace, and specify the behavior should a workspace already exists with a name that matches the desired name for the new workspace. |
|
DeleteBranchRequest |
deleteBranch(Location at,
String workspaceName)
Add a request to delete a branch. |
|
DestroyWorkspaceRequest |
destroyWorkspace(String workspaceName)
Add a request to destroy an existing workspace. |
|
GetWorkspacesRequest |
getWorkspaces()
Add a request to obtain the information about the available workspaces. |
|
LockBranchRequest |
lockBranch(String workspaceName,
Location target,
LockBranchRequest.LockScope lockScope,
long lockTimeoutInMillis)
Create a request to lock a branch or node |
|
MoveBranchRequest |
moveBranch(Location from,
Location into,
Location before,
String workspaceName,
Name newNameForNode)
Create a request to move a branch from one location into another before the given child node of the new location. |
|
MoveBranchRequest |
moveBranch(Location from,
Location into,
String workspaceName)
Create a request to move a branch from one location into another. |
|
MoveBranchRequest |
moveBranch(Location from,
Location into,
String workspaceName,
Name newNameForNode)
Create a request to move a branch from one location into another. |
|
MoveBranchRequest |
moveBranch(Location from,
Location into,
String workspaceName,
Name newNameForNode,
NodeConflictBehavior conflictBehavior)
Create a request to move a branch from one location into another. |
|
MoveBranchRequest |
moveBranch(Location from,
Location into,
String workspaceName,
NodeConflictBehavior conflictBehavior)
Create a request to move a branch from one location into another. |
|
protected abstract
|
process(T request)
|
|
ReadAllChildrenRequest |
readAllChildren(Location of,
String workspaceName)
Add a request to read the children of a node at the supplied location in the designated workspace. |
|
ReadAllPropertiesRequest |
readAllProperties(Location of,
String workspaceName)
Add a request to read the properties and number of children of a node at the supplied location. |
|
ReadBlockOfChildrenRequest |
readBlockOfChildren(Location of,
String workspaceName,
int startingIndex,
int count)
Add a request to read a block of the children of a node at the supplied location. |
|
ReadBranchRequest |
readBranch(Location at,
String workspaceName)
Add a request to read the branch at the supplied location, to a maximum depth of 2. |
|
ReadBranchRequest |
readBranch(Location at,
String workspaceName,
int maxDepth)
Add a request to read the branch (of given depth) at the supplied location. |
|
ReadNextBlockOfChildrenRequest |
readNextBlockOfChildren(Location startingAfter,
String workspaceName,
int count)
Add a request to read those children of a node that are immediately after a supplied sibling node. |
|
ReadNodeRequest |
readNode(Location at,
String workspaceName)
Add a request to read the properties and number of children of a node at the supplied location. |
|
ReadPropertyRequest |
readProperty(Location of,
String workspaceName,
Name propertyName)
Add a request to read the properties and number of children of a node at the supplied location. |
|
Request |
removeProperties(Location on,
String workspaceName,
Name... propertyNames)
Add a request to remove from the node the properties with the supplied names. |
|
RemovePropertyRequest |
removeProperty(Location on,
String workspaceName,
Name propertyName)
Add a request to remove the property with the supplied name from the given node. |
|
UpdateValuesRequest |
removeValues(String workspaceName,
Location on,
Name property,
List<Object> values)
Add a request to remove values from a property on an existing node |
|
RenameNodeRequest |
renameNode(Location at,
String workspaceName,
Name newName)
Add a request to rename the node at the supplied location. |
|
FullTextSearchRequest |
search(String workspaceName,
String fullTextSearchExpression,
int maxResults,
int offset)
Create a request to perform a full-text search of the workspace. |
|
Request |
setProperties(Location on,
String workspaceName,
Property... properties)
Add a request to update the properties on the node at the supplied location. |
|
SetPropertyRequest |
setProperty(Location on,
String workspaceName,
Property property)
Add a request to update the property on the node at the supplied location. |
|
UnlockBranchRequest |
unlockBranch(String workspaceName,
Location target)
Create a request to unlock a branch or node The lock on the node should be removed. |
|
VerifyNodeExistsRequest |
verifyNodeExists(Location at,
String workspaceName)
Add a request to verify the existance and location of a node at the supplied location. |
|
VerifyWorkspaceRequest |
verifyWorkspace(String workspaceName)
Add a request to verify the existance of the named workspace. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected RequestBuilder()
Method Detail |
---|
protected abstract <T extends Request> T process(T request)
public GetWorkspacesRequest getWorkspaces()
public VerifyWorkspaceRequest verifyWorkspace(String workspaceName)
workspaceName
- the desired name of the workspace, or null if the source's default workspace should be used
public CreateWorkspaceRequest createWorkspace(String desiredNameOfNewWorkspace, CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior)
desiredNameOfNewWorkspace
- the desired name of the new workspacecreateConflictBehavior
- the behavior if a workspace already exists with the same name, or null if the default
behavior should be used
public CloneWorkspaceRequest cloneWorkspace(String nameOfWorkspaceToBeCloned, String desiredNameOfTargetWorkspace, CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior, CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior)
nameOfWorkspaceToBeCloned
- the name of the existing workspace that is to be cloneddesiredNameOfTargetWorkspace
- the desired name of the target workspacecreateConflictBehavior
- the behavior if a workspace already exists with the same namecloneConflictBehavior
- the behavior if the workspace to be cloned does not exist
IllegalArgumentException
- if the either workspace name is nullpublic DestroyWorkspaceRequest destroyWorkspace(String workspaceName)
workspaceName
- the name of the workspace that is to be destroyed
IllegalArgumentException
- if the workspace name is nullpublic VerifyNodeExistsRequest verifyNodeExists(Location at, String workspaceName)
at
- the location of the node to be verifiedworkspaceName
- the name of the workspace containing the node
IllegalArgumentException
- if the location or workspace name is nullpublic ReadNodeRequest readNode(Location at, String workspaceName)
at
- the location of the node to be readworkspaceName
- the name of the workspace containing the node
IllegalArgumentException
- if the location or workspace name is nullpublic ReadAllChildrenRequest readAllChildren(Location of, String workspaceName)
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspace
IllegalArgumentException
- if the location or workspace name is nullpublic ReadAllPropertiesRequest readAllProperties(Location of, String workspaceName)
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspace
IllegalArgumentException
- if the location or workspace name is nullpublic ReadPropertyRequest readProperty(Location of, String workspaceName, Name propertyName)
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspacepropertyName
- the name of the property to read
IllegalArgumentException
- if the location or workspace name is nullpublic ReadBranchRequest readBranch(Location at, String workspaceName)
at
- the location of the branchworkspaceName
- the name of the workspace containing the branch
IllegalArgumentException
- if the location or workspace name is null or if the maximum depth is not positivepublic ReadBranchRequest readBranch(Location at, String workspaceName, int maxDepth)
at
- the location of the branchworkspaceName
- the name of the workspace containing the branchmaxDepth
- the maximum depth to read
IllegalArgumentException
- if the location or workspace name is null or if the maximum depth is not positivepublic ReadBlockOfChildrenRequest readBlockOfChildren(Location of, String workspaceName, int startingIndex, int count)
same-name-sibiling index
, but rather is the index of the child as if the children were in
an array.
of
- the location of the node whose children are to be readworkspaceName
- the name of the workspace containing the parentstartingIndex
- the zero-based index of the first child to be included in the blockcount
- the maximum number of children that should be included in the block
IllegalArgumentException
- if the location or workspace name is null, if startingIndex
is negative, or
if count is less than 1.
public ReadNextBlockOfChildrenRequest readNextBlockOfChildren(Location startingAfter, String workspaceName, int count)
startingAfter
- the location of the previous sibling that was the last child of the previous block of children readworkspaceName
- the name of the workspace containing the nodecount
- the maximum number of children that should be included in the block
IllegalArgumentException
- if the workspace name or startingAfter
location is null, or if
count is less than 1.
public CreateNodeRequest createNode(Location parentLocation, String workspaceName, Name childName, Iterator<Property> properties)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new node
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic CreateNodeRequest createNode(Location parentLocation, String workspaceName, Name childName, Iterator<Property> properties, NodeConflictBehavior conflictBehavior)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new nodeconflictBehavior
- the expected behavior if an equivalently-named child already exists under the into
location
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic CreateNodeRequest createNode(Location parentLocation, String workspaceName, Name childName, Property[] properties)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new node
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic CreateNodeRequest createNode(Location parentLocation, String workspaceName, Name childName, Property[] properties, NodeConflictBehavior conflictBehavior)
parentLocation
- the location of the existing parent node, under which the new child should be createdworkspaceName
- the name of the workspace containing the parentchildName
- the name of the new child to create under the existing parentproperties
- the properties of the new node, which should include any identification
properties
for the new nodeconflictBehavior
- the expected behavior if an equivalently-named child already exists under the into
location
IllegalArgumentException
- if the location, workspace name, or child name is nullpublic SetPropertyRequest setProperty(Location on, String workspaceName, Property property)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodeproperty
- the new property on the node
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to updatepublic Request setProperties(Location on, String workspaceName, Property... properties)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodeproperties
- the new properties on the node
SetPropertyRequest
or UpdatePropertiesRequest
request, depending upon the number of properties
being set
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to updatepublic RemovePropertyRequest removeProperty(Location on, String workspaceName, Name propertyName)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodepropertyName
- the name of the property that is to be removed
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to removepublic Request removeProperties(Location on, String workspaceName, Name... propertyNames)
on
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodepropertyNames
- the names of the properties that are to be removed
RemovePropertyRequest
or UpdatePropertiesRequest
request, depending upon the number of
properties being removed; never null
IllegalArgumentException
- if the location or workspace name is null or if there are no properties to removepublic RenameNodeRequest renameNode(Location at, String workspaceName, Name newName)
at
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodenewName
- the new name for the node
IllegalArgumentException
- if the location or workspace name is nullpublic CopyBranchRequest copyBranch(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForCopy, NodeConflictBehavior conflictBehavior)
from
- the location of the top node in the existing branch that is to be copiedfromWorkspace
- the name of the workspace where the from
node existsinto
- the location of the existing node into which the copy should be placedintoWorkspace
- the name of the workspace where the into
node is to be copiednameForCopy
- the desired name for the node that results from the copy, or null if the name of the original should be
usedconflictBehavior
- the expected behavior if an equivalently-named child already exists at the into
location, or null if the default conflict behavior should be used
IllegalArgumentException
- if either of the locations or workspace names are nullpublic CloneBranchRequest cloneBranch(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForClone, Path.Segment exactSegmentForClone, boolean removeExisting)
from
- the location of the top node in the existing branch that is to be clonedfromWorkspace
- the name of the workspace where the from
node existsinto
- the location of the existing node into which the clone should be placedintoWorkspace
- the name of the workspace where the into
node is to be clonednameForClone
- the desired name for the node that results from the clone, or null if the name of the original should
be usedexactSegmentForClone
- the exact segment
at which the cloned tree should be rooted.removeExisting
- whether any nodes in the intoWorkspace with the same UUIDs as a node in the source branch should be
removed (if true) or a UuidAlreadyExistsException
should be thrown.
IllegalArgumentException
- if any of the parameters are null except for nameForClone
or
exactSegmentForClone
. Exactly one of nameForClone
and exactSegmentForClone
must be null.public MoveBranchRequest moveBranch(Location from, Location into, String workspaceName)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedworkspaceName
- the name of the workspace
IllegalArgumentException
- if any of the parameters are nullpublic MoveBranchRequest moveBranch(Location from, Location into, String workspaceName, Name newNameForNode)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedworkspaceName
- the name of the workspacenewNameForNode
- the new name for the node being moved, or null if the name of the original should be used
IllegalArgumentException
- if any of the parameters are nullpublic MoveBranchRequest moveBranch(Location from, Location into, Location before, String workspaceName, Name newNameForNode)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedbefore
- the location of the node before which the branch should be moved; may be nullworkspaceName
- the name of the workspacenewNameForNode
- the new name for the node being moved, or null if the name of the original should be used
IllegalArgumentException
- if any of the parameters are nullpublic MoveBranchRequest moveBranch(Location from, Location into, String workspaceName, Name newNameForNode, NodeConflictBehavior conflictBehavior)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedworkspaceName
- the name of the workspacenewNameForNode
- the new name for the node being moved, or null if the name of the original should be usedconflictBehavior
- the expected behavior if an equivalently-named child already exists at the into
location
IllegalArgumentException
- if any of the parameters are nullpublic MoveBranchRequest moveBranch(Location from, Location into, String workspaceName, NodeConflictBehavior conflictBehavior)
from
- the location of the top node in the existing branch that is to be movedinto
- the location of the existing node into which the branch should be movedworkspaceName
- the name of the workspaceconflictBehavior
- the expected behavior if an equivalently-named child already exists at the into
location
IllegalArgumentException
- if any of the parameters are nullpublic DeleteBranchRequest deleteBranch(Location at, String workspaceName)
at
- the location of the top node in the existing branch that is to be deletedworkspaceName
- the name of the workspace containing the parent
IllegalArgumentException
- if the location or workspace name is nullpublic UpdateValuesRequest addValues(String workspaceName, Location on, Name property, List<Object> values)
workspaceName
- the name of the workspace containing the node; may not be nullon
- the location of the node; may not be nullproperty
- the name of the property; may not be nullvalues
- the new values to add; may not be null
public UpdateValuesRequest removeValues(String workspaceName, Location on, Name property, List<Object> values)
workspaceName
- the name of the workspace containing the node; may not be nullon
- the location of the node; may not be nullproperty
- the name of the property; may not be nullvalues
- the new values to remove; may not be null
public LockBranchRequest lockBranch(String workspaceName, Location target, LockBranchRequest.LockScope lockScope, long lockTimeoutInMillis)
workspaceName
- the name of the workspace containing the node; may not be nulltarget
- the location of the top node in the existing branch that is to be lockedlockScope
- the LockBranchRequest.lockScope()
scope of the locklockTimeoutInMillis
- the number of milliseconds that the lock should last before the lock times out; zero (0)
indicates that the connector default should be used
IllegalArgumentException
- if any of the parameters are nullpublic UnlockBranchRequest unlockBranch(String workspaceName, Location target)
The lock on the node should be removed. If the lock was deep (i.e., locked the entire branch under the node, then all of the descendants of the node affected by the lock should also be unlocked after this request is processed.
workspaceName
- the name of the workspace containing the node; may not be nulltarget
- the location of the top node in the existing branch that is to be unlocked
IllegalArgumentException
- if any of the parameters are nullpublic FullTextSearchRequest search(String workspaceName, String fullTextSearchExpression, int maxResults, int offset)
workspaceName
- the name of the workspace containing the nodefullTextSearchExpression
- the full-text search expressionmaxResults
- the maximum number of results that are to be returned; always positiveoffset
- the number of initial results to skip, or 0 if the first results are to be returned
IllegalArgumentException
- if any of the parameters are null or if the expression is emptypublic FunctionRequest applyFunction(Function function, Map<String,Serializable> inputs, Location to, String workspaceName)
function
- the function to be runinputs
- the input parametersto
- the scope of the functionworkspaceName
- the name of the workspace containing the node
IllegalArgumentException
- if any of the parameters are null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |