Package org.alfresco.rest.requests
Class Node
- java.lang.Object
-
- org.alfresco.rest.requests.ModelRequest<Node>
-
- org.alfresco.rest.requests.Node
-
public class Node extends ModelRequest<Node>
Declares all Rest API under the /nodes path
-
-
Field Summary
-
Fields inherited from class org.alfresco.rest.requests.ModelRequest
restWrapper
-
-
Constructor Summary
Constructors Constructor Description Node(RestWrapper restWrapper)Node(org.alfresco.utility.model.RepoTestModel repoModel, RestWrapper restWrapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestCommentModeladdComment(java.lang.String commentContent)Publish one new comment on a specific node using POST call on "nodes/{nodeId}/comments"RestCommentModelsCollectionaddComments(java.lang.String... comments)Publish multiple comments on a specific node using POST call on "nodes/{nodeId}/comments"RestRatingModeladdInvalidRating(java.lang.String jsonBody)POST call on "nodes/{nodeId}/ratings" using an invalid rating bodyRestTagModeladdTag(java.lang.String tag)Adds a tag to the given content nodeRestTagModelsCollectionaddTags(java.lang.String... tags)Adds multiple tags to the given content nodeRestNodeModelcopy(RestNodeBodyMoveCopyModel copyBody)Copy a node to a target folderRestNodeModelcopyNode(java.lang.String postBody)Copies the node nodeId to the parent folder node targetParentId using POST call "nodes/{nodeId}/copy"RestNodeModelcreateNode()Create new nodes using POST call on 'nodes/{nodeId}/children You need to specify first the multipart callRestWrapper#usingMultipartFile(java.io.File)usingMultipartFile(new File("your-local-file.txt")).withCoreAPI().usingNode(ContentModel.my()).createNode();RestNodeModelcreateNode(RestNodeBodyModel node)Create new nodes using POST call on 'nodes/{nodeId}/childrenvoidcreateNodeRendition(java.lang.String renditionId)Create node rendition using POST call on '/nodes/{nodeId}/renditions'voidcreateNodeRenditionIfNotExists(java.lang.String renditionId)Check if specified rendition exists and if not create node rendition using POST call on '/nodes/{nodeId}/renditions'RestNodeChildAssocModelCollectioncreateSecondaryChildren(java.lang.String secondaryChildren)Create secondary children association using POST call 'nodes/{nodeId}/secondary-children Use a list of secondary children nodesRestNodeAssocTargetModelcreateTargetForNode(RestNodeAssocTargetModel target)Create new target nodes using POST call on '/nodes/{nodeId}/targets'NodesBuilderdefineNodes()voiddeleteComment(RestCommentModel comment)Delete a comment for a specific node using DELETE call on nodes/{nodeId}/comments/{commentId}voiddeleteFiveStarRating()Delete fivestar rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"voiddeleteInvalidRating(java.lang.String rating)Try to delete invalid rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"voiddeleteLikeRating()Delete like rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"voiddeleteNode(java.lang.String nodeId)Delete a specific node using DELETE call on nodes/{nodeId}voiddeleteNode(RestNodeModel nodeModel)Delete a specific node using DELETE call on nodes/{nodeId}voiddeleteNodeVersion(java.lang.String versionId)Delete the version identified by versionId for nodeId using DELETE call 'nodes/{nodeId}versions/{versionId}voiddeleteSecondaryChild(RestNodeAssociationModel child)Delete secondary children using DELETE call 'nodes/{nodeId}/secondary-children/{childId}voiddeleteTag(RestTagModel tag)Deletes a tag for a specific content node using DELETE call on nodes/{nodeId}/tags/{tagId}voiddeleteTarget(RestNodeAssocTargetModel target)Delete a target for a specific node using DELETE call on nodes/{nodeId}/targets/{targetId}RestRatingModeldislikeDocument()RestActionDefinitionModelsCollectiongetActionDefinitions()RestRatingModelgetFiveStarRating()Get fivestar rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"RestRatingModelgetLikeRating()Get like rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"RestNodeModelgetNode()Retrieve details for a specific node using GET call on "nodes/{nodeId}"RestCommentModelsCollectiongetNodeComments()Retrieve comments for a specific node using GET call on "nodes/{nodeId}/comments"RestResponsegetNodeContent()Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"RestResponsegetNodeContent(java.lang.String nodeId)Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"RestRenditionInfoModelgetNodeRendition(java.lang.String renditionId)Get node rendition using GET call on '/nodes/{nodeId}/renditions/{renditionId}RestResponsegetNodeRenditionContent(java.lang.String renditionId)Get node rendition content using GET call on 'nodes/{nodeId}/renditions/{renditionId}/contentRestResponsegetNodeRenditionContentUntilIsCreated(java.lang.String renditionId)Get node rendition content using GET call on 'nodes/{nodeId}/renditions/{renditionId}/content Please note that it retries to get the renditions response several times because on the alfresco server the rendition can take a while to be created.RestRenditionInfoModelCollectiongetNodeRenditionsInfo()Get rendition information for available renditions for the node using GET call on 'nodes/{nodeId}/renditions'RestRenditionInfoModelgetNodeRenditionUntilIsCreated(java.lang.String renditionId)Get node rendition using GET call on 'nodes/{nodeId}/renditions/{renditionId} Please note that it retries to get the renditions response several times because on the alfresco server the rendition can take a while to be created.RestNodeAssociationModelCollectiongetNodeSources()Get sources for a specific node using GET call on GET /nodes/{nodeId}/sourcesRestTagModelsCollectiongetNodeTags()Get node tags using GET call on 'nodes/{nodeId}/tags'RestNodeAssociationModelCollectiongetNodeTargets()Retrieve targets for a specific node using GET call on "nodes/{nodeId}/targetsRestNodeAssociationModelCollectiongetParents()Get a node's parents using GET call 'nodes/{nodeId}/parentsRestRatingModelsCollectiongetRatings()Retrieve node ratings using GET call on "nodes/{nodeId}/ratings"RestNodeAssociationModelCollectiongetSecondaryChildren()Get a node's secondary children using GET call 'nodes/{nodeId}/secondary-childrenRestResponsegetVersionContent(java.lang.String versionId)Gets the content for versionId of node nodeId using GET call 'nodes/{nodeId}/versions/{versionId}/contentRestVersionModelgetVersionInformation(java.lang.String versionId)Gets the version information versionId for node nodeId using GET call 'nodes/{nodeId}/versions/{versionId}RestRatingModellikeDocument()Like a document using POST call on "nodes/{nodeId}/ratings"RestNodeModelsCollectionlistChildren()Get a node's children using GET call 'nodes/{nodeId}/childrenRestVersionModelsCollectionlistVersionHistory()Gets the version history as an ordered list for the specified nodeId using GET call 'nodes/{nodeId}/versionsRestNodeModellockNode(RestNodeLockBodyModel lockBody)Lock a specific node using POST call on "nodes/{nodeId}/lock"RestNodeModelmove(RestNodeBodyMoveCopyModel moveBody)Move a node to a target folderRestRatingModelrateStarsToDocument(int stars)Add five star rate to a document using POST call on "nodes/{nodeId}/ratings"RestVersionModelrevertVersion(java.lang.String versionId, java.lang.String postBody)Revert the version identified by versionId and nodeId to the node using POST call 'nodes/{nodeId}/versions/{versionId}/revertRestNodeModelunlockNode()Unlock a specific node using POST call on "nodes/{nodeId}/unlock"RestCommentModelupdateComment(RestCommentModel commentModel, java.lang.String commentContent)Update a comment for a specific node using PUT call on nodes/{nodeId}/comments/{commentId}RestNodeModelupdateNode(java.lang.String putBody)Update a specific node using PUT call on "nodes/{nodeId}"RestNodeModelupdateNodeContent(java.io.File nodeContent)Updates the content of the node with identifier nodeId using PUT call "/nodes/{nodeId}/content"-
Methods inherited from class org.alfresco.rest.requests.ModelRequest
includePath, usingParams
-
-
-
-
Constructor Detail
-
Node
public Node(RestWrapper restWrapper) throws java.lang.Exception
- Throws:
java.lang.Exception
-
Node
public Node(org.alfresco.utility.model.RepoTestModel repoModel, RestWrapper restWrapper) throws java.lang.Exception- Throws:
java.lang.Exception
-
-
Method Detail
-
getNode
public RestNodeModel getNode() throws java.lang.Exception
Retrieve details for a specific node using GET call on "nodes/{nodeId}"- Parameters:
nodeId-- Returns:
- Throws:
JsonToModelConversionExceptionjava.lang.Exception
-
getNodeComments
public RestCommentModelsCollection getNodeComments() throws java.lang.Exception
Retrieve comments for a specific node using GET call on "nodes/{nodeId}/comments"- Parameters:
nodeId-- Returns:
- Throws:
JsonToModelConversionExceptionjava.lang.Exception
-
addComment
public RestCommentModel addComment(java.lang.String commentContent) throws java.lang.Exception
Publish one new comment on a specific node using POST call on "nodes/{nodeId}/comments"- Parameters:
node-commentContent-- Returns:
- Throws:
java.lang.Exception
-
addComments
public RestCommentModelsCollection addComments(java.lang.String... comments) throws java.lang.Exception
Publish multiple comments on a specific node using POST call on "nodes/{nodeId}/comments"- Parameters:
contentModel-comments-- Returns:
- Throws:
java.lang.Exception
-
updateComment
public RestCommentModel updateComment(RestCommentModel commentModel, java.lang.String commentContent) throws java.lang.Exception
Update a comment for a specific node using PUT call on nodes/{nodeId}/comments/{commentId}- Parameters:
nodeId-commentId-commentContent-- Returns:
- Throws:
JsonToModelConversionExceptionjava.lang.Exception
-
deleteComment
public void deleteComment(RestCommentModel comment) throws java.lang.Exception
Delete a comment for a specific node using DELETE call on nodes/{nodeId}/comments/{commentId}- Parameters:
nodeId-commentId-- Throws:
JsonToModelConversionExceptionjava.lang.Exception
-
likeDocument
public RestRatingModel likeDocument() throws java.lang.Exception
Like a document using POST call on "nodes/{nodeId}/ratings"- Returns:
- Throws:
java.lang.Exception
-
dislikeDocument
public RestRatingModel dislikeDocument() throws java.lang.Exception
- Throws:
java.lang.Exception
-
addInvalidRating
public RestRatingModel addInvalidRating(java.lang.String jsonBody) throws java.lang.Exception
POST call on "nodes/{nodeId}/ratings" using an invalid rating body- Returns:
- Throws:
java.lang.Exception
-
rateStarsToDocument
public RestRatingModel rateStarsToDocument(int stars) throws java.lang.Exception
Add five star rate to a document using POST call on "nodes/{nodeId}/ratings"- Parameters:
stars-- Returns:
- Throws:
java.lang.Exception
-
getRatings
public RestRatingModelsCollection getRatings() throws java.lang.Exception
Retrieve node ratings using GET call on "nodes/{nodeId}/ratings"- Returns:
- Throws:
java.lang.Exception
-
deleteLikeRating
public void deleteLikeRating() throws java.lang.ExceptionDelete like rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"- Throws:
java.lang.Exception
-
deleteInvalidRating
public void deleteInvalidRating(java.lang.String rating) throws java.lang.ExceptionTry to delete invalid rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"- Throws:
java.lang.Exception
-
getLikeRating
public RestRatingModel getLikeRating() throws java.lang.Exception
Get like rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"- Throws:
java.lang.Exception
-
deleteFiveStarRating
public void deleteFiveStarRating() throws java.lang.ExceptionDelete fivestar rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"- Throws:
java.lang.Exception
-
getFiveStarRating
public RestRatingModel getFiveStarRating() throws java.lang.Exception
Get fivestar rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"- Returns:
- Throws:
java.lang.Exception
-
addTag
public RestTagModel addTag(java.lang.String tag) throws java.lang.Exception
Adds a tag to the given content node- Parameters:
contentModel-tag-- Returns:
- Throws:
java.lang.Exception
-
addTags
public RestTagModelsCollection addTags(java.lang.String... tags) throws java.lang.Exception
Adds multiple tags to the given content node- Parameters:
contentModel-tags-- Returns:
- Throws:
java.lang.Exception
-
deleteTag
public void deleteTag(RestTagModel tag) throws java.lang.Exception
Deletes a tag for a specific content node using DELETE call on nodes/{nodeId}/tags/{tagId}- Parameters:
content-tag-- Throws:
JsonToModelConversionExceptionjava.lang.Exception
-
getNodeTags
public RestTagModelsCollection getNodeTags() throws java.lang.Exception
Get node tags using GET call on 'nodes/{nodeId}/tags'- Parameters:
tag-- Returns:
- Throws:
java.lang.Exception
-
createNode
public RestNodeModel createNode(RestNodeBodyModel node) throws java.lang.Exception
Create new nodes using POST call on 'nodes/{nodeId}/children- Parameters:
node-- Returns:
- Throws:
java.lang.Exception
-
createNode
public RestNodeModel createNode() throws java.lang.Exception
Create new nodes using POST call on 'nodes/{nodeId}/children You need to specify first the multipart callRestWrapper#usingMultipartFile(java.io.File)usingMultipartFile(new File("your-local-file.txt")).withCoreAPI().usingNode(ContentModel.my()).createNode();- Returns:
- Throws:
java.lang.Exception
-
getNodeContent
public RestResponse getNodeContent() throws java.lang.Exception
Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"- Returns:
- Throws:
java.lang.Exception
-
getNodeContent
public RestResponse getNodeContent(java.lang.String nodeId) throws java.lang.Exception
Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"- Parameters:
nodeId-- Returns:
- Throws:
java.lang.Exception
-
createNodeRendition
public void createNodeRendition(java.lang.String renditionId) throws java.lang.ExceptionCreate node rendition using POST call on '/nodes/{nodeId}/renditions'- Parameters:
renditionId- id of rendition to be created- Throws:
java.lang.Exception
-
createNodeRenditionIfNotExists
public void createNodeRenditionIfNotExists(java.lang.String renditionId) throws java.lang.ExceptionCheck if specified rendition exists and if not create node rendition using POST call on '/nodes/{nodeId}/renditions'- Parameters:
renditionId- id of rendition to be created- Throws:
java.lang.Exception
-
getNodeRendition
public RestRenditionInfoModel getNodeRendition(java.lang.String renditionId) throws java.lang.Exception
Get node rendition using GET call on '/nodes/{nodeId}/renditions/{renditionId}- Parameters:
renditionId- id of rendition to be retrieved- Returns:
- Throws:
java.lang.Exception
-
getNodeRenditionUntilIsCreated
public RestRenditionInfoModel getNodeRenditionUntilIsCreated(java.lang.String renditionId) throws java.lang.Exception
Get node rendition using GET call on 'nodes/{nodeId}/renditions/{renditionId} Please note that it retries to get the renditions response several times because on the alfresco server the rendition can take a while to be created.- Returns:
- Throws:
java.lang.Exception
-
getNodeRenditionContentUntilIsCreated
public RestResponse getNodeRenditionContentUntilIsCreated(java.lang.String renditionId) throws java.lang.Exception
Get node rendition content using GET call on 'nodes/{nodeId}/renditions/{renditionId}/content Please note that it retries to get the renditions response several times because on the alfresco server the rendition can take a while to be created.- Returns:
- Throws:
java.lang.Exception
-
getNodeRenditionContent
public RestResponse getNodeRenditionContent(java.lang.String renditionId) throws java.lang.Exception
Get node rendition content using GET call on 'nodes/{nodeId}/renditions/{renditionId}/content- Returns:
- Throws:
java.lang.Exception
-
getNodeRenditionsInfo
public RestRenditionInfoModelCollection getNodeRenditionsInfo() throws java.lang.Exception
Get rendition information for available renditions for the node using GET call on 'nodes/{nodeId}/renditions'- Returns:
- Throws:
java.lang.Exception
-
listChildren
public RestNodeModelsCollection listChildren() throws java.lang.Exception
Get a node's children using GET call 'nodes/{nodeId}/children- Returns:
- a collection of nodes
- Throws:
java.lang.Exception
-
move
public RestNodeModel move(RestNodeBodyMoveCopyModel moveBody) throws java.lang.Exception
Move a node to a target folder- Parameters:
moveBody- aRestNodeBodyMoveCopyModelcontaining at least the target parent id- Returns:
- the moved node's new information
- Throws:
java.lang.Exception
-
copy
public RestNodeModel copy(RestNodeBodyMoveCopyModel copyBody) throws java.lang.Exception
Copy a node to a target folder- Parameters:
copyBody- aRestNodeBodyMoveCopyModelcontaining at least the target parent id- Returns:
- the moved node's new information
- Throws:
java.lang.Exception
-
lockNode
public RestNodeModel lockNode(RestNodeLockBodyModel lockBody) throws java.lang.Exception
Lock a specific node using POST call on "nodes/{nodeId}/lock"- Returns:
- Throws:
java.lang.Exception
-
unlockNode
public RestNodeModel unlockNode() throws java.lang.Exception
Unlock a specific node using POST call on "nodes/{nodeId}/unlock"- Returns:
- Throws:
java.lang.Exception
-
defineNodes
public NodesBuilder defineNodes()
- Returns:
NodesBuilder- help you define new nodes using rest API calls
-
updateNode
public RestNodeModel updateNode(java.lang.String putBody) throws java.lang.Exception
Update a specific node using PUT call on "nodes/{nodeId}"- Parameters:
putBody-- Returns:
- Throws:
java.lang.Exception
-
getNodeTargets
public RestNodeAssociationModelCollection getNodeTargets() throws java.lang.Exception
Retrieve targets for a specific node using GET call on "nodes/{nodeId}/targets- Returns:
- Throws:
java.lang.Exception
-
createTargetForNode
public RestNodeAssocTargetModel createTargetForNode(RestNodeAssocTargetModel target) throws java.lang.Exception
Create new target nodes using POST call on '/nodes/{nodeId}/targets'- Parameters:
target-- Returns:
- Throws:
java.lang.Exception
-
deleteTarget
public void deleteTarget(RestNodeAssocTargetModel target) throws java.lang.Exception
Delete a target for a specific node using DELETE call on nodes/{nodeId}/targets/{targetId}- Parameters:
target-- Throws:
java.lang.Exception
-
getNodeSources
public RestNodeAssociationModelCollection getNodeSources() throws java.lang.Exception
Get sources for a specific node using GET call on GET /nodes/{nodeId}/sources- Returns:
- Throws:
java.lang.Exception
-
updateNodeContent
public RestNodeModel updateNodeContent(java.io.File nodeContent) throws java.lang.Exception
Updates the content of the node with identifier nodeId using PUT call "/nodes/{nodeId}/content"- Parameters:
nodeContent-- Returns:
- Throws:
java.lang.Exception
-
copyNode
public RestNodeModel copyNode(java.lang.String postBody)
Copies the node nodeId to the parent folder node targetParentId using POST call "nodes/{nodeId}/copy"- Parameters:
postBody-- Returns:
-
getParents
public RestNodeAssociationModelCollection getParents() throws java.lang.Exception
Get a node's parents using GET call 'nodes/{nodeId}/parents- Returns:
- a collection of nodes
- Throws:
java.lang.Exception
-
getSecondaryChildren
public RestNodeAssociationModelCollection getSecondaryChildren() throws java.lang.Exception
Get a node's secondary children using GET call 'nodes/{nodeId}/secondary-children- Returns:
- a collection of nodes
- Throws:
java.lang.Exception
-
createSecondaryChildren
public RestNodeChildAssocModelCollection createSecondaryChildren(java.lang.String secondaryChildren) throws java.lang.Exception
Create secondary children association using POST call 'nodes/{nodeId}/secondary-children Use a list of secondary children nodes- Returns:
- a collection of nodes
- Throws:
java.lang.Exception
-
deleteSecondaryChild
public void deleteSecondaryChild(RestNodeAssociationModel child) throws java.lang.Exception
Delete secondary children using DELETE call 'nodes/{nodeId}/secondary-children/{childId}- Throws:
java.lang.Exception
-
listVersionHistory
public RestVersionModelsCollection listVersionHistory()
Gets the version history as an ordered list for the specified nodeId using GET call 'nodes/{nodeId}/versions- Returns:
-
deleteNodeVersion
public void deleteNodeVersion(java.lang.String versionId)
Delete the version identified by versionId for nodeId using DELETE call 'nodes/{nodeId}versions/{versionId}- Parameters:
versionId-
-
getVersionInformation
public RestVersionModel getVersionInformation(java.lang.String versionId)
Gets the version information versionId for node nodeId using GET call 'nodes/{nodeId}/versions/{versionId}- Parameters:
versionId-- Returns:
-
getVersionContent
public RestResponse getVersionContent(java.lang.String versionId)
Gets the content for versionId of node nodeId using GET call 'nodes/{nodeId}/versions/{versionId}/content- Parameters:
versionId-- Returns:
-
revertVersion
public RestVersionModel revertVersion(java.lang.String versionId, java.lang.String postBody)
Revert the version identified by versionId and nodeId to the node using POST call 'nodes/{nodeId}/versions/{versionId}/revert- Parameters:
versionId-postBody-- Returns:
-
deleteNode
public void deleteNode(RestNodeModel nodeModel) throws java.lang.Exception
Delete a specific node using DELETE call on nodes/{nodeId}- Parameters:
nodeModel-- Throws:
java.lang.Exception
-
deleteNode
public void deleteNode(java.lang.String nodeId) throws java.lang.ExceptionDelete a specific node using DELETE call on nodes/{nodeId}- Parameters:
nodeId-- Throws:
java.lang.Exception
-
getActionDefinitions
public RestActionDefinitionModelsCollection getActionDefinitions()
- Parameters:
nodeId-- Returns:
-
-