[richfaces-svn-commits] JBoss Rich Faces SVN: r13419 - trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Apr 8 04:40:26 EDT 2009


Author: amarkhel
Date: 2009-04-08 04:40:26 -0400 (Wed, 08 Apr 2009)
New Revision: 13419

Modified:
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/RegistrationManager.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
Log:


Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/RegistrationManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/RegistrationManager.java	2009-04-07 18:55:23 UTC (rev 13418)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/RegistrationManager.java	2009-04-08 08:40:26 UTC (rev 13419)
@@ -65,21 +65,22 @@
 	
 	private boolean checkUserExist(User user) {
 		if(userAction.isUserExist(user.getLogin())){
-    		UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
-    		UIComponent component = root.findComponent(Constants.REGISTER_LOGIN_NAME_ID);
-			FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()), new FacesMessage(
-					FacesMessage.SEVERITY_ERROR, USER_WITH_THIS_LOGIN_ALREADY_EXIST , USER_WITH_THIS_LOGIN_ALREADY_EXIST));
-			return true;
+    		addFacesMessage(Constants.REGISTER_LOGIN_NAME_ID, USER_WITH_THIS_LOGIN_ALREADY_EXIST);
+    		return true;
     	}
 		return false;
 	}
 
+	private void addFacesMessage(String componentId, String message ) {
+		UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
+		UIComponent component = root.findComponent(componentId);
+		FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()), new FacesMessage(
+				FacesMessage.SEVERITY_ERROR, message , message));
+	}
+
 	private boolean checkPassword(User user) {
 		if(!user.getPassword().equals(user.getConfirmPassword())){
-    		UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
-    		UIComponent component = root.findComponent(Constants.REGISTER_CONFIRM_PASSWORD_ID);
-			FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()), new FacesMessage(
-					FacesMessage.SEVERITY_ERROR, CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD , CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD));
+			addFacesMessage(Constants.REGISTER_CONFIRM_PASSWORD_ID, CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD);
 			return true;
     	}
 		return false;

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java	2009-04-07 18:55:23 UTC (rev 13418)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java	2009-04-08 08:40:26 UTC (rev 13419)
@@ -38,6 +38,7 @@
 import org.richfaces.realworld.domain.Image;
 import org.richfaces.realworld.domain.Shelf;
 import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.service.Constants;
 import org.richfaces.realworld.service.IShelfAction;
 
 @Name("shelfManager")
@@ -70,6 +71,7 @@
     @Restrict("#{s:hasRole('admin')}")
     public void addShelf(Shelf shelf) {
     	validationSuccess = true;
+    	shelf.setPreDefined(false);
         shelfAction.addShelf(shelf);
         model.resetModel(NavigationEnum.SHELF_PREVIEW, shelf.getOwner(), shelf, null, null, null);
         Events.instance().raiseEvent("clearTree");
@@ -81,6 +83,7 @@
 
     @Restrict("#{s:hasRole('admin')}")
     public void editShelf(Shelf shelf) {
+    	shelf.setPreDefined(false);
         shelfAction.editShelf(shelf);
         model.resetModel(NavigationEnum.SHELF_PREVIEW, model.getSelectedUser(), shelf, null, null, null);
     }
@@ -90,7 +93,7 @@
         //Update domain model
         List<String> directoriesToDelete = new ArrayList<String>();
         for (Album a : shelf.getAlbums()) {
-            directoriesToDelete.add(user.getLogin() + "/" + a.getId());
+            directoriesToDelete.add(user.getLogin() + Constants.SLASH + a.getId());
         }
         shelfAction.deleteShelf(shelf);
         deleteDirectories(directoriesToDelete);




More information about the richfaces-svn-commits mailing list