Author: amarkhel
Date: 2008-12-05 10:38:09 -0500 (Fri, 05 Dec 2008)
New Revision: 11584
Added:
trunk/test-applications/realworld/ear/src/main/jboss-app.xml
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/service/ISearchService.java
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/
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/util/RatingHelper.java
trunk/test-applications/realworld/web/src/main/webapp/img/Thumbs.db
trunk/test-applications/realworld/web/src/main/webapp/layout/menuShared.xhtml
trunk/test-applications/realworld/web/src/main/webapp/sharedAlbum.xhtml
Removed:
trunk/test-applications/realworld/ear/src/main/application/jboss-app.xml
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTest.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTestTest.java
Modified:
trunk/test-applications/realworld/ear/pom.xml
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/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/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/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/UserAction.java
trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml
trunk/test-applications/realworld/ejb/src/main/resources/import.sql
trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml
trunk/test-applications/realworld/pom.xml
trunk/test-applications/realworld/web/META-INF/MANIFEST.MF
trunk/test-applications/realworld/web/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/FileUploadBean.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/tree/TreeActionManager.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/ModalPanelHelper.java
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/components.xml
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/message.xhtml
trunk/test-applications/realworld/web/src/main/webapp/imagePreview.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld/web/src/main/webapp/main.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/register.xhtml
trunk/test-applications/realworld/web/src/main/webapp/search.xhtml
Log:
Modified: trunk/test-applications/realworld/ear/pom.xml
===================================================================
--- trunk/test-applications/realworld/ear/pom.xml 2008-12-05 15:26:04 UTC (rev 11583)
+++ trunk/test-applications/realworld/ear/pom.xml 2008-12-05 15:38:09 UTC (rev 11584)
@@ -28,6 +28,7 @@
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
+
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
Deleted: trunk/test-applications/realworld/ear/src/main/application/jboss-app.xml
===================================================================
--- trunk/test-applications/realworld/ear/src/main/application/jboss-app.xml 2008-12-05
15:26:04 UTC (rev 11583)
+++ trunk/test-applications/realworld/ear/src/main/application/jboss-app.xml 2008-12-05
15:38:09 UTC (rev 11584)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE jboss-app
- PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
-
-<jboss-app>
- <loader-repository>
- seam.jboss.org:loader=realworld-ear-1.0-SNAPSHOT.ear
- </loader-repository>
-</jboss-app>
\ No newline at end of file
Added: trunk/test-applications/realworld/ear/src/main/jboss-app.xml
===================================================================
--- trunk/test-applications/realworld/ear/src/main/jboss-app.xml
(rev 0)
+++ trunk/test-applications/realworld/ear/src/main/jboss-app.xml 2008-12-05 15:38:09 UTC
(rev 11584)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE jboss-app
+ PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
+
+<jboss-app>
+ <loader-repository>
+ seam.jboss.org:loader=realworld-ear-1.0-SNAPSHOT.ear
+ </loader-repository>
+</jboss-app>
\ No newline at end of file
Property changes on: trunk/test-applications/realworld/ear/src/main/jboss-app.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -0,0 +1,56 @@
+package org.richfaces.realworld.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+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
+@Name("friendshipRequest")
+@Table(name = "friendship_requests")
+public class FriendshipRequest {
+
+ @Id
+ @GeneratedValue
+ @Column(name = "REQUEST_ID")
+ private Long id;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "USER_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERSFRIEND_ID")
+ private User user;
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "FRIEND_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERSFRIEND2_ID")
+ private User friend;
+
+ public User getUser() {
+ return user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ public User getFriend() {
+ return friend;
+ }
+
+ public void setFriend(User friend) {
+ this.friend = friend;
+ }
+
+ public Long getId() {
+ return id;
+ }
+}
Property changes on:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/FriendshipRequest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -8,9 +8,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;
@@ -18,7 +16,6 @@
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -13,6 +13,7 @@
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import javax.persistence.Transient;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;
@@ -36,6 +37,11 @@
private boolean readed;
+ private boolean friendshipRequest;
+
+ @Transient
+ private String ownerLogin;
+
@Column(length = 256, nullable = false)
@NotNull
@NotEmpty
@@ -110,4 +116,20 @@
this.theme = theme;
}
+ public boolean isFriendshipRequest() {
+ return friendshipRequest;
+ }
+
+ public void setFriendshipRequest(boolean friendshipRequest) {
+ this.friendshipRequest = friendshipRequest;
+ }
+
+ public String getOwnerLogin() {
+ return ownerLogin;
+ }
+
+ public void setOwnerLogin(String ownerLogin) {
+ this.ownerLogin = ownerLogin;
+ }
+
}
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -9,14 +9,11 @@
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
-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("metaTag")
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -120,7 +120,9 @@
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@org.hibernate.annotations.OrderBy(clause = "Date desc")
private List<Message> messages = new ArrayList<Message>();
- //private Address address;
+
+ @OneToMany(mappedBy = "user", cascade = { CascadeType.ALL }, fetch =
FetchType.LAZY)
+ private List<FriendshipRequest> friendshipRequests = new
ArrayList<FriendshipRequest>();
/**
* No-arg constructor for JavaBean tools
@@ -284,4 +286,37 @@
public void setMessages(List<Message> messages) {
this.messages = messages;
}
+
+ public List<FriendshipRequest> getFriendshipRequests() {
+ return friendshipRequests;
+ }
+
+ public void setFriendshipRequests(List<FriendshipRequest> friendshipRequests) {
+ this.friendshipRequests = friendshipRequests;
+ }
+
+ public void addFriendshipRequest(User owner) {
+ FriendshipRequest request = new FriendshipRequest();
+ request.setUser(this);
+ request.setFriend(owner);
+ this.friendshipRequests.add(request);
+ }
+
+ public void removeFriendshipRequest(FriendshipRequest request) {
+ this.friendshipRequests.remove(request);
+ }
+
+ public void addFriend(User friend) {
+ this.friends.add(friend);
+ }
+
+ public FriendshipRequest getFriendshipRequest(User friend, User user) {
+ for(FriendshipRequest req: this.friendshipRequests){
+ if(req.getUser().getLogin().equals(user.getLogin()) &&
req.getFriend().getLogin().equals(friend.getLogin())){
+ return req;
+ }
+ }
+ return null;
+ }
+
}
\ No newline at end of file
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -16,7 +16,8 @@
@Stateful
@Name("albumAction")
public class AlbumAction implements IAlbumAction {
- @PersistenceContext(unitName = "realworld",
type=PersistenceContextType.EXTENDED)
+ //@PersistenceContext(unitName = "entityManager",
type=PersistenceContextType.EXTENDED)
+ @In(value="entityManager")
EntityManager em;
@In @Out
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -33,4 +33,6 @@
public abstract void editComment(Comment comment);
+ public abstract void vote(Image image, Long value);
+
}
\ No newline at end of file
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IMessageAction.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -1,11 +1,13 @@
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
public interface IMessageAction {
public abstract void sendMessage(Message message);
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -0,0 +1,24 @@
+package org.richfaces.realworld.service;
+
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.ejb.Remove;
+
+import org.jboss.seam.annotations.Destroy;
+import org.richfaces.realworld.domain.Image;
+@Local
+public interface ISearchService {
+
+ public abstract List<Image> searchImages(String searchPattern);
+
+ public List<Image> popularImages();
+
+ public List<Image> worstImages();
+
+ @Remove
+ public void remove();
+
+ @Destroy
+ public void destroy();
+}
\ No newline at end of file
Property changes on:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ISearchService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -8,6 +8,7 @@
import javax.ejb.Remove;
import org.jboss.seam.annotations.Destroy;
+import org.richfaces.realworld.domain.FriendshipRequest;
import org.richfaces.realworld.domain.User;
@Local
@@ -24,7 +25,9 @@
public void updateUser(User user);
public void resetUser(User user);
- public List<User> getUsers(String suggest);
+ public List<String> getUsers(String suggest);
public long countNotReadedMessages(User user);
public void removeFromFriends(User owner, User removed);
+ public boolean friendExist(User user, User friend);
+ public void addFriend(User user, User friend, FriendshipRequest request);
}
\ No newline at end of file
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -15,10 +15,10 @@
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
-@Stateful
@Name("imageAction")
public class ImageAction implements IImageAction {
- @PersistenceContext(unitName = "realworld",
type=PersistenceContextType.EXTENDED)
+ //@PersistenceContext(unitName = "entityManager",
type=PersistenceContextType.EXTENDED)
+ @In(value="entityManager")
EntityManager em;
/* (non-Javadoc)
@@ -83,4 +83,15 @@
em.merge(comment);
em.flush();
}
+
+ public void vote(Image image, Long value) {
+ image = em.merge(image);
+ Long total = image.getRank().getTotal();
+ Long votes = image.getRank().getHits();
+ total += value;
+ votes++;
+ image.getRank().setHits(votes);
+ image.getRank().setTotal(total);
+ em.flush();
+ }
}
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/MessageAction.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -7,20 +7,32 @@
import javax.persistence.PersistenceContextType;
import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.Message;
+import org.richfaces.realworld.domain.User;
-@Stateful
@Name("messageAction")
public class MessageAction implements IMessageAction {
- @PersistenceContext(unitName = "realworld",
type=PersistenceContextType.EXTENDED)
+ //@PersistenceContext(unitName = "entityManager",
type=PersistenceContextType.EXTENDED)
+ @In(value="entityManager")
EntityManager em;
/* (non-Javadoc)
* @see
org.richfaces.realworld.service.IMessageAction#sendMessage(org.richfaces.realworld.domain.Message)
*/
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())
+ .getSingleResult();
+ message.setOwner(user);
+ message.setOwnerLogin(null);
+ }
+ if(message.isFriendshipRequest()){
+ message.getAuthor().addFriendshipRequest(message.getOwner());
+ }
em.persist(message);
em.flush();
}
@@ -30,8 +42,8 @@
*/
public void deleteMessage(Message message){
message = em.merge(message);
+ em.remove(message);
message.getOwner().removeMessage(message);
- em.remove(message);
em.flush();
}
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -0,0 +1,66 @@
+package org.richfaces.realworld.service;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+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")
+public class SearchService implements ISearchService, Serializable
+ {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2750591521413940277L;
+ //@PersistenceContext(unitName = "entityManager",
type=PersistenceContextType.EXTENDED)
+ @In(value="entityManager")
+ EntityManager em;
+
+ /* (non-Javadoc)
+ * @see org.richfaces.realworld.service.ISearchService#searchImages(java.lang.String)
+ */
+ @Begin(join=true)
+ public List<Image> searchImages(String searchPattern){
+ List<Image> images = em.createQuery("select i from MetaTag t join t.parent i
where t.tag like:metatag and i.album.shared=true order by i.rank.total/i.rank.hits
desc").setParameter("metatag",
searchPattern+"%").getResultList();
+ return images;
+ }
+
+ @Begin(join=true)
+ public List<Image> popularImages(){
+ List<Image> images = em.createQuery("select i from Image i join i.rank r
where i.album.shared=true order by r.total/r.hits
desc").setMaxResults(10).getResultList();
+ return images;
+ }
+
+ @Begin(join=true)
+ public List<Image> worstImages(){
+ List<Image> images = em.createQuery("select i from Image i join i.rank r
where i.album.shared=true order by r.total/r.hits
asc").setMaxResults(10).getResultList();
+ 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(){
+
+ }
+}
Property changes on:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/SearchService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -21,14 +21,15 @@
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;
-@Stateful
@Name("userAction")
public class UserAction implements IUserAction {
- @PersistenceContext(unitName = "realworld",
type=PersistenceContextType.EXTENDED)
+ //@PersistenceContext(unitName = "entityManager",
type=PersistenceContextType.EXTENDED)
+ @In(value="entityManager")
EntityManager em;
@In(create = true, required = true) @Out
@@ -39,7 +40,6 @@
.setParameter("username", username)
.setParameter("password", password)
.getSingleResult();
- long result = countNotReadedMessages(user);
return user != null;
}
@@ -81,8 +81,8 @@
return true;
}
- public List<User> getUsers(String suggest) {
- List<User> users = em.createQuery("from User u where u.login like
:login").setParameter("login", suggest +
"%").setMaxResults(10).getResultList();
+ 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();
return users;
}
@@ -93,6 +93,17 @@
public void removeFromFriends(User owner, User removed) {
owner.removeFriend(removed);
- em.flush();
+ removed.removeFriend(owner);
}
+
+ 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();
+ return result > 0;
+ }
+
+ public void addFriend(User user, User friend, FriendshipRequest request) {
+ friend.removeFriendshipRequest(request);
+ user.addFriend(friend);
+ friend.addFriend(user);
+ }
}
\ No newline at end of file
Modified:
trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml
===================================================================
---
trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml 2008-12-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml 2008-12-05
15:38:09 UTC (rev 11584)
@@ -5,21 +5,23 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
- <persistence-unit name="realworld">
+ <persistence-unit name="entityManager">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/realWorldDatasource</jta-data-source>
- <!--<properties>
+ <properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
- </properties>-->
- <properties>
+ <property name="jboss.entity.manager.factory.jndi.name"
+ value="java:/realWorldEntityManager"/>
+ </properties>
+ <!--<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
- </properties>
+ </properties>-->
</persistence-unit>
</persistence>
Modified: trunk/test-applications/realworld/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-12-05
15:26:04 UTC (rev 11583)
+++ trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-12-05
15:38:09 UTC (rev 11584)
@@ -9,25 +9,25 @@
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id)
VALUES (6, 0, 'Album 3', 'Simple Album 3', false, 2);
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id)
VALUES (7, 0, 'Album 1', 'Simple Album', true, 3);
INSERT INTO Ranks(rank_id, total, hits) VALUES (1, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (2, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (3, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (2, 200, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (3, 100, 31);
INSERT INTO Ranks(rank_id, total, hits) VALUES (4, 100, 21);
INSERT INTO Ranks(rank_id, total, hits) VALUES (5, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (6, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (7, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (8, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (6, 100, 41);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (7, 100, 20);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (8, 55, 11);
INSERT INTO Ranks(rank_id, total, hits) VALUES (9, 100, 21);
INSERT INTO Ranks(rank_id, total, hits) VALUES (10, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (11, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (12, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (13, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (14, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (15, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (16, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (17, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (11, 100, 25);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (12, 110, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (13, 100, 19);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (14, 101, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (15, 102, 17);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (16, 103, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (17, 104, 15);
INSERT INTO Ranks(rank_id, total, hits) VALUES (18, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (19, 100, 21);
-INSERT INTO Ranks(rank_id, total, hits) VALUES (20, 100, 21);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (19, 110, 13);
+INSERT INTO Ranks(rank_id, total, hits) VALUES (20, 160, 21);
INSERT INTO Ranks(rank_id, total, hits) VALUES (21, 100, 21);
INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (1, 0, 'Picture 1', 'pic1.jpg', 'Just
picture', true, '1985-01-08', 1, 1);
INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (2, 0, 'Picture 2', 'pic2.jpg', 'Just
picture', true, '1985-01-08', 1, 2);
@@ -52,28 +52,30 @@
INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (21, 0, 'Picture 33', 'pic3.jpg', 'Just
picture', true, '1985-01-08', 7, 21);
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, 'Cool', 2);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (3, 'richfaces',
2);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (4, 'Cool', 3);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (5, 'Cool', 4);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (5, 'theCool',
4);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (6, 'Cool', 5);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (7, 'Cool', 6);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (7, 'rich', 6);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (8, 'Cool', 7);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (9, 'Cool', 8);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (9, 'New year',
8);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (10, 'Cool', 9);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (11, 'Cool', 10);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (12, 'Cool', 11);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (12, 'Minsk',
11);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (13, 'Cool', 12);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (14, 'Cool', 13);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (14, 'Minsk',
13);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (15, 'Cool', 14);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (16, 'Cool', 15);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (17, 'Cool', 16);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (17, 'Minsk',
16);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (18, 'Cool', 17);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (19, 'Cool', 18);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (19, 'friend',
18);
INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (20, 'Cool', 19);
-INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (21, 'Cool', 20);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (21, 'Cool2',
20);
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(1, '1985-01-08', 'Hello I am user', 1, 2);
INSERT INTO comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
(2, '1985-01-08', 'Hello I am user2', 1, 3);
-INSERT INTO messages(message_id, date, message, author_id, owner_id, readed, theme)
VALUES (1, '1985-01-08', 'Hello I am user', 2, 1, false, 'Hello,
amarkhel');
+INSERT INTO messages(message_id, date, message, author_id, owner_id, readed, theme,
friendshipRequest) VALUES (1, '1985-01-08', 'Hello I am user', 2, 1,
false, 'Hello, amarkhel', false);
+INSERT INTO messages(message_id, date, message, author_id, owner_id, readed, theme,
friendshipRequest) VALUES (2, '1985-01-08', 'Please, add meto your
friends', 3, 1, false, 'Request for friendship', true);
INSERT INTO shared_albums(album_id, user_id) VALUES(4, 1);
INSERT INTO shared_albums(album_id, user_id) VALUES(7, 1);
-INSERT INTO user_friends(user1_id, user2_id) VALUES(1, 2);
\ No newline at end of file
+INSERT INTO user_friends(user1_id, user2_id) VALUES(1, 2);
+INSERT INTO friendship_requests(REQUEST_ID, USER_ID, FRIEND_ID) VALUES(1, 3, 1);
\ No newline at end of file
Modified: trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml 2008-12-05
15:26:04 UTC (rev 11583)
+++ trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml 2008-12-05
15:38:09 UTC (rev 11584)
@@ -7,14 +7,14 @@
<datasources>
<local-tx-datasource>
<jndi-name>realWorldDatasource</jndi-name>
-
<connection-url>jdbc:postgresql://localhost:5432/realworld</connection-url>
+ <!--
<connection-url>jdbc:postgresql://localhost:5432/realworld</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>realworld</user-name>
- <password>realworld</password>
- <!--<connection-url>jdbc:hsqldb:.</connection-url>
+ <password>realworld</password>-->
+ <connection-url>jdbc:hsqldb:.</connection-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>sa</user-name>
- <password></password>-->
+ <password></password>
</local-tx-datasource>
</datasources>
Modified: trunk/test-applications/realworld/pom.xml
===================================================================
--- trunk/test-applications/realworld/pom.xml 2008-12-05 15:26:04 UTC (rev 11583)
+++ trunk/test-applications/realworld/pom.xml 2008-12-05 15:38:09 UTC (rev 11584)
@@ -9,13 +9,13 @@
<parent>
<groupId>org.jboss.seam</groupId>
<artifactId>root</artifactId>
- <version>2.0.1.GA</version>
+ <version>2.1.0.SP1</version>
</parent>
<properties>
<projectName>realworld</projectName>
<richfacesVersion>3.3.0-SNAPSHOT</richfacesVersion>
- <seamVersion>2.0.1.GA</seamVersion>
+ <seamVersion>2.1.0.SP1</seamVersion>
<
jbossDownloadURL>http://downloads.sourceforge.net/jboss/jboss-4.2.3.GA...
<jbossDeployDir>jboss-4.2.3.GA/jboss-4.2.3.GA/server/default/</jbossDeployDir>
<droolsVersion>4.0.0</droolsVersion>
@@ -39,7 +39,6 @@
<module>ejb</module>
<module>web</module>
</modules>
-
<build>
<plugins>
<plugin>
Modified: trunk/test-applications/realworld/web/META-INF/MANIFEST.MF
===================================================================
--- trunk/test-applications/realworld/web/META-INF/MANIFEST.MF 2008-12-05 15:26:04 UTC
(rev 11583)
+++ trunk/test-applications/realworld/web/META-INF/MANIFEST.MF 2008-12-05 15:38:09 UTC
(rev 11584)
@@ -1,7 +1,8 @@
Manifest-Version: 1.0
Class-Path: avalon-framework-4.1.3.jar commons-beanutils-1.7.0.jar com
- mons-digester-1.8.jar commons-logging-1.1.jar jboss-seam-debug-2.0.1.
- GA.jar jboss-seam-remoting-2.0.1.GA.jar jboss-seam-ui-2.0.1.GA.jar js
- f-facelets-1.1.14.jar log4j-1.2.14.jar logkit-1.0.1.jar richfaces-imp
- l-3.3.0-SNAPSHOT.jar richfaces-ui-3.3.0-SNAPSHOT.jar
+ mons-digester-1.8.jar commons-logging-1.1.jar jboss-seam-debug-2.1.0.
+ SP1.jar jboss-seam-jul-2.1.0.SP1.jar jboss-seam-remoting-2.1.0.SP1.ja
+ r jboss-seam-ui-2.1.0.SP1.jar jsf-facelets-1.1.14.jar log4j-1.2.14.ja
+ r logkit-1.0.1.jar richfaces-impl-3.3.0-SNAPSHOT.jar richfaces-ui-3.3
+ .0-SNAPSHOT.jar
Modified: trunk/test-applications/realworld/web/pom.xml
===================================================================
--- trunk/test-applications/realworld/web/pom.xml 2008-12-05 15:26:04 UTC (rev 11583)
+++ trunk/test-applications/realworld/web/pom.xml 2008-12-05 15:38:09 UTC (rev 11584)
@@ -35,7 +35,7 @@
<version>3.0.0.ga</version>
<scope>provided</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -7,6 +7,7 @@
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;
@@ -20,7 +21,7 @@
@Name("avatarUpload")
@Scope(ScopeType.PAGE)
-public class AvatarUpload {
+public class AvatarUpload implements Serializable{
@In(create=true)
private FileManager fileManager;
Deleted:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTest.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTest.java 2008-12-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTest.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -1,104 +0,0 @@
-package org.richfaces.realworld.fileupload;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-public class FileTest {
-
- private String uploadRoot = "F:/Upload/";
-
- public String getUploadRoot() {
- return uploadRoot;
- }
-
- private String getFileSeparator() {
- return System.getProperty("file.separator");
- }
-
- public boolean isDirectoryPresent(String directory) {
- String fullPath = getAbsolutePath(directory);
- File file = new File(fullPath);
- return file.exists() && file.isDirectory();
- }
-
- public void deleteDirectory(String directory) {
- String fullPath = getAbsolutePath(directory);
- File file = new File(fullPath);
- if(file.exists()){
- for(String f :file.list()){
- File temp = new File(fullPath+getFileSeparator()+f);
- temp.delete();
- }
- file.delete();
- }
- }
-
- public void renameDirectory(String directoryOld, String directoryNew) throws Exception
{
- String fullPath = getAbsolutePath(directoryOld);
- File fileOld = new File(fullPath);
- File fileNew = new File(getUploadRoot() + directoryNew);
- createDirectoryIfNotExist(directoryNew);
- if(fileNew.exists())
- if( fileNew.isDirectory() ){
- throw new Exception("exc");
- }else{
- fileNew.delete();
- }
- fileOld.renameTo(fileNew);
- }
-
- public void addDirectory(String directory) {
- String fullPath = getAbsolutePath(directory);
- File file = new File(fullPath);
- file.mkdirs();
- }
-
- public void addImage(String fileName, byte[] data) throws IOException {
- createDirectoryIfNotExist(fileName);
- FileOutputStream b = new FileOutputStream(getUploadRoot() + fileName);
- b.write(data);
- b.close();
- }
-
- public void deleteImage(String fileName) {
- String fullPath = getAbsolutePath(fileName);
- File file = new File(fullPath);
- if(file.exists()){
- file.delete();
- }
- }
-
- public void renameImage(String fileNameOld, String fileNameNew) {
- createDirectoryIfNotExist(fileNameNew);
- String fullPath = getAbsolutePath(fileNameOld);
- File fileOld = new File(fullPath);
- File fileNew = new File(getAbsolutePath(fileNameNew));
- if(fileNew.exists()){
- fileNew.delete();
- }
- fileOld.renameTo(fileNew);
- }
-
- private void createDirectoryIfNotExist(String fileNameNew) {
- int lastIndexOf = fileNameNew.lastIndexOf(getFileSeparator());
- if(lastIndexOf > 0){
- String directory = fileNameNew.substring(0, lastIndexOf);
- File file = new File(getUploadRoot()+directory);
- if(!file.exists()){
- file.mkdirs();
- }
- }
- }
-
- public boolean isImagePresent(String fileName) {
- String fullPath = getAbsolutePath(fileName);
- File file = new File(fullPath);
- return file.exists() && !file.isDirectory();
- }
-
- private String getAbsolutePath(String fileName) {
- return getUploadRoot() + fileName;
- }
-
-}
Deleted:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTestTest.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTestTest.java 2008-12-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileTestTest.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -1,129 +0,0 @@
-package org.richfaces.realworld.fileupload;
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-public class FileTestTest extends TestCase {
-
- FileTest fileManager = new FileTest();
-
- private byte[] image = new byte[40];
-
- public void testIsDirectoryPresent() {
- fileManager.addDirectory("amarkhel");
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), true);
- assertEquals(fileManager.isDirectoryPresent("amarkhel2"), false);
- fileManager.deleteDirectory("amarkhel");
- }
-
- public void testDeleteDirectory() {
- fileManager.addDirectory("amarkhel");
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), true);
- fileManager.deleteDirectory("amarkhel");
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), false);
- }
-
- public void testRenameDirectory() throws Exception {
- fileManager.addDirectory("amarkhel");
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), true);
- fileManager.renameDirectory("amarkhel", "amarkhel2");
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), false);
- assertEquals(fileManager.isDirectoryPresent("amarkhel2"), true);
- fileManager.deleteDirectory("amarkhel2");
- }
-
- public void testRenameDirectory2(){
- fileManager.addDirectory("amarkhel");
- fileManager.addDirectory("amarkhel2");
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), true);
- try {
- fileManager.renameDirectory("amarkhel", "amarkhel2");
- } catch (Exception e) {
- assertTrue(true);
- }
-
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), true);
- assertEquals(fileManager.isDirectoryPresent("amarkhel2"), true);
- fileManager.deleteDirectory("amarkhel");
- fileManager.deleteDirectory("amarkhel2");
- }
-
- public void testRenameDirectory3() throws Exception {
- fileManager.addDirectory("a"+System.getProperty("file.separator")+"amarkhel");
- assertEquals(fileManager.isDirectoryPresent("a"+System.getProperty("file.separator")+"amarkhel"),
true);
- fileManager.renameDirectory("a"+System.getProperty("file.separator")+"amarkhel",
"b"+System.getProperty("file.separator")+"amarkhel");
- assertEquals(fileManager.isDirectoryPresent("a"+System.getProperty("file.separator")+"amarkhel"),
false);
- assertEquals(fileManager.isDirectoryPresent("b"+System.getProperty("file.separator")+"amarkhel"),
true);
- fileManager.deleteDirectory("b"+System.getProperty("file.separator")+"amarkhel");
- }
-
- public void testRenameDirectory4() throws Exception {
- fileManager.addDirectory("a"+System.getProperty("file.separator")+"a"+System.getProperty("file.separator")+"amarkhel");
- assertEquals(fileManager.isDirectoryPresent("a"+System.getProperty("file.separator")+"a"+System.getProperty("file.separator")+"amarkhel"),
true);
- fileManager.renameDirectory("a"+System.getProperty("file.separator")+"a"+System.getProperty("file.separator")+"amarkhel",
"b"+System.getProperty("file.separator")+"b"+System.getProperty("file.separator")+"amarkhel");
- assertEquals(fileManager.isDirectoryPresent("a"+System.getProperty("file.separator")+"a"+System.getProperty("file.separator")+"amarkhel"),
false);
- assertEquals(fileManager.isDirectoryPresent("b"+System.getProperty("file.separator")+"b"+System.getProperty("file.separator")+"amarkhel"),
true);
- fileManager.deleteDirectory("b"+System.getProperty("file.separator")+"b"+System.getProperty("file.separator")+"amarkhel");
- }
-
- public void testAddDirectory() {
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), false);
- fileManager.addDirectory("amarkhel");
- assertEquals(fileManager.isDirectoryPresent("amarkhel"), true);
- fileManager.deleteDirectory("amarkhel");
- }
-
- public void testAddDirectory2() {
- assertEquals(fileManager.isDirectoryPresent("a"+System.getProperty("file.separator")+"amarkhel"),
false);
- fileManager.addDirectory("a"+System.getProperty("file.separator")+"amarkhel");
- assertEquals(fileManager.isDirectoryPresent("a"+System.getProperty("file.separator")+"amarkhel"),
true);
- fileManager.deleteDirectory("a"+System.getProperty("file.separator")+"amarkhel");
- }
-
- public void testAddImage() throws IOException {
- assertEquals(fileManager.isImagePresent("amarkhel.gif"), false);
- fileManager.addImage("amarkhel.gif", image);
- assertEquals(fileManager.isImagePresent("amarkhel.gif"), true);
- fileManager.deleteImage("amarkhel.gif");
- }
-
- public void testDeleteImage() throws IOException {
- fileManager.addImage("amarkhel.gif", image);
- assertEquals(fileManager.isImagePresent("amarkhel.gif"), true);
- fileManager.deleteImage("amarkhel.gif");
- assertEquals(fileManager.isImagePresent("amarkhel.gif"), false);
- }
-
- public void testRenameImage() throws IOException {
- fileManager.addImage("amarkhel.gif", image);
- assertEquals(fileManager.isImagePresent("amarkhel.gif"), true);
- fileManager.renameImage("amarkhel.gif", "amarkhel2.gif");
- assertEquals(fileManager.isImagePresent("amarkhel.gif"), false);
- assertEquals(fileManager.isImagePresent("amarkhel2.gif"), true);
- fileManager.deleteImage("amarkhel2.gif");
- }
-
- public void testRenameImage2() throws IOException {
- fileManager.addImage("a"+System.getProperty("file.separator")+"amarkhel.gif",
image);
- assertEquals(fileManager.isImagePresent("a"+System.getProperty("file.separator")+"amarkhel.gif"),
true);
- fileManager.renameImage("a"+System.getProperty("file.separator")+"amarkhel.gif",
"b"+System.getProperty("file.separator")+"amarkhel2.gif");
- assertEquals(fileManager.isImagePresent("a"+System.getProperty("file.separator")+"amarkhel.gif"),
false);
- assertEquals(fileManager.isImagePresent("b"+System.getProperty("file.separator")+"amarkhel2.gif"),
true);
- fileManager.deleteImage("b"+System.getProperty("file.separator")+"amarkhel2.gif");
- fileManager.deleteDirectory("b");
- fileManager.deleteDirectory("a");
- }
-
- public void testIsImagePresent() throws IOException {
- fileManager.addImage("amarkhel.gif", image);
- assertEquals(fileManager.isImagePresent("amarkhel.gif"), true);
- assertEquals(fileManager.isImagePresent("amarkhel3.gif"), false);
- fileManager.deleteImage("amarkhel.gif");
- fileManager.addImage("am"+System.getProperty("file.separator")+"amarkhel.gif",
image);
- assertEquals(fileManager.isImagePresent("am"+System.getProperty("file.separator")+"amarkhel.gif"),
true);
- fileManager.deleteImage("am"+System.getProperty("file.separator")+"amarkhel.gif");
- fileManager.deleteDirectory("am");
- }
-
-}
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
@@ -47,7 +48,7 @@
@Name("fileUploadBean")
@Scope(ScopeType.SESSION)
@Synchronized(timeout=2000)
-public class FileUploadBean {
+public class FileUploadBean implements Serializable{
@In @Out
private User user;
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -0,0 +1,182 @@
+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;
+import java.util.List;
+
+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;
+
+@Name("searchBean")
+public class SearchBean implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5071655218132021316L;
+
+ @In(required=false)
+ private SearchBeanHelper helper;
+
+ @In(create=true)
+ private ISearchService searchService;
+
+ @In(create=true)
+ private FileManager fileManager;
+
+ private String searchPattern;
+
+ private Long spinnerChoice;
+
+ private Long dateChoice;
+
+ private Long votesChoice;
+
+ private Long numberOfVotes;
+
+ private Date date;
+
+ private List<Image> findedImages = new ArrayList<Image>();
+
+ public List<SelectItem> getItems() {
+ List<SelectItem> list = new ArrayList<SelectItem>(4);
+ list.add(new SelectItem(Long.valueOf(1L), "More"));
+ list.add(new SelectItem(Long.valueOf(2L), "Less"));
+ list.add(new SelectItem(Long.valueOf(3L), "Equals"));
+ return list;
+ }
+
+ public synchronized void paint(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 List<Image> searchImages(){
+ findedImages = searchService.searchImages(this.searchPattern);
+ return findedImages;
+ }
+
+ public List<Image> popularImages(){
+ findedImages = searchService.popularImages();
+ return findedImages;
+ }
+
+ public List<Image> worstImages(){
+ findedImages = searchService.worstImages();
+ return findedImages;
+ }
+
+ public String getSearchPattern() {
+ return searchPattern;
+ }
+
+ public void setSearchPattern(String searchPattern) {
+ this.searchPattern = searchPattern;
+ }
+
+ public Long getSpinnerChoice() {
+ return spinnerChoice;
+ }
+
+ public void setSpinnerChoice(Long spinnerChoice) {
+ this.spinnerChoice = spinnerChoice;
+ }
+
+ public Long getDateChoice() {
+ return dateChoice;
+ }
+
+ public void setDateChoice(Long dateChoice) {
+ this.dateChoice = dateChoice;
+ }
+
+ public Long getVotesChoice() {
+ return votesChoice;
+ }
+
+ public void setVotesChoice(Long votesChoice) {
+ this.votesChoice = votesChoice;
+ }
+
+ public Long getNumberOfVotes() {
+ return numberOfVotes;
+ }
+
+ public void setNumberOfVotes(Long numberOfVotes) {
+ this.numberOfVotes = numberOfVotes;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public List<Image> getFindedImages() {
+ return findedImages;
+ }
+
+ public void setFindedImages(List<Image> findedImages) {
+ this.findedImages = findedImages;
+ }
+}
Property changes on:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBean.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/search/SearchBeanHelper.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBeanHelper.java
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBeanHelper.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -0,0 +1,22 @@
+package org.richfaces.realworld.search;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.component.UIInputNumberSpinner;
+
+@Name("helper")
+(a)Scope(ScopeType.EVENT)
+public class SearchBeanHelper {
+
+ private UIInputNumberSpinner inputSpinner;
+
+ public UIInputNumberSpinner getInputSpinner() {
+ return inputSpinner;
+ }
+
+ public void setInputSpinner(UIInputNumberSpinner inputSpinner) {
+ this.inputSpinner = inputSpinner;
+ }
+
+}
Property changes on:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/search/SearchBeanHelper.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/session/Authenticator.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-12-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -6,6 +6,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
@@ -39,6 +40,7 @@
/* (non-Javadoc)
* @see org.richfaces.realworld.service.IAuthenticator#authenticate()
*/
+ @Begin
public boolean authenticate()
{
log.info("authenticating #0", identity.getUsername());
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -1,5 +1,6 @@
package org.richfaces.realworld.tree;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -13,6 +14,7 @@
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.Message;
import org.richfaces.realworld.domain.User;
@@ -21,20 +23,22 @@
import org.richfaces.realworld.service.IImageAction;
import org.richfaces.realworld.service.IMessageAction;
import org.richfaces.realworld.service.IUserAction;
+import org.richfaces.realworld.util.RatingHelper;
@Name("treeActionManager")
@Scope(ScopeType.PAGE)
-public class TreeActionManager {
+public class TreeActionManager implements Serializable{
@In
private User user;
- private long countUnreadedMessages;
-
@In(create=true, required=true)
private IAlbumAction albumAction;
@In(create=true, required=true)
+ private RatingHelper ratingHelper;
+
+ @In(create=true, required=true)
private IMessageAction messageAction;
@In(create=true, required=true)
@@ -65,8 +69,8 @@
}
- public List<User> availableUsers(Object suggest){
- List<User> suggestions = userAction.getUsers((String)suggest);
+ public List<String> availableUserLogins(Object suggest){
+ List<String> suggestions = userAction.getUsers((String)suggest);
return suggestions;
}
@@ -161,11 +165,45 @@
messageAction.sendMessage(message);
}
- public long getCountUnreadedMessages() {
- return userAction.countNotReadedMessages(user);
+ public Long getCountUnreadedMessages() {
+ Long count = userAction.countNotReadedMessages(user);
+ return count!= null? count:0;
}
public void removeFromFriends(User owner, User removed){
userAction.removeFromFriends(owner, removed);
+ Message message = new Message();
+ message.setAuthor(user);
+ message.setDate(new Date());
+ 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");
+ messageAction.sendMessage(message);
}
+
+ public void addToFriends(User friend){
+ FriendshipRequest request = friend.getFriendshipRequest(user, friend);
+ if(request != null){
+ if(!userAction.friendExist(user, friend)){
+ userAction.addFriend(user, friend, request);
+ Message message = new Message();
+ message.setAuthor(user);
+ message.setDate(new Date());
+ 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");
+ messageAction.sendMessage(message);
+ }
+ }/*else{
+ throw new Exception("This user won't be your friend!");
+ }*/
+ }
+
+ public void vote(Image image){
+ imageAction.vote(image,
(Long)Long.valueOf(ratingHelper.getInputSlider().getValue().toString()));
+ }
}
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -7,6 +7,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -46,7 +47,7 @@
@Name("treeSelectionManager")
@Synchronized(timeout=2000)
@Scope(ScopeType.SESSION)
-public class TreeSelectionManager {
+public class TreeSelectionManager implements Serializable{
private static final FacesContext FacesContext = null;
Modified:
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-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ModalPanelHelper.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -1,5 +1,6 @@
package org.richfaces.realworld.util;
+import java.io.Serializable;
import java.util.Date;
import javax.faces.event.ActionEvent;
@@ -18,7 +19,7 @@
@Name("modalPanelHelper")
@Scope(ScopeType.SESSION)
-public class ModalPanelHelper {
+public class ModalPanelHelper implements Serializable{
private String caption;
@@ -105,6 +106,7 @@
public void initMessage(boolean sendRequired, Message message){
this.sendRequired = sendRequired;
this.message = message;
+ this.message.setReaded(true);
this.searchRequired = false;
}
@@ -130,6 +132,19 @@
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, User
user, Image image){
this.caption = caption;
this.actionName = actionName;
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RatingHelper.java 2008-12-05
15:38:09 UTC (rev 11584)
@@ -0,0 +1,24 @@
+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;
+
+@Name("ratingHelper")
+public class RatingHelper {
+
+ 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/RatingHelper.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/webapp/WEB-INF/components.xml
===================================================================
---
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/components.xml 2008-12-05
15:26:04 UTC (rev 11583)
+++
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/components.xml 2008-12-05
15:38:09 UTC (rev 11584)
@@ -9,33 +9,30 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xsi:schemaLocation=
- "http://jboss.com/products/seam/core
http://jboss.com/products/seam/core-2.0.xsd
-
http://jboss.com/products/seam/transaction
http://jboss.com/products/seam/transaction-2.0.xsd
-
http://jboss.com/products/seam/persistence
http://jboss.com/products/seam/persistence-2.0.xsd
-
http://jboss.com/products/seam/drools
http://jboss.com/products/seam/drools-2.0.xsd
-
http://jboss.com/products/seam/bpm
http://jboss.com/products/seam/bpm-2.0.xsd
-
http://jboss.com/products/seam/security
http://jboss.com/products/seam/security-2.0.xsd
-
http://jboss.com/products/seam/mail
http://jboss.com/products/seam/mail-2.0.xsd
-
http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-2.0.xsd">
+ "http://jboss.com/products/seam/core
http://jboss.com/products/seam/core-2.1.0.xsd
+
http://jboss.com/products/seam/transaction
http://jboss.com/products/seam/transaction-2.1.0.xsd
+
http://jboss.com/products/seam/persistence
http://jboss.com/products/seam/persistence-2.1.0.xsd
+
http://jboss.com/products/seam/drools
http://jboss.com/products/seam/drools-2.1.0.xsd
+
http://jboss.com/products/seam/bpm
http://jboss.com/products/seam/bpm-2.1.0.xsd
+
http://jboss.com/products/seam/security
http://jboss.com/products/seam/security-2.1.0.xsd
+
http://jboss.com/products/seam/mail
http://jboss.com/products/seam/mail-2.1.0.xsd
+
http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-2.1.0.xsd">
<core:init debug="true" jndi-pattern="@jndiPattern@"/>
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
conversation-id-parameter="cid"/>
-
-<drools:rule-base name="securityRules">
- <drools:rule-files>
- <value>/security.drl</value>
- </drools:rule-files>
- </drools:rule-base>
-
- <security:identity security-rules="#{securityRules}"
authenticate-method="#{authenticator.authenticate}"/>
+ <persistence:managed-persistence-context
name="entityManager"
+ auto-create="true"
+
persistence-unit-jndi-name="java:/realWorldEntityManager"/>
+ <transaction:ejb-transaction />
+ <security:identity
authenticate-method="#{authenticator.authenticate}"/>
<event type="org.jboss.seam.security.notLoggedIn">
- <action execute="#{redirect.captureCurrentView}"/>
- </event>
- <event type="org.jboss.seam.security.loginSuccessful">
- <action execute="#{redirect.returnToCapturedView}"/>
- </event>
-
+ <action execute="#{redirect.captureCurrentView}"/>
+ <action execute="#{identity.tryLogin()}"/>
+ </event>
+ <event type="org.jboss.seam.security.loginSuccessful">
+ <action execute="#{redirect.returnToCapturedView}"/>
+ </event>
</components>
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/imagePreview.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/img/Thumbs.db
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/realworld/web/src/main/webapp/img/Thumbs.db
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/layout/menuShared.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/realworld/web/src/main/webapp/layout/menuShared.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/realworld/web/src/main/webapp/main.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/register.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/search.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/sharedAlbum.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/realworld/web/src/main/webapp/sharedAlbum.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml