Class FileSystemApi

java.lang.Object
nl.bimbase.bimworks.client.apis.SubApi
nl.bimbase.bimworks.client.apis.FileSystemApi

public class FileSystemApi extends SubApi
BIM.works Repository maintains a virtual file system. The API calls in this namespace allow you to manipulate this.
  • Constructor Details

  • Method Details

    • createNode

      public UUID createNode(UUID parentNodeUuid, String name, boolean isFolder) throws BimWorksException
      Create a new Node
      Parameters:
      parentNodeUuid - The UUID of the node the new Node should become a child of
      name - The name of the new Node
      isFolder - Whether the new Node is a folder or not
      Returns:
      The UUID of the new Node
      Throws:
      BimWorksException
    • createNode

      public UUID createNode(UUID parentNodeUuid, String name, boolean isFolder, nl.bimbase.bimworks.api.upload.InputFileType inputFileType) throws BimWorksException
      Create a new Node
      Parameters:
      parentNodeUuid - The UUID of the node the new Node should become a child of
      name - The name of the new Node
      isFolder - Whether the new Node is a folder or not
      inputFileType - The type of the Model
      Returns:
      Throws:
      BimWorksException
    • deleteNodeIfExists

      public void deleteNodeIfExists(String path) throws BimWorksException
      Delete a Node based on it's path if it exists, does not throw an exception for non-existing paths
      Parameters:
      path - The path to the Node to delete. Keep in mind that paths are relative to your (potential) API Token.
      Throws:
      BimWorksException
    • deleteNode

      public void deleteNode(UUID nodeUuid) throws BimWorksException
      Delete a Node based on its UUID if it exists, will throw an exception when a Node already exists
      Parameters:
      nodeUuid - The UUID of the Node to delete. Keep in mind that paths are relative to your (potential) API Token.
      Throws:
      BimWorksException
    • renameNode

      public void renameNode(UUID nodeUuid, String newName) throws BimWorksException
      Rename an existing Node
      Parameters:
      nodeUuid - The UUID of the Node to rename
      newName - The new name of the Node
      Throws:
      BimWorksException
    • moveNode

      public void moveNode(UUID nodeUuid, UUID targetParentNodeUuid) throws BimWorksException
      Move a Node into another folder. The Node keeps its name. The target must be a folder that does not already contain a node with that name, and a Node cannot be moved onto itself — those cases are rejected by the server with a typed error.
      Parameters:
      nodeUuid - The UUID of the Node to move
      targetParentNodeUuid - The UUID of the folder Node to move it into
      Throws:
      BimWorksException
    • deleteNodeVersion

      public void deleteNodeVersion(UUID nodeUuid, UUID versionUuid) throws BimWorksException
      Delete a specific Version
      Parameters:
      nodeUuid -
      versionUuid -
      Throws:
      BimWorksException
    • deleteNodeError

      public void deleteNodeError(UUID nodeUuid, UUID errorUuid) throws BimWorksException
      Delete an Error
      Parameters:
      nodeUuid - The Node UUID, this is a redundant argument and will be removed in the future
      errorUuid - The Error UUID
      Throws:
      BimWorksException
    • undeleteNode

      public void undeleteNode(UUID nodeUuid) throws BimWorksException
      Undelete a Node
      Parameters:
      nodeUuid - The UUID of the Node to undelete
      Throws:
      BimWorksException
    • getRootNode

      public TreeNode getRootNode() throws BimWorksException
      Returns:
      The root Node
      Throws:
      BimWorksException
    • createNodeIfNotExists

      public UUID createNodeIfNotExists(UUID parentNodeUuid, String name, boolean isFolder, nl.bimbase.bimworks.api.upload.InputFileType inputFileType) throws BimWorksException
      Create a new Node if it does not already exists. Does not throw an exception when a Node already exists and instead returns the UUID of the existing Node.
      Parameters:
      parentNodeUuid - The UUID of the parent Node
      name - The name of the new Node
      isFolder - Whether the new Node is a folder
      inputFileType - The type of Node
      Returns:
      The UUID of the newly created Node, or the UUID of the existing Node
      Throws:
      BimWorksException
    • getNodeByUuid

      public TreeNode getNodeByUuid(UUID nodeUuid) throws BimWorksException
      Get a Node by it's UUID
      Parameters:
      nodeUuid - The UUID of the requested Node
      Returns:
      A Node
      Throws:
      BimWorksException
    • getNodeVersion

      public TreeNodeVersion getNodeVersion(UUID versionUuid) throws BimWorksException
      Get a Version
      Parameters:
      versionUuid - The UUID of the requested Version
      Returns:
      A Version
      Throws:
      BimWorksException
    • getNodeByVersionUuid

      public TreeNode getNodeByVersionUuid(UUID versionUuid) throws BimWorksException
      Get the Node the given Version belongs to.
      Parameters:
      versionUuid - The UUID of the Version
      Returns:
      A Node
      Throws:
      BimWorksException
    • listNodes

      public com.fasterxml.jackson.databind.node.ObjectNode listNodes(UUID nodeUuid, boolean includeDeletedNodes) throws BimWorksException
      List all child nodes of the given Node
      Parameters:
      nodeUuid - The UUID of the given Node
      includeDeletedNodes - Whether to include deleted Nodes. This option requires SUPER_ADMIN privileges at the moment.
      Returns:
      Throws:
      BimWorksException
    • listNodeErrors

      public com.fasterxml.jackson.databind.node.ArrayNode listNodeErrors(UUID nodeUuid) throws BimWorksException
      List all the errors on a given Node
      Parameters:
      nodeUuid - The UUID of the given Node
      Returns:
      An ArrayNode of all Errors
      Throws:
      BimWorksException
    • listNodeVersions

      public com.fasterxml.jackson.databind.node.ArrayNode listNodeVersions(UUID nodeUuid) throws BimWorksException
      List all the Versions of the given Node
      Parameters:
      nodeUuid - UUID of the given Node
      Returns:
      An ArrayNode of Version
      Throws:
      BimWorksException
    • listNodesRecursive

      public com.fasterxml.jackson.databind.node.ObjectNode listNodesRecursive(UUID nodeUuid) throws BimWorksException
      List all Nodes below the given Node. Lists all subnodes recursively but the returned data structure is a flat list.
      Parameters:
      nodeUuid -
      Returns:
      Throws:
      BimWorksException
    • getNodeByPath

      public TreeNode getNodeByPath(String path) throws BimWorksException
      Get a Node by it's path
      Parameters:
      path - The path
      Returns:
      The Node if found
      Throws:
      BimWorksException
    • exists

      public boolean exists(String path) throws BimWorksException
      Parameters:
      path - The path to check
      Returns:
      Whether a Node exists on the given path
      Throws:
      BimWorksException
    • getRootNodeUuid

      public UUID getRootNodeUuid() throws BimWorksException
      Returns:
      The UUID of the root node of the current context. The context depends on the type of authentication. For Username/Password authentication this is always the root Account Node. For API Tokens this is always the Node on which the API Token was created.
      Throws:
      BimWorksException
    • clearNodeChildren

      public int clearNodeChildren() throws BimWorksException
      Remove all Nodes of this currently authenticated Account or API Token, be careful! Requires the ADVANCED_SETTINGS user feature on the authenticated Account (for an API Token, the Account that owns it) — without it the server refuses with USER_FEATURE_REQUIRED.
      Returns:
      The amount of deleted Nodes, counted recursively — folders and already-deleted Nodes included
      Throws:
      BimWorksException
    • clearNodeChildren

      public int clearNodeChildren(UUID nodeUuid) throws BimWorksException
      Remove all child Nodes of the given Node recursively, be careful! The Node itself is kept. Requires the ADVANCED_SETTINGS user feature on the authenticated Account (for an API Token, the Account that owns it) — without it the server refuses with USER_FEATURE_REQUIRED.
      Parameters:
      nodeUuid - The UUID of the Node whose children are deleted
      Returns:
      The amount of deleted Nodes, counted recursively — folders and already-deleted Nodes included
      Throws:
      BimWorksException
    • downloadAsZip

      public InputStream downloadAsZip(UUID nodeUuid, boolean includeDeleted) throws BimWorksException
      Download a folder Node as a ZIP archive holding the last Version of every (non-deleted) Node below it, with the folder structure as entry paths. The archive is generated on the fly: the server pushes the stream descriptor up front and then streams the ZIP into it, so bytes arrive while generation is still running.
      Parameters:
      nodeUuid - The UUID of the folder Node to download
      includeDeleted - Whether deleted Nodes are included
      Returns:
      An InputStream with the ZIP content. Responsibility for closing this stream is on the caller.
      Throws:
      BimWorksException - when the node is not a folder, on missing read rights, or when no stream arrives
    • listNodes

      public com.fasterxml.jackson.databind.node.ObjectNode listNodes(String path, boolean includeDeletedNodes) throws BimWorksException
      List all the child Nodes on the given path
      Parameters:
      path - The path to the given Node
      includeDeletedNodes - Whether to include deleted Nodes. This option requires SUPER_ADMIN privileges at the moment.
      Returns:
      Throws:
      BimWorksException
    • listNodesInteractive

      public FileSystemApi.NodeSubscription listNodesInteractive(UUID parentNodeUuid, FileSystemApi.TreeChangeListener listener) throws BimWorksException
      List a folder the way the web UI does: the listing stays open and the server pushes every change under it (new versions, checkin progress, errors, renames) until the subscription is closed. A browser tab holds one of these per open folder.
      Parameters:
      parentNodeUuid - the folder, null for the root
      Throws:
      BimWorksException
    • getNodeVersions

      public com.fasterxml.jackson.databind.node.ArrayNode getNodeVersions(Set<UUID> versionUuids) throws BimWorksException
      The version records of the given versions (across nodes).
      Throws:
      BimWorksException