[seam-commits] Seam SVN: r10753 - examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sat May 2 02:35:28 EDT 2009


Author: dan.j.allen
Date: 2009-05-02 02:35:28 -0400 (Sat, 02 May 2009)
New Revision: 10753

Modified:
   examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java
   examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java
Log:
got event to work to add new booking to history list


Modified: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java	2009-05-02 06:17:44 UTC (rev 10752)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java	2009-05-02 06:35:28 UTC (rev 10753)
@@ -31,8 +31,10 @@
 import javax.context.RequestScoped;
 import javax.ejb.Remove;
 import javax.ejb.Stateful;
+import javax.inject.AnnotationLiteral;
 import javax.inject.Current;
 import javax.inject.Produces;
+import javax.inject.manager.Manager;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 import org.jboss.seam.examples.booking.account.Registered;
@@ -63,6 +65,7 @@
    @Registered User user;
 
    //@Fires @Confirmed Event<BookingEvent> bookingConfirmedEvent;
+   @Current Manager manager;
 
    private Hotel hotelSelection;
 
@@ -113,7 +116,9 @@
    public void confirm()
    {
       em.persist(booking);
+      // FIXME can't inject event object into bean with passivating scope
       //bookingConfirmedEvent.fire(new BookingEvent(booking));
+      manager.fireEvent(new BookingEvent(booking), new AnnotationLiteral<Confirmed>() {});
       log.info("New booking at the {0} confirmed for {1}", booking.getHotel().getName(), booking.getUser().getName());
       statusMessages.add("You're booked!");
       conversation.end();

Modified: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java	2009-05-02 06:17:44 UTC (rev 10752)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java	2009-05-02 06:35:28 UTC (rev 10753)
@@ -51,7 +51,7 @@
       return bookingsForUser;
    }
 
-   // TODO should probably observe after transaction success
+   // TODO should probably observe @AfterTransactionSuccess (but it is broken)
    public void afterBookingConfirmed(@Observes @Confirmed BookingEvent bookingEvent)
    {
       getBookingsForCurrentUser();




More information about the seam-commits mailing list