[richfaces-svn-commits] JBoss Rich Faces SVN: r11950 - in trunk/test-applications/realworld: ear and 17 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Sat Dec 20 10:58:35 EST 2008
Author: amarkhel
Date: 2008-12-20 10:58:34 -0500 (Sat, 20 Dec 2008)
New Revision: 11950
Added:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/AlbumPopupHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/CommentPopupHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConfirmationPopupHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageBinder.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImagePopupHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/MessagePanelHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingBinder.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectionHelper.java
Removed:
trunk/test-applications/realworld/ear/src/main/application/security.drl
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ModalPanelHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectedImageIndex.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java
Modified:
trunk/test-applications/realworld/ear/pom.xml
trunk/test-applications/realworld/ejb/pom.xml
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
trunk/test-applications/realworld/ejb/src/main/resources/import.sql
trunk/test-applications/realworld/pom.xml
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileLoader.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBeanHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeAlbumItem.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeImageItem.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ComboboxHelper.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java
trunk/test-applications/realworld/web/src/main/resources/messages_en.properties
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/addComment.xhtml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/albumModalPanel.xhtml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/confirmation.xhtml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/imagePrefs.xhtml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/message.xhtml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/web.xml
trunk/test-applications/realworld/web/src/main/webapp/fileUpload.xhtml
trunk/test-applications/realworld/web/src/main/webapp/imagePreview.xhtml
trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
trunk/test-applications/realworld/web/src/main/webapp/readMessages.xhtml
trunk/test-applications/realworld/web/src/main/webapp/tree.xhtml
Log:
Modified: trunk/test-applications/realworld/ear/pom.xml
===================================================================
--- trunk/test-applications/realworld/ear/pom.xml 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ear/pom.xml 2008-12-20 15:58:34 UTC (rev 11950)
@@ -21,45 +21,13 @@
<artifactId>richfaces-api</artifactId>
<version>${richfacesVersion}</version>
</dependency>
- <!-- EJB -->
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>${projectName}-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
-
- <dependency>
- <groupId>org.drools</groupId>
- <artifactId>drools-core</artifactId>
- <version>${droolsVersion}</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
- <groupId>org.drools</groupId>
- <artifactId>drools-compiler</artifactId>
- <version>${droolsVersion}</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
@@ -88,7 +56,6 @@
</exclusion>
</exclusions>
</dependency>
-
</dependencies>
<build>
<finalName>${projectName}-ear-1.0-SNAPSHOT</finalName>
@@ -119,45 +86,6 @@
</modules>
</configuration>
</plugin>
- <!--<plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.0-SNAPSHOT</version>
- <executions>
- <execution>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>deployer-deploy</goal>
- </goals>
- </execution>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <container>
- <containerId>jboss4x</containerId>
- <zipUrlInstaller>
- <url>${jbossDownloadURL}</url>
- <installDir>${installDir}</installDir>
- </zipUrlInstaller>
- <output>${project.build.directory}/jboss4x.log</output>
- <log>${project.build.directory}/cargo.log</log>
- </container>
- <configuration>
- <type>existing</type>
- <home>${installDir}/${jbossDeployDir}</home>
- <properties>
- <cargo.servlet.port>8080</cargo.servlet.port>
- <cargo.jboss.configuration>default</cargo.jboss.configuration>
- </properties>
- </configuration>
- </configuration>
- </plugin>-->
</plugins>
</build>
</project>
Deleted: trunk/test-applications/realworld/ear/src/main/application/security.drl
===================================================================
--- trunk/test-applications/realworld/ear/src/main/application/security.drl 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ear/src/main/application/security.drl 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,6 +0,0 @@
-package Permissions;
-
-import java.security.Principal;
-
-import org.jboss.seam.security.PermissionCheck;
-import org.jboss.seam.security.Role;
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/pom.xml
===================================================================
--- trunk/test-applications/realworld/ejb/pom.xml 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/pom.xml 2008-12-20 15:58:34 UTC (rev 11950)
@@ -82,5 +82,4 @@
</plugin>
</plugins>
</build>
-
</project>
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -7,9 +7,7 @@
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -20,10 +18,11 @@
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
-import javax.persistence.Version;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
@@ -31,7 +30,6 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Role;
-import org.jboss.seam.annotations.Scope;
/**
* Class for representing Album Entity
@@ -39,6 +37,13 @@
*
* @author Andrey Markhel
*/
+ at NamedQueries({
+ @NamedQuery(
+ name = "album-byAlbumNameAndLogin",
+ query = "from Album a where a.name=:albumName and a.owner.login=:login"
+ )
+})
+
@Entity
@Name("album")
@Table(name = "albums")
@@ -51,10 +56,6 @@
@GeneratedValue
@Column(name = "ALBUM_ID")
private Long id = null;
-
- @Version
- @Column(name = "OBJ_VERSION")
- private int version = 0;
@Column(length = 255, nullable = false)
@NotNull
@@ -127,15 +128,6 @@
public String getName() {
return name;
}
-
- /**
- * Getter for property version
- *
- * @return version of current album object
- */
- public int getVersion() {
- return version;
- }
/**
* Setter for property name
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -13,20 +13,19 @@
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import javax.persistence.Version;
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.Scope;
@Entity
@Name("comment")
@Table(name = "comments")
public class Comment implements Serializable{
+ private static final long serialVersionUID = 3429270322123226071L;
+
@Id
@GeneratedValue
@Column(name = "COMMENT_ID")
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -11,9 +11,6 @@
import javax.persistence.ManyToOne;
import javax.persistence.Table;
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotEmpty;
-import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;
@Entity
@@ -21,6 +18,8 @@
@Table(name = "friendship_requests")
public class FriendshipRequest implements Serializable{
+ private static final long serialVersionUID = 1218079203119021096L;
+
@Id
@GeneratedValue
@Column(name = "REQUEST_ID")
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -18,13 +18,14 @@
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+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.Version;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
@@ -32,7 +33,6 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Role;
-import org.jboss.seam.annotations.Scope;
/**
* Class for representing Image Entity
@@ -40,6 +40,7 @@
*
* @author Andrey Markhel
*/
+
@Entity
@Name("image")
@Table(name = "Images")
@@ -52,10 +53,6 @@
@GeneratedValue
@Column(name = "IMAGE_ID")
private Long id = null;
-
- @Version
- @Column(name = "OBJ_VERSION")
- private int version = 0;
@Column(length = 255, nullable = false)
@NotNull
@@ -82,9 +79,6 @@
@Transient
private String albumName;
- @NotNull
- private boolean shared;
-
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@@ -141,15 +135,6 @@
public String getName() {
return name;
}
-
- /**
- * Getter for property version
- *
- * @return version of current album object
- */
- public int getVersion() {
- return version;
- }
/**
* Setter for property name
@@ -186,14 +171,6 @@
this.path = path;
}
- public boolean isShared() {
- return shared;
- }
-
- public void setShared(boolean shared) {
- this.shared = shared;
- }
-
public Date getCreated() {
return created;
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -18,14 +18,14 @@
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.Scope;
@Entity
@Name("message")
@Table(name = "messages")
public class Message implements Serializable{
+ private static final long serialVersionUID = -2449408843982851550L;
+
@Id
@GeneratedValue
@Column(name = "MESSAGE_ID")
@@ -48,7 +48,7 @@
private String theme;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "AUTHOR_ID", updatable = false)
+ @JoinColumn(name = "AUTHOR_ID",nullable = false, updatable = false)
@org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERS_ID")
private User author;
@@ -59,7 +59,7 @@
private String message;
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "OWNER_ID", nullable = false, updatable = false)
+ @JoinColumn(name = "OWNER_ID", updatable = false)
@org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERS2_ID")
private User owner;
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -19,6 +19,9 @@
@Name("metaTag")
@Table(name = "metatags")
public class MetaTag implements Serializable{
+
+ private static final long serialVersionUID = -9065024051468971330L;
+
@Id
@GeneratedValue
@Column(name = "METATAG_ID")
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -9,7 +9,6 @@
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
-import javax.persistence.Transient;
import org.jboss.seam.annotations.Name;
@@ -18,6 +17,8 @@
@Table(name = "Ranks")
public class Rank implements Serializable{
+ private static final long serialVersionUID = -3106134752407013128L;
+
@Id
@GeneratedValue
@Column(name = "RANK_ID")
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -3,9 +3,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -23,41 +21,50 @@
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
-import javax.persistence.Version;
+
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Pattern;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Role;
import org.jboss.seam.annotations.Scope;
-/*@NamedQueries({
+ at NamedQueries({
@NamedQuery(
- name = "User-rootAlbums",
- query = "select a from Album a where a.parent is null and a.owner=:owner"
+ name = "user-login",
+ query = "from User u where u.login = :username and u.password = :password"
+ ),
+ @NamedQuery(
+ name = "user-exist",
+ query = "from User u where u.login = :login"
+ ),
+ @NamedQuery(
+ name = "user-availableUsers",
+ query = "select u.login from User u where u.login like :login"
+ ),
+ @NamedQuery(
+ name = "user-countMessages",
+ query = "SELECT count(u) FROM User u JOIN u.messages mg WHERE u.login=:login and mg.readed = false"
+ ),
+ @NamedQuery(
+ name = "user-friendExist",
+ query = "SELECT count(u) FROM User u JOIN u.friendshipRequests fr WHERE u.login=:login and fr.friend.login=:friend"
)
-})*/
+})
@Entity
@Scope(ScopeType.CONVERSATION)
@Name("user")
- at Role(name="selectedUser", scope = ScopeType.CONVERSATION)
@Table(name = "Users")
public class User implements Serializable {
-
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@Column(name = "USER_ID")
private Long id = null;
-
- @Version
- @Column(name = "OBJ_VERSION")
- private int version = 0;
@Column(length = 255, nullable = false)
@NotNull
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,12 +1,8 @@
package org.richfaces.realworld.service;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
+import javax.ejb.Stateless;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
@@ -14,6 +10,7 @@
import org.richfaces.realworld.domain.User;
@Name("albumAction")
+ at Stateless
public class AlbumAction implements IAlbumAction {
@In(value="entityManager")
@@ -42,20 +39,4 @@
public void editAlbum(Album album){
em.flush();
}
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#remove()
- */
- @Remove
- public void remove(){
-
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#destroy()
- */
- @Destroy
- public void destroy(){
-
- }
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,22 +1,16 @@
package org.richfaces.realworld.service;
-import javax.ejb.Remove;
+import javax.ejb.Local;
-import org.jboss.seam.annotations.Destroy;
import org.richfaces.realworld.domain.Album;
+ at Local
public interface IAlbumAction {
public abstract void addAlbum(Album album);
-
- @Remove
- public abstract void remove();
public void deleteAlbum(Album album);
public void editAlbum(Album album);
-
- @Destroy
- public abstract void destroy();
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,30 +1,17 @@
package org.richfaces.realworld.service;
-import javax.ejb.Remove;
+import javax.ejb.Local;
-import org.jboss.seam.annotations.Destroy;
-import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.Image;
+ at Local
public interface IImageAction {
public abstract void deleteImage(Image image);
public abstract void editImage(Image image, boolean parentChanged);
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#remove()
- */
- @Remove
- public abstract void remove();
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#destroy()
- */
- @Destroy
- public abstract void destroy();
-
public abstract void addImage(Image image);
public void deleteComment(Comment comment);
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,10 +1,7 @@
package org.richfaces.realworld.service;
import javax.ejb.Local;
-import javax.ejb.Remove;
-import org.jboss.seam.annotations.Destroy;
-import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.Message;
@Local
@@ -13,12 +10,6 @@
public abstract void sendMessage(Message message);
public abstract void deleteMessage(Message message);
-
- @Remove
- public void remove();
-
- @Destroy
- public void destroy();
public void markAsReaded(Message message);
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -4,9 +4,7 @@
import java.util.Map;
import javax.ejb.Local;
-import javax.ejb.Remove;
-import org.jboss.seam.annotations.Destroy;
import org.richfaces.realworld.domain.Image;
@Local
public interface ISearchService {
@@ -16,10 +14,4 @@
public List<Image> popularImages(String additionalParams, Map<String, Object> paramMap);
public List<Image> worstImages(String additionalParams, Map<String, Object> paramMap);
-
- @Remove
- public void remove();
-
- @Destroy
- public void destroy();
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,13 +1,9 @@
package org.richfaces.realworld.service;
-import java.util.ArrayList;
import java.util.List;
import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
-import org.jboss.seam.annotations.Destroy;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.FriendshipRequest;
import org.richfaces.realworld.domain.User;
@@ -15,16 +11,9 @@
@Local
public interface IUserAction {
public User login(String username, String password);
- @Remove
- public void remove();
-
- @Destroy
- public void destroy();
-
public void register(User user);
public boolean isUserExist(String login);
public void updateUser(User user);
-
public void resetUser(User user);
public List<String> getUsers(String suggest);
public long countNotReadedMessages(User user);
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,55 +1,28 @@
package org.richfaces.realworld.service;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
+import javax.ejb.Stateless;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import org.jboss.seam.annotations.Destroy;
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.Comment;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
@Name("imageAction")
+ at Stateless
public class ImageAction implements IImageAction {
+ private static final String ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY = "album-byAlbumNameAndLogin";
+ private static final String LOGIN_PARAMETER = "login";
+ private static final String ALBUM_NAME_PARAMETER = "albumName";
@In(value="entityManager")
EntityManager em;
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IImageAction#deleteImage(org.richfaces.realworld.domain.Image)
- */
public void deleteImage(Image image){
image.getAlbum().removeImage(image);
em.flush();
}
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#remove()
- */
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IImageAction#remove()
- */
- @Remove
- public void remove(){
-
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#destroy()
- */
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IImageAction#destroy()
- */
- @Destroy
- public void destroy(){
-
- }
public void editImage(Image image, boolean parentChanged) {
if(parentChanged){
@@ -57,7 +30,7 @@
String login = albumPrevious.getOwner().getLogin();
String albumName = image.getAlbumName();
albumPrevious.removeImage(image);
- Album album = (Album)em.createQuery("from Album a where a.name=:albumName and a.owner.login=:login").setParameter("albumName", albumName).setParameter("login", login).getSingleResult();
+ Album album = (Album)em.createNamedQuery(ALBUM_BY_ALBUM_NAME_AND_LOGIN_QUERY).setParameter(ALBUM_NAME_PARAMETER, albumName).setParameter(LOGIN_PARAMETER, login).getSingleResult();
album.addImage(image);
}
image.getTags().clear();
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,34 +1,28 @@
package org.richfaces.realworld.service;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
+import javax.ejb.Stateless;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.TransactionPropagationType;
-import org.jboss.seam.annotations.Transactional;
-import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.Message;
import org.richfaces.realworld.domain.User;
@Name("messageAction")
+ at Stateless
public class MessageAction implements IMessageAction {
- //@PersistenceContext(unitName = "entityManager", type=PersistenceContextType.EXTENDED)
+
+ private static final String LOGIN_PARAMETER = "login";
@In(value="entityManager")
EntityManager em;
/* (non-Javadoc)
* @see org.richfaces.realworld.service.IMessageAction#sendMessage(org.richfaces.realworld.domain.Message)
*/
- @Transactional(TransactionPropagationType.REQUIRED)
public void sendMessage(Message message){
if(message.getOwnerLogin() != null){
User user = (User)em.createQuery("from User u where u.login = :login")
- .setParameter("login", message.getOwnerLogin())
+ .setParameter(LOGIN_PARAMETER, message.getOwnerLogin())
.getSingleResult();
message.setOwner(user);
message.setOwnerLogin(null);
@@ -43,10 +37,8 @@
/* (non-Javadoc)
* @see org.richfaces.realworld.service.IMessageAction#deleteMessage(org.richfaces.realworld.domain.Message)
*/
- @Transactional(TransactionPropagationType.REQUIRED)
public void deleteMessage(Message message){
- //message = em.merge(message);
- //em.remove(message);
+ em.remove(message);
message.getOwner().removeMessage(message);
em.flush();
}
@@ -55,19 +47,4 @@
message.setReaded(true);
em.flush();
}
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#remove()
- */
- @Remove
- public void remove(){
-
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#destroy()
- */
- @Destroy
- public void destroy(){
-
- }
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -4,103 +4,78 @@
import java.util.List;
import java.util.Map;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
+import javax.ejb.Stateless;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
import javax.persistence.Query;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.richfaces.realworld.domain.Image;
@Name("searchService")
+ at Stateless
public class SearchService implements ISearchService, Serializable
{
+ private static final String PERCENT = "%";
+ public static final String DATE_NAMED_PARAMETER = ":date";
+ public static final String CHOICE_NAMED_PARAMETER = ":choice";
+ public static final String SPINNER_VALUE_NAMED_PARAMETER = ":spinnerValue";
+ private static final String DATE_PARAMETER = "date";
+ private static final String CHOICE_PARAMETER = "choice";
+ private static final String SPINNER_VALUE_PARAMETER = "spinnerValue";
+ private static final String METATAG_PARAMETER = "metatag";
+ private static final String SEARCH_UNPOPULAR_QUERY_END = " order by r.total/r.hits asc";
+ private static final String SEARCH_POPULAR_QUERY_END = " order by r.total/r.hits desc";
+ private static final String SEARCH_RELEVANT_QUERY_BEGIN = "select i from Image i join i.rank r where i.album.shared=true";
+ private static final String SEARCH_QUERY_END = " order by i.rank.total/i.rank.hits desc";
+ private static final String SEARCH_QUERY_BEGIN = "select i from MetaTag t join t.parent i where t.tag like:metatag and i.album.shared=true";
private static final long serialVersionUID = -2750591521413940277L;
@In(value="entityManager")
EntityManager em;
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.ISearchService#searchImages(java.lang.String)
- */
public List<Image> searchImages(String searchPattern, String additionalParams, Map<String, Object> paramMap){
- String fullQuery = "select i from MetaTag t join t.parent i where t.tag like:metatag and i.album.shared=true" + additionalParams + " order by i.rank.total/i.rank.hits desc";
- Query prepared = em.createQuery(fullQuery).setParameter("metatag", searchPattern+"%");
- if(paramMap != null && paramMap.get(":spinnerValue") != null){
- prepared.setParameter("spinnerValue", paramMap.get(":spinnerValue"));
- }
- if(paramMap != null && paramMap.get(":choice") != null){
- prepared.setParameter("choice", paramMap.get(":choice"));
- }
- if(paramMap != null && paramMap.get(":date") != null){
- prepared.setParameter("date", paramMap.get(":date"));
- }
- prepared.setMaxResults(20);
- List<Image> images = prepared.getResultList();
- for(Image image:images){
- image.getAlbum().getOwner().getLogin();
- }
- return images;
+ String fullQuery = SEARCH_QUERY_BEGIN + additionalParams + SEARCH_QUERY_END;
+ Query prepared = prepareQuery(fullQuery, searchPattern, additionalParams, paramMap);
+ return initImages(prepared);
}
public List<Image> popularImages(String additionalParams, Map<String, Object> paramMap){
- String fullQuery = "select i from Image i join i.rank r where i.album.shared=true" + additionalParams + " order by r.total/r.hits desc";
- Query prepared = em.createQuery(fullQuery);
- if(paramMap != null && paramMap.get(":spinnerValue") != null){
- prepared.setParameter("spinnerValue", paramMap.get(":spinnerValue"));
- }
- if(paramMap != null && paramMap.get(":choice") != null){
- prepared.setParameter("choice", paramMap.get(":choice"));
- }
- if(paramMap != null && paramMap.get(":date") != null){
- prepared.setParameter("date", paramMap.get(":date"));
- }
- prepared.setMaxResults(20);
- List<Image> images = prepared.getResultList();
- for(Image image:images){
- image.getAlbum().getOwner().getLogin();
- }
- return images;
+ String fullQuery = SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + SEARCH_POPULAR_QUERY_END;
+ Query prepared = prepareQuery(fullQuery, null, additionalParams, paramMap);
+ return initImages(prepared);
}
public List<Image> worstImages(String additionalParams, Map<String, Object> paramMap){
- String fullQuery = "select i from Image i join i.rank r where i.album.shared=true" + additionalParams + " order by r.total/r.hits asc";
+ String fullQuery = SEARCH_RELEVANT_QUERY_BEGIN + additionalParams + SEARCH_UNPOPULAR_QUERY_END;
+ Query prepared = prepareQuery(fullQuery, null, additionalParams, paramMap);
+ return initImages(prepared);
+ }
+
+ private Query prepareQuery(String fullQuery ,String searchPattern, String additionalParams,
+ Map<String, Object> paramMap) {
Query prepared = em.createQuery(fullQuery);
- if(paramMap != null && paramMap.get(":spinnerValue") != null){
- prepared.setParameter("spinnerValue", paramMap.get(":spinnerValue"));
+ if(searchPattern != null){
+ prepared.setParameter(METATAG_PARAMETER, searchPattern+PERCENT);
}
- if(paramMap != null && paramMap.get(":choice") != null){
- prepared.setParameter("choice", paramMap.get(":choice"));
+ if(paramMap != null && paramMap.get(SPINNER_VALUE_NAMED_PARAMETER) != null){
+ prepared.setParameter(SPINNER_VALUE_PARAMETER, paramMap.get(SPINNER_VALUE_NAMED_PARAMETER));
}
- if(paramMap != null && paramMap.get(":date") != null){
- prepared.setParameter("date", paramMap.get(":date"));
+ if(paramMap != null && paramMap.get(CHOICE_NAMED_PARAMETER) != null){
+ prepared.setParameter(CHOICE_PARAMETER, paramMap.get(CHOICE_NAMED_PARAMETER));
}
+ if(paramMap != null && paramMap.get(DATE_NAMED_PARAMETER) != null){
+ prepared.setParameter(DATE_PARAMETER, paramMap.get(DATE_NAMED_PARAMETER));
+ }
prepared.setMaxResults(20);
+ return prepared;
+ }
+
+ private List<Image> initImages(Query prepared) {
List<Image> images = prepared.getResultList();
for(Image image:images){
image.getAlbum().getOwner().getLogin();
}
return images;
}
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#remove()
- */
- @Remove
- public void remove(){
-
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.realworld.service.IAlbumAction#destroy()
- */
- @Destroy
- public void destroy(){
-
- }
}
Modified: trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,33 +1,61 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.service;
-import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
-import java.util.Set;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.FriendshipRequest;
-import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
@Name("userAction")
+ at Stateless
public class UserAction implements IUserAction {
+ private static final String USER_FRIEND_EXIST_QUERY = "user-friendExist";
+
+ private static final String USER_COUNT_MESSAGES_QUERY = "user-countMessages";
+
+ private static final String USER_AVAILABLE_USERS_QUERY = "user-availableUsers";
+
+ private static final String USER_EXIST_QUERY = "user-exist";
+
+ private static final String USER_LOGIN_QUERY = "user-login";
+
+ private static final String FRIEND_PARAMETER = "friend";
+
+ private static final String PERCENT = "%";
+
+ private static final String LOGIN_PARAMETER = "login";
+
+ private static final String PASSWORD_PARAMETER = "password";
+
+ private static final String USERNAME_PARAMETER = "username";
+
@In(value="entityManager")
EntityManager em;
@@ -35,24 +63,15 @@
private User user;
public User login(String username, String password) {
- return user = (User)em.createQuery("from User u where u.login = :username and u.password = :password")
- .setParameter("username", username)
- .setParameter("password", password)
+ return user = (User)em.createNamedQuery(USER_LOGIN_QUERY)
+ .setParameter(USERNAME_PARAMETER, username)
+ .setParameter(PASSWORD_PARAMETER, password)
.getSingleResult();
}
-
- @Remove
- public void remove(){
-
- }
-
- @Destroy
- public void destroy(){
-
- }
public void register(User user) {
em.persist(user);
+ em.flush();
}
public void updateUser(User user) {
@@ -67,28 +86,37 @@
}
public boolean isUserExist(String login) {
- return em.createQuery("from User u where u.login = :login")
- .setParameter("login", login)
+ return em.createNamedQuery(USER_EXIST_QUERY)
+ .setParameter(LOGIN_PARAMETER, login)
.getResultList().size() == 0;
}
public List<String> getUsers(String suggest) {
- List<String> users = em.createQuery("select u.login from User u where u.login like :login").setParameter("login", suggest + "%").setMaxResults(10).getResultList();
+ List<String> users = em.createNamedQuery(USER_AVAILABLE_USERS_QUERY)
+ .setParameter(LOGIN_PARAMETER, suggest + PERCENT)
+ .setMaxResults(10)
+ .getResultList();
return users;
}
public long countNotReadedMessages(User user){
- Long result = (Long)em.createQuery("SELECT count(u) FROM User u JOIN u.messages mg WHERE u.login=:login and mg.readed = false").setParameter("login", user.getLogin()).getSingleResult();
+ Long result = (Long)em.createNamedQuery(USER_COUNT_MESSAGES_QUERY)
+ .setParameter(LOGIN_PARAMETER, user.getLogin())
+ .getSingleResult();
return result;
}
public void removeFromFriends(User owner, User removed) {
owner.removeFriend(removed);
removed.removeFriend(owner);
+ em.flush();
}
public boolean friendExist(User user, User friend) {
- Long result = (Long)em.createQuery("SELECT count(u) FROM User u JOIN u.friendshipRequests fr WHERE u.login=:login and fr.friend.login=:friend").setParameter("login", user.getLogin()).setParameter("friend", friend.getLogin()).getSingleResult();
+ Long result = (Long)em.createNamedQuery(USER_FRIEND_EXIST_QUERY)
+ .setParameter(LOGIN_PARAMETER, user.getLogin())
+ .setParameter(FRIEND_PARAMETER, friend.getLogin())
+ .getSingleResult();
return result > 0;
}
@@ -96,12 +124,12 @@
friend.removeFriendshipRequest(request);
user.addFriend(friend);
friend.addFriend(user);
- //em.flush();
+ em.flush();
}
public void removeFromSharedAlbums(User user, Album album) {
user.removeFromSharedAlbums(album);
- //em.flush();
+ em.flush();
}
public void addSharedAlbum(Album album) {
Modified: trunk/test-applications/realworld/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,11 +1,11 @@
-INSERT INTO Users(user_id, obj_version, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (1, 0, 'Andrey', 'Markhel', 'amarkhel at exadel.com', 'avatar.jpg', 'amarkhel', '12345', '1985-01-08');
-INSERT INTO Users(user_id, obj_version, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (2, 0, 'Andrey', 'Markhel', 'amarkhel at exadel.com', 'avatar.jpg', 'root', '12345', '1985-01-08');
-INSERT INTO Users(user_id, obj_version, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (3, 0, 'Andrey', 'Markhel', 'amarkhel at exadel.com', 'avatar.jpg', 'qqqq', '12345', '1985-01-08');
-INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (1, 0, 'Cars', 'Photo of my dog', true, 1);
-INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (2, 0, 'Tetki', 'Simple Album 2', true, 1);
-INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (3, 0, 'Football', 'Simple Album 3', true, 2);
-INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (4, 0, 'Japan', 'Simple Album', true, 3);
-INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id) VALUES (5, 0, 'Music', 'Simple Album 2', true, 3);
+INSERT INTO Users(user_id, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (1, 'Andrey', 'Markhel', 'amarkhel at exadel.com', 'avatar.jpg', 'amarkhel', '12345', '1985-01-08');
+INSERT INTO Users(user_id, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (2, 'Andrey', 'Markhel', 'amarkhel at exadel.com', 'avatar.jpg', 'root', '12345', '1985-01-08');
+INSERT INTO Users(user_id, firstname, secondname, email, avatarpath, login, password, birthdate) VALUES (3, 'Andrey', 'Markhel', 'amarkhel at exadel.com', 'avatar.jpg', 'qqqq', '12345', '1985-01-08');
+INSERT INTO albums(album_id, name, description, shared, album_user_id) VALUES (1, 'Cars', 'Photo of my dog', true, 1);
+INSERT INTO albums(album_id, name, description, shared, album_user_id) VALUES (2, 'Tetki', 'Simple Album 2', true, 1);
+INSERT INTO albums(album_id, name, description, shared, album_user_id) VALUES (3, 'Football', 'Simple Album 3', true, 2);
+INSERT INTO albums(album_id, name, description, shared, album_user_id) VALUES (4, 'Japan', 'Simple Album', true, 3);
+INSERT INTO albums(album_id, name, description, shared, album_user_id) VALUES (5, 'Music', 'Simple Album 2', true, 3);
INSERT INTO Ranks(rank_id, total, hits) VALUES (1, 100, 21);
INSERT INTO Ranks(rank_id, total, hits) VALUES (2, 200, 21);
INSERT INTO Ranks(rank_id, total, hits) VALUES (3, 100, 31);
@@ -38,37 +38,37 @@
INSERT INTO Ranks(rank_id, total, hits) VALUES (30, 100, 30);
INSERT INTO Ranks(rank_id, total, hits) VALUES (31, 110, 31);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (1, 0, 'Aston Martin', 'aston_martin.jpg', 'Where is the Batman?', true, '2008-12-18', 1, 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (2, 0, 'Ferrari', 'ferrari_profile.jpg', 'Beauty!', true, '2008-12-18', 1, 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (3, 0, 'Australian supercar', 'holden-efijy-1809.jpg', 'This one glitters in my garage ;)', true, '2008-12-18', 1, 3);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (4, 0, 'Hulme Supercar', 'hulme_supercar_side_parked.jpg', 'Saw it in Germany in summer 2007', true, '2008-12-18', 1, 4);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (5, 0, 'Pagani Zonda', 'Pagani_Zonda.jpg', 'The picture is provided by my friend photographer', true, '2008-12-18', 1, 5);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (6, 0, 'Codatronca (concept)', 'spadaconcept codatronca.jpg', 'Just concept', true, '2008-12-18', 1, 6);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (7, 0, 'Unknown supercar', 'supercar.jpg', 'Tell me it name if you know', true, '2008-12-18', 1, 7);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (8, 0, 'Audrey Tautou', 'Audrey_Tautou.jpg', 'Pretty girl!', true, '2008-12-18', 2, 8);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (9, 0, 'Juliette Binoche', 'Juliette_Binoche.jpg', 'Saw her in "Chocolate" at first', true, '2008-12-18', 2, 9);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (10, 0, 'Penelope Cruz', 'Penelope_Cruz.jpg', 'Without comments', true, '2008-12-18', 2, 10);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (11, 0, 'Rihanna', 'Rihanna.jpg', 'Was born in Barbados. True or false?', true, '2008-12-18', 2, 11);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (12, 0, 'Uma Turman', 'Uma_Turman.jpg', 'Share the delight with Tarantino )', true, '2008-12-18', 2, 12);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (13, 0, 'Basketball soccer', 'Basketball_soccer.jpg', 'They never saw camera', true, '2008-12-18', 3, 13);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (14, 0, 'bdysch!!!', 'bdysch!!!.jpg', 'Dermo sluchaetsia', true, '2008-12-18', 3, 14);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (15, 0, 'Training', 'euro2008_holland_wideweb__470x321,0.jpg', ' ) ', true, '2008-12-18', 3, 15);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (16, 0, 'Also football', 'flag_football.jpg', 'This is also football, but I do not understand it at all', true, '2008-12-18', 3, 16);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (17, 0, 'Soccer', 'soccer.jpg', 'Soccer differs from football', true, '2008-12-18', 3, 17);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (18, 0, 'from birds fly', 'birds_fly.jpg', 'One of the megalopolices', true, '2008-12-18', 4, 18);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (19, 0, 'Haruki Murakami', 'Haruki_Murakami.jpg', 'World famous aouthor', true, '2008-12-18', 4, 19);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (20, 0, 'Street fashion', 'Japanese_Street_Fashion.jpg', 'Venture to walk in such in our streets?', true, '2008-12-18', 4, 20);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (21, 0, 'Kendo Championship', 'Kendo_Championship_2006.jpg', 'Samurais steel alive!', true, '2008-12-18', 4, 21);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (22, 0, 'Live in peace', 'live_in_piece.jpg', 'The best place for meditation', true, '2008-12-18', 4, 22);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (23, 0, 'Modern family', 'modern_japanesse_family.jpg', 'Where is his mother?!', true, '2008-12-18', 4, 23);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (24, 0, 'Zen garden', 'zen-garden_landscape_design.jpg', 'Fen Shui i vsia fignia', true, '2008-12-18', 4, 24);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (25, 0, 'Sergei Babkin', 'Babkin.jpg', 'Also plays in theatre', true, '2008-12-18', 5, 25);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (26, 0, 'Bob Marley', 'Bob_Marley.jpg', 'Everyone should know him', true, '2008-12-18', 5, 26);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (27, 0, 'Infected Mushroom', 'Infected_Mushroom.jpg', 'Famous psyhedelic trance group from Israel', true, '2008-12-18', 5, 27);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (28, 0, 'Massive Attack', 'massiveAttack.jpg', 'They play theme to "House"', true, '2008-12-18', 5, 28);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (29, 0, 'Street musician', 'StreetMusician.jpg', 'unknown musician', true, '2008-12-18', 5, 29);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (30, 0, 'SOAD', 'system-of-a-down.jpg', 'Try not to loose your innervision!', true, '2008-12-18', 5, 30);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created, img_album_id, rank_id) VALUES (31, 0, 'Amon Tobin', 'tobin.jpg', 'Brasilian, works in London. Try his "Supermodified2000" album', true, '2008-12-18', 5, 31);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (1, 'Aston Martin', 'aston_martin.jpg', 'Where is the Batman?', '2008-12-18', 1, 1);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (2, 'Ferrari', 'ferrari_profile.jpg', 'Beauty!', '2008-12-18', 1, 2);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (3, 'Australian supercar', 'holden-efijy-1809.jpg', 'This one glitters in my garage ;)', '2008-12-18', 1, 3);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (4, 'Hulme Supercar', 'hulme_supercar_side_parked.jpg', 'Saw it in Germany in summer 2007', '2008-12-18', 1, 4);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (5, 'Pagani Zonda', 'Pagani_Zonda.jpg', 'The picture is provided by my friend photographer', '2008-12-18', 1, 5);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (6, 'Codatronca (concept)', 'spadaconcept codatronca.jpg', 'Just concept', '2008-12-18', 1, 6);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (7, 'Unknown supercar', 'supercar.jpg', 'Tell me it name if you know', '2008-12-18', 1, 7);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (8, 'Audrey Tautou', 'Audrey_Tautou.jpg', 'Pretty girl!', '2008-12-18', 2, 8);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (9, 'Juliette Binoche', 'Juliette_Binoche.jpg', 'Saw her in "Chocolate" at first', '2008-12-18', 2, 9);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (10, 'Penelope Cruz', 'Penelope_Cruz.jpg', 'Without comments', '2008-12-18', 2, 10);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (11, 'Rihanna', 'Rihanna.jpg', 'Was born in Barbados. True or false?', '2008-12-18', 2, 11);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (12, 'Uma Turman', 'Uma_Turman.jpg', 'Share the delight with Tarantino )', '2008-12-18', 2, 12);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (13, 'Basketball soccer', 'Basketball_soccer.jpg', 'They never saw camera', '2008-12-18', 3, 13);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (14, 'bdysch!!!', 'bdysch!!!.jpg', 'Dermo sluchaetsia', '2008-12-18', 3, 14);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (15, 'Training', 'euro2008_holland_wideweb__470x321,0.jpg', ' ) ', '2008-12-18', 3, 15);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (16, 'Also football', 'flag_football.jpg', 'This is also football, but I do not understand it at all', '2008-12-18', 3, 16);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (17, 'Soccer', 'soccer.jpg', 'Soccer differs from football', '2008-12-18', 3, 17);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (18, 'from birds fly', 'birds_fly.jpg', 'One of the megalopolices', '2008-12-18', 4, 18);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (19, 'Haruki Murakami', 'Haruki_Murakami.jpg', 'World famous aouthor', '2008-12-18', 4, 19);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (20, 'Street fashion', 'Japanese_Street_Fashion.jpg', 'Venture to walk in such in our streets?', '2008-12-18', 4, 20);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (21, 'Kendo Championship', 'Kendo_Championship_2006.jpg', 'Samurais steel alive!', '2008-12-18', 4, 21);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (22, 'Live in peace', 'live_in_piece.jpg', 'The best place for meditation', '2008-12-18', 4, 22);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (23, 'Modern family', 'modern_japanesse_family.jpg', 'Where is his mother?!', '2008-12-18', 4, 23);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (24, 'Zen garden', 'zen-garden_landscape_design.jpg', 'Fen Shui i vsia fignia', '2008-12-18', 4, 24);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (25, 'Sergei Babkin', 'Babkin.jpg', 'Also plays in theatre', '2008-12-18', 5, 25);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (26, 'Bob Marley', 'Bob_Marley.jpg', 'Everyone should know him', '2008-12-18', 5, 26);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (27, 'Infected Mushroom', 'Infected_Mushroom.jpg', 'Famous psyhedelic trance group from Israel', '2008-12-18', 5, 27);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (28, 'Massive Attack', 'massiveAttack.jpg', 'They play theme to "House"', '2008-12-18', 5, 28);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (29, 'Street musician', 'StreetMusician.jpg', 'unknown musician', '2008-12-18', 5, 29);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (30, 'SOAD', 'system-of-a-down.jpg', 'Try not to loose your innervision!', '2008-12-18', 5, 30);
+INSERT INTO images(image_id, name, path, description, created, img_album_id, rank_id) VALUES (31, 'Amon Tobin', 'tobin.jpg', 'Brasilian, works in London. Try his "Supermodified2000" album', '2008-12-18', 5, 31);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (1, 'Cool', 1);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (2, 'Cool2', 1);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (3, 'richfaces', 2);
Modified: trunk/test-applications/realworld/pom.xml
===================================================================
--- trunk/test-applications/realworld/pom.xml 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/pom.xml 2008-12-20 15:58:34 UTC (rev 11950)
@@ -16,11 +16,7 @@
<projectName>realworld</projectName>
<richfacesVersion>3.3.0-SNAPSHOT</richfacesVersion>
<seamVersion>2.1.0.SP1</seamVersion>
- <jbossDownloadURL>http://downloads.sourceforge.net/jboss/jboss-4.2.3.GA.zip</jbossDownloadURL>
- <jbossDeployDir>jboss-4.2.3.GA/jboss-4.2.3.GA/server/default/</jbossDeployDir>
- <droolsVersion>4.0.0</droolsVersion>
<faceletsVersion>1.1.14</faceletsVersion>
- <installDir>E:/apps/jboss</installDir>
</properties>
<repositories>
<repository>
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,35 +1,44 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.fileupload;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
@Name("avatarUpload")
@Scope(ScopeType.CONVERSATION)
public class AvatarUpload implements Serializable{
- @In(create=true)
- private FileManager fileManager;
+ private static final long serialVersionUID = -3653686566159143678L;
private FileItem avatarItem;
- private boolean autoUpload = false;
-
public void avatarListener(UploadEvent event){
UploadItem item = event.getUploadItem();
FileItem file = new FileItem();
@@ -44,14 +53,7 @@
public synchronized void paintAvatar(OutputStream stream, Object object) throws IOException {
stream.write(this.getAvatarItem().getData());
}
- public boolean isAutoUpload() {
- return autoUpload;
- }
- public void setAutoUpload(boolean autoUpload) {
- this.autoUpload = autoUpload;
- }
-
public FileItem getAvatarItem() {
return avatarItem;
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.fileupload;
import org.richfaces.realworld.domain.Image;
@@ -5,9 +25,13 @@
public class FileItem {
private Image image = new Image();
+
private boolean selected;
+
private long length;
+
private byte[] data;
+
public byte[] getData() {
return data;
}
@@ -25,12 +49,15 @@
public boolean isSelected() {
return selected;
}
+
public void setSelected(boolean selected) {
this.selected = selected;
}
+
public Image getImage() {
return image;
}
+
public void setImage(Image image) {
this.image = image;
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileLoader.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileLoader.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileLoader.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.fileupload;
import java.io.IOException;
@@ -4,8 +24,6 @@
import java.io.OutputStream;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.fileupload;
import java.io.File;
@@ -14,10 +34,10 @@
@Scope(ScopeType.CONVERSATION)
public class FileManager {
+ private static final String UPLOAD_ROOT = "uploadRoot";
+ private static final String FILE_SEPARATOR = "file.separator";
+ private String uploadRoot;
-private String uploadRoot;
-
-
public String getUploadRoot() {
return uploadRoot;
}
@@ -28,11 +48,11 @@
public FileManager(){
FacesContext fc = FacesContext.getCurrentInstance();
- this.setUploadRoot(fc.getExternalContext().getInitParameter("uploadRoot"));
+ this.setUploadRoot(fc.getExternalContext().getInitParameter(UPLOAD_ROOT));
}
public String getFileSeparator() {
- return System.getProperty("file.separator");
+ return System.getProperty(FILE_SEPARATOR);
}
public boolean isDirectoryPresent(String directory) {
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -22,31 +22,22 @@
package org.richfaces.realworld.fileupload;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Synchronized;
import org.jboss.seam.core.Events;
-import org.jboss.seam.faces.FacesMessages;
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.tree.TreeActionManager;
-import org.richfaces.realworld.tree.TreeSelectionManager;
-import org.richfaces.realworld.util.NavigationEnum;
-import org.richfaces.realworld.util.SelectedImageIndex;
/**
* @author $Autor$
@@ -57,6 +48,14 @@
public class FileUploadBean implements Serializable{
+ private static final String SAMPLE_NAME = "Sample Name";
+
+ private static final String SAMPLE_DESCRIPTION = "Sample Description";
+
+ private static final String ADD_IMAGE_EVENT = "addImage";
+
+ private static final long serialVersionUID = 4969087557225414955L;
+
@In
private User user;
@@ -68,8 +67,6 @@
@In(create=true)
private FileManager fileManager;
-
- private boolean autoUpload = false;
public synchronized void listener(UploadEvent event) throws Exception{
UploadItem item = event.getUploadItem();
@@ -79,8 +76,8 @@
file.setSelected(false);
Image image = new Image();
image.setCreated(new Date());
- image.setDescription("Sample Description");
- image.setName("Sample Name");
+ image.setDescription(SAMPLE_DESCRIPTION);
+ image.setName(SAMPLE_NAME);
image.setPath(item.getFileName());
image.setAlbumName(selectedAlbum.getName());
image.setAlbum(selectedAlbum);
@@ -112,7 +109,7 @@
// TODO Auto-generated catch block
e.printStackTrace();
}
- Events.instance().raiseEvent("addImage", file.getImage());
+ Events.instance().raiseEvent(ADD_IMAGE_EVENT, file.getImage());
}else{
temp.add(file);
}
@@ -132,21 +129,9 @@
e.printStackTrace();
}
//Update domain model
- Events.instance().raiseEvent("addImage", file.getImage());
+ Events.instance().raiseEvent(ADD_IMAGE_EVENT, file.getImage());
}
fileWrapper.getFiles().clear();
}
- public long getTimeStamp(){
- return System.currentTimeMillis();
- }
-
- public boolean isAutoUpload() {
- return autoUpload;
- }
-
- public void setAutoUpload(boolean autoUpload) {
- this.autoUpload = autoUpload;
- }
-
}
\ No newline at end of file
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.fileupload;
import java.util.ArrayList;
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,181 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.fileupload;
+
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+
+import javax.imageio.ImageIO;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.User;
+
+ at Name("imageLoader")
+ at Scope(ScopeType.CONVERSATION)
+public class ImageLoader implements Serializable{
+
+ private static final String DELIMITER = ":";
+
+ private static final String JPEG = "jpeg";
+
+ private static final long serialVersionUID = -1572789608594870285L;
+
+ @In(create=true)
+ FileManager fileManager;
+
+ public synchronized void paintSearchImage(OutputStream stream, Object object) throws IOException {
+ Image painted = (Image)object;
+
+ File image = fileManager.getImage(painted.getAlbum().getOwner().getLogin() + fileManager.getFileSeparator() + painted.getAlbum().getName()+ fileManager.getFileSeparator() + painted.getPath());
+ InputStream paintData = null;
+ byte[] data = new byte[(int)image.length() - 1];
+ FileInputStream fileInputStream = null;
+ BufferedInputStream bufferedInputStream = null;
+ if (image != null) {
+ try {
+ fileInputStream = new FileInputStream(image);
+ bufferedInputStream = new BufferedInputStream(fileInputStream);
+ paintData = bufferedInputStream;
+ paintData.read(data);
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }finally{
+ try {
+ fileInputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ bufferedInputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ paintData.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ stream.write(data);
+ }
+
+ public synchronized void paint(OutputStream out, Object data) throws IOException{
+ if (null == data) {
+ return;
+ }
+ Image image = (Image)data;
+ File imageResource = fileManager.getImage(image.getAlbum().getOwner().getLogin() + fileManager.getFileSeparator() + image.getAlbum().getName() + fileManager.getFileSeparator() + image.getPath());
+ if (imageResource != null) {
+ FileInputStream fileInputStream = new FileInputStream(imageResource);
+ BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
+ InputStream paintData = bufferedInputStream;
+ if (null == paintData) {
+ // throw new Exception("");
+ // TODO
+ }
+ try{
+ BufferedImage images = ImageIO.read(paintData);
+ ImageIO.write(images, JPEG, out);
+ }catch(Exception e){
+
+ }finally{
+ fileInputStream.close();
+ bufferedInputStream.close();
+ paintData.close();
+ }
+ }
+ }
+
+ public synchronized void paintAvatar(OutputStream out, Object data) throws IOException{
+ if (null == data) {
+ return;
+ }
+ User user = (User)data;
+ File imageResource = fileManager.getImage(user.getLogin() + fileManager.getFileSeparator() + "avatars" + fileManager.getFileSeparator() + user.getAvatarPath());
+ if (imageResource != null) {
+ FileInputStream fileInputStream = new FileInputStream(imageResource);
+ BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
+ InputStream paintData = bufferedInputStream;
+ if (null == paintData) {
+ // throw new Exception("");
+ // TODO
+ }
+ try{
+ BufferedImage image = ImageIO.read(paintData);
+ ImageIO.write(image, JPEG, out);
+ }catch(Exception e){
+
+ }finally{
+ fileInputStream.close();
+ bufferedInputStream.close();
+ paintData.close();
+ }
+ }
+ }
+
+ public synchronized void paintFriendAvatar(OutputStream out, Object data) throws IOException{
+ if (null == data) {
+ return;
+ }
+ String temp = data.toString();
+ String[] array = temp.split(DELIMITER);
+ File imageResource = fileManager.getImage(array[0] + fileManager.getFileSeparator() + "avatars" + fileManager.getFileSeparator() + array[1]);
+ if (imageResource != null) {
+ FileInputStream fileInputStream = new FileInputStream(imageResource);
+ BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
+ InputStream paintData = bufferedInputStream;
+ if (null == paintData) {
+ // throw new Exception("");
+ // TODO
+ }
+ try{
+ BufferedImage image = ImageIO.read(paintData);
+ ImageIO.write(image, JPEG, out);
+ }catch(Exception e){
+
+ }finally{
+ fileInputStream.close();
+ bufferedInputStream.close();
+ paintData.close();
+ }
+ }
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,27 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.navigation;
+
+public enum NavigationEnum {
+ IMAGE_PREVIEW,
+ FILE_UPLOAD,
+ USER_PREFS, SEARCH, READ_MESSAGES,
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,56 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.navigation;
+
+import java.io.Serializable;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+ at Name(value="navigationHelper")
+ at Scope(ScopeType.CONVERSATION)
+public class NavigationHelper implements Serializable{
+
+ private static final long serialVersionUID = -89683694316344212L;
+
+ private NavigationEnum navigationEnum;
+
+ public NavigationEnum getNavigationEnumUserPrefs(){
+ return NavigationEnum.USER_PREFS;
+ }
+
+ public NavigationEnum getNavigationEnumSearch(){
+ return NavigationEnum.SEARCH;
+ }
+
+ public NavigationEnum getNavigationEnumReadMessages(){
+ return NavigationEnum.READ_MESSAGES;
+ }
+
+ public NavigationEnum getNavigationEnumImagePreview(){
+ return NavigationEnum.IMAGE_PREVIEW;
+ }
+
+ public NavigationEnum getNavigationEnumFileUpload(){
+ return NavigationEnum.FILE_UPLOAD;
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,12 +1,25 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.search;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
@@ -17,23 +30,37 @@
import javax.faces.model.SelectItem;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
-import org.richfaces.component.UIInputNumberSpinner;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.fileupload.FileManager;
import org.richfaces.realworld.service.ISearchService;
+import org.richfaces.realworld.service.SearchService;
@Name("searchBean")
@Scope(ScopeType.CONVERSATION)
public class SearchBean implements Serializable {
- /**
- *
- */
+ private static final String EQUALS_CHOICE = "Equals";
+
+ private static final String LESS_CHOICE = "Less";
+
+ private static final String MORE_CHOICE = "More";
+
+ private static final String NO_MATTER_CHOICE = "No Matter";
+
+ private static final String EQUALS = "= ";
+
+ private static final String LESSTHEN = "< ";
+
+ private static final String GREATTHEN = "> ";
+
+ private static final String DATE_ADDON = " and i.created";
+
+ private static final String VOTES_ADDON = " and i.rank.hits";
+
+ private static final String SPINNER_ADDON = " and i.rank.total/i.rank.hits";
+
private static final long serialVersionUID = 5071655218132021316L;
@In(required=false)
@@ -58,20 +85,20 @@
public List<SelectItem> getItems() {
List<SelectItem> list = new ArrayList<SelectItem>(4);
- list.add(new SelectItem(Long.valueOf(0L), "No Matter"));
- list.add(new SelectItem(Long.valueOf(1L), "More"));
- list.add(new SelectItem(Long.valueOf(2L), "Less"));
- list.add(new SelectItem(Long.valueOf(3L), "Equals"));
+ list.add(new SelectItem(Long.valueOf(0L), NO_MATTER_CHOICE));
+ list.add(new SelectItem(Long.valueOf(1L), MORE_CHOICE));
+ list.add(new SelectItem(Long.valueOf(2L), LESS_CHOICE));
+ list.add(new SelectItem(Long.valueOf(3L), EQUALS_CHOICE));
return list;
}
private String getAstFromIndex(Long item){
if(item == 1L){
- return "> ";
+ return GREATTHEN;
}else if(item == 2L){
- return "< ";
+ return LESSTHEN;
}else if(item == 3L){
- return "= ";
+ return EQUALS;
}
return null;
}
@@ -98,14 +125,14 @@
private Map<String, Object> populateMap(String additionalParams) {
Map<String, Object> map = new HashMap<String, Object>();
- if(additionalParams.lastIndexOf(":spinnerValue") != -1){
- map.put(":spinnerValue", Long.valueOf(helper.getInputSpinner().getValue().toString()));
+ if(additionalParams.lastIndexOf(SearchService.SPINNER_VALUE_NAMED_PARAMETER) != -1){
+ map.put(SearchService.SPINNER_VALUE_NAMED_PARAMETER, Long.valueOf(helper.getInputSpinner().getValue().toString()));
}
- if(additionalParams.lastIndexOf(":choice") != -1){
- map.put(":choice", numberOfVotes);
+ if(additionalParams.lastIndexOf(SearchService.CHOICE_NAMED_PARAMETER) != -1){
+ map.put(SearchService.CHOICE_NAMED_PARAMETER, numberOfVotes);
}
- if(additionalParams.lastIndexOf(":date") != -1){
- map.put(":date", date);
+ if(additionalParams.lastIndexOf(SearchService.DATE_NAMED_PARAMETER) != -1){
+ map.put(SearchService.DATE_NAMED_PARAMETER, date);
}
return map;
}
@@ -113,19 +140,19 @@
private String populateAdditionalParams() {
StringBuilder additionalParams = new StringBuilder("");
if(spinnerChoice != null && spinnerChoice > 0L){
- additionalParams.append(" and i.rank.total/i.rank.hits");
+ additionalParams.append(SPINNER_ADDON);
additionalParams.append(getAstFromIndex(spinnerChoice));
- additionalParams.append(":spinnerValue");
+ additionalParams.append(SearchService.SPINNER_VALUE_NAMED_PARAMETER);
}
if(votesChoice != null && votesChoice > 0L){
- additionalParams.append(" and i.rank.hits");
+ additionalParams.append(VOTES_ADDON);
additionalParams.append(getAstFromIndex(votesChoice));
- additionalParams.append(":choice");
+ additionalParams.append(SearchService.CHOICE_NAMED_PARAMETER);
}
if(dateChoice != null && dateChoice > 0L && date != null){
- additionalParams.append(" and i.created");
+ additionalParams.append(DATE_ADDON);
additionalParams.append(getAstFromIndex(dateChoice));
- additionalParams.append(":date");
+ additionalParams.append(SearchService.DATE_NAMED_PARAMETER);
}
return additionalParams.toString();
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBeanHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBeanHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBeanHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.search;
import org.jboss.seam.ScopeType;
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.session;
import java.io.IOException;
@@ -8,42 +28,53 @@
import javax.faces.context.FacesContext;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.TransactionPropagationType;
-import org.jboss.seam.annotations.Transactional;
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
import org.jboss.seam.security.Identity;
-import org.jboss.seam.web.Session;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.AvatarUpload;
import org.richfaces.realworld.fileupload.FileManager;
+import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.IUserAction;
-import org.richfaces.realworld.tree.TreeSelectionManager;
-import org.richfaces.realworld.util.NavigationEnum;
@Name("authenticator")
@Scope(ScopeType.CONVERSATION)
public class Authenticator implements Serializable
{
- @Logger Log log;
+
+ private static final String USER_WITH_THIS_LOGIN_ALREADY_EXIST = "User with this login already exist";
+
+ private static final String CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD = "Confirm Password not equals password";
+
+ private static final String REGISTER_LOGIN_NAME_ID = "register:loginName";
+
+ private static final String REGISTER_CONFIRM_PASSWORD_ID = "register:confirmPassword";
+
+ private static final String INDEX_OUTCOME = "index";
+
+ private static final String ADMIN_ROLE = "admin";
+
+ private static final String GUEST_ROLE = "guest";
+
+ private static final String UPDATE_MAIN_AREA_EVENT = "updateMainArea";
+
+ private static final long serialVersionUID = -4585673256547342140L;
+
+ @Logger Log log;
@In Identity identity;
@Out(required=false)
private Image selectedImage;
-
- @Out(required=false)
- private User selectedUser;
@Out(required=false)
private Album selectedAlbum;
@@ -65,15 +96,15 @@
public boolean authenticate()
{
if(null == identity.getUsername() || identity.getUsername().equals("")){
- identity.addRole("guest");
- Events.instance().raiseEvent("updateMainArea", NavigationEnum.SEARCH);
+ identity.addRole(GUEST_ROLE);
+ Events.instance().raiseEvent(UPDATE_MAIN_AREA_EVENT, NavigationEnum.SEARCH);
userAction.loginAnonymous();
return true;
}
try{
User user = userAction.login(identity.getUsername(), identity.getPassword());
if(user != null){
- identity.addRole("admin");
+ identity.addRole(ADMIN_ROLE);
if(!fileManager.isDirectoryPresent(identity.getUsername())){
fileManager.addDirectory(identity.getUsername());
}
@@ -83,8 +114,7 @@
selectedImage = selectedAlbum.getImages().get(0);
}
}
- selectedUser = user;
- Events.instance().raiseEvent("updateMainArea", NavigationEnum.IMAGE_PREVIEW);
+ Events.instance().raiseEvent(UPDATE_MAIN_AREA_EVENT, NavigationEnum.IMAGE_PREVIEW);
return true;
}
}catch(Exception nre){
@@ -94,21 +124,21 @@
return false;
}
- @Begin @End
+ @End
public String register(User user){
boolean errorHappened = false;
if(!user.getPassword().equals(user.getConfirmPassword())){
UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
- UIComponent component = root.findComponent("register:confirmPassword");
+ UIComponent component = root.findComponent(REGISTER_CONFIRM_PASSWORD_ID);
FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()), new FacesMessage(
- FacesMessage.SEVERITY_ERROR, "Confirm Password not equals password" , "Confirm Password not equals password"));
+ FacesMessage.SEVERITY_ERROR, CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD , CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD));
errorHappened = true;
}
if(userAction.isUserExist(user.getLogin())){
UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
- UIComponent component = root.findComponent("register:loginName");
+ UIComponent component = root.findComponent(REGISTER_LOGIN_NAME_ID);
FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()), new FacesMessage(
- FacesMessage.SEVERITY_ERROR, "User with this login already exist" , "User with this login already exist"));
+ FacesMessage.SEVERITY_ERROR, USER_WITH_THIS_LOGIN_ALREADY_EXIST , USER_WITH_THIS_LOGIN_ALREADY_EXIST));
errorHappened = true;
}
if(errorHappened){
@@ -126,15 +156,6 @@
e.printStackTrace();
}
}
- return "index";
+ return INDEX_OUTCOME;
}
-
- /**
- * Logout from session.
- *
- * @return outcome which redirects to login page.
- *//*
- public void logout() {
- Session.instance().invalidate();
- }*/
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.slideshow;
import java.io.Serializable;
@@ -8,12 +28,17 @@
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.richfaces.realworld.tree.TreeSelectionManager;
-import org.richfaces.realworld.util.SlideshowHelper;
@Name("slideshow")
@Scope(ScopeType.CONVERSATION)
public class SlideshowBean implements Serializable{
+ private static final int INITIAL_DELAY = 10000;
+
+ private static final int DELAY = 1000;
+
+ private static final long serialVersionUID = 7801877176558409702L;
+
@In(required=false) @Out(required=false)
SlideshowHelper slideshowHelper;
@@ -22,7 +47,7 @@
private boolean active;
- private int interval = 10000;
+ private int interval = INITIAL_DELAY;
public int getInterval() {
return interval;
@@ -49,7 +74,7 @@
}
public void updateInterval(){
- this.setInterval((int)(1000 * Long.valueOf(slideshowHelper.getInputSlider().getValue().toString())));
+ this.setInterval((int)(DELAY * Long.valueOf(slideshowHelper.getInputSlider().getValue().toString())));
}
public void incrementSlide(){
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.slideshow;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.component.UIInputNumberSlider;
+
+ at Name("slideshowHelper")
+ at Scope(ScopeType.EVENT)
+public class SlideshowHelper {
+
+ private UIInputNumberSlider inputSlider;
+
+ public UIInputNumberSlider getInputSlider() {
+ return inputSlider;
+ }
+
+ public void setInputSlider(UIInputNumberSlider inputSlider) {
+ this.inputSlider = inputSlider;
+ }
+
+
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,22 +1,37 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.tree;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.faces.model.SelectItem;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.TransactionPropagationType;
-import org.jboss.seam.annotations.Transactional;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.FriendshipRequest;
@@ -24,29 +39,36 @@
import org.richfaces.realworld.domain.Message;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.FileManager;
+import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.IAlbumAction;
import org.richfaces.realworld.service.IImageAction;
import org.richfaces.realworld.service.IMessageAction;
import org.richfaces.realworld.service.IUserAction;
-import org.richfaces.realworld.util.NavigationEnum;
-import org.richfaces.realworld.util.RatingHelper;
-import org.richfaces.realworld.util.SelectedImageIndex;
+import org.richfaces.realworld.util.RatingBinder;
+import org.richfaces.realworld.util.SelectionHelper;
@Name("treeActionManager")
@Scope(ScopeType.CONVERSATION)
public class TreeActionManager implements Serializable{
+ private static final String ADDED_TO_FRIENDS_MESSAGE_THEME = "You are were added to friends";
+
+ private static final String ADDED_TO_FRIENDS_MESSAGE = "You are were added to friends by User ";
+
+ private static final String REMOVED_FROM_FRIENDS_MESSAGE_THEME = "You are were removed from friends";
+
+ private static final String YOU_ARE_WERE_REMOVED_FROM_FRIENDS_MESSAGE = "You are were removed from friends of ";
+
+ private static final long serialVersionUID = 6027103521084558931L;
+
@In
private User user;
- @Out(required=false)
- private User selectedUser;
-
@In(create=true, required=true)
private IAlbumAction albumAction;
@In(create=true, required=true)
- private RatingHelper ratingHelper;
+ private RatingBinder ratingBinder;
@In(create=true, required=true)
private IMessageAction messageAction;
@@ -61,7 +83,7 @@
private Album album;
@In(create=true) @Out
- private SelectedImageIndex selectedImageIndex;
+ private SelectionHelper selectionHelper;
@In(create=true)
FileManager fileManager;
@@ -168,7 +190,6 @@
}
}
-
@Observer("addImage")
public void addImage(Image image) {
imageAction.addImage(image);
@@ -213,8 +234,8 @@
message.setOwner(removed);
message.setFriendshipRequest(false);
message.setReaded(false);
- message.setMessage("You are were removed from friends of "+ user.getLogin());
- message.setTheme("You are were removed from friends");
+ message.setMessage(YOU_ARE_WERE_REMOVED_FROM_FRIENDS_MESSAGE+ user.getLogin());
+ message.setTheme(REMOVED_FROM_FRIENDS_MESSAGE_THEME);
messageAction.sendMessage(message);
}
@@ -229,8 +250,8 @@
message.setOwner(friend);
message.setFriendshipRequest(false);
message.setReaded(false);
- message.setMessage("You are were added to friends by User "+ user.getLogin());
- message.setTheme("You are were added to friends");
+ message.setMessage(ADDED_TO_FRIENDS_MESSAGE+ user.getLogin());
+ message.setTheme(ADDED_TO_FRIENDS_MESSAGE_THEME);
messageAction.sendMessage(message);
}
}/*else{
@@ -248,22 +269,23 @@
}
public void vote(Image image){
- imageAction.vote(image, (Long)Long.valueOf(ratingHelper.getInputSlider().getValue().toString()));
+ imageAction.vote(image, (Long)Long.valueOf(ratingBinder.getInputSlider().getValue().toString()));
}
public void showSharedAlbum(Image image){
NavigationEnum mainArea = NavigationEnum.IMAGE_PREVIEW;
treeSelectionManager.setMainArea(mainArea);
- selectedUser = image.getAlbum().getOwner();
selectedAlbum = image.getAlbum();
selectedImage = selectedAlbum.getImages().get(0);
- selectedImageIndex.setSelectedImageIndex(1);
+ selectionHelper.setSelectedImageIndex(1);
+ selectionHelper.setUserAlbumSelected(false);
}
public void updateSelectedAlbum(){
selectedAlbum = user.getAlbumByName(this.getSelectedAlbumName());
selectedImage = selectedAlbum.getImages().get(0);
- selectedImageIndex.setSelectedImageIndex(1);
+ selectionHelper.setSelectedImageIndex(1);
+ selectionHelper.setUserAlbumSelected(true);
}
}
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeAlbumItem.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeAlbumItem.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeAlbumItem.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.tree;
import java.util.ArrayList;
@@ -11,10 +31,11 @@
import org.richfaces.realworld.domain.Image;
public class TreeAlbumItem implements TreeNode {
- /**
- *
- */
+
+ private static final String ALBUM_NODE_TYPE = "album";
+
private static final long serialVersionUID = 6514596192023597908L;
+
private long id;
private Map<Object, TreeNode> images = new LinkedHashMap<Object, TreeNode>();
private Album album;
@@ -89,7 +110,7 @@
}
public String getType() {
- return "album";
+ return ALBUM_NODE_TYPE;
}
public String toString(){
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeImageItem.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeImageItem.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeImageItem.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.tree;
import java.util.Iterator;
@@ -8,9 +28,8 @@
import org.richfaces.realworld.domain.Image;
public class TreeImageItem implements TreeNode {
- /**
- *
- */
+
+ private static final String IMAGE_NODE_TYPE = "image";
private static final long serialVersionUID = 6514596192023597908L;
private long id;
private Image image;
@@ -66,7 +85,7 @@
}
public String getType() {
- return "image";
+ return IMAGE_NODE_TYPE;
}
public Image getImage() {
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.tree;
import java.util.ArrayList;
@@ -15,15 +35,14 @@
import org.jboss.seam.annotations.Scope;
import org.richfaces.model.TreeNode;
import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.service.IAlbumAction;
-import org.richfaces.realworld.service.IImageAction;
@Name("treeRoot")
@Scope(ScopeType.CONVERSATION)
public class TreeRootItem implements TreeNode {
+ private static final String TREE_ROOT_NODE_TYPE = "treeRoot";
+
@In @Out
private User user;
@@ -80,7 +99,7 @@
}
public String getType() {
- return "treeBean";
+ return TREE_ROOT_NODE_TYPE;
}
private void initData() {
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,12 +1,25 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.tree;
-import java.awt.image.BufferedImage;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
@@ -17,19 +30,15 @@
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
-import javax.imageio.ImageIO;
import org.ajax4jsf.context.AjaxContext;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Synchronized;
-import org.jboss.seam.annotations.TransactionPropagationType;
-import org.jboss.seam.annotations.Transactional;
import org.richfaces.component.UIDatascroller;
import org.richfaces.component.UIDragSupport;
import org.richfaces.component.UITree;
@@ -42,18 +51,28 @@
import org.richfaces.model.TreeRowKey;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.util.NavigationEnum;
-import org.richfaces.realworld.util.SelectedImageIndex;
+import org.richfaces.realworld.navigation.NavigationEnum;
+import org.richfaces.realworld.util.SelectionHelper;
@Name("treeSelectionManager")
@Scope(ScopeType.CONVERSATION)
@Synchronized(timeout=200000)
public class TreeSelectionManager implements Serializable{
- @In(required=false)
- private User user;
+ private static final String DATASCROLLER_ID = "mainform:sc1";
+
+ private static final String IMAGE_DATATABLE_ID = "mainform:imageList";
+
+ private static final String FIRST = "first";
+
+ private static final String NEXT = "next";
+
+ private static final String LAST = "last";
+
+ private static final String PREVIOUS = "previous";
+
+ private static final long serialVersionUID = -6072049677194472463L;
private NavigationEnum mainArea;
@@ -64,7 +83,7 @@
private Album selectedAlbum;
@In(required=false) @Out(required=false)
- private SelectedImageIndex selectedImageIndex;
+ private SelectionHelper selectionHelper;
@In(create=true)
FileManager fileManager;
@@ -91,27 +110,27 @@
public void scrollerListener(DataScrollerEvent event) {
List<Image> images = selectedAlbum.getImages();
- if (event.getNewScrolVal().equals("previous")) {
+ if (event.getNewScrolVal().equals(PREVIOUS)) {
for(int index = 0 ; index < images.size(); index++){
if(images.get(index) == selectedImage){
selectedImage = images.get(index - 1);
- selectedImageIndex.setSelectedImageIndex(index);
+ selectionHelper.setSelectedImageIndex(index);
}
}
- } else if (event.getNewScrolVal().equals("last")) {
+ } else if (event.getNewScrolVal().equals(LAST)) {
selectedImage = images.get(images.size() - 1);
- selectedImageIndex.setSelectedImageIndex(images.size());
- } else if (event.getNewScrolVal().equals("next")) {
+ selectionHelper.setSelectedImageIndex(images.size());
+ } else if (event.getNewScrolVal().equals(NEXT)) {
for(int index = 0 ; index < images.size(); index++){
if(images.get(index) == selectedImage){
selectedImage = images.get(index + 1);
- selectedImageIndex.setSelectedImageIndex(index + 2);
+ selectionHelper.setSelectedImageIndex(index + 2);
return;
}
}
- } else if (event.getNewScrolVal().equals("first")) {
+ } else if (event.getNewScrolVal().equals(FIRST)) {
selectedImage = images.get(0);
- selectedImageIndex.setSelectedImageIndex(1);
+ selectionHelper.setSelectedImageIndex(1);
}
}
@@ -138,7 +157,7 @@
// Note: check if we dropped node on to itself or to item instead of
// folder here
if (droppedInNode != null && (droppedInNode.equals(draggedNode) || droppedInNode.getParent().getParent() != null || draggedNode.getParent().getParent() == null)) {
- System.out.println("Warning: Can't drop on itself or to pic itself! Also can't move folders");
+ //Warning: Can't drop on itself or to pic itself! Also can't move folders
return;
}
@@ -172,7 +191,7 @@
}
AjaxContext ac = AjaxContext.getCurrentInstance();
- ac.addRenderedArea("mainform:imageList");
+ ac.addRenderedArea(IMAGE_DATATABLE_ID);
Image draggedImage = ((TreeImageItem)draggedNode).getImage();
draggedImage.setAlbumName(((TreeAlbumItem)droppedInNode).getAlbum().getName());
treeActionManager.editImage(draggedImage);
@@ -180,7 +199,7 @@
try {
ac.addComponentToAjaxRender(destTree);
} catch (Exception e) {
- System.err.print(e.getMessage());
+ //System.err.print(e.getMessage());
}
}
@@ -259,6 +278,7 @@
}
}
}
+ selectionHelper.setUserAlbumSelected(true);
}
catch(Exception e){
//Bla-bla-bla
@@ -266,16 +286,15 @@
}
public void updateScroller(ActionEvent event){
- this.setDataScrollerIndex(selectedImageIndex.getSelectedImageIndex()- 1);
+ this.setDataScrollerIndex(selectionHelper.getSelectedImageIndex()- 1);
}
private void setDataScrollerIndex(int index) {
UIComponent component = FacesContext.getCurrentInstance().getViewRoot();
- UIDatascroller scroller = (UIDatascroller)component.findComponent("mainform:sc1");
- //scroller.setPage(index+1);
+ UIDatascroller scroller = (UIDatascroller)component.findComponent(DATASCROLLER_ID);
Map<String, Object> attributes = scroller.getDataTable().getAttributes();
attributes.put(UIDatascroller.SCROLLER_STATE_ATTRIBUTE, index+1);
- selectedImageIndex.setSelectedImageIndex(index+1);
+ selectionHelper.setSelectedImageIndex(index+1);
}
public void incrementSlideshowIndex() {
@@ -285,11 +304,10 @@
}
selectedImage = selectedAlbum.getImages().get(index +1);
UIComponent component = FacesContext.getCurrentInstance().getViewRoot();
- UIDatascroller scroller = (UIDatascroller)component.findComponent("mainform:sc1");
- //scroller.setPage(index+2);
+ UIDatascroller scroller = (UIDatascroller)component.findComponent(DATASCROLLER_ID);
Map<String, Object> attributes = scroller.getDataTable().getAttributes();
attributes.put(UIDatascroller.SCROLLER_STATE_ATTRIBUTE, index+2);
- selectedImageIndex.setSelectedImageIndex(index+2);
+ selectionHelper.setSelectedImageIndex(index+2);
}
public String getNodeTitle() {
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/AlbumPopupHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/AlbumPopupHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/AlbumPopupHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,64 @@
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+
+import javax.faces.event.ActionEvent;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.tree.TreeActionManager;
+
+ at Name("albumPopupHelper")
+ at Scope(ScopeType.CONVERSATION)
+public class AlbumPopupHelper implements Serializable{
+
+ private static final long serialVersionUID = 2561824019376412988L;
+
+ private String caption;
+
+ private String actionName;
+
+ @In(create=true, required=true) @Out
+ private Album album;
+
+ @In(create=true, required=true)
+ private TreeActionManager treeActionManager;
+
+ public void initAlbumData( String actionName, String caption, Album album){
+ this.caption = caption;
+ this.actionName = actionName;
+ if(null != album){
+ this.album = album;
+ }else{
+ this.album = new Album();
+ }
+ }
+
+ public void editAlbum(ActionEvent event){
+ treeActionManager.editAlbum(this.album);
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public void setCaption(String caption) {
+ this.caption = caption;
+ }
+
+ public String getActionName() {
+ return actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public void addAlbum(ActionEvent event){
+ treeActionManager.addAlbum();
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/AlbumPopupHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ComboboxHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ComboboxHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ComboboxHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.util;
import java.io.Serializable;
@@ -14,7 +34,7 @@
@Scope(ScopeType.CONVERSATION)
public class ComboboxHelper implements Serializable{
-
+ private static final long serialVersionUID = -8864867298110686848L;
private String albumName;
public String getAlbumName() {
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/CommentPopupHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/CommentPopupHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/CommentPopupHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,73 @@
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.faces.event.ActionEvent;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Comment;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.tree.TreeActionManager;
+
+ at Name("commentPopupHelper")
+ at Scope(ScopeType.CONVERSATION)
+public class CommentPopupHelper implements Serializable{
+
+ private static final long serialVersionUID = 2561824019376412988L;
+
+ private String caption;
+
+ private String actionName;
+
+ @In(create=true, required=true) @Out
+ private Comment comment;
+
+ @In
+ private User user;
+
+ @In(create=true, required=true)
+ private TreeActionManager treeActionManager;
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public void setCaption(String caption) {
+ this.caption = caption;
+ }
+
+ public String getActionName() {
+ return actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public void initComment( String actionName, String caption, Comment comment, Image image){
+ this.caption = caption;
+ this.actionName = actionName;
+ if(null != comment){
+ this.comment = comment;
+ }else{
+ this.comment = new Comment();
+ this.comment.setAuthor(user);
+ this.comment.setImage(image);
+ this.comment.setDate(new Date());
+ }
+ }
+
+ public void editComment(ActionEvent event){
+ treeActionManager.editComment(this.comment);
+ }
+
+ public void addComment(ActionEvent event){
+ treeActionManager.addComment(this.comment);
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/CommentPopupHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConfirmationPopupHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConfirmationPopupHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConfirmationPopupHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,81 @@
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import javax.faces.event.ActionEvent;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.MetaTag;
+import org.richfaces.realworld.tree.TreeActionManager;
+
+ at Name("confirmationPopupHelper")
+ at Scope(ScopeType.CONVERSATION)
+public class ConfirmationPopupHelper implements Serializable{
+
+ private static final long serialVersionUID = 2561824019376412988L;
+
+ private String caption;
+
+ private String actionName;
+
+ @In(required=true)
+ private Image image;
+
+ @In(required=true)
+ private Album album;
+
+ @In(required=true)
+ private TreeActionManager treeActionManager;
+
+ public void initImagePopup( String actionName, String caption, Image image){
+ this.caption = caption;
+ this.actionName = actionName;
+ if(null != image){
+ this.image = image;
+ image.setMeta(new ArrayList<MetaTag>(image.getTags()));
+ }else{
+ this.image = new Image();
+ }
+ }
+
+ public void initAlbumData( String actionName, String caption, Album album){
+ this.caption = caption;
+ this.actionName = actionName;
+ if(null != album){
+ this.album = album;
+ }else{
+ this.album = new Album();
+ }
+ }
+
+ public void deleteAlbum(ActionEvent event){
+ treeActionManager.deleteAlbum(this.album);
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public void setCaption(String caption) {
+ this.caption = caption;
+ }
+
+ public String getActionName() {
+ return actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public void deleteImage(ActionEvent event){
+ treeActionManager.deleteImage(this.image);
+ }
+
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConfirmationPopupHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/FriendHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,60 +1,65 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.realworld.util;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.TransactionPropagationType;
-import org.jboss.seam.annotations.Transactional;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.service.IAlbumAction;
-import org.richfaces.realworld.service.IUserAction;
@Name("friendHelper")
@Scope(ScopeType.CONVERSATION)
public class FriendHelper implements Serializable{
+
+ private static final long serialVersionUID = 4735350615108906608L;
- @Out(required=false)
- private User selectedUser;
-
@In(required=false) @Out(required=false)
private Image selectedImage;
@In(required=false) @Out(required=false)
private Album selectedAlbum;
- @In(create=true)
- private IAlbumAction albumAction;
-
@In(required=false) @Out(required=false)
- private SelectedImageIndex selectedImageIndex;
+ private SelectionHelper selectionHelper;
@In(required=false)
ComboboxHelper comboboxHelper;
public void chooseAlbum(User friend){
- selectedUser = friend;
selectedAlbum = friend.getAlbumByName(comboboxHelper.getAlbumName());
selectedImage = selectedAlbum.getImages().get(0);
- selectedImageIndex.setSelectedImageIndex(1);
+ selectionHelper.setSelectedImageIndex(1);
+ selectionHelper.setUserAlbumSelected(false);
}
public void chooseAlbum(Album album){
- selectedUser = album.getOwner();
selectedAlbum = album;
selectedImage = selectedAlbum.getImages().get(0);
- selectedImageIndex.setSelectedImageIndex(1);
+ selectionHelper.setSelectedImageIndex(1);
+ selectionHelper.setUserAlbumSelected(false);
}
}
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageBinder.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageBinder.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageBinder.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,96 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.util;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.component.UIRepeat;
+import org.jboss.seam.annotations.Name;
+import org.richfaces.component.html.HtmlInputText;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.MetaTag;
+
+ at Name(value="imageBinder")
+public class ImageBinder {
+
+ HtmlInputText metaRef;
+ private UIRepeat repeater;
+ private Set<Integer> keys = null;
+
+ /**
+ * @return the keys
+ */
+ public Set<Integer> getKeys() {
+ return keys;
+ }
+
+ /**
+ * @param keys the keys to set
+ */
+ public void setKeys(Set<Integer> keys) {
+ this.keys = keys;
+ }
+
+ public void setRepeater(UIRepeat repeater) {
+ this.repeater = repeater;
+ }
+
+ public UIRepeat getRepeater() {
+ return repeater;
+ }
+
+ public HtmlInputText getMetaRef() {
+ return metaRef;
+ }
+
+ public void setMetaRef(HtmlInputText metaRef) {
+ this.metaRef = metaRef;
+ }
+
+ public String change(Image image){
+
+ Set<Integer> keys = new HashSet<Integer>();
+ int rowKey = getRepeater().getRowIndex();
+ keys.add(rowKey);
+ setKeys(keys);
+ metaRef.processValidators(FacesContext.getCurrentInstance());
+ metaRef.processUpdates(FacesContext.getCurrentInstance());
+ MetaTag metaTag = new MetaTag();
+ metaTag.setTag(metaRef.getValue().toString());
+ metaTag.setParent(image);
+ image.getMeta().add(metaTag);
+ return null;
+ }
+
+ public void addTag(Image image){
+ MetaTag metaTag = new MetaTag();
+ metaTag.setTag("");
+ metaTag.setParent(image);
+ image.getMeta().add(metaTag);
+ }
+
+ public void removeTag(MetaTag tag, Image image){
+ image.getMeta().remove(tag);
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageBinder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,79 +0,0 @@
-package org.richfaces.realworld.util;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.component.UIRepeat;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.Name;
-import org.richfaces.component.html.HtmlInputText;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.MetaTag;
-
- at Name(value="imageHelper")
-public class ImageHelper {
-
- HtmlInputText metaRef;
- private UIRepeat repeater;
- private Set<Integer> keys = null;
-
- /**
- * @return the keys
- */
- public Set getKeys() {
- return keys;
- }
-
- /**
- * @param keys the keys to set
- */
- public void setKeys(Set keys) {
- this.keys = keys;
- }
-
- public void setRepeater(UIRepeat repeater) {
- this.repeater = repeater;
- }
-
- public UIRepeat getRepeater() {
- return repeater;
- }
-
- public HtmlInputText getMetaRef() {
- return metaRef;
- }
-
- public void setMetaRef(HtmlInputText metaRef) {
- this.metaRef = metaRef;
- }
-
- public String change(Image image){
-
- HashSet keys = new HashSet<Integer>();
- int rowKey = getRepeater().getRowIndex();
- keys.add(rowKey);
- setKeys(keys);
- metaRef.processValidators(FacesContext.getCurrentInstance());
- metaRef.processUpdates(FacesContext.getCurrentInstance());
- MetaTag metaTag = new MetaTag();
- metaTag.setTag(metaRef.getValue().toString());
- metaTag.setParent(image);
- image.getMeta().add(metaTag);
- return null;
- }
-
- public void addTag(Image image){
- MetaTag metaTag = new MetaTag();
- metaTag.setTag("");
- metaTag.setParent(image);
- image.getMeta().add(metaTag);
- //image.getMeta().add("");
- }
-
- public void removeTag(MetaTag tag, Image image){
- image.getMeta().remove(tag);
- //image.getMeta().remove(tag);
- }
-}
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,157 +0,0 @@
-package org.richfaces.realworld.util;
-
-import java.awt.image.BufferedImage;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-
-import javax.imageio.ImageIO;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.fileupload.FileManager;
-
- at Name("imageLoader")
- at Scope(ScopeType.CONVERSATION)
-public class ImageLoader implements Serializable{
-
- @In(create=true)
- FileManager fileManager;
-
- public synchronized void paintSearchImage(OutputStream stream, Object object) throws IOException {
- Image painted = (Image)object;
-
- File image = fileManager.getImage(painted.getAlbum().getOwner().getLogin() + fileManager.getFileSeparator() + painted.getAlbum().getName()+ fileManager.getFileSeparator() + painted.getPath());
- InputStream paintData = null;
- byte[] data = new byte[(int)image.length() - 1];
- FileInputStream fileInputStream = null;
- BufferedInputStream bufferedInputStream = null;
- if (image != null) {
- try {
- fileInputStream = new FileInputStream(image);
- bufferedInputStream = new BufferedInputStream(fileInputStream);
- paintData = bufferedInputStream;
- paintData.read(data);
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }finally{
- try {
- fileInputStream.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- bufferedInputStream.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- paintData.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- stream.write(data);
- }
-
- public synchronized void paint(OutputStream out, Object data) throws IOException{
- if (null == data) {
- return;
- }
- Image image = (Image)data;
- File imageResource = fileManager.getImage(image.getAlbum().getOwner().getLogin() + fileManager.getFileSeparator() + image.getAlbum().getName() + fileManager.getFileSeparator() + image.getPath());
- if (imageResource != null) {
- FileInputStream fileInputStream = new FileInputStream(imageResource);
- BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
- InputStream paintData = bufferedInputStream;
- if (null == paintData) {
- // throw new Exception("");
- // TODO
- }
- try{
- BufferedImage images = ImageIO.read(paintData);
- ImageIO.write(images, "jpeg", out);
- }catch(Exception e){
-
- }finally{
- fileInputStream.close();
- bufferedInputStream.close();
- paintData.close();
- }
- }
- }
-
- public synchronized void paintAvatar(OutputStream out, Object data) throws IOException{
- if (null == data) {
- return;
- }
- User user = (User)data;
- File imageResource = fileManager.getImage(user.getLogin() + fileManager.getFileSeparator() + "avatars" + fileManager.getFileSeparator() + user.getAvatarPath());
- if (imageResource != null) {
- FileInputStream fileInputStream = new FileInputStream(imageResource);
- BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
- InputStream paintData = bufferedInputStream;
- if (null == paintData) {
- // throw new Exception("");
- // TODO
- }
- try{
- BufferedImage image = ImageIO.read(paintData);
- ImageIO.write(image, "jpeg", out);
- }catch(Exception e){
-
- }finally{
- fileInputStream.close();
- bufferedInputStream.close();
- paintData.close();
- }
- }
- }
-
- public synchronized void paintFriendAvatar(OutputStream out, Object data) throws IOException{
- if (null == data) {
- return;
- }
- String temp = data.toString();
- String[] array = temp.split(":");
- File imageResource = fileManager.getImage(array[0] + fileManager.getFileSeparator() + "avatars" + fileManager.getFileSeparator() + array[1]);
- if (imageResource != null) {
- FileInputStream fileInputStream = new FileInputStream(imageResource);
- BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
- InputStream paintData = bufferedInputStream;
- if (null == paintData) {
- // throw new Exception("");
- // TODO
- }
- try{
- BufferedImage image = ImageIO.read(paintData);
- ImageIO.write(image, "jpeg", out);
- }catch(Exception e){
-
- }finally{
- fileInputStream.close();
- bufferedInputStream.close();
- paintData.close();
- }
- }
- }
-}
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImagePopupHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImagePopupHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImagePopupHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,41 @@
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import javax.faces.event.ActionEvent;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.MetaTag;
+import org.richfaces.realworld.tree.TreeActionManager;
+
+ at Name("imagePopupHelper")
+ at Scope(ScopeType.CONVERSATION)
+public class ImagePopupHelper implements Serializable{
+
+ private static final long serialVersionUID = 2561824019376412988L;
+
+ @In(create=true, required=true) @Out
+ private Image image;
+
+ @In(create=true, required=true)
+ private TreeActionManager treeActionManager;
+
+ public void initImagePopup(Image image){
+ if(null != image){
+ this.image = image;
+ image.setMeta(new ArrayList<MetaTag>(image.getTags()));
+ }else{
+ this.image = new Image();
+ }
+ }
+
+ public void editImage(ActionEvent event){
+ treeActionManager.editImage(this.image);
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImagePopupHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/MessagePanelHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/MessagePanelHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/MessagePanelHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,163 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+
+import javax.faces.event.ActionEvent;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Comment;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.Message;
+import org.richfaces.realworld.domain.MetaTag;
+import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.tree.TreeActionManager;
+
+ at Name("modalPanelHelper")
+ at Scope(ScopeType.CONVERSATION)
+public class MessagePanelHelper implements Serializable{
+
+ private static final long serialVersionUID = 2561824019376412988L;
+
+ private String caption;
+
+ private String actionName;
+
+ private boolean sendRequired;
+
+ private boolean searchRequired = false;
+
+ @In
+ private User user;
+
+ @Out(required=false)
+ private Message message;
+
+ @In(create=true, required=true)
+ private TreeActionManager treeActionManager;
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public void setCaption(String caption) {
+ this.caption = caption;
+ }
+
+ public String getActionName() {
+ return actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public void initModalPanelData( String actionName, boolean sendRequired, Message message){
+ this.actionName = actionName;
+ this.sendRequired = sendRequired;
+ this.message = new Message();
+ this.message.setTheme("Re:" + message.getTheme());
+ this.message.setAuthor(user);
+ this.message.setOwner(message.getAuthor());
+ this.message.setReaded(false);
+ this.searchRequired = false;
+ }
+
+ public void initMessage( String actionName, boolean sendRequired, Message message, boolean userSearchRequired){
+ this.actionName = actionName;
+ this.sendRequired = sendRequired;
+ this.searchRequired = userSearchRequired;
+ this.message = new Message();
+ this.message.setAuthor(user);
+ this.message.setReaded(false);
+ }
+
+ public void initMessage(boolean sendRequired, Message message){
+ this.sendRequired = sendRequired;
+ this.message = message;
+ this.message.setReaded(true);
+ this.searchRequired = false;
+ }
+
+ public void initModalPanelData( String actionName, boolean sendRequired, User owner){
+ this.actionName = actionName;
+ this.sendRequired = sendRequired;
+ this.message = new Message();
+ this.message.setAuthor(user);
+ this.message.setOwner(owner);
+ this.message.setReaded(false);
+ this.searchRequired = false;
+ }
+
+ public void initModalPanelData( String actionName, boolean sendRequired, User owner, String theme, String message){
+ this.actionName = actionName;
+ this.sendRequired = sendRequired;
+ this.message = new Message();
+ this.message.setAuthor(user);
+ this.message.setOwner(owner);
+ this.message.setReaded(false);
+ this.message.setTheme(theme);
+ this.message.setMessage(message);
+ this.searchRequired = false;
+ }
+
+ public void initModalPanelData( String actionName, boolean sendRequired, User owner, String theme, String message, boolean friendshipRequest){
+ this.actionName = actionName;
+ this.sendRequired = sendRequired;
+ this.message = new Message();
+ this.message.setAuthor(user);
+ this.message.setOwner(owner);
+ this.message.setReaded(false);
+ this.message.setTheme(theme);
+ this.message.setMessage(message);
+ this.message.setFriendshipRequest(friendshipRequest);
+ this.searchRequired = false;
+ }
+
+ public void sendMessage(ActionEvent event){
+ this.message.setDate(new Date());
+ treeActionManager.sendMessage(this.message);
+ }
+
+ public boolean isSendRequired() {
+ return sendRequired;
+ }
+
+ public void setSendRequired(boolean sendRequired) {
+ this.sendRequired = sendRequired;
+ }
+
+ public boolean isSearchRequired() {
+ return searchRequired;
+ }
+
+ public void setSearchRequired(boolean searchRequired) {
+ this.searchRequired = searchRequired;
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/MessagePanelHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ModalPanelHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ModalPanelHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ModalPanelHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,214 +0,0 @@
-package org.richfaces.realworld.util;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-
-import javax.faces.event.ActionEvent;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.End;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Comment;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.Message;
-import org.richfaces.realworld.domain.MetaTag;
-import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.tree.TreeActionManager;
-
- at Name("modalPanelHelper")
- at Scope(ScopeType.CONVERSATION)
-public class ModalPanelHelper implements Serializable{
-
- private String caption;
-
- private String actionName;
-
- private boolean sendRequired;
-
- private boolean searchRequired = false;
-
- @In
- private User user;
-
- @Out(required=false)
- private Message message;
-
- @In(create=true, required=true) @Out
- private Album album;
-
- @In(create=true, required=true) @Out
- private Image image;
-
- @In(create=true, required=true)
- private TreeActionManager treeActionManager;
-
- @In(create=true, required=true) @Out
- private Comment comment;
-
- public String getCaption() {
- return caption;
- }
-
- public void setCaption(String caption) {
- this.caption = caption;
- }
-
- public String getActionName() {
- return actionName;
- }
-
- public void setActionName(String actionName) {
- this.actionName = actionName;
- }
-
- public void initModalPanelData( String actionName, String caption, Album album){
- this.caption = caption;
- this.actionName = actionName;
- if(null != album){
- this.album = album;
- }else{
- this.album = new Album();
- }
- }
-
- public void initModalPanelData( String actionName, String caption, Image image){
- this.caption = caption;
- this.actionName = actionName;
- if(null != image){
- this.image = image;
- image.setMeta(new ArrayList<MetaTag>(image.getTags()));
- }else{
- this.image = new Image();
- }
- }
-
- public void initModalPanelData( String actionName, boolean sendRequired, Message message){
- this.actionName = actionName;
- this.sendRequired = sendRequired;
- this.message = new Message();
- this.message.setTheme("Re:" + message.getTheme());
- this.message.setAuthor(user);
- this.message.setOwner(message.getAuthor());
- this.message.setReaded(false);
- this.searchRequired = false;
- }
-
- public void initMessage( String actionName, boolean sendRequired, Message message, boolean userSearchRequired){
- this.actionName = actionName;
- this.sendRequired = sendRequired;
- this.searchRequired = userSearchRequired;
- this.message = new Message();
- this.message.setAuthor(user);
- this.message.setReaded(false);
- }
-
- public void initMessage(boolean sendRequired, Message message){
- this.sendRequired = sendRequired;
- this.message = message;
- this.message.setReaded(true);
- this.searchRequired = false;
- }
-
- public void initModalPanelData( String actionName, boolean sendRequired, User owner){
- this.actionName = actionName;
- this.sendRequired = sendRequired;
- this.message = new Message();
- this.message.setAuthor(user);
- this.message.setOwner(owner);
- this.message.setReaded(false);
- this.searchRequired = false;
- }
-
- public void initModalPanelData( String actionName, boolean sendRequired, User owner, String theme, String message){
- this.actionName = actionName;
- this.sendRequired = sendRequired;
- this.message = new Message();
- this.message.setAuthor(user);
- this.message.setOwner(owner);
- this.message.setReaded(false);
- this.message.setTheme(theme);
- this.message.setMessage(message);
- this.searchRequired = false;
- }
-
- public void initModalPanelData( String actionName, boolean sendRequired, User owner, String theme, String message, boolean friendshipRequest){
- this.actionName = actionName;
- this.sendRequired = sendRequired;
- this.message = new Message();
- this.message.setAuthor(user);
- this.message.setOwner(owner);
- this.message.setReaded(false);
- this.message.setTheme(theme);
- this.message.setMessage(message);
- this.message.setFriendshipRequest(friendshipRequest);
- this.searchRequired = false;
- }
-
- public void initModalPanelData( String actionName, String caption, Comment comment, Image image){
- this.caption = caption;
- this.actionName = actionName;
- if(null != comment){
- this.comment = comment;
- }else{
- this.comment = new Comment();
- this.comment.setAuthor(user);
- this.comment.setImage(image);
- this.comment.setDate(new Date());
- }
- }
-
- public void addAlbum(ActionEvent event){
- treeActionManager.addAlbum();
- }
-
- public void editAlbum(ActionEvent event){
- treeActionManager.editAlbum(this.album);
- }
-
- public void deleteAlbum(ActionEvent event){
- treeActionManager.deleteAlbum(this.album);
- }
-
- public void deleteImage(ActionEvent event){
- treeActionManager.deleteImage(this.image);
- }
-
- public void editComment(ActionEvent event){
- treeActionManager.editComment(this.comment);
- }
-
- public void addComment(ActionEvent event){
- treeActionManager.addComment(this.comment);
- }
-
- public void editImage(ActionEvent event){
- treeActionManager.editImage(this.image);
- }
-
- public void sendMessage(ActionEvent event){
- this.message.setDate(new Date());
- treeActionManager.sendMessage(this.message);
- }
-
- public boolean isSendRequired() {
- return sendRequired;
- }
-
- public void setSendRequired(boolean sendRequired) {
- this.sendRequired = sendRequired;
- }
-
- public boolean isSearchRequired() {
- return searchRequired;
- }
-
- public void setSearchRequired(boolean searchRequired) {
- this.searchRequired = searchRequired;
- }
-}
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationEnum.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,7 +0,0 @@
-package org.richfaces.realworld.util;
-
-public enum NavigationEnum {
- IMAGE_PREVIEW,
- FILE_UPLOAD,
- USER_PREFS, SEARCH, READ_MESSAGES,
-}
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/NavigationHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,34 +0,0 @@
-package org.richfaces.realworld.util;
-
-import java.io.Serializable;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-
- at Name(value="navigationHelper")
- at Scope(ScopeType.CONVERSATION)
-public class NavigationHelper implements Serializable{
-
- private NavigationEnum navigationEnum;
-
- public NavigationEnum getNavigationEnumUserPrefs(){
- return NavigationEnum.USER_PREFS;
- }
-
- public NavigationEnum getNavigationEnumSearch(){
- return NavigationEnum.SEARCH;
- }
-
- public NavigationEnum getNavigationEnumReadMessages(){
- return NavigationEnum.READ_MESSAGES;
- }
-
- public NavigationEnum getNavigationEnumImagePreview(){
- return NavigationEnum.IMAGE_PREVIEW;
- }
-
- public NavigationEnum getNavigationEnumFileUpload(){
- return NavigationEnum.FILE_UPLOAD;
- }
-}
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingBinder.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingBinder.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingBinder.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,41 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+
+import org.jboss.seam.annotations.Name;
+import org.richfaces.component.UIInputNumberSlider;
+
+ at Name("ratingBinder")
+public class RatingBinder implements Serializable{
+
+ private static final long serialVersionUID = -7714638502390978362L;
+ private UIInputNumberSlider inputSlider;
+
+ public UIInputNumberSlider getInputSlider() {
+ return inputSlider;
+ }
+
+ public void setInputSlider(UIInputNumberSlider inputSlider) {
+ this.inputSlider = inputSlider;
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingBinder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,24 +0,0 @@
-package org.richfaces.realworld.util;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.component.UIInputNumberSlider;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.service.IImageAction;
-
- at Name("ratingHelper")
-public class RatingHelper {
-
- private UIInputNumberSlider inputSlider;
-
- public UIInputNumberSlider getInputSlider() {
- return inputSlider;
- }
-
- public void setInputSlider(UIInputNumberSlider inputSlider) {
- this.inputSlider = inputSlider;
- }
-}
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectedImageIndex.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectedImageIndex.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectedImageIndex.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,22 +0,0 @@
-package org.richfaces.realworld.util;
-
-import java.io.Serializable;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-
- at Name("selectedImageIndex")
- at Scope(ScopeType.CONVERSATION)
-public class SelectedImageIndex implements Serializable{
-
- private Integer selectedImageIndex = 1;
-
- public Integer getSelectedImageIndex() {
- return selectedImageIndex;
- }
-
- public void setSelectedImageIndex(Integer selectedImageIndex) {
- this.selectedImageIndex = selectedImageIndex;
- }
-}
Added: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectionHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectionHelper.java (rev 0)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectionHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+ at Name("selectionHelper")
+ at Scope(ScopeType.CONVERSATION)
+public class SelectionHelper implements Serializable{
+
+ private static final long serialVersionUID = 5656562187249324512L;
+ private Integer selectedImageIndex = 1;
+
+ private boolean userAlbumSelected = true;
+
+ public boolean isUserAlbumSelected() {
+ return userAlbumSelected;
+ }
+
+ public void setUserAlbumSelected(boolean userAlbumSelected) {
+ this.userAlbumSelected = userAlbumSelected;
+ }
+
+ public Integer getSelectedImageIndex() {
+ return selectedImageIndex;
+ }
+
+ public void setSelectedImageIndex(Integer selectedImageIndex) {
+ this.selectedImageIndex = selectedImageIndex;
+ }
+}
Property changes on: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SelectionHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java
===================================================================
--- trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/SlideshowHelper.java 2008-12-20 15:58:34 UTC (rev 11950)
@@ -1,25 +0,0 @@
-package org.richfaces.realworld.util;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.component.UIInputNumberSlider;
-
- at Name("slideshowHelper")
- at Scope(ScopeType.EVENT)
-public class SlideshowHelper {
-
- private UIInputNumberSlider inputSlider;
-
- public UIInputNumberSlider getInputSlider() {
- return inputSlider;
- }
-
- public void setInputSlider(UIInputNumberSlider inputSlider) {
- this.inputSlider = inputSlider;
- }
-
-
-}
Modified: trunk/test-applications/realworld/web/src/main/resources/messages_en.properties
===================================================================
--- trunk/test-applications/realworld/web/src/main/resources/messages_en.properties 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/resources/messages_en.properties 2008-12-20 15:58:34 UTC (rev 11950)
@@ -91,6 +91,7 @@
error=Error
errorStub=Something bad happened :-(
fileUpload.header=You will upload files in album: #{selectedAlbum.name}. If you want upload in another album, select it.
+fileUpload.header2=Choose album:
fileUpload.uploadedPanelHeader=Uploaded Files Info
fileUpload.fileNameLabel=File Name:
fileUpload.fileLengthLabel=File Length(bytes):
@@ -100,4 +101,4 @@
fileUpload.clearLabel=Clear Uploaded Data
fileUpload.clearSelectedLabel=Clear Selected
-image.panelHeader=Image Preview: Selected Album: #{selectedAlbum.name}
\ No newline at end of file
+image.panelHeader=Image Preview\: Selected Album\: \#{selectedAlbum.name}
\ No newline at end of file
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/addComment.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/albumModalPanel.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/confirmation.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/imagePrefs.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/message.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/web.xml 2008-12-20 15:50:44 UTC (rev 11949)
+++ trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/web.xml 2008-12-20 15:58:34 UTC (rev 11950)
@@ -78,7 +78,7 @@
<context-param>
<param-name>uploadRoot</param-name>
- <param-value>E:\Andrey\Upload\</param-value>
+ <param-value>E:\richfaces\test-applications\realworld\Upload\</param-value>
</context-param>
Modified: trunk/test-applications/realworld/web/src/main/webapp/fileUpload.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/imagePreview.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/readMessages.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/tree.xhtml
===================================================================
(Binary files differ)
More information about the richfaces-svn-commits
mailing list