Author: amarkhel
Date: 2009-03-11 06:50:56 -0400 (Wed, 11 Mar 2009)
New Revision: 12914
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/MetaTag.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.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/IUserAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.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
trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
trunk/test-applications/realworld2/pom.xml
Log:
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -22,7 +22,6 @@
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -33,8 +32,6 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
@@ -42,7 +39,6 @@
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import javax.persistence.Transient;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
@@ -56,11 +52,7 @@
*
* @author Andrey Markhel
*/
-@NamedQueries(
- {
- @NamedQuery(name = "album-byAlbumNameAndLogin", query = "from Album a
where a.name=:albumName and a.owner.login=:login")
- }
- )
+@NamedQueries( { @NamedQuery(name = "album-byAlbumNameAndLogin", query =
"from Album a where a.name=:albumName and a.owner.login=:login") })
@Entity
@Name("album")
@Table(name = "albums")
@@ -87,31 +79,14 @@
@JoinColumn(name = "ALBUM_USER_ID", referencedColumnName =
"USER_ID")
private User owner;
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(name="ALBUMS_METATAGS",
- joinColumns=
- @JoinColumn(name="CI_ALBUM_ID",
- referencedColumnName="ALBUM_ID"),
- inverseJoinColumns=
- @JoinColumn(name="CI_METATAG_ID",
- referencedColumnName="METATAG_ID"))
- protected List<MetaTag> albumTags;
-
- @NotNull
- private boolean shared;
-
@OneToMany(cascade = CascadeType.ALL, mappedBy = "album")
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
private List<Image> images = new ArrayList<Image>();
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "SHARED_ALBUMS", joinColumns = @JoinColumn(name =
"ALBUM_ID"), inverseJoinColumns = @JoinColumn(name = "USER_ID"))
- private List<User> sharedOwners = new ArrayList<User>();
-
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "PARENT_SHELF_ID", nullable = true)
@org.hibernate.annotations.ForeignKey(name = "FK_SHELF_PARENT_ID")
- private Shelf parent;
+ private Shelf shelf;
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@@ -120,12 +95,12 @@
- public Shelf getParent() {
- return parent;
+ public Shelf getShelf() {
+ return shelf;
}
- public void setParent(Shelf parent) {
- this.parent = parent;
+ public void setShelf(Shelf parent) {
+ this.shelf = parent;
}
/**
@@ -218,14 +193,6 @@
}
- public boolean isShared() {
- return shared;
- }
-
- public void setShared(boolean shared) {
- this.shared = shared;
- }
-
public User getOwner() {
return owner;
}
@@ -237,15 +204,7 @@
public void setOwner(User owner) {
this.owner = owner;
}
-
- public List<User> getSharedOwners() {
- return sharedOwners;
- }
-
- public void setSharedOwners(List<User> sharedOwners) {
- this.sharedOwners = sharedOwners;
- }
-
+
public int getIndex(Image image) {
for (int i = 0; i < this.images.size(); i++) {
if (this.images.get(i).equals(image)) {
@@ -254,35 +213,7 @@
}
return -1;
}
-
- public List<MetaTag> getAlbumTags() {
- return albumTags;
- }
-
- public void setAlbumTags(List<MetaTag> albumTags) {
- this.albumTags = albumTags;
- }
- public void addMetaTag(MetaTag metatag) {
- if (metatag == null) {
- throw new IllegalArgumentException("Null metatag!");
- }
- if(!albumTags.contains(metatag)){
- metatag.addAlbum(this);
- albumTags.add(metatag);
- }
- }
-
- public void removeMetaTag(MetaTag metatag) {
- if (metatag == null) {
- throw new IllegalArgumentException("Null metatag!");
- }
- if(albumTags.contains(metatag)){
- metatag.removeAlbum(this);
- albumTags.remove(metatag);
- }
- }
-
public Image getLastImage(){
if(images != null && images.size() > 0){
return images.get(images.size() - 1);
@@ -309,5 +240,4 @@
this.created = created;
}
-
}
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -43,7 +43,6 @@
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@@ -123,9 +122,6 @@
@Length(min=3)
private String description;
- @Transient
- private String albumName;
-
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@@ -142,14 +138,6 @@
referencedColumnName="ALBUM_ID")
private Album album;
- @ManyToMany
- @JoinTable(
- name = "SHARED_IMAGES",
- joinColumns = @JoinColumn(name = "IMAGE_ID"),
- inverseJoinColumns = @JoinColumn(name = "USER_ID")
- )
- private List<User> sharedOwners = new ArrayList<User>();
-
@NotNull
private boolean allowComments;
@@ -181,14 +169,6 @@
public void setName(String name) {
this.name = name;
}
-
- public List<User> getSharedOwners() {
- return sharedOwners;
- }
-
- public void setSharedOwners(List<User> sharedOwners) {
- this.sharedOwners = sharedOwners;
- }
/**
* Getter for property description
@@ -231,18 +211,7 @@
public void setAlbum(Album album) {
this.album = album;
}
-
- public String getAlbumName() {
- if(null == albumName && this.getAlbum() != null){
- albumName = this.getAlbum().getName();
- }
- return albumName;
- }
- public void setAlbumName(String albumName) {
- this.albumName = albumName;
- }
-
//---------------------------Business methods
public void addComment(Comment comment) {
@@ -268,7 +237,6 @@
return comments;
}
-
public List<MetaTag> getImageTags() {
return imageTags;
}
@@ -359,5 +327,4 @@
this.allowComments = allowComments;
}
-
}
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -27,9 +27,7 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.validator.Length;
@@ -57,9 +55,6 @@
@ManyToMany(mappedBy="imageTags")
private List<Image> images;
-
- @ManyToMany(mappedBy="albumTags")
- private List<Album> albums;
public Long getId() {
return id;
@@ -80,14 +75,6 @@
public void setImages(List<Image> images) {
this.images = images;
}
-
- public List<Album> getAlbums() {
- return albums;
- }
-
- public void setAlbums(List<Album> albums) {
- this.albums = albums;
- }
public void addImage(Image image){
images.add(image);
@@ -96,12 +83,4 @@
public void removeImage(Image image){
images.remove(image);
}
-
- public void addAlbum(Album album){
- albums.add(album);
- }
-
- public void removeAlbum(Album album){
- albums.remove(album);
- }
}
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.java 2009-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Sex.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -1,6 +1,5 @@
package org.richfaces.realworld.domain;
-
public enum Sex {
MALE("1"),
FEMALE("0");
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -12,8 +12,6 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@@ -23,9 +21,7 @@
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
-import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Role;
@Entity
@Name("shelf")
@@ -52,9 +48,9 @@
@JoinColumn(name = "SHELF_USER_ID", referencedColumnName =
"USER_ID")
private User owner;
- @OneToMany(mappedBy = "parent", cascade = { CascadeType.ALL })
+ @OneToMany(mappedBy = "shelf", cascade = { CascadeType.ALL })
@org.hibernate.annotations.OrderBy(clause = "NAME asc")
- private List<Album> childAlbums = new ArrayList<Album>();
+ private List<Album> albums = new ArrayList<Album>();
@NotNull
private boolean shared;
@@ -109,8 +105,8 @@
this.description = description;
}
- public List<Album> getChildAlbums() {
- return childAlbums;
+ public List<Album> getAlbums() {
+ return albums;
}
public User getOwner() {
@@ -121,36 +117,35 @@
this.owner = owner;
}
- public void addChildAlbum(Album album) {
+ public void addAlbum(Album album) {
if (album == null)
throw new IllegalArgumentException("Null child!");
- if (album.getParent() != null)
- album.getParent().getChildAlbums().remove(album);
- album.setParent(this);
- childAlbums.add(album);
+ if (album.getShelf() != null)
+ album.getShelf().getAlbums().remove(album);
+ album.setShelf(this);
+ albums.add(album);
}
public void removeChildAlbum(Album album) {
if (album == null)
throw new IllegalArgumentException("Null child!");
- album.setParent(null);
- childAlbums.remove(album);
+ album.setShelf(null);
+ albums.remove(album);
}
public int getCountAlbums() {
- return this.getChildAlbums() != null ? this.getChildAlbums().size() : 0;
+ return this.getAlbums() != null ? this.getAlbums().size() : 0;
}
public int getCountImages() {
int result = 0;
if(getCountAlbums() > 0){
- for(Album album : getChildAlbums()){
+ for(Album album : getAlbums()){
result += album.getCountImages();
}
}
return result;
-
}
/**
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -31,17 +31,16 @@
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
+import javax.persistence.UniqueConstraint;
+
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
@@ -50,7 +49,6 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Role;
import org.jboss.seam.annotations.Scope;
-import javax.persistence.UniqueConstraint;
@NamedQueries({
@NamedQuery(
@@ -61,10 +59,6 @@
name = "user-exist",
query = "from User u where u.login = :login"
),
- @NamedQuery(
- name = "user-rootAlbums",
- query = "from Album a WHERE a.owner.login=:login and a.parent is
null"
- ),
@NamedQuery(
name = "user-user",
query = "from User u where u.login = :login"
@@ -121,12 +115,6 @@
@Transient
private String confirmPassword;
- @ManyToMany(mappedBy = "sharedOwners")
- private List<Album> favoriteAlbums = new ArrayList<Album>();
-
- @ManyToMany(mappedBy = "sharedOwners")
- private List<Image> favoriteImages = new ArrayList<Image>();
-
@Temporal(TemporalType.TIMESTAMP)
private Date birthDate;
@@ -142,7 +130,7 @@
@OneToMany(mappedBy = "owner", cascade = { CascadeType.ALL}, fetch =
FetchType.LAZY)
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@org.hibernate.annotations.OrderBy(clause = "NAME asc")
- private List<Album> childAlbums = new ArrayList<Album>();
+ private List<Album> albums = new ArrayList<Album>();
@OneToMany(mappedBy = "owner", cascade = { CascadeType.ALL}, fetch =
FetchType.LAZY)
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@@ -206,8 +194,8 @@
return id;
}
- public List<Album> getChildAlbums() {
- return childAlbums;
+ public List<Album> getAlbums() {
+ return albums;
}
//---------------------------Business methods
@@ -217,7 +205,7 @@
throw new IllegalArgumentException("Null album!");
}
album.setOwner(this);
- childAlbums.add(album);
+ albums.add(album);
}
public void removeAlbum(Album album) {
@@ -225,7 +213,7 @@
throw new IllegalArgumentException("Null album");
}
album.setOwner(null);
- childAlbums.remove(album);
+ albums.remove(album);
}
public void addShelf(Shelf shelf) {
@@ -252,42 +240,6 @@
this.confirmPassword = confirmPassword;
}
- public List<Album> getFavoriteAlbums() {
- return favoriteAlbums;
- }
-
- public void removeFromFavoriteAlbums(Album album) {
- favoriteAlbums.remove(album);
- }
-
- public void addFavoriteAlbum(Album album) {
- if (album == null) {
- throw new IllegalArgumentException("Null album!");
- }
- if(favoriteAlbums.contains(album)){
- return;
- }
- favoriteAlbums.add(album);
- }
-
- public void removeFromFavoriteImages(Image image) {
- favoriteImages.remove(image);
- }
-
- public void addFavoriteImage(Image image) {
- if (image == null) {
- throw new IllegalArgumentException("Null image!");
- }
- if(favoriteAlbums.contains(image)){
- return;
- }
- favoriteImages.add(image);
- }
-
- public List<Image> getFavoriteImages() {
- return favoriteImages;
- }
-
public List<Shelf> getShelfs() {
return shelfs;
}
@@ -298,7 +250,6 @@
public int getCountShelfs() {
return this.getShelfs() != null ? this.getShelfs().size() : 0;
-
}
public Sex getSex() {
@@ -336,7 +287,7 @@
public List<Album> getAllAlbums(){
List<Album> albums = new ArrayList<Album>();
for(Shelf s:getShelfs()){
- albums.addAll(s.getChildAlbums());
+ albums.addAll(s.getAlbums());
}
return albums;
}
@@ -344,7 +295,7 @@
public List<Image> getAllImages(){
List<Image> images = new ArrayList<Image>();
for(Shelf s:getShelfs()){
- for(Album a:s.getChildAlbums()){
+ for(Album a:s.getAlbums()){
images.addAll(a.getImages());
}
}
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -20,8 +20,6 @@
*/
package org.richfaces.realworld.service;
-import java.util.List;
-
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
@@ -48,12 +46,11 @@
}
public void deleteAlbum(Album album){
- if(album.getParent()!=null){
- album.getParent().removeChildAlbum(album);
+ if(album.getShelf()!=null){
+ album.getShelf().removeChildAlbum(album);
}else{
user.removeAlbum(album);
}
- //em.remove(album);
em.flush();
}
@@ -64,9 +61,4 @@
public void flush(){
em.flush();
}
-
- public List<Album> getSharedAlbums() {
- return em.createQuery("from Album a where a.shared=true").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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -81,7 +81,6 @@
public static final String USER_EXIST_QUERY = "user-exist";
public static final String USER_LOGIN_QUERY = "user-login";
- public static final String USER_ROOT_ALBUMS_QUERY = "user-rootAlbums";
public static final String PERCENT = "%";
public static final String LOGIN_PARAMETER = "login";
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -20,8 +20,6 @@
*/
package org.richfaces.realworld.service;
-import java.util.List;
-
import javax.ejb.Local;
import org.richfaces.realworld.domain.Album;
@@ -37,6 +35,4 @@
public abstract void flush();
- public abstract List<Album> getSharedAlbums();
-
}
\ No newline at end of file
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -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;
@Local
@@ -35,12 +31,7 @@
public boolean isUserExist(String login);
public void updateUser(User user);
public void resetUser(User user);
- public void removeFromFavoriteAlbums(User user, Album album);
- public void addFavoriteAlbum(Album album);
public void loginAnonymous();
- public List<Album> getRootAlbums(User user);
- public void addFavoriteImage(Image image);
- public void removeFromFavoriteImages(User user, Image image);
public Long countAlbums(User user);
public Long countImages(User user);
}
\ No newline at end of file
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -42,16 +42,6 @@
}
public void editImage(Image image) {
- /*if(parentChanged){
- Album albumPrevious = image.getAlbum();
- String login = albumPrevious.getOwner().getLogin();
- String albumName = image.getAlbumName();
- albumPrevious.removeImage(image);
- Album album =
(Album)em.createNamedQuery(Constants.ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY).setParameter(Constants.ALBUM_NAME_PARAMETER,
albumName).setParameter(Constants.LOGIN_PARAMETER, login).getSingleResult();
- album.addImage(image);
- }
- image.getImageTags().clear();
- setTags(image, image.getMeta());*/
/*image.setImageTags(null);
String[] tokens = image.getMeta().split(",");
for(String token:tokens){
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -24,7 +24,7 @@
private User user;
public List<Image> searchByAlbum(String searchQuery, boolean searchInMyAlbums,
boolean searchInShared) {
- StringBuilder b = new StringBuilder("from Album a where a.name=:name and
a.shared=:shared");
+ StringBuilder b = new StringBuilder("from Album a where a.name=:name and
a.shelf.shared=:shared");
if (searchInMyAlbums) {
b.append(" and a.owner.login=:login");
}
@@ -40,7 +40,7 @@
}
public List<Image> searchByImage(String searchQuery, boolean searchInMyAlbums,
boolean searchInShared) {
- StringBuilder b = new StringBuilder("from Image i where i.name=:name and
i.album.shared=:shared");
+ StringBuilder b = new StringBuilder("from Image i where i.name=:name and
i.album.shelf.shared=:shared");
if (searchInMyAlbums) {
b.append(" and i.album.owner.login=:login");
}
@@ -58,7 +58,7 @@
public List<Image> searchByUsers(String searchQuery, boolean searchInMyAlbums,
boolean searchInShared) {
StringBuilder b = new StringBuilder("select distinct u from User u, Album a where
u.login=:name");
if (searchInShared) {
- b.append(" and a.owner=u and a.shared=true");
+ b.append(" and a.owner=u and a.shelf.shared=true");
}
Query query = em.createQuery(b.toString());
@@ -75,5 +75,4 @@
return query.getResultList();
}
-
}
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -20,7 +20,6 @@
*/
package org.richfaces.realworld.service;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -31,8 +30,6 @@
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
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-03-11
10:48:53 UTC (rev 12913)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2009-03-11
10:50:56 UTC (rev 12914)
@@ -20,7 +20,6 @@
*/
package org.richfaces.realworld.service;
-import java.util.Collections;
import java.util.List;
import javax.ejb.Stateless;
@@ -62,14 +61,6 @@
this.user = user;
}
- @SuppressWarnings("unchecked")
- public List<Album> getRootAlbums(User user) {
- List<Album> albums = em.createNamedQuery(Constants.USER_ROOT_ALBUMS_QUERY)
- .setParameter(Constants.LOGIN_PARAMETER, user.getLogin())
- .getResultList();
- return albums;
- }
-
public void resetUser(User user) {
em.refresh(user);
em.flush();
@@ -82,31 +73,9 @@
.getResultList().size() != 0;
}
- public void removeFromFavoriteAlbums(User user, Album album) {
- user.removeFromFavoriteAlbums(album);
- em.flush();
- }
-
- public void addFavoriteAlbum(Album album) {
- user.addFavoriteAlbum(album);
- album.getSharedOwners().add(user);
- em.flush();
- }
-
public void loginAnonymous() {
user = new User();
}
-
- public void addFavoriteImage(Image image) {
- user.addFavoriteImage(image);
- image.getSharedOwners().add(user);
- em.flush();
- }
-
- public void removeFromFavoriteImages(User user, Image image) {
- user.removeFromFavoriteImages(image);
- em.flush();
- }
public Long countAlbums(User user){
return (Long)em.createQuery("select count(a) from Album a where
a.owner=:user").setParameter("user", user).getSingleResult();
Modified: trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-03-11
10:48:53 UTC (rev 12913)
+++ trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-03-11
10:50:56 UTC (rev 12914)
@@ -3,19 +3,19 @@
INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex, doNotShowMail, informAboutNews, hasAvatar) VALUES (3, 'John',
'Smith', 'jsmith(a)jboss.com', 'Noname',
'8cb2237d0679ca88db6464eac60da96345513964', '1970-01-08', 1, 1, 1, 0);
INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created, shared) VALUES
(1, 'Nature', 'Nature pictures', 1, '2008-12-18', true);
-INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created,shared) VALUES (2,
'Sport', 'Nature pictures', 1, '2008-12-18', true);
+INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created,shared) VALUES (2,
'Sport', 'Nature pictures', 1, '2008-12-18', false);
INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created,shared) VALUES (3,
'Water', 'Nature pictures', 2, '2008-12-18', true);
INSERT INTO shelfs(shelf_id, name, description, shelf_user_id, created,shared) VALUES (4,
'Flowers', 'Nature pictures', 3, '2008-12-18', true);
-INSERT INTO albums(album_id, name, description, shared, album_user_id, parent_shelf_id,
created) VALUES (15, 'Water', 'Rivers pictures', true, 2, 3,
'2008-12-18');
+INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created)
VALUES (15, 'Water', 'Rivers pictures', 2, 3, '2008-12-18');
-INSERT INTO albums(album_id, name, description, shared, album_user_id, parent_shelf_id,
created) VALUES (20, 'Sport', 'Nature pictures', true, 1, 1,
'2008-12-18');
+INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created)
VALUES (20, 'Sport', 'Nature pictures', 1, 1, '2008-12-18');
-INSERT INTO albums(album_id, name, description, shared, album_user_id, parent_shelf_id,
created) VALUES (26, 'Flowers', 'Fun pictures', true, 1, 2,
'2008-12-18');
-INSERT INTO albums(album_id, name, description, shared, album_user_id, parent_shelf_id,
created) VALUES (25, 'Beach', 'Fun pictures', true, 1, 1,
'2008-12-18');
-INSERT INTO albums(album_id, name, description, shared, album_user_id, parent_shelf_id,
created) VALUES (23, 'Travel', 'Fun pictures', true, 3, 4,
'2008-12-18');
-INSERT INTO albums(album_id, name, description, shared, album_user_id, parent_shelf_id,
created) VALUES (27, 'Very very very very very very very long album name ',
'Long name test', true, 1, 2, '2008-12-18');
+INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created)
VALUES (26, 'Flowers', 'Fun pictures', 1, 2, '2008-12-18');
+INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created)
VALUES (25, 'Beach', 'Fun pictures', 1, 1, '2008-12-18');
+INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created)
VALUES (23, 'Travel', 'Fun pictures', 3, 4, '2008-12-18');
+INSERT INTO albums(album_id, name, description, album_user_id, parent_shelf_id, created)
VALUES (27, 'Very very very very very very very long album name ', 'Long name
test', 1, 2, '2008-12-18');
INSERT INTO images(image_id, name, path, description, created, img_album_id,
cameraModel, width, size, height, uploaded, allowComments) VALUES (1, 'korana',
'Viking/15/korana.jpg', 'korana', '2008-12-18', 15, 'Canon
S3', 1024, 1917.000000, 768, '2008-12-01', true);
@@ -340,43 +340,6 @@
INSERT INTO IMAGES_METATAGS(CI_METATAG_ID, CI_IMAGE_ID) VALUES(17,79);
INSERT INTO IMAGES_METATAGS(CI_METATAG_ID, CI_IMAGE_ID) VALUES(20,27);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(23, 1);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(15, 1);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(20, 1);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(26, 1);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(25, 1);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(27, 1);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(23, 2);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(15, 3);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(20, 4);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(26, 5);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(25, 6);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(27, 7);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(23, 8);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(15, 9);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(20, 10);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(26, 11);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(25, 12);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(27, 13);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(23, 14);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(15, 15);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(20, 16);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(26, 17);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(25, 18);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(27, 19);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(23, 20);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(15, 21);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(20, 22);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(26, 23);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(25, 24);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(27, 25);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(23, 26);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(15, 27);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(20, 28);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(26, 29);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(25, 30);
-INSERT INTO ALBUMS_METATAGS(CI_ALBUM_ID, CI_METATAG_ID) VALUES(27, 30);
-
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(1, '1985-01-08', 'Hello I am user', 1, 2);
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(2, '1985-01-08', 'Hello I am user2', 1, 3);
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(3, '1985-01-08', 'Hello I am user',2, 2);
@@ -542,8 +505,4 @@
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(163, '1985-01-08', 'Hello I am user',82, 2);
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(164, '1985-01-08', 'Hello I am user2',82, 3);
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(165, '1985-01-08', 'Hello I am user',83, 2);
-INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(166, '1985-01-08', 'Hello I am user2',83, 3);
-INSERT INTO shared_albums(album_id, user_id) VALUES(15, 1);
-INSERT INTO shared_albums(album_id, user_id) VALUES(26, 1);
-INSERT INTO shared_images(image_id, user_id) VALUES(34, 1);
-INSERT INTO shared_images(image_id, user_id) VALUES(45, 1);
\ No newline at end of file
+INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(166, '1985-01-08', 'Hello I am user2',83, 3);
\ No newline at end of file
Modified: trunk/test-applications/realworld2/pom.xml
===================================================================
--- trunk/test-applications/realworld2/pom.xml 2009-03-11 10:48:53 UTC (rev 12913)
+++ trunk/test-applications/realworld2/pom.xml 2009-03-11 10:50:56 UTC (rev 12914)
@@ -14,7 +14,7 @@
<properties>
<projectName>realworld</projectName>
- <richfacesVersion>3.3.0.GA</richfacesVersion>
+ <richfacesVersion>3.3.1-SNAPSHOT</richfacesVersion>
<seamVersion>2.1.0.SP1</seamVersion>
<faceletsVersion>1.1.14</faceletsVersion>
<jbosshome>${project.basedir}/target/installs/jboss-4.2.3.GA/jboss-4.2.3.GA</jbosshome>