Package su.onno.ui

Class GenericCatalogController

java.lang.Object
su.onno.ui.GenericCatalogController

@RestController @RequestMapping("/api/catalogs") public class GenericCatalogController extends Object
  • Constructor Details

  • Method Details

    • children

      @GetMapping("/{name}/children") public List<Map<String,Object>> children(@PathVariable String name, @RequestParam(required=false) UUID parent, @RequestParam(defaultValue="logical") String representation, Principal principal)
    • tree

      @GetMapping("/{name}/tree") public List<Map<String,Object>> tree(@PathVariable String name, @RequestParam(defaultValue="logical") String representation, Principal principal)
    • 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 catalog's editor (see RelatedList) — the junction rows whose back-reference points at record id. For a join-catalog junction, add/remove go through the plain create/delete endpoints on the join catalog itself (so its own write roles apply), which the form drives from this panel's metadata; an information-register junction is read-only. The shared RelatedListReader resolves the junction 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 record id: same description/attributes/parent, fresh identity (new id, next code). Secret attributes are not copied — reads are redacted, so a copy would store the sentinel; the clone starts with them unset. 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 — 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 record first, exactly like PUT.
    • 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 records in one request — the list's batch selection posts here instead of firing N single DELETEs. 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). Capped like the action batch (see ActionController.BATCH_LIMIT).