Commit 90ee58a
feat(intent): postings reverses - red-storno reversal on a source void (#6308)
* feat(intent): transitions - guarded on-demand status flips (void/cancel/close)
A document whose create-time process has ended (invoice ISSUED, entry POSTED)
has no declarative affordance left to change its status: process triggers fire
only on create/update/delete, and actions: only opens a custom page. The new
top-level transitions: block adds one - a per-record button that moves the
record into a designated EntityStatus, guarded server-side:
transitions:
- name: VoidInvoice
forEntity: Invoice # must declare a function: EntityStatus relation
from: [3, 4] # allowed source status seed ids
setStatus: 8 # target status seed id
when: "Paid == 0" # optional <Field> ==|!= <number> guard (Calc semantics)
label: Void
icon: ban
Two halves, the generates pattern: TransitionsIntentGenerator (@order(470))
contributes the per-record button to <project>-custom-action (descriptor
carries the endpoint); GlueIntentGenerator.buildTransitions pre-renders the
allowed-statuses expression and the Calc-backed when guard into the
transitions glue collection, rendered by Transition.java.template into a
@controller at gen/events/<ClassName>Transition/run. The controller re-loads
the record, returns 409 with the reason when a guard fails, flips ONLY the
status column via the targeted updateProperty (no -updated re-fire), and
publishes -transitioned - the same channel workflow setters publish, so
postings:/integrations observe a manual void exactly like a workflow
transition (the enabler for red-storno reversal postings).
ControllerInvoker: a CharSequence return no longer stamps text/plain over a
content type the controller set explicitly (the transition controller returns
JSON); default unchanged when unset.
Verified:
- unit: TransitionsIntentTest (7) + GlueTransitionsTest (2) + full
engine-intent suite green; ControllerInvokerBindingTest +2 content-type
tests, full engine-java suite green
- IntentEmissionCoverageIT extended (fixture transition + emission tokens +
runtime: cancel 200 with the status flipped, wrong-status 409, when-guard
409 leaving the record untouched) and green
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(intent): postings reverses - red-storno reversal on a source void
The postings glue could post a document when a source reaches a status, but
not UN-post it: a voided/cancelled source left its journal entry standing.
The new reverses: mode pairs with the transitions: void primitive:
postings:
- name: invoicePosting
event: { onTransition: Invoice, when: "Status == 3" }
creates: JournalEntry
backReference: Invoice
rule: { ... }
items: [ ... ]
- name: invoiceStorno
event: { onTransition: Invoice, when: "Status == 8" } # the void transition
reverses: invoicePosting
storno: Storno # the created entity's to-one SELF-relation to the original
Semantics (red storno - the accounting correction convention): the reversal
inherits creates/backReference/rule/map/items from the reversed sibling and
re-derives them from the source with every item amount expression NEGATED on
the SAME debit/credit side (never swapped - turnovers stay honest). It locates
the ORIGINAL through the empty storno link (back-reference set, link null) and
skips fail-soft when none exists (the source was never posted); its creation
stamps the link. Both handlers' idempotency guards discriminate by that link:
the reversal counts only linked rows, the reversed sibling counts only
unlinked ones (stornoProperty/stornoFilterProperty in the glue). The reversal
lands as a normal new document - DRAFT status init, number placeholder,
checks, the accountant review-and-Post task.
Verified:
- unit: PostingsReversesIntentTest (5: parse + sibling/inherited-keys/storno
validations) + GluePostingsReversesTest (negated exprs, inherited
coordinates, storno keys on both entries); full engine-intent suite green
- IntentEmissionCoverageIT extended (Doc + PostDoc/VoidDoc transitions +
docPosting/docStorno fixture; emission tokens for negation/fail-soft/link;
runtime: post -> balanced Entry appears, void -> the reversal appears with
negative debit AND credit lines and the storno link to the original) - green
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(intent): report filter translates bare to-one relation names to their FK columns
A report filter like `Status != 8` (a to-one RELATION of the source, not a
field) passed through buildWhere untranslated - fields rewrote to their
qualified physical columns but relation names did not, so the generated query
carried a nonexistent column and failed at SQL time. Bare to-one relation
names now rewrite to the FK column (Invoice."INVOICE_STATUS"), with guards
so join-alias tokens from the dotted-ref pass (Customer."CUSTOMER_NAME")
and already-quoted columns are left intact.
Found by a suite emission audit: an overdue-invoices report excluding a
VOIDED status generated 'AND Status != 8' verbatim into the WHERE.
Verified: ReportIntentGeneratorTest +1 (bare relation translated, dotted-ref
alias unmangled), full class green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 495cb6b commit 90ee58a
10 files changed
Lines changed: 531 additions & 20 deletions
File tree
- components
- engine/engine-intent
- src
- main
- java/org/eclipse/dirigible/components/intent
- generator
- model
- parser
- resources
- test/java/org/eclipse/dirigible/components/intent
- generator
- parser
- template/template-application-events-java/src/main/resources/META-INF/dirigible/template-application-events-java/events
- ui/service-generate/src/main/resources/META-INF/dirigible/service-generate/template
- tests/tests-integrations/src/main/java/org/eclipse/dirigible/integration/tests/api
Large diffs are not rendered by default.
Lines changed: 49 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
702 | 702 | | |
703 | 703 | | |
704 | 704 | | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
705 | 709 | | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
706 | 734 | | |
707 | 735 | | |
708 | | - | |
| 736 | + | |
709 | 737 | | |
710 | 738 | | |
711 | 739 | | |
712 | 740 | | |
713 | 741 | | |
714 | 742 | | |
715 | | - | |
| 743 | + | |
716 | 744 | | |
717 | 745 | | |
718 | 746 | | |
| |||
769 | 797 | | |
770 | 798 | | |
771 | 799 | | |
772 | | - | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
773 | 806 | | |
774 | | - | |
775 | | - | |
| 807 | + | |
| 808 | + | |
776 | 809 | | |
777 | 810 | | |
778 | 811 | | |
779 | | - | |
780 | | - | |
| 812 | + | |
| 813 | + | |
781 | 814 | | |
782 | 815 | | |
783 | 816 | | |
784 | 817 | | |
785 | 818 | | |
786 | | - | |
787 | | - | |
| 819 | + | |
| 820 | + | |
788 | 821 | | |
789 | 822 | | |
790 | 823 | | |
| |||
793 | 826 | | |
794 | 827 | | |
795 | 828 | | |
796 | | - | |
797 | | - | |
798 | | - | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
799 | 832 | | |
800 | 833 | | |
801 | 834 | | |
802 | 835 | | |
803 | 836 | | |
804 | 837 | | |
805 | | - | |
| 838 | + | |
806 | 839 | | |
807 | 840 | | |
808 | 841 | | |
| |||
832 | 865 | | |
833 | 866 | | |
834 | 867 | | |
835 | | - | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
836 | 871 | | |
837 | 872 | | |
838 | 873 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
73 | 104 | | |
74 | 105 | | |
75 | 106 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2280 | 2280 | | |
2281 | 2281 | | |
2282 | 2282 | | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
2283 | 2324 | | |
2284 | 2325 | | |
2285 | 2326 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
212 | 227 | | |
213 | 228 | | |
214 | 229 | | |
| |||
0 commit comments