Announcement Announcement Module
Collapse
No announcement yet.
decision-state vs action-state Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • decision-state vs action-state

    I am reading up and dont understand the diff of decision-state vs action-state. I understand that view-state will display a jsp for input but whats the diff of decision-state vs action-state?

    why should I use decision-state over a action-state?
    why should I use a action-state over a decision-state?

    Can someone shot some light on this

  • #2
    Use decision states to evaluate logic to decide wich view or action state should be executed (if else logic)

    Action-state to process. Call a webservice, execute a database call, process a file, etc...

    I'll give you an example:

    <decision-state id="decideIfEmailShouldBeSent">
    <if test="someService.someLogicThatreturnsBoolean()" then="sendEmail" else="writeEntryInDbAndDoNothing" />
    </decision-state>

    <action-state id="sendEmail">
    <evaluate expression="emailService.sendEmail()" />
    <transition on="next" to="nextView" />
    </action-state>

    <view-state id="writeEntryInDbAndDoNothing">
    <on-entry>
    <evaluate expression="repository.writeSomething()" />
    </on-entry>
    <transition on="next" to="nextView" />
    </view-state>

    As you can see, is this example i even mixed view-state with action-state.

    Best Regards

    Comment


    • #3
      thanks for the post.. it was a stupid question but sometimes until you see the question and anwser you are like hmmmm

      Comment

      Working...
      X