Class Node


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

    • Node

      public Node(RestWrapper restWrapper)
    • Node

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

    • getNode

      public RestNodeModel getNode()
      Retrieve details for a specific node using GET call on "nodes/{nodeId}"
      Parameters:
      nodeId -
      Returns:
      Throws:
      JsonToModelConversionException
    • getNodeComments

      public RestCommentModelsCollection getNodeComments()
      Retrieve comments for a specific node using GET call on "nodes/{nodeId}/comments"
      Parameters:
      nodeId -
      Returns:
      Throws:
      JsonToModelConversionException
    • addComment

      public RestCommentModel addComment(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(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, 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:
    • dislikeDocument

      public RestRatingModel dislikeDocument()
    • addInvalidRating

      public RestRatingModel addInvalidRating(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(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(String tag)
      Adds a tag to the given content node
      Parameters:
      contentModel -
      tag -
      Returns:
    • addTags

      public RestTagModelsCollection addTags(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(String nodeId)
      Retrieve content for a specific node using GET call on "nodes/{nodeId}/content"
      Parameters:
      nodeId -
      Returns:
    • createNodeRendition

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

      public void createNodeVersionRendition(String renditionId, 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(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(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(String renditionId, 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(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(String renditionId, 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(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(String renditionId, 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(String renditionId)
      Get node rendition content using GET call on 'nodes/{nodeId}/renditions/{renditionId}/content
      Returns:
    • getNodeVersionRenditionContent

      public RestResponse getNodeVersionRenditionContent(String renditionId, 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(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(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
    • move

      public RestNodeModel move(RestNodeBodyMoveCopyModel moveBody)
      Move a node to a target folder
      Parameters:
      moveBody - a RestNodeBodyMoveCopyModel containing at least the target parent id
      Returns:
      the moved node's new information
    • copy

      public RestNodeModel copy(RestNodeBodyMoveCopyModel copyBody)
      Copy a node to a target folder
      Parameters:
      copyBody - a RestNodeBodyMoveCopyModel containing at least the target parent id
      Returns:
      the moved node's new information
    • lockNode

      public RestNodeModel lockNode(RestNodeLockBodyModel lockBody)
      Lock a specific node using POST call on "nodes/{nodeId}/lock"
      Returns:
    • 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(String putBody)
      Update a specific node using PUT call on "nodes/{nodeId}"
      Parameters:
      putBody -
      Returns:
    • getNodeTargets

      public RestNodeAssociationModelCollection getNodeTargets()
      Retrieve targets for a specific node using GET call on "nodes/{nodeId}/targets
      Returns:
    • createTargetForNode

      public RestNodeAssocTargetModel createTargetForNode(RestNodeAssocTargetModel target)
      Create new target nodes using POST call on '/nodes/{nodeId}/targets'
      Parameters:
      target -
      Returns:
    • deleteTarget

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

      public RestNodeAssociationModelCollection getNodeSources()
      Get sources for a specific node using GET call on GET /nodes/{nodeId}/sources
      Returns:
    • updateNodeContent

      public RestNodeModel updateNodeContent(File nodeContent)
      Updates the content of the node with identifier nodeId using PUT call "/nodes/{nodeId}/content"
      Parameters:
      nodeContent -
      Returns:
    • copyNode

      public RestNodeModel copyNode(String postBody)
      Copies the node nodeId to the parent folder node targetParentId using POST call "nodes/{nodeId}/copy"
      Parameters:
      postBody -
      Returns:
    • getParents

      Get a node's parents using GET call 'nodes/{nodeId}/parents
      Returns:
      a collection of nodes
    • getSecondaryChildren

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

      public RestNodeChildAssociationModel addSecondaryChild(org.alfresco.utility.model.RepoTestModel secondaryChild)
      Creates a secondary child association using POST call to: 'nodes/{nodeId}/secondary-children'.
      Parameters:
      secondaryChild - - node, which should become a secondary child
      Returns:
      a node's parent-child association
    • addSecondaryChild

      public RestNodeChildAssociationModel addSecondaryChild(String associationType, org.alfresco.utility.model.RepoTestModel secondaryChild)
      Creates a secondary child association using POST call to: 'nodes/{nodeId}/secondary-children'.
      Parameters:
      associationType - - type of secondary parent-child relationship association
      secondaryChild - - node, which should become a secondary child
      Returns:
      a node's parent-child association
    • addSecondaryChild

      public RestNodeChildAssociationModel addSecondaryChild(RestNodeChildAssociationModel secondaryChildAssociation)
      Creates a secondary child association using POST call to: 'nodes/{nodeId}/secondary-children'.
      Parameters:
      secondaryChildAssociation - - node's secondary parent-child association model
      Returns:
      a node's parent-child association
    • addSecondaryChildren

      public RestNodeChildAssocModelCollection addSecondaryChildren(org.alfresco.utility.model.RepoTestModel... secondaryChildren)
      Creates a secondary children association using POST call to: 'nodes/{nodeId}/secondary-children'.
      Parameters:
      secondaryChildren - - nodes, which should become secondary children
      Returns:
      a collection of node's parent-child associations
    • addSecondaryChildren

      public RestNodeChildAssocModelCollection addSecondaryChildren(String associationType, org.alfresco.utility.model.RepoTestModel... secondaryChildren)
      Creates a secondary children association using POST call to: 'nodes/{nodeId}/secondary-children'.
      Parameters:
      associationType - - type of secondary parent-child relationship association
      secondaryChildren - - nodes, which should become secondary children
      Returns:
      a collection of node's parent-child associations
    • addSecondaryChildren

      public RestNodeChildAssocModelCollection addSecondaryChildren(RestNodeChildAssociationModel... secondaryChildrenAssociations)
      Creates a secondary children association using POST call to: 'nodes/{nodeId}/secondary-children'.
      Parameters:
      secondaryChildrenAssociations - - node's secondary parent-child association models
      Returns:
      a collection of node's parent-child associations
    • removeSecondaryChild

      public void removeSecondaryChild(org.alfresco.utility.model.RepoTestModel secondaryChild)
      Removes secondary child association using DELETE call 'nodes/{nodeId}/secondary-children/{childId}'.
      Parameters:
      secondaryChild - - node, which should NOT be a secondary child anymore
    • removeSecondaryChild

      public void removeSecondaryChild(String associationType, org.alfresco.utility.model.RepoTestModel secondaryChild)
      Removes secondary child association using DELETE call 'nodes/{nodeId}/secondary-children/{childId}'.
      Parameters:
      associationType - - type of secondary parent-child relationship association
      secondaryChild - - node, which should NOT be a secondary child anymore
    • removeSecondaryChild

      public void removeSecondaryChild(RestNodeAssociationModel secondaryChildAssociation)
      Removes secondary child association using DELETE call 'nodes/{nodeId}/secondary-children/{childId}'.
      Parameters:
      secondaryChildAssociation - - node's secondary parent-child association to remove
    • 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(String versionId)
      Delete the version identified by versionId for nodeId using DELETE call 'nodes/{nodeId}versions/{versionId}
      Parameters:
      versionId -
    • getVersionInformation

      public RestVersionModel getVersionInformation(String versionId)
      Gets the version information versionId for node nodeId using GET call 'nodes/{nodeId}/versions/{versionId}
      Parameters:
      versionId -
      Returns:
    • getVersionContent

      public RestResponse getVersionContent(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(String versionId, 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(String nodeId)
      Delete a specific node using DELETE call on nodes/{nodeId}
      Parameters:
      nodeId -
    • getActionDefinitions

      public RestActionDefinitionModelsCollection getActionDefinitions()
    • createDirectAccessURL

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

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

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

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

      public ContentStorageInformation usingStorageInfo(String contentPropName)
    • usingVersionStorageInfo

      public ContentStorageInformation usingVersionStorageInfo(String contentPropName, String versionId)
    • usingDefaultRuleSet

      public FolderRules usingDefaultRuleSet()
    • usingRuleSet

      public FolderRules usingRuleSet(String ruleSetId)
    • getListOfRuleSets

      public RestRuleSetModelsCollection getListOfRuleSets()
      Get the rule sets defined on a folder.
      Returns:
      The list of rule sets.
    • getRuleSet

      public RestRuleSetModel getRuleSet(String ruleSetId)
      Get the specified rule set from a folder.
      Parameters:
      ruleSetId - The id of the rule set.
      Returns:
      The specified rule set.
    • updateRuleSet

      public RestRuleSetModel updateRuleSet(RestRuleSetModel ruleSet)
      Update a rule set on this folder - for example to reorder the rules.
      Parameters:
      ruleSet - The updated rule set.
      Returns:
      The updated rule set returned by the server.
    • getDefaultRuleSet

      public RestRuleSetModel getDefaultRuleSet()
      Get the default rule set from a folder.
      Returns:
      The specified rule set.
    • usingRuleSetting

      public RuleSettings usingRuleSetting(String ruleSettingKey)
    • usingIsInheritanceEnabledRuleSetting

      public RuleSettings usingIsInheritanceEnabledRuleSetting()
    • createRuleLink

      public RestRuleSetLinkModel createRuleLink(RestRuleSetLinkModel body)
    • unlinkRuleSet

      public void unlinkRuleSet(String ruleSetId)
      Try to delete a ruleset link performing a DELETE call on "/nodes/{folderNodeId}/rule-set-links/{rulesetId}"
      Parameters:
      ruleSetId - the id of the ruleset to be unlinked from the folder
    • executeRules

      public RestRuleExecutionModel executeRules(RestRuleExecutionModel body)
      Trigger rules on a folder performing POST call on "/nodes/{folderNodeId}/rule-executions"
      Parameters:
      body - - rules execution request
      Returns:
      execution result
    • getLinkedCategories

      public RestCategoryModelsCollection getLinkedCategories()
      Get linked categories performing GET cal on "/nodes/{nodeId}/category-links"
      Returns:
      categories which are linked from content
    • linkToCategory

      public RestCategoryModel linkToCategory(RestCategoryLinkBodyModel categoryLink)
      Link content to category performing POST call on "/nodes/{nodeId}/category-links"
      Parameters:
      categoryLink - - contains category ID
      Returns:
      linked to category
    • linkToCategories

      public RestCategoryModelsCollection linkToCategories(List<RestCategoryLinkBodyModel> categoryLinks)
      Link content to many categories performing POST call on "/nodes/{nodeId}/category-links"
      Parameters:
      categoryLinks - - contains categories IDs
      Returns:
      linked to categories
    • unlinkFromCategory

      public void unlinkFromCategory(String categoryId)
      Unlink content from a category performing a DELETE call on "nodes/{nodeId}/category-links/{categoryId}"
      Parameters:
      categoryId - the id of the category to be unlinked from content
    • executeSizeDetails

      public RestSizeDetailsModel executeSizeDetails()
      In order to retrieve folder size details using POST call on "nodes/{nodeId}/size-details"
      Returns:
    • getSizeDetails

      public RestSizeDetailsModel getSizeDetails(String jobId)
      Getting Folder size details using GET call on "nodes/{nodeId}/size-details/{jobId}"
      Returns: