Results 1 to 3 of 3

Thread: decision-state vs action-state

  1. #1
    Join Date
    Mar 2011
    Posts
    166

    Default 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. #2
    Join Date
    Apr 2008
    Posts
    22

    Default

    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
    Joćo Simas
    Software Engineer @ Glintt

  3. #3
    Join Date
    Mar 2011
    Posts
    166

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •