Author: pete.muir(a)jboss.org
Date: 2010-06-16 17:03:34 -0400 (Wed, 16 Jun 2010)
New Revision: 6464
Modified:
examples/trunk/jsf/pastecode/pom.xml
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
Log:
add hibernate validator
Modified: examples/trunk/jsf/pastecode/pom.xml
===================================================================
--- examples/trunk/jsf/pastecode/pom.xml 2010-06-16 20:30:44 UTC (rev 6463)
+++ examples/trunk/jsf/pastecode/pom.xml 2010-06-16 21:03:34 UTC (rev 6464)
@@ -57,6 +57,12 @@
</dependency>
<dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-api</artifactId>
<scope>provided</scope>
@@ -95,7 +101,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
-
<warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
+ <warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**
+ </warSourceExcludes>
</configuration>
</plugin>
<plugin>
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
===================================================================
---
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16
20:30:44 UTC (rev 6463)
+++
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16
21:03:34 UTC (rev 6464)
@@ -38,6 +38,7 @@
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import javax.validation.constraints.Size;
/**
* The entity class for the pasted code "fragment". This is the main entity
@@ -69,6 +70,7 @@
private String note;
@Lob
+ @Size(min=1, message="Must enter some text!")
private String text;
private String user;
@@ -78,13 +80,6 @@
@OneToMany(mappedBy = "codeFragment", cascade = CascadeType.REMOVE)
List<AccessLog> largeCodeFragmentAccessLog;
- public CodeFragment()
- {
- this.note = "";
- this.text = "";
- this.user = "";
- }
-
public int getId()
{
return id;
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
---
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16
20:30:44 UTC (rev 6463)
+++
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16
21:03:34 UTC (rev 6464)
@@ -47,7 +47,7 @@
// The number of code fragments to display per page
private static int PAGE_SIZE = 2;
- @PersistenceContext(unitName = "pastecodeDatabase")
+ @PersistenceContext
private EntityManager entityManager;
@Inject
Modified: examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 20:30:44 UTC (rev
6463)
+++ examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 21:03:34 UTC (rev
6464)
@@ -32,7 +32,7 @@
<h:selectBooleanCheckbox id="secured"
value="#{pasteWindow.privateFragment}"/>
</h:panelGroup>
</h:panelGrid>
- <h:outputLabel for="text" value="Code: "/>
+ <h:outputLabel for="text" value="Code: "/><h:message
for="text" style="color: red" />
<h:inputTextarea id="text" style="width: 98%"
cols="17" rows="18"
value="#{pasteWindow.codeFragment.text}"/>
<h:outputLabel for="note" value="Note: (optional) "/>
Show replies by date