Class VaultApiController

java.lang.Object
org.saidone.component.BaseComponent
org.saidone.controller.VaultApiController
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@RestController @RequestMapping("/api/vault") public class VaultApiController extends BaseComponent
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 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<Entry> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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