[richfaces-svn-commits] JBoss Rich Faces SVN: r13500 - in trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld: service and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Apr 10 11:50:57 EDT 2009


Author: amarkhel
Date: 2009-04-10 11:50:57 -0400 (Fri, 10 Apr 2009)
New Revision: 13500

Modified:
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java
   trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
Log:
Refactoring

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -90,9 +90,6 @@
     @Temporal(TemporalType.TIMESTAMP)
     private Date created;
 
-    @Transient
-    private List<Image> unvisitedImages = new ArrayList<Image>();
-
     @OneToOne(cascade = CascadeType.ALL, optional = true)
     private Image coveringImage;
 
@@ -191,15 +188,14 @@
      * @return List of unvisited images
      */
     public List<Image> getUnvisitedImages() {
+    	List<Image> unvisitedImages = new ArrayList<Image>();
+    	for(Image i : this.getImages()){
+    		if(i.isNew()){
+    			unvisitedImages.add(i);
+    		}
+    	}
         return unvisitedImages;
     }
-
-    /**
-     * @param unvisitedImages - List of unvisited images
-     */
-    public void setUnvisitedImages(List<Image> unvisitedImages) {
-        this.unvisitedImages = unvisitedImages;
-    }
     
     /**
      * @param coveringImage - Image for covering album
@@ -226,9 +222,6 @@
         if (image.getAlbum() != null && !this.equals(image.getAlbum())) {
         	//Remove from previous album
         	image.getAlbum().removeImage(image);
-        }if(!image.isVisited()){//Check, if user already seen this image
-        	this.getShelf().getUnvisitedImages().add(image);
-            this.getUnvisitedImages().add(image);
         }
         image.setAlbum(this);
         images.add(image);
@@ -245,13 +238,6 @@
             throw new IllegalArgumentException("Null image");
         }
         if(image.getAlbum().equals(this)){
-        	//Remove from unvisited images if needed
-        	if(image.getAlbum().getUnvisitedImages().contains(image)){
-        		image.getAlbum().getUnvisitedImages().remove(image);
-        	}
-        	if(image.getAlbum().getShelf().getUnvisitedImages().contains(image)){
-        		image.getAlbum().getShelf().getUnvisitedImages().remove(image);
-        	}
         	image.setAlbum(null);
             images.remove(image);
         }else{
@@ -260,15 +246,6 @@
     }
 
     /**
-     * This method return count of images of current album
-     *
-     * @return count of images of this album
-     */
-    public int getCountImages() {
-        return this.getImages() != null ? this.getImages().size() : 0;
-    }
-
-    /**
      * Getter for property owner
      *
      * @return User object, owner of this album
@@ -318,32 +295,6 @@
     }
 
     /**
-     * @return count of unvisited images
-     */
-    public Long getCountUnvisitedImages() {
-        return new Long(unvisitedImages.size());
-    }
-
-    /** This method marks specified image as visited, if isSetVisited parameter is true. 
-     * If isSetVisited parameter is false(in case of copy images from one album to another),
-     * image not marked as visited.
-     * Undependently of isSetVisited parameter, removes image from collection of unvisitedImages.
-     * 
-     * @param image - image to mark visited
-     * @param isSetVisited - List of unvisited images
-     */
-    public void visitImage(Image image, boolean isSetVisited) {
-        if (unvisitedImages.contains(image)) {
-            unvisitedImages.remove(image);
-            //Clean unvisitedImages of parent shelf
-            if(this.getShelf().getUnvisitedImages().contains(image)){
-            	this.getShelf().getUnvisitedImages().remove(image);
-            }
-        }
-        image.setVisited(isSetVisited);
-    }
-
-    /**
      * Return relative path of this album in file-system(relative to uploadRoot parameter)
      *
      */

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -25,7 +25,6 @@
  */
 package org.richfaces.realworld.domain;
 
-import java.io.File;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Date;
@@ -60,14 +59,6 @@
 
 @NamedQueries({
     @NamedQuery(
-            name = "album-unvisited",
-            query = "from Image i where i.album=:album and i.uploaded > :date"
-    ),
-    @NamedQuery(
-            name = "shelf-unvisited",
-            query = "from Image i where i.album.shelf = :shelf and i.uploaded > :date"
-    ),
-    @NamedQuery(
             name = "tag-byName",
             query = "from MetaTag m where m.tag =:tag"
     ), 

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -58,8 +58,7 @@
     @OneToMany(mappedBy = "shelf", cascade = {CascadeType.ALL})
     @org.hibernate.annotations.OrderBy(clause = "NAME asc")
     private List<Album> albums = new ArrayList<Album>();
-    @Transient
-    private List<Image> unvisitedImages = new ArrayList<Image>();
+
     @NotNull
     private boolean shared;
 
@@ -196,30 +195,35 @@
     public void setShared(boolean shared) {
         this.shared = shared;
     }
-
+    
+ // ********************** Business Methods ********************** //
+    
     /**
-     * @return count of unvisited images
-     */
-    public Long getCountUnvisitedImages() {
-        return new Long(unvisitedImages.size());
-    }
-
-    /**
      * @return List of unvisited images
      */
     public List<Image> getUnvisitedImages() {
+    	List<Image> unvisitedImages = new ArrayList<Image>();
+    	for(Album a : getAlbums()){
+    		for(Image i : a.getImages()){
+    			if(i.isNew()){
+    				unvisitedImages.add(i);
+    			}
+    		}
+    	}
         return unvisitedImages;
     }
-
+    
     /**
-     * @param unvisitedImages - List of unvisited images
+     * @return List of images, belongs to this shelf
      */
-    public void setUnvisitedImages(List<Image> unvisitedImages) {
-        this.unvisitedImages = unvisitedImages;
+    public List<Image> getImages() {
+    	List<Image> images = new ArrayList<Image>();
+    	for(Album a : getAlbums()){
+    		images.addAll(a.getImages());
+    	}
+        return images;
     }
     
- // ********************** Business Methods ********************** //
-    
     /**
      * This method add album to collection of albums of current shelf
      *
@@ -233,12 +237,6 @@
             // remove from previous shelf
         	album.getShelf().removeAlbum(album);
             album.setShelf(this);
-            //If album contain new or unvisited images, add to shelf unvisited images
-            for(Image i : album.getImages()){
-            	if(i.isNew()){
-            		this.getUnvisitedImages().add(i);
-            	}
-        	}
             albums.add(album);
         }	
     }
@@ -253,10 +251,6 @@
         if (album == null)
             throw new IllegalArgumentException("Null album!");
         if(album.getShelf().equals(this)){
-        	//Remove from unvisitedImages if needed
-        	for(Image i : album.getImages()){
-        		album.visitImage(i, false);
-        	}
         	album.setShelf(null);
             albums.remove(album);
         }else{
@@ -265,30 +259,6 @@
     }
 
     /**
-     * This method return count of albums of current shelf
-     *
-     * @return count of albums of current shelf
-     */
-    public int getCountAlbums() {
-        return this.getAlbums() != null ? this.getAlbums().size() : 0;
-    }
-
-    /**
-     * This method return count of images of current shelf
-     *
-     * @return count of images of this shelf
-     */
-    public int getCountImages() {
-        int result = 0;
-        if (getCountAlbums() > 0) {
-            for (Album album : getAlbums()) {
-                result += album.getCountImages();
-            }
-        }
-        return result;
-    }
-
-    /**
      * This method return first album of current shelf or null if shelf haven't albums.
      *
      * @return first album of shelf or null

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -66,30 +66,6 @@
         query = "from User u where u.login = :login"
    ),
    @NamedQuery(
-	    name = "user-sharedAlbums",
-	    query = "from Album a where a.shelf.owner=:user and a.shelf.shared=true"
-	   ),
-   @NamedQuery(
-		name = "user-sharedImages",
-		query = "from Image i where i.album.shelf.owner=:user and i.album.shelf.shared=true"
-		   ),
-   @NamedQuery(
-		name = "user-countAlbums",
-		query = "select count(a) from Album a where a.shelf.owner=:user"
-			   ),
-	@NamedQuery(
-		name = "user-countSharedAlbums",
-		query = "select count(a) from Album a where a.shelf.owner=:user and a.shelf.shared=true"
-				   ),
-	@NamedQuery(
-		name = "user-countImages",
-		query = "select count(i) from Image i where i.album.shelf.owner=:user"
-					   ),
-		@NamedQuery(
-		name = "user-countSharedImages",
-		query = "select count(i) from Image i where i.album.shelf.owner=:user and i.album.shelf.shared=true"
-						   ),
-   @NamedQuery(
 	    name = "user-user",
 	    query = "from User u where u.login = :login"
 	   )
@@ -151,24 +127,12 @@
 	@NotNull
 	private Sex sex;
 	
-	@Transient
-	private Long countImages;
-	
-	@Transient
-	private Long countAlbums;
-	
 	private Boolean hasAvatar;
 	
 	@OneToMany(mappedBy = "owner", cascade = { CascadeType.ALL})
     @org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
     @org.hibernate.annotations.OrderBy(clause = "NAME asc")
     private List<Shelf> shelfs = new ArrayList<Shelf>();
-	
-	@Transient
-	private List<Image> images = null;
-	
-	@Transient
-	private List<Album> albums = null;
 
 	//----------------Getters, Setters
 	public String getFirstName() {
@@ -231,22 +195,6 @@
 		return id;
 	}
 	
-	public Long getCountImages() {
-		return countImages;
-	}
-
-	public void setCountImages(Long countImages) {
-		this.countImages = countImages;
-	}
-
-	public Long getCountAlbums() {
-		return countAlbums;
-	}
-
-	public void setCountAlbums(Long countAlbums) {
-		this.countAlbums = countAlbums;
-	}
-	
 	public String getConfirmPassword() {
 		return confirmPassword;
 	}
@@ -294,7 +242,6 @@
         if(!shelfs.contains(shelf)){
         	shelf.setOwner(this);
             shelfs.add(shelf);
-			albums.addAll(shelf.getAlbums());
         }
     }
 
@@ -311,117 +258,81 @@
         if(shelf.getOwner().getLogin().equals(this.getLogin())){
         	shelf.setOwner(null);
             shelfs.remove(shelf);
-			albums.removeAll(shelf.getAlbums());
         }else{
         	throw new IllegalArgumentException("Shelf not belongs to this user!");
         }
     }
-
-/*    *//**
-     * This method set countAlbums and countImages to null.
-     * Used when user delete shelf, album or image and so on... to reset statistics.
-     * On next access to this properties, hit to database occur, to retrieve actual data.
-     *//*
-    public void updateStatistics() {
-		countAlbums = null;
-		countImages = null;
-	}*/
 	
-    /**
-     * This method return count of shelves, belongs to user
-     *
-     * @return count of of shelves, belongs to user
-     */
-	public int getCountShelfs() {
-		return this.getShelfs() != null ? this.getShelfs().size() : 0;
-	}
-	
 	/**
-     * This method return all albums, belongs to user
+     * Return relative path of folder with user's images in file-system(relative to uploadRoot parameter)
      *
-     * @return albums, belongs to user
      */
-	public List<Album> getAllAlbums(){
-		if(this.albums == null){
-			List<Album> albums = new ArrayList<Album>();
-			for(Shelf s:getShelfs()){
-				albums.addAll(s.getAlbums());
-			}
-			this.albums = albums;
+	public String getPath(){
+		if(this.getId() != null){
+			return File.separator + this.getLogin().toString() + File.separator;
 		}
-		return albums;
+		return null;
 	}
-	
+
 	/**
      * This method return all images, belongs to user
      *
      * @return images, belongs to user
      */
-	public List<Image> getAllImages(){
-		if(this.images == null){
+	public List<Image> getImages() {
 		List<Image> images = new ArrayList<Image>();
-		for(Shelf s:getShelfs()){
-			for(Album a:s.getAlbums()){
+		for (Shelf s : getShelfs()) {
+			for (Album a : s.getAlbums()) {
 				images.addAll(a.getImages());
 			}
 		}
-		this.images = images;
-		}
-		return this.images;
+		return images;
 	}
-	
-	public void addAlbum(Album album){
-		if(albums == null){
-			albums = new ArrayList<Album>();
+
+	/**
+	 * This method return all albums, belongs to user
+	 * 
+	 * @return albums, belongs to user
+	 */
+	public List<Album> getAlbums() {
+		List<Album> albums = new ArrayList<Album>();
+		for (Shelf s : getShelfs()) {
+			albums.addAll(s.getAlbums());
 		}
-		albums.add(album);
+		return albums;
 	}
 	
-	public void removeAlbum(Album album){
-		if(albums == null){
-			albums = new ArrayList<Album>();
-		}
-		albums.remove(album);
-	}
-	
-	public void addImage(Image image){
-		if(images == null){
-			images = new ArrayList<Image>();
-		}
-		images.add(image);
-	}
-	
-	public void removeImage(Image image){
-		if(images == null){
-			images = new ArrayList<Image>();
-		}
-		images.remove(image);
-	}
-	
 	/**
-     * Return relative path of folder with user's images in file-system(relative to uploadRoot parameter)
+     * This method return all images, belongs to user
      *
+     * @return images, belongs to user
      */
-	public String getPath(){
-		if(this.getId() != null){
-			return File.separator + this.getLogin().toString() + File.separator;
+	public List<Image> getSharedImages() {
+		List<Image> images = new ArrayList<Image>();
+		for (Shelf s : getShelfs()) {
+			if(!s.isShared()){
+				continue;
+			}
+			for (Album a : s.getAlbums()) {
+				images.addAll(a.getImages());
+			}
 		}
-		return null;
-	}
-
-	public List<Image> getImages() {
 		return images;
 	}
 
-	public void setImages(List<Image> images) {
-		this.images = images;
-	}
-
-	public List<Album> getAlbums() {
+	/**
+	 * This method return all albums, belongs to user
+	 * 
+	 * @return albums, belongs to user
+	 */
+	public List<Album> getSharedAlbums() {
+		List<Album> albums = new ArrayList<Album>();
+		for (Shelf s : getShelfs()) {
+			if(!s.isShared()){
+				continue;
+			}
+			albums.addAll(s.getAlbums());
+		}
 		return albums;
 	}
-
-	public void setAlbums(List<Album> albums) {
-		this.albums = albums;
-	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -77,15 +77,4 @@
 	public void editAlbum(Album album){
 		em.flush();
 	}
-
-	/**
-     * Used to retrieve all unvisited images, belongs to specified album.
-     *
-     * @param album
-     * @return List of unvisited images
-     */
-	@SuppressWarnings("unchecked")
-	public List<Image> getUnvisitedImages(Album album){
-		return (List<Image>)em.createNamedQuery(Constants.ALBUM_UNVISITED_QUERY).setParameter(Constants.ALBUM_PARAMETER, album).setParameter(Constants.DATE_PARAMETER, ActionTools.getRecentlyDate()).getResultList();
-	}
 }

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -36,7 +36,8 @@
 	public static final String CLEAR_EDITOR_EVENT = "clearEditor";
 	public static final String CLEAR_TREE_EVENT = "clearTree";
 	public static final String ALBUM_ADDED_EVENT = "albumAdded";
-	public static final String DNDUPLOADED_EVENT = "DNDUploadedEvent";
+	public static final String IMAGE_DRAGGED_EVENT = "imageDraggedEvent";
+	public static final String ALBUM_DRAGGED_EVENT = "albumDraggedEvent";
 	public static final String ADD_IMAGE_EVENT = "addImage";
 	public static final String SHELF_DELETED_EVENT = "shelfDeleted";
 	public static final String CLEAR_FILE_UPLOAD_EVENT = "clearFileUpload";
@@ -135,15 +136,8 @@
 	public static final String PASSWORD_PARAMETER = "password";
 	public static final String USERNAME_PARAMETER = "username";
 	public static final String USER_PARAMETER = "user";
-	public static final String USER_COUNT_SHARED_IMAGES_QUERY = "user-countSharedImages";
-	public static final String USER_COUNT_IMAGES_QUERY = "user-countImages";
-	public static final String USER_COUNT_SHARED_ALBUMS_QUERY = "user-countSharedAlbums";
-	public static final String USER_COUNT_ALBUMS_QUERY = "user-countAlbums";
-	public static final String USER_SHARED_IMAGES_QUERY = "user-sharedImages";
-	public static final String USER_SHARED_ALBUMS_QUERY = "user-sharedAlbums";
 	public static final String DATE_PARAMETER = "date";
 	public static final String ALBUM_PARAMETER = "album";
-	public static final String ALBUM_UNVISITED_QUERY = "album-unvisited";
 	public static final String COMMA = ",";
 	public static final int MAX_RESULTS = 20;
 	public static final String PERCENT = "%";
@@ -166,7 +160,6 @@
 	public static final String SEARCH_ALBUM_QUERY = "from Album a where lower(a.name) like :name or lower(a.description) like :name";
 	public static final String USER_SHELVES_QUERY = "user-shelves";
 	public static final String SHELF_PARAMETER = "shelf";
-	public static final String SHELF_UNVISITED_QUERY = "shelf-unvisited";
 	private Constants(){
 	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -42,6 +42,4 @@
 	
 	public void editAlbum(Album album);
 
-	public List<Image> getUnvisitedImages(Album album);
-
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -44,6 +44,4 @@
 	public void editShelf(Shelf shelf);
 	
 	public List<Shelf> getShelfs(User user);
-
-	public List<Image> getUnvisitedImages(Shelf shelf);
 }

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -20,12 +20,8 @@
  */
 package org.richfaces.realworld.service;
 
-import java.util.List;
-
 import javax.ejb.Local;
 
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
 import org.richfaces.realworld.domain.User;
 
 /**
@@ -40,10 +36,4 @@
 	public void register(User user);
 	public boolean isUserExist(String login);
 	public User updateUser();
-	public Long countAlbums();
-	public Long countImages();
-	public Long countSharedImages(User u);
-	public Long countSharedAlbums(User user);
-	public List<Album> getSharedAlbums(User user);
-	public List<Image> getSharedImages(User user);
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -92,17 +92,4 @@
 		query.setParameter(Constants.USER_PARAMETER, user.getId() == null ? null : user);
 		return query.getResultList();
 	}
-
-	/**
-     * Used to retrieve all unvisited images, belongs to specified shelf.
-     *
-     *@param shelf
-     *@return List of unvisited images
-     */
-	@SuppressWarnings("unchecked")
-	public List<Image> getUnvisitedImages(Shelf shelf) {
-		return (List<Image>) em.createNamedQuery(Constants.SHELF_UNVISITED_QUERY)
-				.setParameter(Constants.SHELF_PARAMETER, shelf)
-				.setParameter(Constants.DATE_PARAMETER, ActionTools.getRecentlyDate()).getResultList();
-	}
 }
\ No newline at end of file

Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java	2009-04-10 15:48:02 UTC (rev 13499)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java	2009-04-10 15:50:57 UTC (rev 13500)
@@ -20,16 +20,12 @@
  */
 package org.richfaces.realworld.service;
 
-import java.util.List;
-
 import javax.ejb.Stateless;
 import javax.persistence.EntityManager;
 
 import org.jboss.seam.annotations.AutoCreate;
 import org.jboss.seam.annotations.In;
 import org.jboss.seam.annotations.Name;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
 import org.richfaces.realworld.domain.User;
 
 /**
@@ -89,58 +85,4 @@
 		.setParameter(Constants.LOGIN_PARAMETER, login)
 		.getResultList().size() != 0;
 	}
-	
-	/**
-     * Used to retrieve all shared albums, belongs to specified user.
-     * @param user
-     * @return list of shared albums of specified user
-     */
-	@SuppressWarnings("unchecked")
-	public List<Album> getSharedAlbums(User user){
-		return (List<Album>)em.createNamedQuery(Constants.USER_SHARED_ALBUMS_QUERY).setParameter(Constants.USER_PARAMETER, user).getResultList();
-	}
-	
-	/**
-     * Used to retrieve all shared images, belongs to specified user.
-     * @param user
-     * @return list of shared images of specified user
-     */
-	@SuppressWarnings("unchecked")
-	public List<Image> getSharedImages(User user){
-		return (List<Image>)em.createNamedQuery(Constants.USER_SHARED_IMAGES_QUERY).setParameter(Constants.USER_PARAMETER, user).getResultList();
-	}
-	
-	/**
-     * Used to retrieve count of all albums, belongs to specified user.
-     * @return count of all albums of current user
-     */
-	public Long countAlbums(){
-		return (Long)em.createNamedQuery(Constants.USER_COUNT_ALBUMS_QUERY).setParameter(Constants.USER_PARAMETER, user).getSingleResult();
-	}
-	
-	/**
-     * Used to retrieve count of shared albums, belongs to specified user.
-     * @param user
-     * @return count of shared albums of specified user
-     */
-	public Long countSharedAlbums(User user){
-		return (Long)em.createNamedQuery(Constants.USER_COUNT_SHARED_ALBUMS_QUERY).setParameter(Constants.USER_PARAMETER, user).getSingleResult();
-	}
-	
-	/**
-     * Used to retrieve count of all images, belongs to specified user.
-     * @return count of all images of current user
-     */
-	public Long countImages(){
-		return (Long)em.createNamedQuery(Constants.USER_COUNT_IMAGES_QUERY).setParameter(Constants.USER_PARAMETER, user).getSingleResult();
-	}
-	
-	/**
-     * Used to retrieve count shared images, belongs to specified user.
-     * @param user
-     * @return count of shared images of specified user
-     */
-	public Long countSharedImages(User user){
-		return (Long)em.createNamedQuery(Constants.USER_COUNT_SHARED_IMAGES_QUERY).setParameter(Constants.USER_PARAMETER, user).getSingleResult();
-	}
 }
\ No newline at end of file




More information about the richfaces-svn-commits mailing list