From 6e9cb66ec52cd043e0d5a71ff325d952a3d9d17e Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Tue, 21 Aug 2007 02:57:32 +0000 Subject: [PATCH] polish - added conventions as much as possible for flow moduarlization and naming tweaked package structure --- .../booking-jsf/.springBeans | 6 +- .../booking-jsf/.springWebflow | 6 +- .../src/main/java/META-INF/persistence.xml | 6 +- .../booking-jsf/src/main/java/import.sql | 2 +- .../webflow/samples/booking/SearchAction.java | 46 ----- .../booking/{model => app}/Booking.java | 13 +- .../samples/booking/app/BookingService.java | 16 ++ .../samples/booking/{model => app}/Hotel.java | 9 +- .../{service => app}/JpaBookingService.java | 22 +-- .../samples/booking/{model => app}/User.java | 10 +- .../booking}/ValidateBookingAction.java | 4 +- .../booking/flow/main/MainActions.java | 51 ++++++ .../main/SearchCriteria.java} | 4 +- .../booking/service/BookingService.java | 20 -- .../booking/service/services-config-jpa.xml | 52 ------ .../booking/util/DebuggingPhaseListener.java | 41 ----- .../util}/SerializableListDataModel.java | 2 +- .../config/application-layer-config.xml | 36 ++++ .../src/main/webapp/WEB-INF/faces-config.xml | 4 - .../src/main/webapp/WEB-INF/web.xml | 10 +- .../main/webapp/WEB-INF/webflow-config.xml | 56 ------ .../webapp/flow/booking/booking-beans.xml | 11 ++ .../booking/booking.xml} | 41 +++-- .../webapp/flow/booking/bookingForm.xhtml | 171 ++++++++++++++++++ .../booking/confirmBooking.xhtml} | 0 .../booking/hotelDetails.xhtml} | 9 +- .../src/main/webapp/flow/main/main-beans.xml | 13 ++ .../webapp/{flows => flow}/main/main.xhtml | 43 ++--- .../main/main-flow.xml => flow/main/main.xml} | 35 ++-- .../src/main/webapp/flows/booking/book.xhtml | 162 ----------------- 30 files changed, 409 insertions(+), 492 deletions(-) delete mode 100644 spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/SearchAction.java rename spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/{model => app}/Booking.java (93%) create mode 100755 spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java rename spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/{model => app}/Hotel.java (96%) rename spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/{service => app}/JpaBookingService.java (79%) rename spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/{model => app}/User.java (89%) rename spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/{ => flow/booking}/ValidateBookingAction.java (90%) create mode 100644 spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java rename spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/{HotelSearch.java => flow/main/SearchCriteria.java} (89%) delete mode 100755 spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/BookingService.java delete mode 100755 spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/services-config-jpa.xml delete mode 100644 spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/util/DebuggingPhaseListener.java rename spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/{ => web/util}/SerializableListDataModel.java (96%) create mode 100755 spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/config/application-layer-config.xml delete mode 100755 spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/webflow-config.xml create mode 100755 spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/booking-beans.xml rename spring-webflow-samples/booking-jsf/src/main/webapp/{flows/booking/bookHotel-flow.xml => flow/booking/booking.xml} (63%) create mode 100755 spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/bookingForm.xhtml rename spring-webflow-samples/booking-jsf/src/main/webapp/{flows/booking/confirm.xhtml => flow/booking/confirmBooking.xhtml} (100%) rename spring-webflow-samples/booking-jsf/src/main/webapp/{flows/booking/hotel.xhtml => flow/booking/hotelDetails.xhtml} (91%) create mode 100755 spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main-beans.xml rename spring-webflow-samples/booking-jsf/src/main/webapp/{flows => flow}/main/main.xhtml (79%) rename spring-webflow-samples/booking-jsf/src/main/webapp/{flows/main/main-flow.xml => flow/main/main.xml} (51%) delete mode 100755 spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/book.xhtml diff --git a/spring-webflow-samples/booking-jsf/.springBeans b/spring-webflow-samples/booking-jsf/.springBeans index a291fcdf..359b8990 100755 --- a/spring-webflow-samples/booking-jsf/.springBeans +++ b/spring-webflow-samples/booking-jsf/.springBeans @@ -4,7 +4,8 @@ xml - src/main/webapp/WEB-INF/webflow-config.xml + src/main/webapp/WEB-INF/config/application-layer-config.xml + src/main/webapp/WEB-INF/config/web-application-config.xml @@ -12,7 +13,8 @@ true false - src/main/webapp/WEB-INF/webflow-config.xml + src/main/webapp/WEB-INF/config/application-layer-config.xml + src/main/webapp/WEB-INF/config/web-application-config.xml diff --git a/spring-webflow-samples/booking-jsf/.springWebflow b/spring-webflow-samples/booking-jsf/.springWebflow index 5f10b668..48eb91a1 100755 --- a/spring-webflow-samples/booking-jsf/.springWebflow +++ b/spring-webflow-samples/booking-jsf/.springWebflow @@ -2,8 +2,12 @@ - src/main/webapp/WEB-INF/flows/booking-flow.xml + src/main/webapp/flows/booking/booking-flow.xml + + src/main/webapp/flows/main/main-flow.xml + + diff --git a/spring-webflow-samples/booking-jsf/src/main/java/META-INF/persistence.xml b/spring-webflow-samples/booking-jsf/src/main/java/META-INF/persistence.xml index a104e6ed..4ad486f6 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/META-INF/persistence.xml +++ b/spring-webflow-samples/booking-jsf/src/main/java/META-INF/persistence.xml @@ -5,9 +5,9 @@ version="1.0"> org.hibernate.ejb.HibernatePersistence - org.springframework.webflow.samples.booking.model.User - org.springframework.webflow.samples.booking.model.Booking - org.springframework.webflow.samples.booking.model.Hotel + org.springframework.webflow.samples.booking.app.User + org.springframework.webflow.samples.booking.app.Booking + org.springframework.webflow.samples.booking.app.Hotel diff --git a/spring-webflow-samples/booking-jsf/src/main/java/import.sql b/spring-webflow-samples/booking-jsf/src/main/java/import.sql index b0dea15c..56a353ab 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/import.sql +++ b/spring-webflow-samples/booking-jsf/src/main/java/import.sql @@ -1,4 +1,4 @@ -insert into Customer (username, password, name) values ('springuser', 'barfoo', 'Spring User') +insert into Customer (username, password, name) values ('springer', 'springrocks', 'Spring User') insert into Customer (username, password, name) values ('demo', 'demo', 'Demo User') insert into Hotel (id, price, name, address, city, state, zip, country) values (1, 199, 'Westin Diplomat', '3555 S. Ocean Drive', 'Hollywood', 'FL', '33019', 'USA') insert into Hotel (id, price, name, address, city, state, zip, country) values (2, 120, 'Marriott Courtyard', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA') diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/SearchAction.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/SearchAction.java deleted file mode 100644 index 8410b644..00000000 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/SearchAction.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.util.List; - -import org.springframework.webflow.action.MultiAction; -import org.springframework.webflow.execution.Event; -import org.springframework.webflow.execution.RequestContext; -import org.springframework.webflow.samples.booking.model.Booking; -import org.springframework.webflow.samples.booking.model.Hotel; -import org.springframework.webflow.samples.booking.model.User; -import org.springframework.webflow.samples.booking.service.BookingService; - -public class SearchAction extends MultiAction { - - BookingService bookingService; - - public Event findHotels(RequestContext context) { - HotelSearch search = (HotelSearch) context.getFlowScope().get("hotelSearch"); - List hotels = bookingService - .findHotels(search.getSearchString(), search.getPageSize(), search.getPage()); - if (hotels != null) { - SerializableListDataModel model = new SerializableListDataModel(hotels); - int test = model.getRowCount(); - context.getFlowScope().put("hotels", new SerializableListDataModel(hotels)); - } else { - context.getFlowScope().put("hotels", null); - } - return success(); - } - - public Event findBookings(RequestContext context) { - User user = (User) context.getConversationScope().get("user"); - List bookings = bookingService.findBookings(user); - if (bookings != null) { - context.getFlowScope().put("bookings", new SerializableListDataModel(bookings)); - } else { - context.getFlowScope().put("bookings", null); - } - return success(); - } - - public void setBookingService(BookingService bookingService) { - this.bookingService = bookingService; - } - -} diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/Booking.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/Booking.java similarity index 93% rename from spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/Booking.java rename to spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/Booking.java index ee3980f1..f88ce6fa 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/Booking.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/Booking.java @@ -1,4 +1,4 @@ -package org.springframework.webflow.samples.booking.model; +package org.springframework.webflow.samples.booking.app; import java.io.Serializable; import java.math.BigDecimal; @@ -19,15 +19,25 @@ import javax.persistence.Transient; @Entity public class Booking implements Serializable { private Long id; + private User user; + private Hotel hotel; + private Date checkinDate; + private Date checkoutDate; + private String creditCard; + private String creditCardName; + private int creditCardExpiryMonth; + private int creditCardExpiryYear; + private boolean smoking; + private int beds; public Booking() { @@ -36,7 +46,6 @@ public class Booking implements Serializable { public Booking(Hotel hotel, User user) { this.hotel = hotel; this.user = user; - Calendar calendar = Calendar.getInstance(); setCheckinDate(calendar.getTime()); calendar.add(Calendar.DAY_OF_MONTH, 1); diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java new file mode 100755 index 00000000..2bf431c2 --- /dev/null +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java @@ -0,0 +1,16 @@ +package org.springframework.webflow.samples.booking.app; + +import java.util.List; + +public interface BookingService { + + public List findBookings(String username); + + public List findHotels(String searchString, int pageSize, int page); + + public Hotel findHotelById(Long id); + + public Booking bookHotel(Hotel hotel, User user); + + public void cancelBooking(Long id); +} diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/Hotel.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/Hotel.java similarity index 96% rename from spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/Hotel.java rename to spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/Hotel.java index 4b4dcd12..0b6bda3d 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/Hotel.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/Hotel.java @@ -1,4 +1,4 @@ -package org.springframework.webflow.samples.booking.model; +package org.springframework.webflow.samples.booking.app; import java.io.Serializable; import java.math.BigDecimal; @@ -11,12 +11,19 @@ import javax.persistence.Id; @Entity public class Hotel implements Serializable { private Long id; + private String name; + private String address; + private String city; + private String state; + private String zip; + private String country; + private BigDecimal price; @Id diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/JpaBookingService.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/JpaBookingService.java similarity index 79% rename from spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/JpaBookingService.java rename to spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/JpaBookingService.java index 09334c56..8fe4c0c3 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/JpaBookingService.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/JpaBookingService.java @@ -1,4 +1,4 @@ -package org.springframework.webflow.samples.booking.service; +package org.springframework.webflow.samples.booking.app; import java.util.List; @@ -8,20 +8,22 @@ import javax.persistence.PersistenceContext; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; -import org.springframework.webflow.samples.booking.model.Booking; -import org.springframework.webflow.samples.booking.model.Hotel; -import org.springframework.webflow.samples.booking.model.User; @Repository public class JpaBookingService implements BookingService { private EntityManager em; + @PersistenceContext + public void setEntityManager(EntityManager em) { + this.em = em; + } + @Transactional(readOnly = true) @SuppressWarnings("unchecked") - public List findBookings(User user) { + public List findBookings(String username) { return em.createQuery("select b from Booking b where b.user.username = :username order by b.checkinDate") - .setParameter("username", user.getUsername()).getResultList(); + .setParameter("username", username).getResultList(); } @Transactional(readOnly = true) @@ -36,7 +38,7 @@ public class JpaBookingService implements BookingService { } @Transactional(readOnly = true) - public Hotel readHotelById(Long id) { + public Hotel findHotelById(Long id) { return em.find(Hotel.class, id); } @@ -54,10 +56,4 @@ public class JpaBookingService implements BookingService { em.remove(booking); } } - - @PersistenceContext - public void setEntityManager(EntityManager em) { - this.em = em; - } - } diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/User.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/User.java similarity index 89% rename from spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/User.java rename to spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/User.java index cc4f0078..465c517e 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/model/User.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/User.java @@ -1,4 +1,4 @@ -package org.springframework.webflow.samples.booking.model; +package org.springframework.webflow.samples.booking.app; import java.io.Serializable; @@ -10,18 +10,20 @@ import javax.persistence.Table; @Table(name = "Customer") public class User implements Serializable { private String username; + private String password; + private String name; + public User() { + } + public User(String name, String password, String username) { this.name = name; this.password = password; this.username = username; } - public User() { - } - public String getName() { return name; } diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/ValidateBookingAction.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/booking/ValidateBookingAction.java similarity index 90% rename from spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/ValidateBookingAction.java rename to spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/booking/ValidateBookingAction.java index e9a6a238..011f9353 100644 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/ValidateBookingAction.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/booking/ValidateBookingAction.java @@ -1,4 +1,4 @@ -package org.springframework.webflow.samples.booking; +package org.springframework.webflow.samples.booking.flow.booking; import java.util.Calendar; @@ -8,7 +8,7 @@ import javax.faces.context.FacesContext; import org.springframework.webflow.action.AbstractAction; import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; -import org.springframework.webflow.samples.booking.model.Booking; +import org.springframework.webflow.samples.booking.app.Booking; public class ValidateBookingAction extends AbstractAction { diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java new file mode 100644 index 00000000..7e669b6e --- /dev/null +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java @@ -0,0 +1,51 @@ +package org.springframework.webflow.samples.booking.flow.main; + +import java.util.List; + +import org.springframework.webflow.action.MultiAction; +import org.springframework.webflow.execution.Event; +import org.springframework.webflow.execution.RequestContext; +import org.springframework.webflow.samples.booking.app.Booking; +import org.springframework.webflow.samples.booking.app.BookingService; +import org.springframework.webflow.samples.booking.app.Hotel; +import org.springframework.webflow.samples.booking.app.User; +import org.springframework.webflow.samples.booking.web.util.SerializableListDataModel; + +public class MainActions extends MultiAction { + + private BookingService bookingService; + + public MainActions(BookingService bookingService) { + this.bookingService = bookingService; + } + + public Event initCurrentUser(RequestContext context) { + User user = new User("springer", "springrocks", "Spring User"); + context.getConversationScope().put("user", user); + return success(); + } + + public Event findCurrentUserBookings(RequestContext context) { + User user = (User) context.getConversationScope().get("user"); + List bookings = bookingService.findBookings(user.getName()); + if (bookings != null) { + context.getFlowScope().put("bookings", new SerializableListDataModel(bookings)); + } else { + context.getFlowScope().put("bookings", null); + } + return success(); + } + + public Event findHotels(RequestContext context) { + SearchCriteria search = (SearchCriteria) context.getFlowScope().get("hotelSearch"); + List hotels = bookingService + .findHotels(search.getSearchString(), search.getPageSize(), search.getPage()); + if (hotels != null) { + context.getFlowScope().put("hotels", new SerializableListDataModel(hotels)); + } else { + context.getFlowScope().put("hotels", null); + } + return success(); + } + +} diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/HotelSearch.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/SearchCriteria.java similarity index 89% rename from spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/HotelSearch.java rename to spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/SearchCriteria.java index 19a1f65a..4ce5071f 100755 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/HotelSearch.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/SearchCriteria.java @@ -1,10 +1,10 @@ -package org.springframework.webflow.samples.booking; +package org.springframework.webflow.samples.booking.flow.main; import java.io.Serializable; import javax.faces.event.ActionEvent; -public class HotelSearch implements Serializable { +public class SearchCriteria implements Serializable { private static final long serialVersionUID = 1L; diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/BookingService.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/BookingService.java deleted file mode 100755 index 9fd00efc..00000000 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/BookingService.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.springframework.webflow.samples.booking.service; - -import java.util.List; - -import org.springframework.webflow.samples.booking.model.Booking; -import org.springframework.webflow.samples.booking.model.Hotel; -import org.springframework.webflow.samples.booking.model.User; - -public interface BookingService { - - public List findBookings(User user); - - public List findHotels(String searchString, int pageSize, int page); - - public Hotel readHotelById(Long id); - - public Booking bookHotel(Hotel hotel, User user); - - public void cancelBooking(Long id); -} diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/services-config-jpa.xml b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/services-config-jpa.xml deleted file mode 100755 index 42d5f2cc..00000000 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/service/services-config-jpa.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/util/DebuggingPhaseListener.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/util/DebuggingPhaseListener.java deleted file mode 100644 index 43cd27e8..00000000 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/util/DebuggingPhaseListener.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.springframework.webflow.samples.booking.util; - -import java.util.Map; - -import javax.faces.context.FacesContext; -import javax.faces.event.PhaseEvent; -import javax.faces.event.PhaseId; -import javax.faces.event.PhaseListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class DebuggingPhaseListener implements PhaseListener { - - private static final long serialVersionUID = 1L; - - Log logger = LogFactory.getLog(DebuggingPhaseListener.class); - - public void afterPhase(PhaseEvent event) { - // No-op - - } - - public void beforePhase(PhaseEvent event) { - if (logger.isDebugEnabled()) { - logger.debug("Entering JSF Phase: " + event.getPhaseId()); - - if (event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES) { - Map input = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); - for (Object key : input.keySet()) - logger.debug(key + " : " + input.get(key)); - } - } - - } - - public PhaseId getPhaseId() { - return PhaseId.ANY_PHASE; - } - -} diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/SerializableListDataModel.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/web/util/SerializableListDataModel.java similarity index 96% rename from spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/SerializableListDataModel.java rename to spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/web/util/SerializableListDataModel.java index 00956ed2..93e6dcb6 100644 --- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/SerializableListDataModel.java +++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/web/util/SerializableListDataModel.java @@ -1,4 +1,4 @@ -package org.springframework.webflow.samples.booking; +package org.springframework.webflow.samples.booking.web.util; import java.io.Serializable; import java.util.List; diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/config/application-layer-config.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/config/application-layer-config.xml new file mode 100755 index 00000000..09add3fb --- /dev/null +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/config/application-layer-config.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/faces-config.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/faces-config.xml index 68dbf5f8..acf136c9 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/faces-config.xml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/faces-config.xml @@ -7,8 +7,4 @@ com.sun.facelets.FaceletViewHandler - - - org.springframework.webflow.samples.booking.util.DebuggingPhaseListener - \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml index b64c1b35..df28d08d 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml @@ -7,8 +7,7 @@ contextConfigLocation - classpath:org/springframework/webflow/samples/booking/service/services-config-jpa.xml - /WEB-INF/webflow-config.xml + /WEB-INF/config/web-application-config.xml @@ -18,12 +17,6 @@ .xhtml - - - facelets.DEVELOPMENT - true - - @@ -59,6 +52,7 @@ javax.faces.webapp.FacesServlet 1 + Faces Servlet *.spring diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/webflow-config.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/webflow-config.xml deleted file mode 100755 index 7ee69ce4..00000000 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/webflow-config.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /flows/main/main-flow.xml - /flows/booking/bookHotel-flow.xml - - - - - - - - - - - \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/booking-beans.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/booking-beans.xml new file mode 100755 index 00000000..56141daa --- /dev/null +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/booking-beans.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/bookHotel-flow.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/booking.xml similarity index 63% rename from spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/bookHotel-flow.xml rename to spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/booking.xml index 43ef378f..bca36bb6 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/bookHotel-flow.xml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/booking.xml @@ -9,34 +9,35 @@ - + + + + + + + + + + - - - - - - - - - - + + - - - - - + + + + + - + @@ -47,8 +48,8 @@ - - + + @@ -57,7 +58,7 @@ - + diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/bookingForm.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/bookingForm.xhtml new file mode 100755 index 00000000..be9129c8 --- /dev/null +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/bookingForm.xhtml @@ -0,0 +1,171 @@ + + + + + +
+

Book Hotel

+
+ +
+ + +
+
+
Name:
+
#{hotel.name}
+
+
+
Address:
+
#{hotel.address}
+
+
+
City, State:
+
#{hotel.city}, #{hotel.state}
+
+
+
Zip:
+
#{hotel.zip}
+
+
+
Country:
+
#{hotel.country}
+
+
+
Nightly rate:
+
+ + + +
+
+ +
+
+ Check In Date: +
+
+ + + + + +
+
+ +
+
+ Check Out Date: +
+
+ + + + + +
+
+ +
+
+ Room Preference: +
+
+ + + + + +
+
+ +
+
+ Smoking Preference: +
+
+ + + + + + +
+
+ +
+
+ Credit Card #: +
+
+ + + +
+
+ +
+
+ Credit Card Name: +
+
+ + + +
+
+ +
+
+ Credit Card Expiry: +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+
 
+
+ + +   + +
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/confirm.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/confirmBooking.xhtml similarity index 100% rename from spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/confirm.xhtml rename to spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/confirmBooking.xhtml diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/hotel.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/hotelDetails.xhtml similarity index 91% rename from spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/hotel.xhtml rename to spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/hotelDetails.xhtml index c57e1dc1..9bfee410 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/hotel.xhtml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/booking/hotelDetails.xhtml @@ -5,11 +5,12 @@ xmlns:f="http://java.sun.com/jsf/core" template="/template.xhtml"> - +

View Hotel

+
Name:
@@ -39,12 +40,12 @@
Nightly rate:
- +
+
@@ -55,4 +56,4 @@
- + \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main-beans.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main-beans.xml new file mode 100755 index 00000000..9594fb15 --- /dev/null +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main-beans.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/main/main.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xhtml similarity index 79% rename from spring-webflow-samples/booking-jsf/src/main/webapp/flows/main/main.xhtml rename to spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xhtml index ade80858..adbeffa1 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/main/main.xhtml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xhtml @@ -3,32 +3,19 @@ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" - xmlns:a="https://ajax4jsf.dev.java.net/ajax" template="/template.xhtml"> - - + +
- - -

Search Hotels

- - -   - -   - - - - - +   +
Maximum results:  @@ -39,9 +26,9 @@
-
+
- + Name #{hotel.name} @@ -66,22 +53,20 @@ -
+

Current Hotel Bookings

-
- - +
+ + Name #{booking.hotel.name} @@ -116,7 +101,5 @@
- - - + \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/main/main-flow.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml similarity index 51% rename from spring-webflow-samples/booking-jsf/src/main/webapp/flows/main/main-flow.xml rename to spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml index 33c2eed7..58608590 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/main/main-flow.xml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml @@ -4,28 +4,26 @@ xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd"> - - + - + + + - - - - + - - - - + + + + - - + + - + @@ -37,12 +35,15 @@ - + - + - + + + + \ No newline at end of file diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/book.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/book.xhtml deleted file mode 100755 index fc1eb4b7..00000000 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/flows/booking/book.xhtml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - -
-

Book Hotel

-
-
- - -
-
-
Name:
-
#{hotel.name}
-
-
-
Address:
-
#{hotel.address}
-
-
-
City, State:
-
#{hotel.city}, #{hotel.state}
-
-
-
Zip:
-
#{hotel.zip}
-
-
-
Country:
-
#{hotel.country}
-
-
-
Nightly rate:
-
- - - -
-
- -
-
Check In Date:
-
- - - - - - -
-
- -
-
Check Out Date:
-
- - - - - -
-
- -
-
Room Preference:
-
- - - - - - - -
-
- -
-
Smoking Preference:
-
- - - - - - -
-
- -
-
Credit Card #:
-
- - - -
-
- -
-
Credit Card Name:
-
- - - -
-
- -
-
Credit Card Expiry:
-
- - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
-
-
 
-
- - -   - -
-
-
-
-
-
- -