The Sample Webflow File
<?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-1.0.xsd">
<var name="sampleEventCreateForm"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventCreateForm" />
<var name="sampleEventEditForm"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventEditForm" />
<var name="sampleEventAdminForm"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventAdminForm" />
<var name="sampleEventViewForm"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventViewForm" />
<start-state idref="menuAction" />
<view-state id="menuAction"
view="/sampleevent/sampleEventMenu.xhtml">
<transition on="createSampleEvent" to="createSampleEvent">
<action bean="sampleEventCreateFormAction"
method="initializeData" />
<action bean="sampleEventCreateFormAction"
method="setEventType" />
</transition>
<transition on="editSampleEvent" to="editSelectSampleEvent">
<action bean="sampleEventEditFormAction"
method="initializeData" />
<action bean="sampleEventEditFormAction"
method="setEventType" />
<action bean="sampleEventEditFormAction"
method="searchSampleEvent" />
</transition>
<transition on="viewSampleEvent" to="viewSampleEvent">
<action bean="sampleEventViewFormAction"
method="setEventType" />
</transition>
<transition on="adminSampleEvent" to="adminSampleEvent">
<action bean="sampleEventAdminFormAction"
method="setEventType" />
</transition>
</view-state>
<!-- create event -->
<view-state id="createSampleEvent"
view="/sampleevent/createSampleEvent.xhtml">
<transition on="createSampleEvent" to="createSearchItems">
<action bean="sampleEventCreateFormAction"
method="createSampleEvent" />
</transition>
</view-state>
<view-state id="createSearchItems"
view="/sampleevent/createSearchItems.xhtml">
<transition on="search" to="createSearchResults">
<action bean="sampleEventCreateFormAction" method="search" />
</transition>
<transition on="addManufacturers" to="createSearchItems">
<action bean="sampleEventCreateFormAction"
method="addManufacturers" />
</transition>
<transition on="removeManufacturers" to="createSearchItems">
<action bean="sampleEventCreateFormAction"
method="removeManufacturers" />
</transition>
<transition on="addItemModelAlias" to="createSearchItems">
<action bean="sampleEventCreateFormAction"
method="addItemModelAlias" />
</transition>
<transition on="removeItemModelAlias" to="createSearchItems">
<action bean="sampleEventCreateFormAction"
method="removeItemModelAlias" />
</transition>
</view-state>
<view-state id="createSearchResults"
view="/sampleevent/createSearchResults.xhtml">
<transition on="backToSearch" to="createSearchItems">
<action bean="sampleEventCreateFormAction"
method="resetForReturnedSearch" />
</transition>
<transition on="reviewSelections" to="createReviewSelections">
<action bean="sampleEventCreateFormAction"
method="reviewSelections" />
</transition>
</view-state>
<view-state id="createReviewSelections"
view="/sampleevent/createReviewSelections.xhtml">
<transition on="modifySelections" to="createSearchResults" />
<transition on="saveSelections" to="createSuccess">
<action bean="sampleEventCreateFormAction"
method="saveSelections" />
</transition>
</view-state>
<view-state id="createSuccess"
view="/sampleevent/createSuccess.xhtml">
<transition on="addMoreItems" to="createSearchItems">
<action bean="sampleEventCreateFormAction"
method="resetForReturnedSearch" />
</transition>
</view-state>
<!-- edit event -->
<view-state id="editSelectSampleEvent"
view="/sampleevent/editSelectSampleEvent.xhtml">
<transition on="submitSelectedSampleEvent"
to="displayOperationOptions">
<action bean="sampleEventEditFormAction"
method="setSelectedSampleEvent" />
</transition>
</view-state>
<view-state id="displayOperationOptions"
view="/sampleevent/editOperationOptions.xhtml">
<transition on="editSavedItems" to="displaySavedItems">
<action bean="sampleEventEditFormAction"
method="searchSavedItems" />
</transition>
<transition on="addOtherItems" to="editAddOtherItems">
</transition>
<transition on="backToEditSampleEventSearchResults"
to="editSelectSampleEvent">
</transition>
</view-state>
<!-- add new items -->
<view-state id="editAddOtherItems"
view="/sampleevent/editAddOtherItems.xhtml">
<transition on="search" to="editOtherItemsResults">
<action bean="sampleEventEditFormAction"
method="searchOtherItems" />
</transition>
<transition on="addManufacturers" to="editAddOtherItems">
<action bean="sampleEventEditFormAction"
method="addManufacturers" />
</transition>
<transition on="removeManufacturers" to="editAddOtherItems">
<action bean="sampleEventEditFormAction"
method="removeManufacturers" />
</transition>
<transition on="addItemModelAlias" to="createSearchItems">
<action bean="sampleEventEditFormAction"
method="addItemModelAlias" />
</transition>
<transition on="removeItemModelAlias" to="createSearchItems">
<action bean="sampleEventEditFormAction"
method="removeItemModelAlias" />
</transition>
</view-state>
<view-state id="editOtherItemsResults"
view="/sampleevent/editOtherItemsResults.xhtml">
<transition on="reviewSelections"
to="editReviewOtherItemSelections">
</transition>
</view-state>
<view-state id="editReviewOtherItemSelections"
view="/sampleevent/editReviewOtherItemSelections.xhtml">
<transition on="modifySelections" to="editOtherItemsResults" />
<transition on="saveSelections" to="editSuccessSaveOthers">
<action bean="sampleEventEditFormAction"
method="saveOtherSelections" />
</transition>
</view-state>
<view-state id="editSuccessSaveOthers"
view="/sampleevent/editSuccessSaveOthers.xhtml">
<transition on="backToOperationOptions"
to="displayOperationOptions" />
</view-state>
<!-- remove saved items -->
<view-state id="displaySavedItems"
view="/sampleevent/editDisplaySavedItems.xhtml">
<transition on="reviewDeSelections" to="reviewDeSelections">
<action bean="sampleEventEditFormAction"
method="reviewDeSelections" />
</transition>
</view-state>
<view-state id="reviewDeSelections"
view="/sampleevent/editReviewDeSelections.xhtml">
<transition on="modifySelections" to="displaySavedItems" />
<transition on="saveDeSelections"
to="editSuccessDeSelections">
<action bean="sampleEventEditFormAction"
method="saveDeSelections" />
</transition>
</view-state>
<view-state id="editSuccessDeSelections"
view="/sampleevent/editSuccessDeSelections.xhtml">
<transition on="backToOperationOptions"
to="displayOperationOptions" />
</view-state>
<!-- Cancel/close/Reactive Item Event -->
<view-state id="adminSampleEvent"
view="/sampleevent/adminChooseType.xhtml">
<transition on="submitAdminSelection" to="adminSearchResults">
<action bean="sampleEventAdminFormAction"
method="searchSampleEvents" />
</transition>
</view-state>
<view-state id="adminSearchResults"
view="/sampleevent/adminSearchResults.xhtml">
<transition on="reviewSelections" to="adminReviewSelections">
</transition>
</view-state>
<view-state id="adminReviewSelections"
view="/sampleevent/adminReviewSelections.xhtml">
<render-actions>
<action bean="sampleEventAdminFormAction"
method="reviewUpdates" />
</render-actions>
<transition on="modifySelections" to="adminSearchResults" />
<transition on="saveSelections" to="adminSuccess">
<action bean="sampleEventAdminFormAction"
method="saveSelections" />
</transition>
</view-state>
<view-state id="adminSuccess"
view="/sampleevent/adminSuccess.xhtml">
</view-state>
<!-- View Completed Events -->
<view-state id="viewSampleEvent"
view="/sampleevent/viewSearchCriteria.xhtml">
<transition on="searchSampleEvents"
to="viewDecideShowSearchResults">
<action bean="sampleEventViewFormAction"
method="searchSampleEvents" />
</transition>
</view-state>
<decision-state id="viewDecideShowSearchResults">
<if
test="${flowScope.sampleEventViewForm.numberOfSampleEvents == 1}"
then="viewInfoForSingleSampleEvent"
else="viewSampleEventSearchResults" />
</decision-state>
<!-- when searching returns only one event -->
<view-state id="viewInfoForSingleSampleEvent"
view="/sampleevent/viewInfoForSampleEventID.xhtml">
<transition on="searchItems" to="viewItemsForSampleEventID">
<action bean="sampleEventViewFormAction"
method="searchItemsForSelectedSampleEventId" />
</transition>
<transition on="backToMenuAction" to="menuAction" />
</view-state>
<!-- when user clicks on the ID of event which is a link -->
<view-state id="viewInfoForSampleEventLinkID"
view="/sampleevent/viewInfoForSampleEventID.xhtml">
<transition on="searchItems" to="viewItemsForSampleEventID">
<action bean="sampleEventViewFormAction"
method="searchItemsForSelectedSampleEventId" />
</transition>
<transition on="backToMenuAction" to="menuAction" />
</view-state>
<view-state id="viewItemsForSampleEventID"
view="/sampleevent/viewItemsForSampleEventID.xhtml">
<transition on="backToMenuAction" to="menuAction" />
</view-state>
<view-state id="viewSampleEventSearchResults"
view="/sampleevent/viewSampleEventSearchResults.xhtml">
<transition on="viewInfoForSampleEventLinkID"
to="viewInfoForSampleEventLinkID">
<action bean="sampleEventViewFormAction"
method="searchSampleEventForLinkID" />
</transition>
</view-state>
<end-state id="restart" view="flowRedirect:sampleEvent-flow">
</end-state>
<global-transitions>
<transition on="cancel" to="restart" />
</global-transitions>
<import resource="sampleEvent-beans.xml" />
</flow>
The Sample Bean File
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sampleEventCreateFormAction"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventCreateFormAction"
init-method="init">
<property name="formObjectClass"
value="com.mycompany.myapp.server.webflow.sampleevent.SampleEventCreateForm" />
<property name="formObjectName" value="sampleEventCreateForm" />
<property name="formObjectScope" value="FLOW" />
<property name="propertyEditorRegistrar">
<bean
class="com.mycompany.myapp.server.web.jsf.CommonPropertyEditorRegistrar" />
</property>
<property name="sampleEventBo">
<ref bean="sampleEventBo" />
</property>
</bean>
<bean id="sampleEventEditFormAction"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventEditFormAction"
init-method="init">
<property name="formObjectClass"
value="com.mycompany.myapp.server.webflow.sampleevent.SampleEventEditForm" />
<property name="formObjectName" value="sampleEventEditForm" />
<property name="formObjectScope" value="FLOW" />
<property name="propertyEditorRegistrar">
<bean
class="com.mycompany.myapp.server.web.jsf.CommonPropertyEditorRegistrar" />
</property>
<property name="sampleEventBo">
<ref bean="sampleEventBo" />
</property>
</bean>
<bean id="sampleEventAdminFormAction"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventAdminFormAction"
init-method="init">
<property name="formObjectClass"
value="com.mycompany.myapp.server.webflow.sampleevent.SampleEventAdminForm" />
<property name="formObjectName" value="sampleEventAdminForm" />
<property name="formObjectScope" value="FLOW" />
<property name="propertyEditorRegistrar">
<bean
class="com.mycompany.myapp.server.web.jsf.CommonPropertyEditorRegistrar" />
</property>
<property name="sampleEventBo">
<ref bean="sampleEventBo" />
</property>
</bean>
<bean id="sampleEventViewFormAction"
class="com.mycompany.myapp.server.webflow.sampleevent.SampleEventViewFormAction"
init-method="init">
<property name="formObjectClass"
value="com.mycompany.myapp.server.webflow.sampleevent.SampleEventViewForm" />
<property name="formObjectName" value="sampleEventViewForm" />
<property name="formObjectScope" value="FLOW" />
<property name="propertyEditorRegistrar">
<bean
class="com.mycompany.myapp.server.web.jsf.CommonPropertyEditorRegistrar" />
</property>
<property name="sampleEventBo">
<ref bean="sampleEventBo" />
</property>
</bean>
</beans>
No comments:
Post a Comment