Sure

addVenue.jpdl.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <pageflow-definition
  |   name="addVenue">
  |    <start-page name="details" 
view-id="/secure/venue/addVenue_details.xhtml">
  |       <transition name="next" to="travel"></transition>
  |       <transition name="cancel" to="cancel"></transition>
  |       <redirect />
  |    </start-page>
  |    <page name="travel" view-id="/secure/venue/addVenue_travel.xhtml">
  |       <transition name="back" to="details"></transition>
  |       <transition name="next" to="documents"></transition>
  |       <transition name="cancel" to="cancel"></transition>
  | 
  |    </page>
  |    <page name="documents" view-id="/secure/venue/addVenue_documents.xhtml">
  |       <transition name="next" to="summary"></transition>
  |       <transition name="back" to="travel"></transition>
  |       <transition name="cancel" to="cancel"></transition>
  |        <redirect />
  |    </page>
  |    <page name="summary" view-id="/secure/venue/addVenue_finish.xhtml">
  |       <transition name="finish" to="nextTask">
  |          <action expression="#{createVenue.create}" />
  |       </transition>
  |       <transition name="back" to="documents"></transition>
  |       <transition name="cancel" to="cancel"></transition>
  |       <redirect />
  |    </page>
  | 
  |    <decision name="nextTask" expression="#{addVenueNextTask}">
  |       <transition name="searchVenues" to="searchVenues"></transition>
  |       <!-- TODO other transitions at end of addVenue wizard
  |    </decision>
  | 
  |    <!--<page name="nextTask" view-id="/secure/venue/searchVenues.xhtml">
  |       <end-conversation />
  |        <redirect />
  |    </page>-->
  | 
  |    <page name="cancel" view-id="/secure/venue/searchVenues.xhtml" >
  |           <end-conversation />
  |            <redirect />
  |    </page>
  | </pageflow-definition>
  | 

CreateClientBean.java

  | @Stateful
  | @Name("createVenue")
  | @Conversational(ifNotBegunOutcome="addVenue")
  | public class CreateVenueBean implements CreateVenue {
  | 
  |         @In (create=true)
  |         private EntityManager smsDatabase;
  | 
  |         @In(create=true)
  |         @Out
  |         private Venue venue;
  | 
  |         @In(create=true)
  |         FacesMessages facesMessages;
  | 
  |         @In(create=true)
  |         private User authenticatedUser;
  | 
  |         private Folder rootFolder;
  | 
  |         // Initialise this to a nice default
  | 
  |         protected final Logger log = Logger.getLogger(this.getClass());
  | 
  |         private String nextTask;
  | 
  |         public String getNextTask() {
  |                 return nextTask;
  |         }
  | 
  |         public void setNextTask(String nextTask) {
  |                 this.nextTask = nextTask;
  |         }
  | 
  |         @Create
  |         @Begin(pageflow="addVenue", join=true)
  |         public void begin() {
  |                 /*
  |                  * Start the pageflow
  |                  */
  |                 log.info("Creating venue");
  | 
  |                 // Next Task default
  |                 nextTask = "searchVenues";
  | 
  |                 if (venue == null) return;
  |                 rootFolder = venue.getRootFolder();
  | 
  |                 log.info("Root folder: " + rootFolder);
  | 
  |                 // Hmm, having real issues outjecting the root folder
  |                 Contexts.getConversationContext().set("rootFolder", 
rootFolder);
  | 
  |         }
  | 
  |         @End
  |         public void create() {
  |                 venue.setBranch(authenticatedUser.getBranch());
  |                 log.info("Next task: " + nextTask);
  |                 smsDatabase.persist(venue);
  |                
facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO, 
"screen.addVenue.create");
  |                 Contexts.getSessionContext().set("addVenueNextTask", 
nextTask);
  |         }
  | 
  |         @Destroy @Remove
  |         public void destroy() {
  | 
  |         }
  | 
  |         public void instantiate() {
  |         }
  | 
  | }
  | 

As you can see I outject the addVenueNextTask variable to the session scope so 
it is available for the decision (and from the stacktrace above the correct 
transition is selected)

Below is the relevant JSF navigation file

main.xml

  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <!DOCTYPE faces-config
  | PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
  |                                                          
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>
  | <faces-config>
  | 
  |         <navigation-rule>
  |                 <!-- Navigation rules for venues -->
  |                 <navigation-case>
  |                         <from-outcome>editVenue</from-outcome>
  |                         
<to-view-id>/secure/venue/editVenue.xhtml</to-view-id>
  | 
  |                 </navigation-case>
  |                 <navigation-case>
  |                         <from-outcome>searchVenues</from-outcome>
  |                         
<to-view-id>/secure/venue/searchVenues.xhtml</to-view-id>
  |                          <redirect />
  |                 </navigation-case>
  |                 <navigation-case>
  |                         <from-outcome>addVenue</from-outcome>
  |                         
<to-view-id>/secure/venue/addVenue_details.xhtml</to-view-id>
  |                          <redirect />
  |                 </navigation-case>
  |         </navigation-rule>
  | ...
  | </faces-config>
  | 

>From the docs/forum I don't think what I'm trying to do is supported currently 
>- so I'm really asking whether it will be at some point (I can try to create a 
>patch for it if wanted) or if not whether there is another way to do what I'm 
>trying to do.

If I've forgotten to post any code let me know :)

Thanks

Peter


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3944856#3944856

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3944856


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to