[richfaces-svn-commits] JBoss Rich Faces SVN: r13491 - 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 09:37:27 EDT 2009
Author: amarkhel
Date: 2009-04-10 09:37:27 -0400 (Fri, 10 Apr 2009)
New Revision: 13491
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/service/Constants.java
Log:
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 12:12:17 UTC (rev 13490)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-04-10 13:37:27 UTC (rev 13491)
@@ -163,6 +163,12 @@
@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() {
@@ -288,6 +294,7 @@
if(!shelfs.contains(shelf)){
shelf.setOwner(this);
shelfs.add(shelf);
+ albums.addAll(shelf.getAlbums());
}
}
@@ -304,20 +311,21 @@
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
@@ -334,9 +342,12 @@
* @return albums, belongs to user
*/
public List<Album> getAllAlbums(){
- List<Album> albums = new ArrayList<Album>();
- for(Shelf s:getShelfs()){
- albums.addAll(s.getAlbums());
+ if(this.albums == null){
+ List<Album> albums = new ArrayList<Album>();
+ for(Shelf s:getShelfs()){
+ albums.addAll(s.getAlbums());
+ }
+ this.albums = albums;
}
return albums;
}
@@ -347,15 +358,46 @@
* @return images, belongs to user
*/
public List<Image> getAllImages(){
+ if(this.images == null){
List<Image> images = new ArrayList<Image>();
for(Shelf s:getShelfs()){
for(Album a:s.getAlbums()){
images.addAll(a.getImages());
}
}
- return images;
+ this.images = images;
+ }
+ return this.images;
}
+ public void addAlbum(Album album){
+ if(albums == null){
+ albums = new ArrayList<Album>();
+ }
+ albums.add(album);
+ }
+
+ 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)
*
@@ -366,4 +408,20 @@
}
return null;
}
+
+ public List<Image> getImages() {
+ return images;
+ }
+
+ public void setImages(List<Image> images) {
+ this.images = images;
+ }
+
+ public List<Album> 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/Constants.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-04-10 12:12:17 UTC (rev 13490)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-04-10 13:37:27 UTC (rev 13491)
@@ -118,6 +118,7 @@
public static final int INITIAL_DELAY = 4000;
public static final int DELAY = 3000;
public static final String DEFAULT_PICTURE = "default/noimage_small200.jpg";
+ public static final String DEFAULT_ORIGINAL_PICTURE = "default/noimage.jpg";
public static final int DEFAULT_BUFFER_SIZE = 8192;
public static final String UPLOAD = "upload";
public static final String FEMALE = "Female";
More information about the richfaces-svn-commits
mailing list