[jbpm-commits] JBoss JBPM SVN: r5646 - in projects/demos/trainticket-demo/user_registration/trunk: src/main/org/jbpm/trainticketdemo/userregistration/entity and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Sep 15 16:50:40 EDT 2009


Author: jbarrez
Date: 2009-09-15 16:50:39 -0400 (Tue, 15 Sep 2009)
New Revision: 5646

Added:
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsActionImpl.java
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterActionImpl.java
   projects/demos/trainticket-demo/user_registration/trunk/view/img/header.jpg
Removed:
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCredits.java
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/Register.java
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java
Modified:
   projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AuthenticatorBean.java
   projects/demos/trainticket-demo/user_registration/trunk/src/main/org/jbpm/trainticketdemo/userregistration/entity/User.java
   projects/demos/trainticket-demo/user_registration/trunk/view/login.xhtml
   projects/demos/trainticket-demo/user_registration/trunk/view/user_details.xhtml
Log:
Small enhancements to demo

Deleted: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCredits.java
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCredits.java	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCredits.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.trainticketdemo.userregistration.sessionbeans;
-
-import javax.ejb.Local;
-
-/**
- * @author Joram Barrez
- */
- at Local
-public interface AddCredits {
-	
-	public void addCredits();
-	
-	public String getCreditsToAdd();
-	
-	public void setCreditsToAdd(String creditsToAdd);
-	
-	public void reloadDetails();
-
-}

Deleted: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.trainticketdemo.userregistration.sessionbeans;
-
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.log.Log;
-import org.jbpm.trainticketdemo.userregistration.entity.User;
-
-/**
- * @author Joram Barrez
- */
- at Stateless
- at Name("addCreditsAction")
-public class AddCreditsAction implements AddCredits {
-	
-	@In
-	@Out
-	private User user;
-	
-	@PersistenceContext
-	private EntityManager em;
-	
-	@Logger
-	private Log log;
-	
-	private String creditsToAdd = "";
-	
-	public void addCredits() {
-		try {
-			Double credits = Double.parseDouble(creditsToAdd);
-			user.setCurrentCredit(user.getCurrentCredit() + credits);
-			em.merge(user);
-			FacesMessages.instance().add(credits + " added to balance");
-		} catch (NumberFormatException e) {
-			FacesMessages.instance().add("Invalid amount of credits.");
-		}
-	}
-	
-	public void reloadDetails() {
-		this.user = em.find(User.class, user.getId());
-	}
-
-	public String getCreditsToAdd() {
-		return creditsToAdd;
-	}
-
-	public void setCreditsToAdd(String creditsToAdd) {
-		this.creditsToAdd = creditsToAdd;
-	}
-
-}

Copied: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java (from rev 5554, projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCredits.java)
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java	                        (rev 0)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.userregistration.sessionbeans;
+
+import javax.ejb.Local;
+
+/**
+ * @author Joram Barrez
+ */
+ at Local
+public interface AddCreditsAction {
+	
+	public void addCredits();
+	
+	public String getCreditsToAdd();
+	
+	public void setCreditsToAdd(String creditsToAdd);
+	
+	public void reloadDetails();
+
+}

Copied: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsActionImpl.java (from rev 5554, projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsAction.java)
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsActionImpl.java	                        (rev 0)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AddCreditsActionImpl.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.userregistration.sessionbeans;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.intercept.PostConstruct;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.log.Log;
+import org.jbpm.trainticketdemo.userregistration.entity.User;
+
+/**
+ * @author Joram Barrez
+ */
+ at Stateless
+ at Name("addCreditsAction")
+public class AddCreditsActionImpl implements AddCreditsAction {
+	
+	@In
+	@Out
+	private User user;
+	
+	@PersistenceContext
+	private EntityManager em;
+	
+	@Logger
+	private Log log; 
+	
+	private String creditsToAdd = "";
+	
+	public void addCredits() {
+		try {
+			Double credits = Double.parseDouble(creditsToAdd);
+			user.setCurrentCredit(user.getCurrentCredit() + credits);
+			em.merge(user);
+			FacesMessages.instance().add(credits + " added to balance");
+		} catch (NumberFormatException e) {
+			FacesMessages.instance().add("Invalid amount of credits.");
+		}
+	}
+	
+	public void reloadDetails() {
+		this.user = em.find(User.class, user.getId());
+	}
+
+	public String getCreditsToAdd() {
+		return creditsToAdd;
+	}
+
+	public void setCreditsToAdd(String creditsToAdd) {
+		this.creditsToAdd = creditsToAdd;
+	}
+
+	public User getUser() {
+		reloadDetails();
+		return user;
+	}
+
+	public void setUser(User user) {
+		this.user = user;
+	}
+
+}

Modified: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AuthenticatorBean.java
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AuthenticatorBean.java	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/AuthenticatorBean.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -34,6 +34,8 @@
     @Out(required = false)
     private User user;
     
+    private Long userId;
+    
 
     @SuppressWarnings("unchecked")
 	public boolean authenticate() {
@@ -42,7 +44,7 @@
         log.info("authenticating {0}", credentials.getUsername());
         
         List<User> users = new ArrayList<User>();
-        if (credentials.getUsername().equalsIgnoreCase("emulator")) {
+        if (credentials.getUsername().equalsIgnoreCase("123456789")) { // emulator
         	users = em.createQuery("select user from User user where user.name='jBPMPhone' ").getResultList();
         } else {
         	users = em.createQuery(

Deleted: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/Register.java
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/Register.java	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/Register.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.trainticketdemo.userregistration.sessionbeans;
-
-import javax.ejb.Local;
-
-/**
- * @author Joram Barrez
- */
- at Local
-public interface Register {
-
-	String register();
-	
-}

Deleted: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.trainticketdemo.userregistration.sessionbeans;
-
-import java.util.List;
-
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.log.Log;
-import org.jbpm.trainticketdemo.userregistration.entity.User;
-
-/**
- * @author Joram Barrez
- */
- at Stateless
- at Name("registerAction")
-public class RegisterAction implements Register {
-
-	@In
-	private User user;
-
-	@PersistenceContext
-	private EntityManager em;
-	
-	@Logger
-	private Log log;
-
-	public String register() {
-		
-		List existingCellPhone = em.createQuery(
-				"select name from User where cellPhoneNr = #{user.cellPhoneNr}")
-				.getResultList();
-
-		if (existingCellPhone.size() == 0) {
-			user.setCurrentCredit(0.0);
-			em.persist(user);
-			log.info("Registered new cellphone nr #{user.cellPhoneNr} for #{user.name}");
-			return "/registered.xhtml";
-		} else {
-			FacesMessages.instance().add("Cellphone number #{user.cellPhoneNr} already registered");
-			return null;
-		}
-
-	}
-
-}

Copied: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java (from rev 5554, projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/Register.java)
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java	                        (rev 0)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.userregistration.sessionbeans;
+
+import javax.ejb.Local;
+
+/**
+ * @author Joram Barrez
+ */
+ at Local
+public interface RegisterAction {
+
+	String register();
+	
+}

Copied: projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterActionImpl.java (from rev 5554, projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterAction.java)
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterActionImpl.java	                        (rev 0)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/hot/org/jbpm/trainticketdemo/userregistration/sessionbeans/RegisterActionImpl.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.userregistration.sessionbeans;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.log.Log;
+import org.jbpm.trainticketdemo.userregistration.entity.User;
+
+/**
+ * @author Joram Barrez
+ */
+ at Stateless
+ at Name("registerAction")
+public class RegisterActionImpl implements RegisterAction {
+
+	@In
+	@Out
+	private User user;
+
+	@PersistenceContext
+	private EntityManager em;
+	
+	@Logger
+	private Log log;
+
+	public String register() {
+		
+		List<User> existingCellPhone = em.createQuery(
+				"select u from User u where u.cellPhoneNr = #{user.cellPhoneNr}")
+				.getResultList();
+		
+		// If using the demo cellphone nr, we fake registration and use the already stored user.
+		if (user.getCellPhoneNr().equals("123456789")) {
+			user = (User) em.createQuery("select user from User user where user.name='jBPMPhone' ").getResultList().get(0);
+			return "/registered.xhtml";
+		}
+
+		if (existingCellPhone.size() == 0) {
+			user.setCurrentCredit(0.0);
+			em.persist(user);
+			log.info("Registered new cellphone nr #{user.cellPhoneNr} for #{user.name}");
+			return "/registered.xhtml";
+		} else {			
+			
+			FacesMessages.instance().add("Cellphone number #{user.cellPhoneNr} already registered");
+			return null;
+		}
+
+	}
+
+}

Modified: projects/demos/trainticket-demo/user_registration/trunk/src/main/org/jbpm/trainticketdemo/userregistration/entity/User.java
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/src/main/org/jbpm/trainticketdemo/userregistration/entity/User.java	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/src/main/org/jbpm/trainticketdemo/userregistration/entity/User.java	2009-09-15 20:50:39 UTC (rev 5646)
@@ -35,6 +35,8 @@
 import org.jboss.seam.annotations.Scope;
 
 /**
+ * Basic entity for storing user information: a cellphone nr, password and credit.
+ * 
  * @author Joram Barrez
  */
 @Entity

Added: projects/demos/trainticket-demo/user_registration/trunk/view/img/header.jpg
===================================================================
(Binary files differ)


Property changes on: projects/demos/trainticket-demo/user_registration/trunk/view/img/header.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: projects/demos/trainticket-demo/user_registration/trunk/view/login.xhtml
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/view/login.xhtml	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/view/login.xhtml	2009-09-15 20:50:39 UTC (rev 5646)
@@ -15,6 +15,8 @@
         <rich:panel>
             <f:facet name="header">Login</f:facet>
 
+			<h:graphicImage value="/img/header.jpg" alt="jBPM Demo Header" style="float:right"/>
+
             <p>Please login here</p>
 
             <div class="dialog">

Modified: projects/demos/trainticket-demo/user_registration/trunk/view/user_details.xhtml
===================================================================
--- projects/demos/trainticket-demo/user_registration/trunk/view/user_details.xhtml	2009-09-15 20:49:13 UTC (rev 5645)
+++ projects/demos/trainticket-demo/user_registration/trunk/view/user_details.xhtml	2009-09-15 20:50:39 UTC (rev 5646)
@@ -13,15 +13,11 @@
 	template="layout/template.xhtml">
 
 	<ui:define name="body">
-	
-		<a4j:region>
-	        <h:form>
-	            <a4j:poll id="poll" interval="3000" reRender="poll,currentBalance" actionListener="#{addCreditsAction.reloadDetails}" />
-	        </h:form>
-    	</a4j:region>
 
 		<rich:panel id="userDetails">
 			<f:facet name="header">User details</f:facet>
+			
+			<h:graphicImage value="/img/header.jpg" alt="jBPM Demo Header" style="float:right"/>
 
 			<f:view>
 				<h:form>
@@ -32,12 +28,16 @@
 							<b>Current balance: <h:outputText id="currentBalance" value="#{user.currentCredit}" /></b>
 						</h:panelGrid>
 						<br/>
-						<h:panelGrid columns="2">
-							Add credits to balance: <h:inputText value="#{addCreditsAction.creditsToAdd}" />
+						<h:panelGrid columns="3">
+							<h:outputText value="Add credits to balance:" />
+							<h:inputText value="#{addCreditsAction.creditsToAdd}" />
+							<h:commandButton value="OK" action="#{addCreditsAction.addCredits}" />
 						</h:panelGrid>
 					</s:validateAll>
 					<h:messages />
-					<h:commandButton value="OK" action="#{addCreditsAction.addCredits}" />
+					<br/>
+					<br/>
+					<h:commandButton value="Refresh" action="#{addCreditsAction.reloadDetails}" />
 				</h:form>
 			</f:view>
 		</rich:panel>



More information about the jbpm-commits mailing list