Author: lincolnthree
Date: 2010-06-17 11:03:25 -0400 (Thu, 17 Jun 2010)
New Revision: 13216
Added:
examples/trunk/booking-simplified/src/main/resources/messages_de.properties
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/ChangePasswordValidator.java
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/ReservationDateRangeValidator.java
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Identity.java
Log:
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/ChangePasswordValidator.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/ChangePasswordValidator.java 2010-06-17
14:24:11 UTC (rev 13215)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/account/ChangePasswordValidator.java 2010-06-17
15:03:25 UTC (rev 13216)
@@ -1,6 +1,7 @@
package org.jboss.seam.examples.booking.account;
import java.util.Map;
+
import javax.enterprise.inject.Instance;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
@@ -10,6 +11,7 @@
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import javax.inject.Inject;
+
import org.jboss.seam.examples.booking.Bundles;
import org.jboss.seam.examples.booking.model.User;
import org.jboss.seam.faces.validation.InputField;
@@ -21,8 +23,8 @@
*/
@FacesValidator(value = "changePasswordValidator")
public class ChangePasswordValidator implements Validator
- // extending throws an unsatisified dependency exception
- //extends ConfirmPasswordValidator
+// extending throws an unsatisified dependency exception
+// extends ConfirmPasswordValidator
{
@Inject
private Instance<BundleTemplateMessage> messageBuilder;
@@ -35,25 +37,20 @@
@InputField
private String currentPassword;
- @Override
- public void validate(FacesContext ctx, UIComponent form, Object value) throws
ValidatorException
+ public void validate(final FacesContext ctx, final UIComponent form, final Object
value) throws ValidatorException
{
Map<String, UIInput> fieldMap = (Map<String, UIInput>) value;
- if (currentUser.getPassword() != null &&
!currentUser.getPassword().equals(currentPassword))
+ if ((currentUser.getPassword() != null) &&
!currentUser.getPassword().equals(currentPassword))
{
/*
* This is an ugly way to put i18n in FacesMessages:
*
https://jira.jboss.org/browse/SEAMFACES-24
*/
- throw new ValidatorException(
- new FacesMessage(messageBuilder.get().text(
- new BundleKey(Bundles.MESSAGES,
"account.passwordNotConfirmed"))
- .targets(fieldMap.get("oldPassword").getClientId())
- .build().getText()));
+ throw new ValidatorException(new FacesMessage(messageBuilder.get().text(new
BundleKey(Bundles.MESSAGES,
"account.passwordNotConfirmed")).targets(fieldMap.get("oldPassword").getClientId()).build().getText()));
}
// TODO enable when we can extend
- //super.validate(ctx, form, value);
+ // super.validate(ctx, form, value);
}
}
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/ReservationDateRangeValidator.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/ReservationDateRangeValidator.java 2010-06-17
14:24:11 UTC (rev 13215)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/booking/ReservationDateRangeValidator.java 2010-06-17
15:03:25 UTC (rev 13216)
@@ -24,6 +24,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
+
import javax.enterprise.inject.Instance;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
@@ -33,15 +34,16 @@
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import javax.inject.Inject;
+
import org.jboss.seam.examples.booking.Bundles;
import org.jboss.seam.faces.validation.InputField;
import org.jboss.seam.international.status.builder.BundleKey;
import org.jboss.seam.international.status.builder.BundleTemplateMessage;
/**
- * A cross-field validator that validates the begin date
- * is in the future and before the end date.
- *
+ * A cross-field validator that validates the begin date is in the future and
+ * before the end date.
+ *
* @author Dan Allen
*/
@FacesValidator("reservationDateRangeValidator")
@@ -58,8 +60,7 @@
@Inject
private Instance<BundleTemplateMessage> messageBuilder;
- @Override
- public void validate(FacesContext ctx, UIComponent form, Object value) throws
ValidatorException
+ public void validate(final FacesContext ctx, final UIComponent form, final Object
value) throws ValidatorException
{
Map<String, UIInput> fieldMap = (Map<String, UIInput>) value;
Calendar calendar = Calendar.getInstance();
@@ -67,17 +68,15 @@
if (beginDate.before(calendar.getTime()))
{
String message = messageBuilder.get().text(new BundleKey(Bundles.MESSAGES,
"booking.checkInNotFutureDate"))
- // FIXME the component should come through via injection
- .targets(fieldMap.get("beginDate").getClientId())
- .build().getText();
+ // FIXME the component should come through via injection
+
.targets(fieldMap.get("beginDate").getClientId()).build().getText();
throw new ValidatorException(new FacesMessage(message));
}
else if (!beginDate.before(endDate))
{
String message = messageBuilder.get().text(new BundleKey(Bundles.MESSAGES,
"booking.checkOutBeforeCheckIn"))
- // FIXME the component should come through via injection
- .targets(fieldMap.get("endDate").getClientId())
- .build().getText();
+ // FIXME the component should come through via injection
+
.targets(fieldMap.get("endDate").getClientId()).build().getText();
throw new ValidatorException(new FacesMessage(message));
}
}
Modified:
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Identity.java
===================================================================
---
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Identity.java 2010-06-17
14:24:11 UTC (rev 13215)
+++
examples/trunk/booking-simplified/src/main/java/org/jboss/seam/examples/booking/security/Identity.java 2010-06-17
15:03:25 UTC (rev 13216)
@@ -71,7 +71,7 @@
loggedIn = false;
HttpSession session = (HttpSession)
facesContext.getExternalContext().getSession(true);
session.invalidate();
- return "pretty:home";
+ return "home?faces-redirect=true";
}
}
Added: examples/trunk/booking-simplified/src/main/resources/messages_de.properties
===================================================================
--- examples/trunk/booking-simplified/src/main/resources/messages_de.properties
(rev 0)
+++ examples/trunk/booking-simplified/src/main/resources/messages_de.properties 2010-06-17
15:03:25 UTC (rev 13216)
@@ -0,0 +1,15 @@
+booking.initiated=Sie haben eine Buchung auf leitete die {0}.
+booking.checkInNotFutureDate=Check-in Datum muss in der Zukunft liegen.
+booking.checkOutBeforeCheckIn=Abreisedatum muss nach dem Check-in Datum sein.
+booking.confirmed=Du bist gebucht, um zu bleiben {0} {1}.
+booking.canceled=Ihre Buchung auf dem {0} auf {1} wurde abgebrochen.
+booking.doesNotExist=Unsere Aufzeichnungen zeigen, dass die Buchung Sie wurde bereits
abgesagt ausgew�hlt.
+account.passwordChanged=Passwort erfolgreich aktualisiert.
+account.passwordNotConfirmed=Ihr aktuelles Passwort ung�ltig sei. Bitte versuchen Sie es
erneut.
+account.passwordsDoNotMatch=Passw�rter stimmen nicht �berein. Bitte wiederholen Sie das
neue Kennwort.
+account.usernameTaken=Der Benutzername '{0}' ist bereits vergeben. Bitte w�hlen
Sie einen anderen Benutzernamen.
+registration.registered=Sie haben sich erfolgreich als Benutzer {0} registriert! Sie
k�nnen sich jetzt anmelden.
+registration.invalid=Ung�ltige Anmeldung. Bitte korrigieren Sie den Fehler und versuchen
Sie es erneut.
+identity.loggedOut=Sie erfolgreich Ihre Sitzung beendet haben.
+identity.loggedIn=Du bist angemeldet als unterzeichneten {0}.
+identity.loginFailed=Ung�ltiger Benutzername oder Kennwort.
\ No newline at end of file