Author: amarkhel
Date: 2009-04-13 12:46:21 -0400 (Mon, 13 Apr 2009)
New Revision: 13538
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/Comment.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/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/RealworldException.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java
trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
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-04-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -39,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;
@@ -295,6 +294,15 @@
}
/**
+ * Getter for property preDefined
+ *
+ * @return is this shelf is predefined
+ */
+ public boolean isPreDefined() {
+ return getOwner() != null ? getOwner().isPreDefined() : false;
+ }
+
+ /**
* 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/Comment.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-04-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -77,6 +77,14 @@
@Length(min = 2)
private String message;
+ /**
+ * Getter for property preDefined
+ *
+ * @return is this shelf is predefined
+ */
+ public boolean isPreDefined() {
+ return getImage() != null? getImage().isPreDefined() : false;
+ }
//---------------------------------------Getters, Setters
public Long getId() {
return id;
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-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -72,7 +72,7 @@
),
@NamedQuery(
name = "user-shelves",
- query = "select distinct s from Shelf s where (s.shared = true and
s.preDefined = true) or s.owner = :user order by s.name"
+ query = "select distinct s from Shelf s where (s.shared = true and
s.owner.preDefined = true) or s.owner = :user order by s.name"
),
@NamedQuery(
name = "image-exist",
@@ -172,6 +172,14 @@
private boolean allowComments;
private Boolean showMetaInfo = true;
+ /**
+ * Getter for property preDefined
+ *
+ * @return is this shelf is predefined
+ */
+ public boolean isPreDefined() {
+ return getAlbum() != null? getAlbum().isPreDefined() : false;
+ }
// ********************** Accessor Methods ********************** //
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-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -18,7 +18,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;
@@ -64,8 +63,6 @@
@Temporal(TemporalType.TIMESTAMP)
private Date created;
-
- private boolean preDefined;
/**
* Getter for property preDefined
@@ -73,18 +70,9 @@
* @return is this shelf is predefined
*/
public boolean isPreDefined() {
- return preDefined;
+ return getOwner() != null? getOwner().isPreDefined() : false;
}
- /**
- * Setter for property preDefined
- *
- * @param preDefined
- */
- public void setPreDefined(boolean preDefined) {
- this.preDefined = preDefined;
- }
-
/**
* Getter for property id
*
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-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -133,7 +133,17 @@
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@org.hibernate.annotations.OrderBy(clause = "NAME asc")
private List<Shelf> shelfs = new ArrayList<Shelf>();
+
+ private boolean preDefined;
+ public boolean isPreDefined() {
+ return preDefined;
+ }
+
+ public void setPreDefined(boolean preDefined) {
+ this.preDefined = preDefined;
+ }
+
//----------------Getters, Setters
public String getFirstName() {
return firstName;
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-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -20,8 +20,6 @@
*/
package org.richfaces.realworld.service;
-import java.util.List;
-
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
@@ -29,7 +27,6 @@
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
/**
* Class for manipulating with album entity. Analogous to DAO pattern.
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-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -20,12 +20,9 @@
*/
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;
/**
* Interface for manipulating with album entity
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-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IShelfAction.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -25,7 +25,6 @@
import javax.ejb.Local;
-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/RealworldException.java
===================================================================
---
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/RealworldException.java 2009-04-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/RealworldException.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -2,23 +2,20 @@
import javax.ejb.ApplicationException;
-
-@ApplicationException(rollback=false)
+@ApplicationException(rollback = false)
public class RealworldException extends Exception {
-
- public RealworldException()
- {
- super();
- }
-
- public RealworldException(String message)
- {
- super(message);
- }
-
- public RealworldException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
+ private static final long serialVersionUID = -305899531752889504L;
+
+ public RealworldException() {
+ super();
+ }
+
+ public RealworldException(String message) {
+ super(message);
+ }
+
+ public RealworldException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
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-13
16:31:54 UTC (rev 13537)
+++
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java 2009-04-13
16:46:21 UTC (rev 13538)
@@ -30,7 +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.Image;
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
Modified: trunk/test-applications/realworld2/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-04-13
16:31:54 UTC (rev 13537)
+++ trunk/test-applications/realworld2/ejb/src/main/resources/import.sql 2009-04-13
16:46:21 UTC (rev 13538)
@@ -1,6 +1,6 @@
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex, hasAvatar) VALUES (1, 'Andrey', 'Markhel',
'amarkhel(a)exadel.com', 'amarkhel',
'8cb2237d0679ca88db6464eac60da96345513964', '1985-01-08', 0, 0);
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex, hasAvatar) VALUES (2, 'Nick', 'Curtis',
'nkurtis(a)iba.com', 'Viking',
'8cb2237d0679ca88db6464eac60da96345513964', '1978-01-08', 1, 0);
-INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex, hasAvatar) VALUES (3, 'John', 'Smith',
'jsmith(a)jboss.com', 'Noname',
'8cb2237d0679ca88db6464eac60da96345513964', '1970-01-08', 1, 0);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex, hasAvatar, preDefined) VALUES (1, 'Andrey', 'Markhel',
'amarkhel(a)exadel.com', 'amarkhel',
'8cb2237d0679ca88db6464eac60da96345513964', '1985-01-08', 0, 0, true);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex, hasAvatar, preDefined) VALUES (2, 'Nick', 'Curtis',
'nkurtis(a)iba.com', 'Viking',
'8cb2237d0679ca88db6464eac60da96345513964', '1978-01-08', 1, 0, true);
+INSERT INTO Users(user_id, firstname, secondname, email, login, passwordHash, birthdate,
sex, hasAvatar, preDefined) VALUES (3, 'John', 'Smith',
'jsmith(a)jboss.com', 'Noname',
'8cb2237d0679ca88db6464eac60da96345513964', '1970-01-08', 1, 0, true);
INSERT INTO shelves(shelf_id, name, description, user_id, created, shared) VALUES (1,
'Nature', 'Nature pictures', 1, '2009-12-18', true);
INSERT INTO shelves(shelf_id, name, description, user_id, created, shared) VALUES (2,
'Sport', 'Nature pictures', 1, '2009-12-18', true);