Conversation
@to: $flow.previous)
@to: $flow.previous)
sjvans
marked this pull request as ready for review
December 1, 2025 00:21
sjvans
requested review from
DanSchlachter,
danjoa,
etimr,
johannes-vogel and
vkozyura
December 1, 2025 00:21
danjoa
approved these changes
Dec 2, 2025
danjoa
left a comment
Member
There was a problem hiding this comment.
Looks good. 👍
Please see my comments before merging...
Comment on lines
+18
to
+24
| // Define flow for Travels | ||
| annotate Travels with @flow.status: Status actions { | ||
| rejectTravel @from: #Open @to: #Canceled; | ||
| acceptTravel @from: #Open @to: #Accepted; | ||
| deductDiscount @from: #Open; | ||
| }; | ||
|
|
Member
There was a problem hiding this comment.
Should we move that to a separate file srv/travel-flow.cds ?
Contributor
Author
There was a problem hiding this comment.
unfortunately leads to an interesting error with profile flow:
xtravels % cds w --profile flow
cds serve all --with-mocks --in-memory? --profile flow
( live reload enabled for browsers )
___________________________
[ERROR] srv/travel-flow.cds:5:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“rejectTravel”)
[ERROR] srv/travel-flow.cds:6:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“acceptTravel”)
[ERROR] xmpls/flow/flow-previous.cds:18:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“acceptTravel”)
[ERROR] xmpls/flow/flow-previous.cds:19:20-24: Duplicate assignment with “@from” (in annotate:“TravelService.Travels”/action:“rejectTravel”)→ i'll follow up with the compiler team
sjvans
added a commit
to capire/xtravels-java
that referenced
this pull request
Dec 15, 2025
### summary makes use of new status-transition flows feature of cds-services^4.5 and cds^9.5: - check entry state(s) for action → previously unchecked → TODO: true? - set to exit state for action → remove custom handlers - automatically add ui artifacts → remove unnecessary annotations ### `CDS_ENV=flow mvn cds:watch` extends to a more complex flow incl. usage of `@to: $flow.previous`. for that, status `InReview` and `Blocked` as well as actions `reviewTravel`, `reopenTravel`, `blockTravel`, and `unblockTravel` were added in order to create a scenario where the previous state of `Blocked` can be either `Open` or `InReview`. visualization of the flow: <img width="913" height="444" alt="image" src="https://github.com/user-attachments/assets/8dd98cdf-7a01-4e55-85bc-a2a7d69fdd16" /> --- ### related - capire/xtravels#12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
makes use of new status-transition flows feature of cds^9.5:
cds w --profile flowextends to a more complex flow incl. usage of
@to: $flow.previous.for that, status
InReviewandBlockedas well as actionsreviewTravel,reopenTravel,blockTravel, andunblockTravelwere added in order to create a scenario where the previous state ofBlockedcan be eitherOpenorInReview.visualization of the flow:

related