Package su.onno.ui
Class GenericDocumentController
java.lang.Object
su.onno.ui.GenericDocumentController
@RestController
@RequestMapping("/api/documents")
public class GenericDocumentController
extends Object
-
Constructor Summary
ConstructorsConstructorDescriptionGenericDocumentController(DocumentQueryService query, UiAccessService access, DocumentCommandService commands, RelatedListReader relatedLists, BatchRunner batch) -
Method Summary
Modifier and TypeMethodDescriptionSoft-delete a set of documents in one request (auto-unposting posted ones, like the single DELETE).voidCreate a copy of documentid: same attributes and line items, fresh identity (new id, next number), dated now, and — like any new document — unposted.postingPreview(String name, UUID id, Principal principal) Live rows of a related-list panel declared on thenamedocument's view (seeRelatedList) — the junction rows whose back-reference points at recordid.Dry-run validation for the form's live (as-you-type) feedback: runs the full write lifecycle — declarative constraints, hooks,Validatedbusiness rules (tabular rows included) — against the submitted values without persisting, and reports{valid, fieldErrors, formErrors}with 200 either way.
-
Constructor Details
-
GenericDocumentController
public GenericDocumentController(DocumentQueryService query, UiAccessService access, DocumentCommandService commands, RelatedListReader relatedLists, BatchRunner batch)
-
-
Method Details
-
get
-
create
-
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 documentid: 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
-
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,Validatedbusiness 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; withid, the changes are overlaid onto the stored document first, exactly likePUT. -
post
-
postingPreview
@GetMapping("/{name}/{id}/posting-preview") public PostingPreview postingPreview(@PathVariable String name, @PathVariable UUID id, Principal principal) -
unpost
-
delete
-
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 sharedBatchRunnerpool (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).
-