Announcement Announcement Module
Collapse
No announcement yet.
_currentStateId in PR3 (using Velocity) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • _currentStateId in PR3 (using Velocity)

    I just upgraded to PR3 and found what seems to be an incompatibility with PR2 that wasn't mentioned in any of the posts found here so far.

    In PR2 I had a line in my views that set a hidden input tag with the name of "_currentStateId" to the value of ${flowExecution.currentStateId}. In PR3 the org.apache.velocity.app.VelocityEngine was throwing a warning that ${flowExecution.currentStateId} was not a valid reference. Looking at the source HTML for the generated page, I noticed that the page had indeed been generated without a proper value for _currentStateId.

    I loaded up the source code for the FlowExecution class and noticed that there was no method in FlowExecution (or its parent FlowContext) that would allow such a reference as flowExecution.currentStateId to exist (such as getCurrentStateId()). However, I noticed a method called getCurrentState() that returns a State object. The State class has a method called getId().

    So I am now using ${flowExecution.currentState.id} (notice the inserted "." and the lower case "i" that follows it) with success.

    Did I find something that you missed or do I not have the whole picture?

  • #2
    You're right, that's a change from PR2. However, note that the "currentStateId" was and still is directly available in the request parameters since it is put there by the FlowExecutionManager.prepareViewDescriptor() method. So a "change proof" way of doing what you need would be: ${currentStateId}

    Erwin

    Comment


    • #3
      Thanks. I wasn't aware that currentStateId is placed in the request parameters. I've taken your suggestion to make my views more change proof and it works great.

      I was using ${flowExecution.currentStateId} based in step 7 of the quick start. There's one other thing that should be changed in step 7 of the quick start. It uses ${flowExecution.id} which doesn't seem to exist (at least not in a Velocity template).

      Comment


      • #4
        I've updated the quick start guide.

        Erwin

        Comment

        Working...
        X