Class Node


  • public class Node
    extends ModelRequest<Node>
    Declares all Rest API under the /nodes path
    • 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:
        JsonToModelConversionException
        java.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:
        JsonToModelConversionException
        java.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:
        JsonToModelConversionException
        java.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.Exception
        Delete 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.Exception
        Try 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.Exception
        Delete 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:
        JsonToModelConversionException
        java.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 call RestWrapper#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.Exception
        Create 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.Exception
        Check 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
      • 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.Exception
        Delete a specific node using DELETE call on nodes/{nodeId}
        Parameters:
        nodeId -
        Throws:
        java.lang.Exception
      • createDirectAccessURL

        public RestResponse createDirectAccessURL()
        Get Direct Access URL for a node
        Returns:
      • createDirectAccessURLforVersion

        public RestResponse createDirectAccessURLforVersion​(java.lang.String versionId)
        Get Direct Access URL for a specific node version. E.g "1.1"
        Parameters:
        versionId -
        Returns:
      • createDirectAccessURLforVersionAndRendition

        public RestResponse createDirectAccessURLforVersionAndRendition​(java.lang.String versionId,
                                                                        java.lang.String renditionId)
        Get Direct Access URL for a specific node version rendition. E.g ("1.1", "pdf")
        Parameters:
        versionId -
        renditionId -
        Returns:
      • createDirectAccessURLforRendition

        public RestResponse createDirectAccessURLforRendition​(java.lang.String renditionId)
        Get Direct Access URL for a specific node rendition E.g "pdf"
        Parameters:
        renditionId -
        Returns: