Author: dan.j.allen
Date: 2010-06-10 19:24:20 -0400 (Thu, 10 Jun 2010)
New Revision: 13123
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/reference/CalendarReferenceProducer.java
examples/trunk/booking-simplified/src/main/webapp/WEB-INF/web.xml
examples/trunk/booking-simplified/src/main/webapp/book.xhtml
Log:
disable error pages for now
fix case in messages field
disable locale in calendar producer for now
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java 2010-06-10
22:47:30 UTC (rev 13122)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/AccountProducerBean.java 2010-06-10
23:24:20 UTC (rev 13123)
@@ -23,11 +23,11 @@
@PersistenceContext
private EntityManager em;
- public @Produces
+ @Produces
@Registered
@Named("currentUser")
@SessionScoped
- User getCurrentAccount()
+ public User getCurrentAccount()
{
log.info("Producing dummy User");
return new User("Current User", "CurrentUser");
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java 2010-06-10
22:47:30 UTC (rev 13122)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/RegistrarBean.java 2010-06-10
23:24:20 UTC (rev 13123)
@@ -26,7 +26,7 @@
private EntityManager em;
@Inject
- private Messages Messages;
+ private Messages messages;
@Inject
private RegistrationFormControls formControls;
@@ -46,7 +46,7 @@
if (verifyPasswordsMatch() && verifyUsernameIsAvailable())
{
registered = true;
- Messages.info(new BundleKey("messages.properties",
"registration.registered")).textDefault("You have been successfully
registered as the user {0}!").textParams(newUser.getUsername());
+ messages.info(new BundleKey("messages.properties",
"registration.registered")).textDefault("You have been successfully
registered as the user {0}!").textParams(newUser.getUsername());
}
else
{
@@ -65,7 +65,7 @@
{
if (validationFailed || registrationInvalid)
{
- Messages.warn(new BundleKey("messages.properties",
"registration.invalid")).textDefault("Invalid registration. Please correct
the errors and try again.");
+ messages.warn(new BundleKey("messages.properties",
"registration.invalid")).textDefault("Invalid registration. Please correct
the errors and try again.");
}
}
@@ -99,7 +99,7 @@
{
if (!newUser.getPassword().equals(confirmPassword))
{
- Messages.warn(new BundleKey("messages.properties",
"account.passwordsDoNotMatch")).textDefault("Passwords do not match. Please
re-type your password.").targets(formControls.getConfirmPasswordControlId());
+ messages.warn(new BundleKey("messages.properties",
"account.passwordsDoNotMatch")).textDefault("Passwords do not match. Please
re-type your password.").targets(formControls.getConfirmPasswordControlId());
confirmPassword = null;
return false;
}
@@ -112,7 +112,7 @@
User existing = em.find(User.class, newUser.getUsername());
if (existing != null)
{
- Messages.warn(new BundleKey("messages.properties",
"account.usernameTaken")).textDefault("The username '{0}' is
already taken. Please choose another
username.").targets(formControls.getUsernameControlId()).textParams(newUser.getUsername());
+ messages.warn(new BundleKey("messages.properties",
"account.usernameTaken")).textDefault("The username '{0}' is
already taken. Please choose another
username.").targets(formControls.getUsernameControlId()).textParams(newUser.getUsername());
return false;
}
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java 2010-06-10
22:47:30 UTC (rev 13122)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java 2010-06-10
23:24:20 UTC (rev 13123)
@@ -45,6 +45,7 @@
import org.jboss.seam.examples.booking.model.Booking;
import org.jboss.seam.examples.booking.model.Hotel;
import org.jboss.seam.examples.booking.model.User;
+import org.jboss.seam.international.status.MessageFactory;
import org.jboss.seam.international.status.Messages;
import org.jboss.seam.international.status.builder.BundleKey;
import org.slf4j.Logger;
@@ -64,9 +65,12 @@
private Conversation conversation;
@Inject
- private Messages Messages;
+ private MessageFactory mf;
@Inject
+ private Messages messages;
+
+ @Inject
private BookingFormControls formControls;
@Inject
@@ -88,7 +92,7 @@
// NOTE get a fresh reference that's managed by the conversational
// persistence context
hotelSelection = em.find(Hotel.class, hotel.getId());
- log.info("Selected the {0} in {1}", hotelSelection.getName(),
hotelSelection.getCity());
+ log.info(mf.info("Selected the {0} in
{1}").textParams(hotelSelection.getName(),
hotelSelection.getCity()).build().getText());
conversation.begin();
}
@@ -101,7 +105,7 @@
calendar.add(Calendar.DAY_OF_MONTH, 1);
booking.setCheckoutDate(calendar.getTime());
hotelSelection = null;
- Messages.info(new BundleKey("messages.properties",
"booking.initiated")).textDefault("You've initiated a booking at
{0}.").textParams(booking.getHotel().getName());
+ messages.info(new BundleKey("messages.properties",
"booking.initiated")).textDefault("You've initiated a booking at
{0}.").textParams(booking.getHotel().getName());
}
public void validateBooking()
@@ -110,12 +114,12 @@
calendar.add(Calendar.DAY_OF_MONTH, -1);
if (booking.getCheckinDate().before(calendar.getTime()))
{
- Messages.info(new BundleKey("messages.properties",
"booking.checkInNotFutureDate")).textDefault("Check in date must be a
future date").targets(formControls.getCheckinDateControlId());
+ messages.info(new BundleKey("messages.properties",
"booking.checkInNotFutureDate")).textDefault("Check in date must be a
future date").targets(formControls.getCheckinDateControlId());
bookingValid = false;
}
else if (!booking.getCheckinDate().before(booking.getCheckoutDate()))
{
- Messages.info(new BundleKey("messages.properties",
"booking.checkOutBeforeCheckIn")).textDefault("Check out date must be after
check in date").targets(formControls.getCheckoutDateControlId());
+ messages.info(new BundleKey("messages.properties",
"booking.checkOutBeforeCheckIn")).textDefault("Check out date must be after
check in date").targets(formControls.getCheckoutDateControlId());
bookingValid = false;
}
else
@@ -133,7 +137,7 @@
{
});
log.info("New booking at the {0} confirmed for {1}",
booking.getHotel().getName(), booking.getUser().getName());
- Messages.info(new BundleKey("messages.properties",
"booking.confirmed")).textDefault("Booking confirmed.");
+ messages.info(new BundleKey("messages.properties",
"booking.confirmed")).textDefault("Booking confirmed.");
conversation.end();
}
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java 2010-06-10
22:47:30 UTC (rev 13122)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/BookingHistoryBean.java 2010-06-10
23:24:20 UTC (rev 13123)
@@ -36,7 +36,7 @@
private EntityManager em;
@Inject
- private Messages Messages;
+ private Messages messages;
@Inject
@Registered
@@ -68,11 +68,11 @@
if (booking != null)
{
em.remove(booking);
- Messages.info(new BundleKey("messages.properties",
"booking.canceled")).textDefault("The booking at the {0} on {1,date} has
been canceled.").textParams(selectedBooking.getHotel().getName(),
selectedBooking.getCheckinDate());
+ messages.info(new BundleKey("messages.properties",
"booking.canceled")).textDefault("The booking at the {0} on {1,date} has
been canceled.").textParams(selectedBooking.getHotel().getName(),
selectedBooking.getCheckinDate());
}
else
{
- Messages.info(new BundleKey("messages.properties",
"booking.doesNotExist")).textDefault("Our records indicate that the booking
you selected has already been canceled.");
+ messages.info(new BundleKey("messages.properties",
"booking.doesNotExist")).textDefault("Our records indicate that the booking
you selected has already been canceled.");
}
bookingsForUser.remove(selectedBooking);
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/reference/CalendarReferenceProducer.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/reference/CalendarReferenceProducer.java 2010-06-10
22:47:30 UTC (rev 13122)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/reference/CalendarReferenceProducer.java 2010-06-10
23:24:20 UTC (rev 13123)
@@ -5,10 +5,8 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
-import java.util.Locale;
import javax.enterprise.context.ConversationScoped;
-import javax.inject.Inject;
import javax.inject.Named;
import javax.enterprise.inject.Produces;
@@ -20,16 +18,14 @@
*/
public class CalendarReferenceProducer {
- @Inject private Locale locale;
-
@Produces
@Named
@ConversationScoped
public List<Month> getMonths()
{
List<Month> months = new ArrayList<Month>(12);
- DateFormat longNameFormat = new SimpleDateFormat("MMMM", locale);
- DateFormat shortNameFormat = new SimpleDateFormat("MMM", locale);
+ DateFormat longNameFormat = new SimpleDateFormat("MMMM");
+ DateFormat shortNameFormat = new SimpleDateFormat("MMM");
Calendar cal = Calendar.getInstance();
for (int m = 0; m < 12; m++)
{
Modified: examples/trunk/booking-simplified/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/booking-simplified/src/main/webapp/WEB-INF/web.xml 2010-06-10 22:47:30
UTC (rev 13122)
+++ examples/trunk/booking-simplified/src/main/webapp/WEB-INF/web.xml 2010-06-10 23:24:20
UTC (rev 13123)
@@ -35,6 +35,7 @@
<auth-constraint/>
</security-constraint>
+ <!--
<error-page>
<exception-type>org.jboss.seam.security.NotLoggedInException</exception-type>
<location>/home.seam</location>
@@ -49,5 +50,6 @@
<error-code>500</error-code>
<location>/error.seam</location>
</error-page>
+ -->
</web-app>
Modified: examples/trunk/booking-simplified/src/main/webapp/book.xhtml
===================================================================
--- examples/trunk/booking-simplified/src/main/webapp/book.xhtml 2010-06-10 22:47:30 UTC
(rev 13122)
+++ examples/trunk/booking-simplified/src/main/webapp/book.xhtml 2010-06-10 23:24:20 UTC
(rev 13123)
@@ -7,11 +7,6 @@
xmlns:s="http://jboss.org/seam/faces"
xmlns:p="http://http://java.sun.com/jsf/composite/components/propert...
template="/WEB-INF/layout/template.xhtml">
- <ui:define name="metadata">
- <f:metadata>
- <s:restrictView require="#{identity.loggedIn}"/>
- </f:metadata>
- </ui:define>
<ui:define name="content">
<div class="section">