[richfaces-svn-commits] JBoss Rich Faces SVN: r14212 - in trunk/examples/photoalbum/source/web/src/main: webapp/includes/help and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu May 14 10:32:19 EDT 2009


Author: amarkhel
Date: 2009-05-14 10:32:19 -0400 (Thu, 14 May 2009)
New Revision: 14212

Modified:
   trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java
   trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/FileUploadManager.java
   trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ImageManager.java
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/buttonHelp.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/errorHelp.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/fileUploadHelp.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/imageScrollerHelp.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/inputSliderHelp.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/slideshow.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/statusHelp.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/tree_predefined.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/tree_user.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/validationHelp.xhtml
   trunk/examples/photoalbum/source/web/src/main/webapp/includes/image/imageInfo.xhtml
Log:


Modified: trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java
===================================================================
--- trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java	2009-05-14 14:10:29 UTC (rev 14211)
+++ trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java	2009-05-14 14:32:19 UTC (rev 14212)
@@ -69,7 +69,7 @@
 	public void addAlbum(Album album){
 		//Shelf must be not-null
 		if(album.getShelf() == null){
-			facesMessages.addToControl(Constants.SHELF_ID, Constants.SHELF_MUST_BE_NOT_NULL_ERROR, null);
+			facesMessages.addToControl(Constants.SHELF_ID, Constants.SHELF_MUST_BE_NOT_NULL_ERROR, new Object[0]);
 			Contexts.getConversationContext().set(Constants.ALBUM_VARIABLE, album);
 			return;
 		}

Modified: trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/FileUploadManager.java
===================================================================
--- trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/FileUploadManager.java	2009-05-14 14:10:29 UTC (rev 14211)
+++ trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/FileUploadManager.java	2009-05-14 14:32:19 UTC (rev 14212)
@@ -39,6 +39,7 @@
 import org.richfaces.photoalbum.domain.Image;
 import org.richfaces.photoalbum.service.Constants;
 import org.richfaces.photoalbum.service.IImageAction;
+import org.richfaces.photoalbum.service.PhotoAlbumException;
 import org.richfaces.photoalbum.ui.FileWrapper;
 
 import com.drew.imaging.jpeg.JpegMetadataReader;
@@ -92,10 +93,11 @@
 		}
 		try{
 			//Check if image with given name already exist
-			if(imageAction.isImageWithThisPathExist(image)){
+			if(imageAction.isImageWithThisPathExist(image.getAlbum(), image.getPath())){
 				//If exist generate new path for image
-				image.setPath(generateNewPath(image.getPath()));
-				image.setName(generateNewPath(image.getPath()));
+				String newPath = generateNewPath(image);
+				image.setPath(newPath);
+				image.setName(newPath);
 			}
 			//Save to database
 			imageAction.addImage(image);
@@ -115,8 +117,11 @@
 		item.getFile().delete();
 	}
 
-	private String generateNewPath(String path) {
-		return fileManager.transformPath(path, "_1");
+	private String generateNewPath(Image image) throws PhotoAlbumException{
+		String path = image.getPath().substring(0, image.getPath().lastIndexOf(Constants.DOT));
+		Long countCopies = imageAction.getCountIdenticalImages(image.getAlbum(), path) + 1;
+		String newPath = fileManager.transformPath(image.getPath(), "_" + countCopies);
+		return newPath;
 	}
 
 	private void addError(UploadItem item, Image image, String error) {

Modified: trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ImageManager.java
===================================================================
--- trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ImageManager.java	2009-05-14 14:10:29 UTC (rev 14211)
+++ trunk/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ImageManager.java	2009-05-14 14:32:19 UTC (rev 14212)
@@ -43,7 +43,6 @@
 import org.richfaces.photoalbum.domain.Comment;
 import org.richfaces.photoalbum.domain.Image;
 import org.richfaces.photoalbum.domain.MetaTag;
-import org.richfaces.photoalbum.domain.Shelf;
 import org.richfaces.photoalbum.domain.User;
 import org.richfaces.photoalbum.service.Constants;
 import org.richfaces.photoalbum.service.IImageAction;

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/buttonHelp.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/errorHelp.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/fileUploadHelp.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/imageScrollerHelp.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/inputSliderHelp.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/slideshow.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/statusHelp.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/tree_predefined.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/tree_user.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/help/validationHelp.xhtml
===================================================================
(Binary files differ)

Modified: trunk/examples/photoalbum/source/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)




More information about the richfaces-svn-commits mailing list