From a1889ad93f47f20a31bc184a85cbfb09071b033b Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 6 Feb 2018 22:26:40 -0500 Subject: [PATCH] Drop portlet samples Preparation for upgrade to SFW 5.0 and SWF 2.5. --- .../main/webapp/WEB-INF/faces-config.pageflow | 2 - booking-portlet-faces/build.xml | 11 - booking-portlet-faces/pom.xml | 125 ----------- booking-portlet-faces/readme.txt | 8 - .../webflow/samples/booking/Booking.java | 198 ------------------ .../samples/booking/BookingService.java | 59 ------ .../webflow/samples/booking/Hotel.java | 110 ---------- .../samples/booking/JpaBookingService.java | 93 -------- .../samples/booking/ReferenceData.java | 83 -------- .../samples/booking/SearchCriteria.java | 66 ------ .../webflow/samples/booking/User.java | 62 ------ .../samples/booking/ViewFlowHandler.java | 11 - .../main/resources/META-INF/persistence.xml | 18 -- .../src/main/resources/import.sql | 28 --- .../src/main/resources/logback.xml | 20 -- .../webapp/WEB-INF/classes/log4j.properties | 11 - .../WEB-INF/config/application-config.xml | 44 ---- .../config/hotelbooking-portlet-config.xml | 59 ------ .../src/main/webapp/WEB-INF/faces-config.xml | 12 -- .../webapp/WEB-INF/flows/booking/booking.xml | 31 --- .../flows/booking/enterBookingDetails.xhtml | 122 ----------- .../WEB-INF/flows/booking/reviewBooking.xhtml | 74 ------- .../flows/main/enterSearchCriteria.xhtml | 77 ------- .../main/webapp/WEB-INF/flows/main/main.xml | 48 ----- .../WEB-INF/flows/main/reviewHotel.xhtml | 52 ----- .../WEB-INF/flows/main/reviewHotels.xhtml | 48 ----- .../webapp/WEB-INF/flows/view/intro.xhtml | 35 ---- .../main/webapp/WEB-INF/flows/view/view.xml | 16 -- .../src/main/webapp/WEB-INF/portlet.xml | 40 ---- .../src/main/webapp/WEB-INF/web.xml | 65 ------ .../src/test/java/.gitignore | 0 .../src/test/resources/.gitignore | 0 booking-portlet-mvc/build.xml | 11 - booking-portlet-mvc/pom.xml | 136 ------------ .../webflow/samples/booking/Booking.java | 192 ----------------- .../samples/booking/BookingDateRange.java | 22 -- .../booking/BookingDateRangeValidator.java | 19 -- .../samples/booking/BookingService.java | 59 ------ .../samples/booking/BookingValidator.java | 31 --- .../webflow/samples/booking/Hotel.java | 107 ---------- .../samples/booking/JpaBookingService.java | 93 -------- .../samples/booking/SearchCriteria.java | 68 ------ .../webflow/samples/booking/User.java | 59 ------ .../samples/booking/ViewFlowHandler.java | 11 - .../main/resources/META-INF/persistence.xml | 18 -- .../src/main/resources/import.sql | 28 --- .../src/main/resources/logback.xml | 20 -- .../src/main/webapp/META-INF/MANIFEST.MF | 2 - .../webapp/WEB-INF/classes/log4j.properties | 11 - .../WEB-INF/config/application-config.xml | 44 ---- .../config/hotelbooking-portlet-config.xml | 49 ----- .../webapp/WEB-INF/flows/booking/booking.xml | 31 --- .../flows/booking/enterBookingDetails.jsp | 142 ------------- .../WEB-INF/flows/booking/messages.properties | 16 -- .../WEB-INF/flows/booking/reviewBooking.jsp | 65 ------ .../flows/main/enterSearchCriteria.jsp | 64 ------ .../main/webapp/WEB-INF/flows/main/main.xml | 55 ----- .../webapp/WEB-INF/flows/main/reviewHotel.jsp | 53 ----- .../WEB-INF/flows/main/reviewHotels.jsp | 63 ------ .../main/webapp/WEB-INF/flows/view/intro.jsp | 28 --- .../main/webapp/WEB-INF/flows/view/view.xml | 16 -- .../src/main/webapp/WEB-INF/portlet.xml | 40 ---- .../src/main/webapp/WEB-INF/web.xml | 54 ----- booking-portlet-mvc/src/test/java/.gitignore | 0 .../src/test/resources/log4j.properties | 9 - pom.xml | 2 - 66 files changed, 3246 deletions(-) delete mode 100644 booking-portlet-faces/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow delete mode 100644 booking-portlet-faces/build.xml delete mode 100644 booking-portlet-faces/pom.xml delete mode 100644 booking-portlet-faces/readme.txt delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/BookingService.java delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/User.java delete mode 100644 booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java delete mode 100644 booking-portlet-faces/src/main/resources/META-INF/persistence.xml delete mode 100644 booking-portlet-faces/src/main/resources/import.sql delete mode 100644 booking-portlet-faces/src/main/resources/logback.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/classes/log4j.properties delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/config/application-config.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/faces-config.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/booking.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/main.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/intro.xhtml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/view.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/portlet.xml delete mode 100644 booking-portlet-faces/src/main/webapp/WEB-INF/web.xml delete mode 100644 booking-portlet-faces/src/test/java/.gitignore delete mode 100644 booking-portlet-faces/src/test/resources/.gitignore delete mode 100644 booking-portlet-mvc/build.xml delete mode 100644 booking-portlet-mvc/pom.xml delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRange.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRangeValidator.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingService.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingValidator.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Hotel.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/User.java delete mode 100644 booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java delete mode 100644 booking-portlet-mvc/src/main/resources/META-INF/persistence.xml delete mode 100644 booking-portlet-mvc/src/main/resources/import.sql delete mode 100644 booking-portlet-mvc/src/main/resources/logback.xml delete mode 100644 booking-portlet-mvc/src/main/webapp/META-INF/MANIFEST.MF delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/classes/log4j.properties delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/config/application-config.xml delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.jsp delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/messages.properties delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/reviewBooking.jsp delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.jsp delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/main.xml delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotel.jsp delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotels.jsp delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/intro.jsp delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/view.xml delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/portlet.xml delete mode 100644 booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml delete mode 100644 booking-portlet-mvc/src/test/java/.gitignore delete mode 100644 booking-portlet-mvc/src/test/resources/log4j.properties diff --git a/booking-portlet-faces/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/booking-portlet-faces/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow deleted file mode 100644 index 60c2b79..0000000 --- a/booking-portlet-faces/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/booking-portlet-faces/build.xml b/booking-portlet-faces/build.xml deleted file mode 100644 index e27197c..0000000 --- a/booking-portlet-faces/build.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/booking-portlet-faces/pom.xml b/booking-portlet-faces/pom.xml deleted file mode 100644 index 195131a..0000000 --- a/booking-portlet-faces/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - 4.0.0 - org.springframework.webflow.samples - booking-portlet-faces - war - Hotel Booking : Spring Portlet MVC + Web Flow + JSF - 1.0.0.BUILD-SNAPSHOT - - - org.springframework.webflow - spring-webflow-samples - 1.0.0.BUILD-SNAPSHOT - - - - - - org.springframework - spring-webmvc - - - org.springframework - spring-jdbc - - - org.springframework - spring-orm - - - org.springframework - spring-webmvc-portlet - - - org.springframework.webflow - spring-faces - ${webflow.version} - - - - javax.servlet - javax.servlet-api - ${servlet.version} - provided - - - javax.portlet - portlet-api - 2.0 - provided - - - - com.sun.faces - jsf-api - ${mojarra.version} - - - com.sun.faces - jsf-impl - ${mojarra.version} - - - - org.hsqldb - hsqldb - ${hsqldb.version} - runtime - - - org.hibernate - hibernate-entitymanager - ${hibernate.version} - - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - - javax.xml.bind - jaxb-api - ${jaxb.version} - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - jul-to-slf4j - ${slf4j.version} - - - ch.qos.logback - logback-classic - ${logback.version} - - - - - booking-portlet-faces - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - - diff --git a/booking-portlet-faces/readme.txt b/booking-portlet-faces/readme.txt deleted file mode 100644 index 323a081..0000000 --- a/booking-portlet-faces/readme.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Starting with version 2.2, Spring Web Flow provides support for JSF Portlets using its own internal -Portlet integration rather than a Portlet Bridge for JSF. - -This sample demonstrates that support. It has been tested on Apache Pluto 2.0.1 with Portlet -API 2.0 and JSF 1.2 (both Mojarra and MyFaces). - -See the reference documentation for more information. diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java deleted file mode 100644 index 07db3df..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java +++ /dev/null @@ -1,198 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.text.DateFormat; -import java.util.Calendar; -import java.util.Date; - -import javax.persistence.Basic; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; - -import org.springframework.binding.message.MessageBuilder; -import org.springframework.binding.message.MessageContext; - -/** - * A Hotel Booking made by a User. - */ -@Entity -public class Booking implements Serializable { - - private static final long serialVersionUID = 1171567558348174963L; - - 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() { - } - - 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); - setCheckoutDate(calendar.getTime()); - } - - @Transient - public BigDecimal getTotal() { - return hotel.getPrice().multiply(new BigDecimal(getNights())); - } - - @Transient - public int getNights() { - return (int) (checkoutDate.getTime() - checkinDate.getTime()) / 1000 / 60 / 60 / 24; - } - - @Id - @GeneratedValue(strategy = GenerationType.TABLE) - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - @Basic - @Temporal(TemporalType.DATE) - public Date getCheckinDate() { - return checkinDate; - } - - public void setCheckinDate(Date datetime) { - this.checkinDate = datetime; - } - - @ManyToOne - public Hotel getHotel() { - return hotel; - } - - public void setHotel(Hotel hotel) { - this.hotel = hotel; - } - - @ManyToOne - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - @Basic - @Temporal(TemporalType.DATE) - public Date getCheckoutDate() { - return checkoutDate; - } - - public void setCheckoutDate(Date checkoutDate) { - this.checkoutDate = checkoutDate; - } - - public String getCreditCard() { - return creditCard; - } - - public void setCreditCard(String creditCard) { - this.creditCard = creditCard; - } - - @Transient - public String getDescription() { - DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); - return hotel == null ? null : hotel.getName() + ", " + df.format(getCheckinDate()) + " to " - + df.format(getCheckoutDate()); - } - - public boolean isSmoking() { - return smoking; - } - - public void setSmoking(boolean smoking) { - this.smoking = smoking; - } - - public int getBeds() { - return beds; - } - - public void setBeds(int beds) { - this.beds = beds; - } - - public String getCreditCardName() { - return creditCardName; - } - - public void setCreditCardName(String creditCardName) { - this.creditCardName = creditCardName; - } - - public int getCreditCardExpiryMonth() { - return creditCardExpiryMonth; - } - - public void setCreditCardExpiryMonth(int creditCardExpiryMonth) { - this.creditCardExpiryMonth = creditCardExpiryMonth; - } - - public int getCreditCardExpiryYear() { - return creditCardExpiryYear; - } - - public void setCreditCardExpiryYear(int creditCardExpiryYear) { - this.creditCardExpiryYear = creditCardExpiryYear; - } - - public boolean validate(MessageContext context) { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DAY_OF_MONTH, -1); - boolean valid = true; - if (checkinDate.before(calendar.getTime())) { - context.addMessage(new MessageBuilder().error().source("checkinDate").defaultText( - "Check in date must be a future date").build()); - valid = false; - } else if (!checkinDate.before(checkoutDate)) { - context.addMessage(new MessageBuilder().error().source("checkoutDate").defaultText( - "Check out date must be later than check in date").build()); - valid = false; - } - return valid; - } - - @Override - public String toString() { - return "Booking(" + user + "," + hotel + ")"; - } - -} diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/BookingService.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/BookingService.java deleted file mode 100644 index 59a333f..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/BookingService.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.util.List; - -/** - * A service interface for retrieving hotels and bookings from a backing repository. Also supports the ability to cancel - * a booking. - */ -public interface BookingService { - - /** - * Find bookings made by the given user - * @param username the user's name - * @return their bookings - */ - public List findBookings(String username); - - /** - * Find hotels available for booking by some criteria. - * @param criteria the search criteria - * @return a list of hotels meeting the criteria - */ - public List findHotels(SearchCriteria criteria); - - /** - * Find hotels by their identifier. - * @param id the hotel id - * @return the hotel - */ - public Hotel findHotelById(Long id); - - /** - * Find user by their username. - * @param username the user's username - * @return the user - */ - public User findUser(String username); - - /** - * Create a new, transient hotel booking instance for the given user. - * @param hotelId the hotelId - * @param userName the user name - * @return the new transient booking instance - */ - public Booking createBooking(Long hotelId, String userName); - - /** - * Persist the booking to the database - * @param booking the booking - */ - public void persistBooking(Booking booking); - - /** - * Cancel an existing booking. - * @param id the booking id - */ - public void cancelBooking(Booking booking); - -} diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java deleted file mode 100644 index 3715a98..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -/** - * A hotel where users may book stays. - */ -@Entity -public class Hotel implements Serializable { - - private static final long serialVersionUID = 4011346719502656269L; - - 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 - @GeneratedValue - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getZip() { - return zip; - } - - public void setZip(String zip) { - this.zip = zip; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Column(precision = 6, scale = 2) - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public Booking createBooking(User user) { - return new Booking(this, user); - } - - @Override - public String toString() { - return "Hotel(" + name + "," + address + "," + city + "," + zip + ")"; - } -} diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java deleted file mode 100644 index b530411..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -import org.springframework.stereotype.Repository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -/** - * A JPA-based implementation of the Booking Service. Delegates to a JPA entity manager to issue data access calls - * against the backing repository. The EntityManager reference is provided by the managing container (Spring) - * automatically. - */ -@Service("bookingService") -@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(String username) { - if (username != null) { - return em.createQuery("select b from Booking b where b.user.username = :username order by b.checkinDate") - .setParameter("username", username).getResultList(); - } else { - return null; - } - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public List findHotels(SearchCriteria criteria) { - String pattern = getSearchPattern(criteria); - return em - .createQuery( - "select h from Hotel h where lower(h.name) like :pattern or lower(h.city) like :pattern " - + " or lower(h.zip) like :pattern or lower(h.address) like :pattern") - .setParameter("pattern", pattern).setMaxResults(criteria.getPageSize()) - .setFirstResult(criteria.getPage() * criteria.getPageSize()).getResultList(); - } - - @Transactional(readOnly = true) - public Hotel findHotelById(Long id) { - return em.find(Hotel.class, id); - } - - @Transactional(readOnly = true) - public User findUser(String username) { - return (User) em.createQuery("select u from User u where u.username = :username") - .setParameter("username", username).getSingleResult(); - } - - @Transactional(readOnly = true) - public Booking createBooking(Long hotelId, String username) { - Hotel hotel = em.find(Hotel.class, hotelId); - User user = findUser(username); - return new Booking(hotel, user); - } - - @Transactional - public void persistBooking(Booking booking) { - em.persist(booking); - } - - @Transactional - public void cancelBooking(Booking booking) { - booking = em.find(Booking.class, booking.getId()); - if (booking != null) { - em.remove(booking); - } - } - - // helpers - - private String getSearchPattern(SearchCriteria criteria) { - if (StringUtils.hasText(criteria.getSearchString())) { - return "%" + criteria.getSearchString().toLowerCase().replace('*', '%') + "%"; - } else { - return "%"; - } - } - -} \ No newline at end of file diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java deleted file mode 100644 index 4c499aa..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.util.ArrayList; -import java.util.List; - -import javax.faces.model.SelectItem; - -import org.springframework.stereotype.Service; - -@Service -public class ReferenceData { - - private List bedOptions; - - private List smokingOptions; - - private List creditCardExpMonths; - - private List creditCardExpYears; - - private List pageSizeOptions; - - public List getBedOptions() { - if (bedOptions == null) { - bedOptions = new ArrayList(); - bedOptions.add(new SelectItem(new Integer(1), "One king-size bed")); - bedOptions.add(new SelectItem(new Integer(2), "Two double beds")); - bedOptions.add(new SelectItem(new Integer(3), "Three beds")); - } - return bedOptions; - } - - public List getSmokingOptions() { - if (smokingOptions == null) { - smokingOptions = new ArrayList(); - smokingOptions.add(new SelectItem(Boolean.TRUE, "Smoking")); - smokingOptions.add(new SelectItem(Boolean.FALSE, "Non-Smoking")); - } - return smokingOptions; - } - - public List getCreditCardExpMonths() { - if (creditCardExpMonths == null) { - creditCardExpMonths = new ArrayList(); - creditCardExpMonths.add(new SelectItem(new Integer(1), "Jan")); - creditCardExpMonths.add(new SelectItem(new Integer(2), "Feb")); - creditCardExpMonths.add(new SelectItem(new Integer(3), "Mar")); - creditCardExpMonths.add(new SelectItem(new Integer(4), "Apr")); - creditCardExpMonths.add(new SelectItem(new Integer(5), "May")); - creditCardExpMonths.add(new SelectItem(new Integer(6), "Jun")); - creditCardExpMonths.add(new SelectItem(new Integer(7), "Jul")); - creditCardExpMonths.add(new SelectItem(new Integer(8), "Aug")); - creditCardExpMonths.add(new SelectItem(new Integer(9), "Sep")); - creditCardExpMonths.add(new SelectItem(new Integer(10), "Oct")); - creditCardExpMonths.add(new SelectItem(new Integer(11), "Nov")); - creditCardExpMonths.add(new SelectItem(new Integer(12), "Dec")); - } - return creditCardExpMonths; - } - - public List getCreditCardExpYears() { - if (creditCardExpYears == null) { - creditCardExpYears = new ArrayList(); - creditCardExpYears.add(new SelectItem(new Integer(2008), "2008")); - creditCardExpYears.add(new SelectItem(new Integer(2009), "2009")); - creditCardExpYears.add(new SelectItem(new Integer(2010), "2010")); - creditCardExpYears.add(new SelectItem(new Integer(2010), "2011")); - creditCardExpYears.add(new SelectItem(new Integer(2010), "2012")); - } - return creditCardExpYears; - } - - public List getPageSizeOptions() { - if (pageSizeOptions == null) { - pageSizeOptions = new ArrayList(); - pageSizeOptions.add(new SelectItem(new Integer(5), "5")); - pageSizeOptions.add(new SelectItem(new Integer(10), "10")); - pageSizeOptions.add(new SelectItem(new Integer(20), "20")); - } - return pageSizeOptions; - } - -} diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java deleted file mode 100644 index 0a1b92d..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; - -/** - * A backing bean for the main hotel search form. Encapsulates the criteria needed to perform a hotel search. - */ -public class SearchCriteria implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * The user-provided search criteria for finding Hotels. - */ - private String searchString = ""; - - /** - * The maximum page size of the Hotel result list - */ - private int pageSize = 5; - - /** - * The current page of the Hotel result list. - */ - private int page; - - public String getSearchString() { - return searchString; - } - - public void setSearchString(String searchString) { - this.searchString = searchString; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public void nextPage() { - page++; - } - - public void previousPage() { - page--; - } - - public void resetPage() { - page = 0; - } - - public String toString() { - return "[Search Criteria searchString = '" + searchString + "'"; - } -} \ No newline at end of file diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/User.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/User.java deleted file mode 100644 index 2a5d0a5..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/User.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * A user who can book hotels. - */ -@Entity -@Table(name = "Customer") -public class User implements Serializable { - - private static final long serialVersionUID = -3652559447682574722L; - - private String username; - - private String password; - - private String name; - - public User() { - } - - public User(String username, String password, String name) { - this.username = username; - this.password = password; - this.name = name; - } - - @Id - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return "User(" + username + ")"; - } -} diff --git a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java b/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java deleted file mode 100644 index 27a4280..0000000 --- a/booking-portlet-faces/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import org.springframework.webflow.mvc.portlet.AbstractFlowHandler; - -public class ViewFlowHandler extends AbstractFlowHandler { - - public String getFlowId() { - return "view"; - } - -} diff --git a/booking-portlet-faces/src/main/resources/META-INF/persistence.xml b/booking-portlet-faces/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 498b08c..0000000 --- a/booking-portlet-faces/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - org.hibernate.ejb.HibernatePersistence - org.springframework.webflow.samples.booking.User - org.springframework.webflow.samples.booking.Booking - org.springframework.webflow.samples.booking.Hotel - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/resources/import.sql b/booking-portlet-faces/src/main/resources/import.sql deleted file mode 100644 index 9c156ed..0000000 --- a/booking-portlet-faces/src/main/resources/import.sql +++ /dev/null @@ -1,28 +0,0 @@ -insert into Customer (username, name) values ('keith', 'Keith') -insert into Customer (username, name) values ('erwin', 'Erwin') -insert into Customer (username, name) values ('jeremy', 'Jeremy') -insert into Customer (username, name) values ('scott', 'Scott') -insert into Customer (username, name) values ('pluto', 'Pluto') -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, 60, 'Jameson Inn', '890 Palm Bay Rd NE', 'Palm Bay', 'FL', '32905', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (3, 199, 'Chilworth Manor', 'The Cottage, Southampton Business Park', 'Southampton', 'Hants', 'SO16 7JF', 'UK') -insert into Hotel (id, price, name, address, city, state, zip, country) values (4, 120, 'Marriott Courtyard', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (5, 180, 'Doubletree', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (6, 450, 'W Hotel', 'Union Square, Manhattan', 'NY', 'NY', '10011', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (7, 450, 'W Hotel', 'Lexington Ave, Manhattan', 'NY', 'NY', '10011', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (8, 250, 'Hotel Rouge', '1315 16th Street NW', 'Washington', 'DC', '20036', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (9, 300, '70 Park Avenue Hotel', '70 Park Avenue', 'NY', 'NY', '10011', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (10, 300, 'Conrad Miami', '1395 Brickell Ave', 'Miami', 'FL', '33131', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (11, 80, 'Sea Horse Inn', '2106 N Clairemont Ave', 'Eau Claire', 'WI', '54703', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (12, 90, 'Super 8 Eau Claire Campus Area', '1151 W Macarthur Ave', 'Eau Claire', 'WI', '54701', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (13, 160, 'Marriot Downtown', '55 Fourth Street', 'San Francisco', 'CA', '94103', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (14, 200, 'Hilton Diagonal Mar', 'Passeig del Taulat 262-264', 'Barcelona', 'Catalunya', '08019', 'Spain') -insert into Hotel (id, price, name, address, city, state, zip, country) values (15, 210, 'Hilton Tel Aviv', 'Independence Park', 'Tel Aviv', '', '63405', 'Israel') -insert into Hotel (id, price, name, address, city, state, zip, country) values (16, 240, 'InterContinental Tokyo Bay', 'Takeshiba Pier', 'Tokyo', '', '105', 'Japan') -insert into Hotel (id, price, name, address, city, state, zip, country) values (17, 130, 'Hotel Beaulac', ' Esplanade Léopold-Robert 2', 'Neuchatel', '', '2000', 'Switzerland') -insert into Hotel (id, price, name, address, city, state, zip, country) values (18, 140, 'Conrad Treasury Place', 'William & George Streets', 'Brisbane', 'QLD', '4001', 'Australia') -insert into Hotel (id, price, name, address, city, state, zip, country) values (19, 230, 'Ritz Carlton', '1228 Sherbrooke St', 'West Montreal', 'Quebec', 'H3G1H6', 'Canada') -insert into Hotel (id, price, name, address, city, state, zip, country) values (20, 460, 'Ritz Carlton', 'Peachtree Rd, Buckhead', 'Atlanta', 'GA', '30326', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (21, 220, 'Swissotel', '68 Market Street', 'Sydney', 'NSW', '2000', 'Australia') -insert into Hotel (id, price, name, address, city, state, zip, country) values (22, 250, 'Meliá White House', 'Albany Street', 'Regents Park London', '', 'NW13UP', 'Great Britain') -insert into Hotel (id, price, name, address, city, state, zip, country) values (23, 210, 'Hotel Allegro', '171 West Randolph Street', 'Chicago', 'IL', '60601', 'USA') \ No newline at end of file diff --git a/booking-portlet-faces/src/main/resources/logback.xml b/booking-portlet-faces/src/main/resources/logback.xml deleted file mode 100644 index 1202bc6..0000000 --- a/booking-portlet-faces/src/main/resources/logback.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/classes/log4j.properties b/booking-portlet-faces/src/main/webapp/WEB-INF/classes/log4j.properties deleted file mode 100644 index 992d816..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/classes/log4j.properties +++ /dev/null @@ -1,11 +0,0 @@ -log4j.rootCategory=INFO, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n - -# Enable web flow logging -log4j.category.org.springframework.webflow=DEBUG -log4j.category.org.springframework.faces=DEBUG -log4j.category.org.springframework.binding=DEBUG -log4j.category.org.springframework.transaction=DEBUG \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/config/application-config.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/config/application-config.xml deleted file mode 100644 index 1eef69a..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/config/application-config.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml deleted file mode 100644 index 4f99f72..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/faces-config.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/faces-config.xml deleted file mode 100644 index ecf53ef..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/faces-config.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - org.springframework.faces.webflow.context.portlet.PortletViewHandler - - - diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/booking.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/booking.xml deleted file mode 100644 index a3abd47..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/booking.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml deleted file mode 100644 index 982cda9..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.xhtml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -

Book Hotel

- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:#{booking.hotel.name}
Address:#{booking.hotel.address}
City, State:#{booking.hotel.city}, #{booking.hotel.state}
Zip:#{booking.hotel.zip}
Country:#{booking.hotel.country}
Nightly rate: - - - -
- Check In Date: - - - - -
- Check Out Date: - - - - -
- Room Preference: - - - - -
- Smoking Preference: - - - - -
- Credit Card #: - - -
- Credit Card Name: - - -
- Expiration Date: - - - - - - - -
-   - -
-
-
- -
-
\ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml deleted file mode 100644 index 57c610b..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/booking/reviewBooking.xhtml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - -

Confirm Hotel Booking

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:#{booking.hotel.name}
Address:#{booking.hotel.address}
City, State:#{booking.hotel.city}, #{booking.hotel.state}
Zip:#{booking.hotel.zip}
Country:#{booking.hotel.country}
Total payment: - - - -
Check In Date: - - - -
Check Out Date: - - - -
Credit Card #:#{booking.creditCard}
-   -   - -
-
-
- -
-
\ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml deleted file mode 100644 index 9b559b5..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.xhtml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - -
-

Search Hotels

- - - - -
-
-
- Search String: - -
-
- Maximum results: - - - -
-
- -
-
-
-
-
- -
- -

Current Hotel Bookings

- - - - Name - #{booking.hotel.name} - - - Address - #{booking.hotel.address} - - - City, State - #{booking.hotel.city}, #{booking.hotel.state} - - - Check in date - - - - - - Check out date - - - - - - Confirmation number - #{booking.id} - - - Action - - - -
-
- -
-
\ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/main.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/main.xml deleted file mode 100644 index 2c79820..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/main.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml deleted file mode 100644 index 9517b4a..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotel.xhtml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - -

View Hotel

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:#{hotel.name}
Address:#{hotel.address}
City:#{hotel.city}
State:#{hotel.state}
Zip:#{hotel.zip}
Country:#{hotel.country}
Nightly rate: - - - -
- - - -   - - - -
-
\ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml deleted file mode 100644 index 95cc409..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/main/reviewHotels.xhtml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - -

Hotel Results

-

- -

-
- - - - Name - #{hotel.name} - - - Address - #{hotel.address} - - - City, State - #{hotel.city}, #{hotel.state}, #{hotel.country} - - - Zip - #{hotel.zip} - - - Action - - - - - -
-
- -
-
\ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/intro.xhtml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/intro.xhtml deleted file mode 100644 index b9b064e..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/intro.xhtml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - -

Welcome to Spring Travel

-

- This reference application illustrates Spring Faces, - a software library that integrates Spring and JavaServerFaces technology in a portlet environment. -

-

- The key features illustrated in this sample include: -

-
    -
  • A declarative navigation model enabling full browser button support and dynamic navigation rules
  • -
  • A fine-grained state management model, including support for ConversationScope and ViewScope
  • -
  • Modularization of web application functionality by domain use case, illustrating project structure best-practices
  • -
  • Managed persistence contexts with the Java Persistence API (JPA)
  • -
  • Unified Expression Language (EL) integration
  • -
  • Declarative page authoring with Facelets, including applying reusable page layouts
  • -
  • Exception handling support across all layers of the application
  • -
  • Spring IDE tooling integration, with support for graphical flow modeling and visualization
  • -
-

- - Start your Spring Travel experience - -

- -
-
\ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/view.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/view.xml deleted file mode 100644 index 71d0044..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/flows/view/view.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/portlet.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/portlet.xml deleted file mode 100644 index 2294d94..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/portlet.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - swf-booking-faces - Spring Webflow Booking Faces - - - org.springframework.web.portlet.DispatcherPortlet - - - - contextConfigLocation - - /WEB-INF/config/hotelbooking-portlet-config.xml - - - - - viewRendererUrl - /WEB-INF/servlet/view - - - 0 - - - text/html - view - - - - Spring Webflow Booking Faces - - - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/main/webapp/WEB-INF/web.xml b/booking-portlet-faces/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 1ad5682..0000000 --- a/booking-portlet-faces/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - contextConfigLocation - - /WEB-INF/config/application-config.xml - - - - - - javax.faces.DEFAULT_SUFFIX - .xhtml - - - - - facelets.DEVELOPMENT - true - - - - - facelets.REFRESH_PERIOD - 1 - - - - org.springframework.web.context.ContextLoaderListener - - - - - swf-booking-faces - org.apache.pluto.container.driver.PortletServlet - - portlet-name - swf-booking-faces - - 1 - - - - swf-booking-faces - /PlutoInvoker/swf-booking-faces - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - *.faces - - - \ No newline at end of file diff --git a/booking-portlet-faces/src/test/java/.gitignore b/booking-portlet-faces/src/test/java/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/booking-portlet-faces/src/test/resources/.gitignore b/booking-portlet-faces/src/test/resources/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/booking-portlet-mvc/build.xml b/booking-portlet-mvc/build.xml deleted file mode 100644 index e28d39c..0000000 --- a/booking-portlet-mvc/build.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/booking-portlet-mvc/pom.xml b/booking-portlet-mvc/pom.xml deleted file mode 100644 index 84e5ad4..0000000 --- a/booking-portlet-mvc/pom.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - 4.0.0 - org.springframework.webflow.samples - booking-portlet-mvc - war - Hotel Booking : Spring Portlet MVC + Web Flow - 1.0.0.BUILD-SNAPSHOT - - - org.springframework.webflow - spring-webflow-samples - 1.0.0.BUILD-SNAPSHOT - - - - - - org.springframework - spring-webmvc - - - org.springframework - spring-jdbc - - - org.springframework - spring-orm - - - org.springframework - spring-webmvc-portlet - - - org.springframework.webflow - spring-webflow - ${webflow.version} - - - org.springframework.webflow - spring-js - ${webflow.version} - - - - javax.servlet - javax.servlet-api - ${servlet.version} - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - javax.servlet - jstl - 1.2 - - - - org.hsqldb - hsqldb - ${hsqldb.version} - runtime - - - org.hibernate - hibernate-entitymanager - ${hibernate.version} - - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - - javax.xml.bind - jaxb-api - ${jaxb.version} - - - - joda-time - joda-time - 2.2 - - - joda-time - joda-time-jsptags - 1.1.1 - runtime - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - jul-to-slf4j - ${slf4j.version} - - - ch.qos.logback - logback-classic - ${logback.version} - - - - - booking-portlet-mvc - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - - diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java deleted file mode 100644 index 2d467c6..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.text.DateFormat; -import java.util.Calendar; -import java.util.Date; - -import javax.persistence.Basic; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import javax.validation.constraints.Future; -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.NotEmpty; -import org.springframework.format.annotation.DateTimeFormat; - -/** - * A Hotel Booking made by a User. - */ -@Entity -@BookingDateRange -public class Booking implements Serializable { - private Long id; - - private User user; - - private Hotel hotel; - - @DateTimeFormat(pattern = "MM-dd-yyyy") - private Date checkinDate; - - @DateTimeFormat(pattern = "MM-dd-yyyy") - private Date checkoutDate; - - private String creditCard; - - private String creditCardName; - - private int creditCardExpiryMonth; - - private int creditCardExpiryYear; - - private boolean smoking; - - private int beds; - - public Booking() { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DAY_OF_MONTH, 1); - setCheckinDate(calendar.getTime()); - calendar.add(Calendar.DAY_OF_MONTH, 1); - setCheckoutDate(calendar.getTime()); - } - - public Booking(Hotel hotel, User user) { - this(); - this.hotel = hotel; - this.user = user; - } - - @Transient - public BigDecimal getTotal() { - return hotel.getPrice().multiply(new BigDecimal(getNights())); - } - - @Transient - public int getNights() { - return (int) (checkoutDate.getTime() - checkinDate.getTime()) / 1000 / 60 / 60 / 24; - } - - @Id - @GeneratedValue(strategy = GenerationType.TABLE) - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - @Basic - @Temporal(TemporalType.DATE) - @NotNull - @Future - public Date getCheckinDate() { - return checkinDate; - } - - public void setCheckinDate(Date datetime) { - this.checkinDate = datetime; - } - - @ManyToOne - public Hotel getHotel() { - return hotel; - } - - public void setHotel(Hotel hotel) { - this.hotel = hotel; - } - - @ManyToOne - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - @Basic - @Temporal(TemporalType.DATE) - @NotNull - @Future - public Date getCheckoutDate() { - return checkoutDate; - } - - public void setCheckoutDate(Date checkoutDate) { - this.checkoutDate = checkoutDate; - } - - @NotEmpty - public String getCreditCard() { - return creditCard; - } - - public void setCreditCard(String creditCard) { - this.creditCard = creditCard; - } - - @Transient - public String getDescription() { - DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); - return hotel == null ? null : hotel.getName() + ", " + df.format(getCheckinDate()) + " to " - + df.format(getCheckoutDate()); - } - - public boolean isSmoking() { - return smoking; - } - - public void setSmoking(boolean smoking) { - this.smoking = smoking; - } - - public int getBeds() { - return beds; - } - - public void setBeds(int beds) { - this.beds = beds; - } - - @NotEmpty - public String getCreditCardName() { - return creditCardName; - } - - public void setCreditCardName(String creditCardName) { - this.creditCardName = creditCardName; - } - - public int getCreditCardExpiryMonth() { - return creditCardExpiryMonth; - } - - public void setCreditCardExpiryMonth(int creditCardExpiryMonth) { - this.creditCardExpiryMonth = creditCardExpiryMonth; - } - - public int getCreditCardExpiryYear() { - return creditCardExpiryYear; - } - - public void setCreditCardExpiryYear(int creditCardExpiryYear) { - this.creditCardExpiryYear = creditCardExpiryYear; - } - - @Override - public String toString() { - return "Booking(" + user + "," + hotel + ")"; - } - -} diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRange.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRange.java deleted file mode 100644 index a5cad18..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRange.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.validation.Constraint; -import javax.validation.Payload; - -@Constraint(validatedBy = BookingDateRangeValidator.class) -@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) -@Retention(RetentionPolicy.RUNTIME) -public @interface BookingDateRange { - - String message() default "Invalid check-in and check-out date range"; - - Class[] groups() default {}; - - Class[] payload() default {}; - -} diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRangeValidator.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRangeValidator.java deleted file mode 100644 index 716a40b..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingDateRangeValidator.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -public class BookingDateRangeValidator implements ConstraintValidator { - - public void initialize(BookingDateRange bookingDateRange) { - } - - public boolean isValid(Booking booking, ConstraintValidatorContext context) { - if ((booking.getCheckinDate() != null) && (booking.getCheckoutDate() != null) - && booking.getCheckoutDate().before(booking.getCheckinDate())) { - return false; - } - return true; - } - -} diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingService.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingService.java deleted file mode 100644 index 5a1978f..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingService.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.util.List; - -/** - * A service interface for retrieving hotels and bookings from a backing repository. Also supports the ability to cancel - * a booking. - */ -public interface BookingService { - - /** - * Find user by their username. - * @param username the user's username - * @return the user - */ - public User findUser(String username); - - /** - * Find bookings made by the given user - * @param username the user's name - * @return their bookings - */ - public List findBookings(String username); - - /** - * Find hotels available for booking by some criteria. - * @param criteria the search criteria - * @return a list of hotels meeting the criteria - */ - public List findHotels(SearchCriteria criteria); - - /** - * Find hotels by their identifier. - * @param id the hotel id - * @return the hotel - */ - public Hotel findHotelById(Long id); - - /** - * Create a new, transient hotel booking instance for the given user. - * @param hotelId the hotelId - * @param userName the user name - * @return the new transient booking instance - */ - public Booking createBooking(Long hotelId, String userName); - - /** - * Persist the booking to the database - * @param booking the booking - */ - public void persistBooking(Booking booking); - - /** - * Cancel an existing booking. - * @param id the booking id - */ - public void cancelBooking(Long id); - -} diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingValidator.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingValidator.java deleted file mode 100644 index b65f63c..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingValidator.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.util.Calendar; - -import org.springframework.validation.Errors; -import org.springframework.validation.Validator; - -public class BookingValidator implements Validator { - - public boolean supports(Class clazz) { - return Booking.class.equals(clazz); - } - - public void validate(Object obj, Errors errors) { - Booking booking = (Booking) obj; - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DAY_OF_MONTH, -1); - if (booking.getCreditCard() == null || "".equals(booking.getCreditCard())) { - errors.rejectValue("creditCard", null, "Credit card number must be provided"); - } - if (booking.getCreditCardName() == null || "".equals(booking.getCreditCardName())) { - errors.rejectValue("creditCardName", null, "Credit card name must be provided"); - } - if (booking.getCheckinDate() == null || booking.getCheckinDate().before(calendar.getTime())) { - errors.rejectValue("checkinDate", null, "Check in date must be a future date"); - } else if (booking.getCheckoutDate() == null || !booking.getCheckinDate().before(booking.getCheckoutDate())) { - errors.rejectValue("checkoutDate", null, "Check out date must be later than check in date"); - } - } - -} diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Hotel.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Hotel.java deleted file mode 100644 index 99719e5..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/Hotel.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -/** - * A hotel where users may book stays. - */ -@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 - @GeneratedValue - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getZip() { - return zip; - } - - public void setZip(String zip) { - this.zip = zip; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Column(precision = 6, scale = 2) - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public Booking createBooking(User user) { - return new Booking(this, user); - } - - @Override - public String toString() { - return "Hotel(" + name + "," + address + "," + city + "," + zip + ")"; - } -} diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java deleted file mode 100644 index 6a36525..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -import org.springframework.stereotype.Repository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -/** - * A JPA-based implementation of the Booking Service. Delegates to a JPA entity manager to issue data access calls - * against the backing repository. The EntityManager reference is provided by the managing container (Spring) - * automatically. - */ -@Service("bookingService") -@Repository -public class JpaBookingService implements BookingService { - - private EntityManager em; - - @PersistenceContext - public void setEntityManager(EntityManager em) { - this.em = em; - } - - @Transactional(readOnly = true) - public User findUser(String username) { - return (User) em.createQuery("select u from User u where u.username = :username") - .setParameter("username", username).getSingleResult(); - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public List findBookings(String username) { - if (username != null) { - return em.createQuery("select b from Booking b where b.user.username = :username order by b.checkinDate") - .setParameter("username", username).getResultList(); - } else { - return null; - } - } - - @Transactional(readOnly = true) - @SuppressWarnings("unchecked") - public List findHotels(SearchCriteria criteria) { - String pattern = getSearchPattern(criteria); - return em - .createQuery( - "select h from Hotel h where lower(h.name) like :pattern or lower(h.city) like :pattern " - + " or lower(h.zip) like :pattern or lower(h.address) like :pattern") - .setParameter("pattern", pattern).setMaxResults(criteria.getPageSize()) - .setFirstResult(criteria.getPage() * criteria.getPageSize()).getResultList(); - } - - @Transactional(readOnly = true) - public Hotel findHotelById(Long id) { - return em.find(Hotel.class, id); - } - - @Transactional(readOnly = true) - public Booking createBooking(Long hotelId, String username) { - Hotel hotel = em.find(Hotel.class, hotelId); - User user = findUser(username); - return new Booking(hotel, user); - } - - @Transactional - public void persistBooking(Booking booking) { - em.persist(booking); - } - - @Transactional - public void cancelBooking(Long id) { - Booking booking = em.find(Booking.class, id); - if (booking != null) { - em.remove(booking); - } - } - - // helpers - - private String getSearchPattern(SearchCriteria criteria) { - if (StringUtils.hasText(criteria.getSearchString())) { - return "%" + criteria.getSearchString().toLowerCase().replace('*', '%') + "%"; - } else { - return "%"; - } - } - -} \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java deleted file mode 100644 index ba0b2f0..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/SearchCriteria.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; - -/** - * A backing bean for the main hotel search form. Encapsulates the criteria needed to perform a hotel search. - * - * It is expected a future milestone of Spring Web Flow 2.0 will allow flow-scoped beans like this one to hold - * references to transient services that are restored automatically when the flow is resumed on subsequent requests. - * This would allow this SearchCriteria object to delegate to the {@link BookingService} directly, for example, - * eliminating the need for the actions in {@link MainActions}. - */ -public class SearchCriteria implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * The user-provided search criteria for finding Hotels. - */ - private String searchString; - - /** - * The maximum page size of the Hotel result list - */ - private int pageSize; - - /** - * The current page of the Hotel result list. - */ - private int page; - - public String getSearchString() { - return searchString; - } - - public void setSearchString(String searchString) { - this.searchString = searchString; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public void nextPage() { - page++; - } - - public void previousPage() { - page--; - } - - public void resetPage() { - page = 0; - } - -} \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/User.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/User.java deleted file mode 100644 index bb4a856..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/User.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * A user who can book hotels. - */ -@Entity -@Table(name = "Customer") -public class User implements Serializable { - private String username; - - private String password; - - private String name; - - public User() { - } - - public User(String username, String password, String name) { - this.username = username; - this.password = password; - this.name = name; - } - - @Id - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return "User(" + username + ")"; - } -} diff --git a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java b/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java deleted file mode 100644 index 27a4280..0000000 --- a/booking-portlet-mvc/src/main/java/org/springframework/webflow/samples/booking/ViewFlowHandler.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import org.springframework.webflow.mvc.portlet.AbstractFlowHandler; - -public class ViewFlowHandler extends AbstractFlowHandler { - - public String getFlowId() { - return "view"; - } - -} diff --git a/booking-portlet-mvc/src/main/resources/META-INF/persistence.xml b/booking-portlet-mvc/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 498b08c..0000000 --- a/booking-portlet-mvc/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - org.hibernate.ejb.HibernatePersistence - org.springframework.webflow.samples.booking.User - org.springframework.webflow.samples.booking.Booking - org.springframework.webflow.samples.booking.Hotel - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/resources/import.sql b/booking-portlet-mvc/src/main/resources/import.sql deleted file mode 100644 index 9c156ed..0000000 --- a/booking-portlet-mvc/src/main/resources/import.sql +++ /dev/null @@ -1,28 +0,0 @@ -insert into Customer (username, name) values ('keith', 'Keith') -insert into Customer (username, name) values ('erwin', 'Erwin') -insert into Customer (username, name) values ('jeremy', 'Jeremy') -insert into Customer (username, name) values ('scott', 'Scott') -insert into Customer (username, name) values ('pluto', 'Pluto') -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, 60, 'Jameson Inn', '890 Palm Bay Rd NE', 'Palm Bay', 'FL', '32905', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (3, 199, 'Chilworth Manor', 'The Cottage, Southampton Business Park', 'Southampton', 'Hants', 'SO16 7JF', 'UK') -insert into Hotel (id, price, name, address, city, state, zip, country) values (4, 120, 'Marriott Courtyard', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (5, 180, 'Doubletree', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (6, 450, 'W Hotel', 'Union Square, Manhattan', 'NY', 'NY', '10011', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (7, 450, 'W Hotel', 'Lexington Ave, Manhattan', 'NY', 'NY', '10011', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (8, 250, 'Hotel Rouge', '1315 16th Street NW', 'Washington', 'DC', '20036', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (9, 300, '70 Park Avenue Hotel', '70 Park Avenue', 'NY', 'NY', '10011', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (10, 300, 'Conrad Miami', '1395 Brickell Ave', 'Miami', 'FL', '33131', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (11, 80, 'Sea Horse Inn', '2106 N Clairemont Ave', 'Eau Claire', 'WI', '54703', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (12, 90, 'Super 8 Eau Claire Campus Area', '1151 W Macarthur Ave', 'Eau Claire', 'WI', '54701', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (13, 160, 'Marriot Downtown', '55 Fourth Street', 'San Francisco', 'CA', '94103', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (14, 200, 'Hilton Diagonal Mar', 'Passeig del Taulat 262-264', 'Barcelona', 'Catalunya', '08019', 'Spain') -insert into Hotel (id, price, name, address, city, state, zip, country) values (15, 210, 'Hilton Tel Aviv', 'Independence Park', 'Tel Aviv', '', '63405', 'Israel') -insert into Hotel (id, price, name, address, city, state, zip, country) values (16, 240, 'InterContinental Tokyo Bay', 'Takeshiba Pier', 'Tokyo', '', '105', 'Japan') -insert into Hotel (id, price, name, address, city, state, zip, country) values (17, 130, 'Hotel Beaulac', ' Esplanade Léopold-Robert 2', 'Neuchatel', '', '2000', 'Switzerland') -insert into Hotel (id, price, name, address, city, state, zip, country) values (18, 140, 'Conrad Treasury Place', 'William & George Streets', 'Brisbane', 'QLD', '4001', 'Australia') -insert into Hotel (id, price, name, address, city, state, zip, country) values (19, 230, 'Ritz Carlton', '1228 Sherbrooke St', 'West Montreal', 'Quebec', 'H3G1H6', 'Canada') -insert into Hotel (id, price, name, address, city, state, zip, country) values (20, 460, 'Ritz Carlton', 'Peachtree Rd, Buckhead', 'Atlanta', 'GA', '30326', 'USA') -insert into Hotel (id, price, name, address, city, state, zip, country) values (21, 220, 'Swissotel', '68 Market Street', 'Sydney', 'NSW', '2000', 'Australia') -insert into Hotel (id, price, name, address, city, state, zip, country) values (22, 250, 'Meliá White House', 'Albany Street', 'Regents Park London', '', 'NW13UP', 'Great Britain') -insert into Hotel (id, price, name, address, city, state, zip, country) values (23, 210, 'Hotel Allegro', '171 West Randolph Street', 'Chicago', 'IL', '60601', 'USA') \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/resources/logback.xml b/booking-portlet-mvc/src/main/resources/logback.xml deleted file mode 100644 index 1202bc6..0000000 --- a/booking-portlet-mvc/src/main/resources/logback.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/META-INF/MANIFEST.MF b/booking-portlet-mvc/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 59499bc..0000000 --- a/booking-portlet-mvc/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/classes/log4j.properties b/booking-portlet-mvc/src/main/webapp/WEB-INF/classes/log4j.properties deleted file mode 100644 index 0b9061f..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/classes/log4j.properties +++ /dev/null @@ -1,11 +0,0 @@ -log4j.rootCategory=INFO, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n - -# Enable web flow logging -log4j.category.org.springframework.webflow=DEBUG -log4j.category.org.springframework.js=DEBUG -log4j.category.org.springframework.binding=DEBUG -log4j.category.org.springframework.transaction=DEBUG \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/config/application-config.xml b/booking-portlet-mvc/src/main/webapp/WEB-INF/config/application-config.xml deleted file mode 100644 index 60ef7b2..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/config/application-config.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml b/booking-portlet-mvc/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml deleted file mode 100644 index 786fc20..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/config/hotelbooking-portlet-config.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml deleted file mode 100644 index f7cd26f..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/booking.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.jsp b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.jsp deleted file mode 100644 index 51508a9..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/enterBookingDetails.jsp +++ /dev/null @@ -1,142 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - -

Book Hotel

- - - - - - -
- - -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:${booking.hotel.name}
Address:${booking.hotel.address}
City, State:${booking.hotel.city}, ${booking.hotel.state}
Zip:${booking.hotel.zip}
Country:${booking.hotel.country}
Nightly rate: - ${status.value} -
- - - - -
- - - - -
- - - - - - - -
- - - - -
- - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
-   -   -
-
-
diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/messages.properties b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/messages.properties deleted file mode 100644 index 3d15709..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/messages.properties +++ /dev/null @@ -1,16 +0,0 @@ -booking.checkinDate.NotNull=The check in date is required -booking.checkinDate.Future=The check in date must be in the future -booking.checkinDate.beforeToday=The check in date must be a future date -booking.checkinDate.typeMismatch=The check in date must be in the format mm-dd-yyyy - -booking.checkoutDate.Future=The check out date must be in the future -booking.checkoutDate.NotNull=The check out date is required -booking.checkoutDate.typeMismatch=The check out date must be in the format mm-dd-yyyy -booking.BookingDateRange=The check out date must be later than the check in date - -booking.creditCard.NotEmpty=The credit card must be a valid 16 digit number -booking.creditCardName.NotEmpty=The name on the credit card is required - -NotEmpty=The {0} field is required -NotNull=The {0} field is required -Future=The {0} date must be in the future \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/reviewBooking.jsp b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/reviewBooking.jsp deleted file mode 100644 index bea6a85..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/booking/reviewBooking.jsp +++ /dev/null @@ -1,65 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - -

Confirm Hotel Booking

- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:${booking.hotel.name}
Address:${booking.hotel.address}
City, State:${booking.hotel.city}, ${booking.hotel.state}
Zip:${booking.hotel.zip}
Country:${booking.hotel.country}
Total payment: - ${status.value} -
Check In Date: - ${status.value} -
Check Out Date: - ${status.value} -
Credit Card #:${booking.creditCard}
-   -   -   -
-
-
diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.jsp b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.jsp deleted file mode 100644 index 4d00322..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/enterSearchCriteria.jsp +++ /dev/null @@ -1,64 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - - - - -

Search Hotels

- - - -
- - - - - - - - - -
-
- -

Current Hotel Bookings

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameAddressCity, StateCheck in DateCheck out DateConfirmation NumberAction
${booking.hotel.name}${booking.hotel.address}${booking.hotel.city}, ${booking.hotel.state}${booking.checkinDate}${booking.checkoutDate}${booking.id} - - - - - - Cancel -
No booking history
diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/main.xml b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/main.xml deleted file mode 100644 index fbd0607..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/main.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotel.jsp b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotel.jsp deleted file mode 100644 index 9d1a051..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotel.jsp +++ /dev/null @@ -1,53 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - -

View Hotel

- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:${hotel.name}
Address:${hotel.address}
City:${hotel.city}
State:${hotel.state}
Zip:${hotel.zip}
Country:${hotel.country}
Nightly rate: - ${status.value} -
-   -   -
-
-
diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotels.jsp b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotels.jsp deleted file mode 100644 index b760e99..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/main/reviewHotels.jsp +++ /dev/null @@ -1,63 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> - -

Hotel Results

- - - - - -Change Search - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameAddressCity, StateZipAction
${hotel.name}${hotel.address}${hotel.city}, ${hotel.state}, ${hotel.country}${hotel.zip} - - - - - - View Hotel -
No hotels found
- - - - - - - Previous Results - - - - - - - More Results - - diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/intro.jsp b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/intro.jsp deleted file mode 100644 index 1fe0053..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/intro.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0"%> - -

Welcome to Spring Travel

-

- This reference application shows how to use Spring MVC and Web Flow together with JavaServerPages (JSP) in a portlet. -

-

- The key features illustrated in this sample include: -

-
    -
  • A declarative navigation model enabling full browser button support and dynamic navigation rules
  • -
  • A fine-grained state management model, including support for ConversationScope and ViewScope
  • -
  • Managed persistence contexts with the Java Persistence API (JPA)
  • -
  • Unified Expression Language (EL) integration
  • -
  • Declarative page authoring with JSP, JSTL, and Spring MVC's form tag library -
  • Exception handling support across all layers of the application
  • -
  • Spring IDE tooling integration, with support for graphical flow modeling and visualization
  • -
-

- - - - - - Start your Spring Travel experience - -

diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/view.xml b/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/view.xml deleted file mode 100644 index 71d0044..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/flows/view/view.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/portlet.xml b/booking-portlet-mvc/src/main/webapp/WEB-INF/portlet.xml deleted file mode 100644 index c3fcc9f..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/portlet.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - swf-booking-mvc - Spring Webflow Booking MVC - - - org.springframework.web.portlet.DispatcherPortlet - - - - contextConfigLocation - - /WEB-INF/config/hotelbooking-portlet-config.xml - - - - - viewRendererUrl - /WEB-INF/servlet/view - - - 0 - - - text/html - view - - - - Spring Webflow Booking MVC - - - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml b/booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 6d89d3a..0000000 --- a/booking-portlet-mvc/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - contextConfigLocation - - /WEB-INF/config/application-config.xml - - - - - - org.springframework.web.context.ContextLoaderListener - - - - - ViewRendererServlet - org.springframework.web.servlet.ViewRendererServlet - - - - ViewRendererServlet - /WEB-INF/servlet/view - - - - - swf-booking-mvc - org.apache.pluto.container.driver.PortletServlet - - portlet-name - swf-booking-mvc - - 1 - - - - swf-booking-mvc - /PlutoInvoker/swf-booking-mvc - - - \ No newline at end of file diff --git a/booking-portlet-mvc/src/test/java/.gitignore b/booking-portlet-mvc/src/test/java/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/booking-portlet-mvc/src/test/resources/log4j.properties b/booking-portlet-mvc/src/test/resources/log4j.properties deleted file mode 100644 index 5ba9222..0000000 --- a/booking-portlet-mvc/src/test/resources/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -log4j.rootCategory=WARN, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n - -# Enable web flow logging -log4j.category.org.springframework.webflow=DEBUG -log4j.category.org.springframework.binding=DEBUG \ No newline at end of file diff --git a/pom.xml b/pom.xml index 053e02f..228d5c6 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,6 @@ booking-mvc booking-faces - booking-portlet-mvc - booking-portlet-faces primefaces-showcase webflow-showcase