Package su.onno.ui

Class GenericDocumentController

java.lang.Object
su.onno.ui.GenericDocumentController

@RestController @RequestMapping("/api/documents") public class GenericDocumentController extends Object
  • Constructor Details

  • Method Details

    • get

      @GetMapping("/{name}/{id}") public Map<String,Object> get(@PathVariable String name, @PathVariable UUID id, @RequestParam(defaultValue="logical") String representation, Principal principal)
    • related

      @GetMapping("/{name}/{id}/related/{relatedName}") public List<Map<String,Object>> related(@PathVariable String name, @PathVariable UUID id, @PathVariable String relatedName, @RequestParam(defaultValue="logical") String representation, Principal principal)
      Live rows of a related-list panel declared on the name document's view (see RelatedList) — the junction rows whose back-reference points at record id. The document-side parity with GenericCatalogController#related (1C surfaces subordinate/related records on documents too); the shared RelatedListReader resolves the junction (join catalog or information register) and enforces read access on it.
    • create

      @PostMapping("/{name}") public Map<String,Object> create(@PathVariable String name, @RequestBody Map<String,Object> body, @RequestParam(defaultValue="logical") String representation, Principal principal)
    • duplicate

      @PostMapping("/{name}/{id}/duplicate") public Map<String,Object> duplicate(@PathVariable String name, @PathVariable UUID id, @RequestParam(defaultValue="logical") String representation, Principal principal)
      Create a copy of document id: same attributes and line items, fresh identity (new id, next number), dated now, and — like any new document — unposted. Secret attributes are not copied (reads are redacted, so a copy would store the sentinel). Runs through the normal create path (lifecycle hooks, validation, write access). Powers the list's clipboard paste (⌘C/⌘V).
    • update

      @PutMapping("/{name}/{id}") public Map<String,Object> update(@PathVariable String name, @PathVariable UUID id, @RequestBody Map<String,Object> body, @RequestParam(defaultValue="logical") String representation, Principal principal)
    • validate

      @PostMapping({"/{name}/validate","/{name}/{id}/validate"}) public Map<String,Object> validate(@PathVariable String name, @PathVariable(required=false) UUID id, @RequestBody Map<String,Object> body, Principal principal)
      Dry-run validation for the form's live (as-you-type) feedback: runs the full write lifecycle — declarative constraints, hooks, Validated business rules (tabular rows included) — against the submitted values without persisting, and reports {valid, fieldErrors, formErrors} with 200 either way. The id-less form validates a create; with id, the changes are overlaid onto the stored document first, exactly like PUT.
    • post

      @PostMapping("/{name}/{id}/post") public Map<String,Object> post(@PathVariable String name, @PathVariable UUID id, @RequestParam(defaultValue="logical") String representation, Principal principal)
    • postingPreview

      @GetMapping("/{name}/{id}/posting-preview") public PostingPreview postingPreview(@PathVariable String name, @PathVariable UUID id, Principal principal)
    • unpost

      @PostMapping("/{name}/{id}/unpost") public Map<String,Object> unpost(@PathVariable String name, @PathVariable UUID id, @RequestParam(defaultValue="logical") String representation, Principal principal)
    • delete

      @DeleteMapping("/{name}/{id}") public void delete(@PathVariable String name, @PathVariable UUID id, Principal principal)
    • batchDelete

      @PostMapping("/{name}/batch-delete") public Map<String,Object> batchDelete(@PathVariable String name, @RequestBody Map<String,Object> body, Principal principal)
      Soft-delete a set of documents in one request (auto-unposting posted ones, like the single DELETE). Per-id failures are recorded and the batch continues; returns {ok, failed, total}. Ids run concurrently on the shared BatchRunner pool (onno.ui.batch.parallelism) — note that parallel unposting reverses register entries concurrently, so heavily-shared accumulation registers may see lock contention. Capped like the action batch (see ActionController.BATCH_LIMIT).