Class VaultApiController

java.lang.Object
org.saidone.controller.VaultApiController

@RestController @RequestMapping("/api/vault") public class VaultApiController extends Object
REST controller that exposes operations for interacting with the vault.

All endpoints require basic authentication and delegate the heavy lifting to VaultService and ContentService.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ResponseEntity<?>
    archiveNode(String auth, String nodeId)
    Archives an Alfresco node and removes it from the repository.
    org.springframework.http.ResponseEntity<?>
    Checks the notarization status of a node and returns a human readable message describing the result.
    org.springframework.http.ResponseEntity<?>
    getNode(String auth, String nodeId)
    Returns the metadata of a node stored in the vault.
    org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource>
    getNodeContent(String auth, String nodeId, boolean attachment)
    Streams the binary content of a node.
    org.springframework.http.ResponseEntity<?>
    notarizeNode(String auth, String nodeId)
    Require notarization of a node.
    org.springframework.http.ResponseEntity<?>
    restoreNode(String auth, String nodeId, boolean restorePermissions)
    Restores a node previously archived in the vault.
    org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<Entry>>
    searchNodes(String auth, Instant from, Instant to, int page, int size, org.springframework.data.domain.Sort.Direction dir)
    Searches nodes archived within the specified date range with pagination support.
    org.springframework.http.ResponseEntity<?>
    updateKey(String auth, int keyVersion)
    Re-encrypts all nodes currently protected with the specified key version.
    org.springframework.http.ResponseEntity<?>
    updateKey(String auth, String nodeId)
    Updates the encryption key for a node.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VaultApiController

      public VaultApiController()
  • Method Details

    • searchNodes

      @GetMapping("/search") public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<Entry>> searchNodes(@RequestHeader(value="Authorization",required=false) String auth, @RequestParam(required=false) Instant from, @RequestParam(required=false) Instant to, @RequestParam(required=false,defaultValue="0") int page, @RequestParam(required=false,defaultValue="20") int size, @RequestParam(required=false,defaultValue="ASC") org.springframework.data.domain.Sort.Direction dir)
      Searches nodes archived within the specified date range with pagination support.

      If no range is supplied the search defaults to the last 24 hours ending at Instant.now(). This mirrors the behaviour of the underlying service which looks for nodes archived during the previous day when no parameters are provided.

      Parameters:
      auth - optional Basic authentication header
      from - start of the archive date range (inclusive)
      to - end of the archive date range (inclusive)
      page - page number
      size - page size
      dir - sort direction for archive date
      Returns:
      paginated list of node entries
    • getNode

      @GetMapping("/nodes/{nodeId}") public org.springframework.http.ResponseEntity<?> getNode(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId)
      Returns the metadata of a node stored in the vault.
      Parameters:
      auth - optional Basic authentication header
      nodeId - identifier of the node to retrieve
      Returns:
      the node metadata wrapped in an Entry object
    • getNodeContent

      @GetMapping("/nodes/{nodeId}/content") public org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource> getNodeContent(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId, @RequestParam(required=false,defaultValue="true") boolean attachment)
      Streams the binary content of a node.
      Parameters:
      auth - optional Basic authentication header
      nodeId - identifier of the node
      attachment - true if the content should be sent as a download attachment
      Returns:
      the streamed content wrapped as an InputStreamResource
    • restoreNode

      @PostMapping("/nodes/{nodeId}/restore") public org.springframework.http.ResponseEntity<?> restoreNode(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId, @RequestParam(required=false,defaultValue="false") boolean restorePermissions)
      Restores a node previously archived in the vault.
      Parameters:
      auth - optional Basic authentication header
      nodeId - identifier of the node to restore
      restorePermissions - true to also restore permissions
      Returns:
      a textual confirmation message
    • archiveNode

      @PostMapping("/nodes/{nodeId}/archive") public org.springframework.http.ResponseEntity<?> archiveNode(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId)
      Archives an Alfresco node and removes it from the repository.
      Parameters:
      auth - optional Basic authentication header
      nodeId - identifier of the node to archive
      Returns:
      a confirmation message
    • notarizeNode

      @PostMapping("/nodes/{nodeId}/notarize") public org.springframework.http.ResponseEntity<?> notarizeNode(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId)
      Require notarization of a node. The notarization process runs asynchronously and the call returns immediately.
      Parameters:
      auth - optional Basic authentication header
      nodeId - identifier of the node to notarize
      Returns:
      a confirmation message, or 409 Conflict if the node was already notarized
    • checkNotarization

      @GetMapping("/nodes/{nodeId}/notarize") public org.springframework.http.ResponseEntity<?> checkNotarization(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId)
      Checks the notarization status of a node and returns a human readable message describing the result.
      Parameters:
      auth - optional Basic authentication header
      nodeId - identifier of the node to be checked
      Returns:
      textual description of the current notarization status
    • updateKey

      @PostMapping("/nodes/{nodeId}/update-key") public org.springframework.http.ResponseEntity<?> updateKey(@RequestHeader(value="Authorization",required=false) String auth, @PathVariable String nodeId)
      Updates the encryption key for a node.
      Parameters:
      auth - optional Basic authentication header
      nodeId - identifier of the node whose key should be updated
      Returns:
      a confirmation message
    • updateKey

      @PostMapping("/nodes/update-keys") public org.springframework.http.ResponseEntity<?> updateKey(@RequestHeader(value="Authorization",required=false) String auth, @RequestParam(name="keyVersion") int keyVersion)
      Re-encrypts all nodes currently protected with the specified key version. The operation runs asynchronously and returns immediately.
      Parameters:
      auth - optional Basic authentication header
      keyVersion - version of the outdated encryption key
      Returns:
      a confirmation message