<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/webflow
      http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

  <end-state id="finish" view="community.ThreadView">
    <on-entry>
      <set name="requestScope.displayCount" value="5" type="int"/>
      <set name="requestScope.page" value="requestParameters.page" type="int"/>
      <set name="requestScope.communityCode" value="requestParameters.communityCode"/>
      <set name="requestScope.threadId" value="requestParameters.threadId" type="int"/>
      <set name="requestScope.user" value="externalContext.requestMap._user"/>
      <set name="flowScope.community" value="communityTable.findByCode(communityCode)"/>
      <set name="flowScope.thread" value="community.findThreadForRead(threadId, user)"/>
      <evaluate expression="thread.retrieveEntries(displayCount, displayCount * page)"/>
      <set name="flashScope._feedUrl" value="'/community/' + community.code + '/' + thread.id + '/index.xml'"/>
      <evaluate expression="communityThreadViewAction.putTitle"/>
    </on-entry>
  </end-state>

</flow>
