Author: manaRH
Date: 2012-02-07 09:40:37 -0500 (Tue, 07 Feb 2012)
New Revision: 14302
Modified:
branches/community/Seam_2_3/examples-ee6/booking/booking-ear/pom.xml
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/pom.xml
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Booking.java
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Hotel.java
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/User.java
branches/community/Seam_2_3/examples-ee6/booking/booking-web/src/main/webapp/WEB-INF/web.xml
branches/community/Seam_2_3/examples-ee6/booking/pom.xml
Log:
JBSEAM-4891 added bean validation into booking example
Modified: branches/community/Seam_2_3/examples-ee6/booking/booking-ear/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/booking/booking-ear/pom.xml 2012-02-07
14:39:58 UTC (rev 14301)
+++ branches/community/Seam_2_3/examples-ee6/booking/booking-ear/pom.xml 2012-02-07
14:40:37 UTC (rev 14302)
@@ -43,7 +43,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <scope>compile</scope>
+ <scope>provided</scope>
<exclusions>
<exclusion>
<groupId>antlr</groupId>
@@ -65,23 +65,8 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>ejb3-persistence</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <scope>compile</scope>
+ <scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
@@ -104,12 +89,12 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <scope>compile</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <scope>compile</scope>
+ <scope>provided</scope>
</dependency>
</dependencies>
Modified: branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/pom.xml 2012-02-07
14:39:58 UTC (rev 14301)
+++ branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/pom.xml 2012-02-07
14:40:37 UTC (rev 14302)
@@ -25,10 +25,6 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
Modified:
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Booking.java
===================================================================
---
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Booking.java 2012-02-07
14:39:58 UTC (rev 14301)
+++
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Booking.java 2012-02-07
14:40:37 UTC (rev 14302)
@@ -15,15 +15,18 @@
import javax.persistence.TemporalType;
import javax.persistence.Transient;
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotNull;
-import org.hibernate.validator.Pattern;
+import javax.validation.constraints.Size;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
import org.jboss.seam.annotations.Name;
@Entity
@Name("booking")
public class Booking implements Serializable
{
+
+ private static final long serialVersionUID = 1L;
+
private Long id;
private User user;
private Hotel hotel;
@@ -109,8 +112,8 @@
}
@NotNull(message="Credit card number is required")
- @Length(min=16, max=16, message="Credit card number must 16 digits long")
- @Pattern(regex="^\\d*$", message="Credit card number must be
numeric")
+ @Size(min=16, max=16, message="Credit card number must 16 digits long")
+ @Pattern(regexp="^\\d*$", message="Credit card number must be
numeric")
public String getCreditCard()
{
return creditCard;
@@ -150,7 +153,7 @@
this.beds = beds;
}
@NotNull(message="Credit card name is required")
- @Length(min=3, max=70, message="Credit card name is required")
+ @Size(min=3, max=70, message="Credit card name is required")
public String getCreditCardName()
{
return creditCardName;
Modified:
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Hotel.java
===================================================================
---
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Hotel.java 2012-02-07
14:39:58 UTC (rev 14301)
+++
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/Hotel.java 2012-02-07
14:40:37 UTC (rev 14302)
@@ -8,15 +8,18 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;
@Entity
@Name("hotel")
public class Hotel implements Serializable
{
+
+ private static final long serialVersionUID = 4718338262521261442L;
+
private Long id;
private String name;
private String address;
@@ -36,7 +39,7 @@
this.id = id;
}
- @Length(max=50) @NotNull
+ @Size(max=50) @NotNull
public String getName()
{
return name;
@@ -46,7 +49,7 @@
this.name = name;
}
- @Length(max=100) @NotNull
+ @Size(max=100) @NotNull
public String getAddress()
{
return address;
@@ -56,7 +59,7 @@
this.address = address;
}
- @Length(max=40) @NotNull
+ @Size(max=40) @NotNull
public String getCity()
{
return city;
@@ -66,7 +69,7 @@
this.city = city;
}
- @Length(min=4, max=6) @NotNull
+ @Size(min=4, max=6) @NotNull
public String getZip()
{
return zip;
@@ -76,7 +79,7 @@
this.zip = zip;
}
- @Length(min=2, max=10) @NotNull
+ @Size(min=2, max=10) @NotNull
public String getState()
{
return state;
@@ -86,7 +89,7 @@
this.state = state;
}
- @Length(min=2, max=40) @NotNull
+ @Size(min=2, max=40) @NotNull
public String getCountry()
{
return country;
Modified:
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/User.java
===================================================================
---
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/User.java 2012-02-07
14:39:58 UTC (rev 14301)
+++
branches/community/Seam_2_3/examples-ee6/booking/booking-ejb/src/main/java/org/jboss/seam/example/booking/User.java 2012-02-07
14:40:37 UTC (rev 14302)
@@ -9,9 +9,7 @@
import javax.persistence.Id;
import javax.persistence.Table;
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotNull;
-import org.hibernate.validator.Pattern;
+import javax.validation.constraints.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@@ -21,6 +19,8 @@
@Table(name="Customer")
public class User implements Serializable
{
+ private static final long serialVersionUID = 4818188553954060410L;
+
private String username;
private String password;
private String name;
@@ -35,7 +35,7 @@
public User() {}
@NotNull
- @Length(max=100)
+ @Size(max=100)
public String getName()
{
return name;
@@ -46,7 +46,7 @@
}
@NotNull
- @Length(min=5, max=15)
+ @Size(min=5, max=15)
public String getPassword()
{
return password;
@@ -57,8 +57,8 @@
}
@Id
- @Length(min=4, max=15)
- @Pattern(regex="^\\w*$", message="not a valid username")
+ @Size(min=4, max=15)
+ @Pattern(regexp="^\\w*$", message="not a valid username")
public String getUsername()
{
return username;
Modified:
branches/community/Seam_2_3/examples-ee6/booking/booking-web/src/main/webapp/WEB-INF/web.xml
===================================================================
---
branches/community/Seam_2_3/examples-ee6/booking/booking-web/src/main/webapp/WEB-INF/web.xml 2012-02-07
14:39:58 UTC (rev 14301)
+++
branches/community/Seam_2_3/examples-ee6/booking/booking-web/src/main/webapp/WEB-INF/web.xml 2012-02-07
14:40:37 UTC (rev 14302)
@@ -38,6 +38,11 @@
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
+
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>false</param-value>
+ </context-param>
<!-- <context-param> -->
<!--
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name> -->
@@ -54,7 +59,7 @@
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
-
+
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
Modified: branches/community/Seam_2_3/examples-ee6/booking/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/booking/pom.xml 2012-02-07 14:39:58 UTC (rev
14301)
+++ branches/community/Seam_2_3/examples-ee6/booking/pom.xml 2012-02-07 14:40:37 UTC (rev
14302)
@@ -42,6 +42,26 @@
<artifactId>booking-ear</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.2.0.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>4.0.1.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.1</version>
+ </dependency>
</dependencies>
</dependencyManagement>
</project>