Class Node


  • public class Node
    extends ModelRequest<Node>
    Declares all Rest API under the /nodes path
    • Constructor Detail

      • Node

        public Node​(org.alfresco.utility.model.RepoTestModel repoModel,
                    RestWrapper restWrapper)
    • Method Detail

      • addComment

        public RestCommentModel addComment​(java.lang.String commentContent)
        Publish one new comment on a specific node using POST call on "nodes/{nodeId}/comments"
        Parameters:
        node -
        commentContent -
        Returns:
      • addComments

        public RestCommentModelsCollection addComments​(java.lang.String... comments)
        Publish multiple comments on a specific node using POST call on "nodes/{nodeId}/comments"
        Parameters:
        contentModel -
        comments -
        Returns:
      • updateComment

        public RestCommentModel updateComment​(RestCommentModel commentModel,
                                              java.lang.String commentContent)
        Update a comment for a specific node using PUT call on nodes/{nodeId}/comments/{commentId}
        Parameters:
        nodeId -
        commentId -
        commentContent -
        Returns:
        Throws:
        JsonToModelConversionException
      • deleteComment

        public void deleteComment​(RestCommentModel comment)
        Delete a comment for a specific node using DELETE call on nodes/{nodeId}/comments/{commentId}
        Parameters:
        nodeId -
        commentId -
        Throws:
        JsonToModelConversionException
      • likeDocument

        public RestRatingModel likeDocument()
        Like a document using POST call on "nodes/{nodeId}/ratings"
        Returns:
      • addInvalidRating

        public RestRatingModel addInvalidRating​(java.lang.String jsonBody)
        POST call on "nodes/{nodeId}/ratings" using an invalid rating body
        Returns:
      • rateStarsToDocument

        public RestRatingModel rateStarsToDocument​(int stars)
        Add five star rate to a document using POST call on "nodes/{nodeId}/ratings"
        Parameters:
        stars -
        Returns:
      • getRatings

        public RestRatingModelsCollection getRatings()
        Retrieve node ratings using GET call on "nodes/{nodeId}/ratings"
        Returns:
      • deleteLikeRating

        public void deleteLikeRating()
        Delete like rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"
      • deleteInvalidRating

        public void deleteInvalidRating​(java.lang.String rating)
        Try to delete invalid rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"
      • getLikeRating

        public RestRatingModel getLikeRating()
        Get like rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"
      • deleteFiveStarRating

        public void deleteFiveStarRating()
        Delete fivestar rating using DELETE call on "nodes/{nodeId}/ratings/{ratingId}"
      • getFiveStarRating

        public RestRatingModel getFiveStarRating()
        Get fivestar rating of a document using GET call on "nodes/{nodeId}/ratings/{ratingId}"
        Returns:
      • addTag

        public RestTagModel addTag​(java.lang.String tag)
        Adds a tag to the given content node
        Parameters:
        contentModel -
        tag -
        Returns:
      • addTags

        public RestTagModelsCollection addTags​(java.lang.String... tags)
        Adds multiple tags to the given content node
        Parameters:
        contentModel -
        tags -
        Returns:
      • deleteTag

        public void deleteTag​(RestTagModel tag)
        Deletes a tag for a specific content node using DELETE call on nodes/{nodeId}/tags/{tagId}
        Parameters:
        content -
        tag -
        Throws:
        JsonToModelConversionException
      • getNodeTags

        public RestTagModelsCollection getNodeTags()
        Get node tags using GET call on 'nodes/{nodeId}/tags'
        Parameters:
        tag -
        Returns:
      • createNode

        public RestNodeModel createNode​(RestNodeBodyModel node)
        Create new nodes using POST call on 'nodes/{nodeId}/children
        Parameters:
        node -
        Returns:
      • createNode

        public RestNodeModel createNode()
        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:
      • getNodeContent

        public RestResponse getNodeContent()
        Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"
        Returns:
      • getNodeContent

        public RestResponse getNodeContent​(java.lang.String nodeId)
        Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"
        Parameters:
        nodeId -
        Returns:
      • createNodeRendition

        public void createNodeRendition​(java.lang.String renditionId)
        Create node rendition using POST call on '/nodes/{nodeId}/renditions'
        Parameters:
        renditionId - id of rendition to be created
      • createNodeVersionRendition

        public void createNodeVersionRendition​(java.lang.String renditionId,
                                               java.lang.String versionId)
        Create node version rendition using POST call on '/nodes/{nodeId}/versions/{versionId}/renditions'
        Parameters:
        renditionId - id of rendition to be created
        versionId - version id of node
      • createNodeRenditionIfNotExists

        public void createNodeRenditionIfNotExists​(java.lang.String renditionId)
        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
      • getNodeRendition

        public RestRenditionInfoModel getNodeRendition​(java.lang.String renditionId)
        Get node rendition using GET call on '/nodes/{nodeId}/renditions/{renditionId}
        Parameters:
        renditionId - id of rendition to be retrieved
        Returns:
      • getNodeVersionRendition

        public RestRenditionInfoModel getNodeVersionRendition​(java.lang.String renditionId,
                                                              java.lang.String versionId)
        Get node version rendition using GET call on '/nodes/{nodeId}/versions/{versionId}renditions/{renditionId}
        Parameters:
        renditionId - id of rendition to be retrieved
        versionId - versionId of the node
        Returns:
      • getNodeRenditionUntilIsCreated

        public RestRenditionInfoModel getNodeRenditionUntilIsCreated​(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.
        Returns:
      • getNodeVersionRenditionUntilIsCreated

        public RestRenditionInfoModel getNodeVersionRenditionUntilIsCreated​(java.lang.String renditionId,
                                                                            java.lang.String versionId)
        Get node version rendition using GET call on 'nodes/{nodeId}/versions/{versionId}/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:
      • getNodeRenditionContentUntilIsCreated

        public RestResponse getNodeRenditionContentUntilIsCreated​(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.
        Returns:
      • getNodeVersionRenditionContentUntilIsCreated

        public RestResponse getNodeVersionRenditionContentUntilIsCreated​(java.lang.String renditionId,
                                                                         java.lang.String versionId)
        Get node version rendition content using GET call on 'nodes/{nodeId}/versions/{versionId}/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:
      • getNodeRenditionContent

        public RestResponse getNodeRenditionContent​(java.lang.String renditionId)
        Get node rendition content using GET call on 'nodes/{nodeId}/renditions/{renditionId}/content
        Returns:
      • getNodeVersionRenditionContent

        public RestResponse getNodeVersionRenditionContent​(java.lang.String renditionId,
                                                           java.lang.String versionId)
        Get node version rendition content using GET call on 'nodes/{nodeId}/versions/{versionId}/renditions/{renditionId}/content
        Returns:
      • getNodeRenditionsInfo

        public RestRenditionInfoModelCollection getNodeRenditionsInfo()
        Get rendition information for available renditions for the node using GET call on 'nodes/{nodeId}/renditions'
        Returns:
      • getNodeVersionRenditionsInfo

        public RestRenditionInfoModelCollection getNodeVersionRenditionsInfo​(java.lang.String versionId)
        Get rendition information for available renditions for the node version using GET call on 'nodes/{nodeId}/versions/{versionId}/renditions'
        Returns:
      • deleteNodeRendition

        public void deleteNodeRendition​(java.lang.String renditionId)
        Delete the rendition identified by renditionId using DELETE call on "/nodes/{nodeId}/renditions/{renditionId}"
        Parameters:
        renditionId - id of rendition to delete
      • listChildren

        public RestNodeModelsCollection listChildren()
        Get a node's children using GET call 'nodes/{nodeId}/children
        Returns:
        a collection of nodes
      • unlockNode

        public RestNodeModel unlockNode()
        Unlock a specific node using POST call on "nodes/{nodeId}/unlock"
        Returns:
      • defineNodes

        public NodesBuilder defineNodes()
        Returns:
        NodesBuilder - help you define new nodes using rest API calls
      • updateNode

        public RestNodeModel updateNode​(java.lang.String putBody)
        Update a specific node using PUT call on "nodes/{nodeId}"
        Parameters:
        putBody -
        Returns:
      • deleteTarget

        public void deleteTarget​(RestNodeAssocTargetModel target)
        Delete a target for a specific node using DELETE call on nodes/{nodeId}/targets/{targetId}
        Parameters:
        target -
      • updateNodeContent

        public RestNodeModel updateNodeContent​(java.io.File nodeContent)
        Updates the content of the node with identifier nodeId using PUT call "/nodes/{nodeId}/content"
        Parameters:
        nodeContent -
        Returns:
      • 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:
      • getSecondaryChildren

        public RestNodeAssociationModelCollection getSecondaryChildren()
        Get a node's secondary children using GET call 'nodes/{nodeId}/secondary-children
        Returns:
        a collection of nodes
      • createSecondaryChildren

        public RestNodeChildAssocModelCollection createSecondaryChildren​(java.lang.String secondaryChildren)
        Create secondary children association using POST call 'nodes/{nodeId}/secondary-children Use a list of secondary children nodes
        Returns:
        a collection of nodes
      • deleteSecondaryChild

        public void deleteSecondaryChild​(RestNodeAssociationModel child)
        Delete secondary children using DELETE call 'nodes/{nodeId}/secondary-children/{childId}
      • 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)
        Delete a specific node using DELETE call on nodes/{nodeId}
        Parameters:
        nodeModel -
      • deleteNode

        public void deleteNode​(java.lang.String nodeId)
        Delete a specific node using DELETE call on nodes/{nodeId}
        Parameters:
        nodeId -
      • createDirectAccessURL

        public RestResponse createDirectAccessURL​(java.lang.String postBody)
        Get Direct Access URL for a node
        Parameters:
        postBody -
        Returns:
      • createDirectAccessURLforRendition

        public RestResponse createDirectAccessURLforRendition​(java.lang.String renditionId)
        Get Direct Access URL for a specific node rendition E.g "pdf"
        Parameters:
        renditionId -
        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:
      • usingVersionStorageInfo

        public ContentStorageInformation usingVersionStorageInfo​(java.lang.String contentPropName,
                                                                 java.lang.String versionId)
      • usingDefaultRuleSet

        public FolderRules usingDefaultRuleSet()
      • usingRuleSet

        public FolderRules usingRuleSet​(java.lang.String ruleSetId)