Author: amarkhel
Date: 2008-11-28 11:00:59 -0500 (Fri, 28 Nov 2008)
New Revision: 11437
Added:
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/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/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/addComment.xhtml
trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
trunk/test-applications/realworld/web/src/main/webapp/scripts/
trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
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/Image.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/IImageAction.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/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/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/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/TreeRootItem.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java
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/fileUpload.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/layout/template.xhtml
trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
trunk/test-applications/realworld/web/src/main/webapp/register.xhtml
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css
trunk/test-applications/realworld/web/src/main/webapp/tree.xhtml
trunk/test-applications/realworld/web/src/main/webapp/userPrefs.xhtml
Log:
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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -6,7 +6,9 @@
package org.richfaces.realworld.domain;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
@@ -15,12 +17,16 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
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.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
@@ -51,10 +57,14 @@
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String name;
@Column(length = 1024)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String description;
/*@OneToMany(mappedBy = "parent", cascade = { CascadeType.ALL }, fetch =
FetchType.LAZY)
@@ -81,8 +91,16 @@
@OneToMany(cascade = CascadeType.ALL, mappedBy = "album")
@org.hibernate.annotations.Cascade(value =
org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
- private Set<Image> images = new HashSet<Image>();
+ private List<Image> images = new ArrayList<Image>();
+ @ManyToMany
+ @JoinTable(
+ name = "SHARED_ALBUMS",
+ joinColumns = @JoinColumn(name = "ALBUM_ID"),
+ inverseJoinColumns = @JoinColumn(name = "USER_ID")
+ )
+ private List<User> sharedOwners = new ArrayList<User>();
+
/**
* No-arg constructor for JavaBean tools
*/
@@ -234,7 +252,7 @@
return owner;
}
- public Set<Image> getImages() {
+ public List<Image> getImages() {
return images;
}
@@ -252,4 +270,12 @@
public void setChangedName(String changedName) {
this.changedName = changedName;
}
+
+ public List<User> getSharedOwners() {
+ return sharedOwners;
+ }
+
+ public void setSharedOwners(List<User> sharedOwners) {
+ this.sharedOwners = sharedOwners;
+ }
}
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -0,0 +1,88 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+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 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.annotations.Name;
+
+@Entity
+@Name("comment")
+@Table(name = "comments")
+public class Comment implements Serializable{
+
+ @Id
+ @GeneratedValue
+ @Column(name = "COMMENT_ID")
+ private Long id;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date date;
+
+ @ManyToOne
+ @JoinColumn(name="IMAGE_COMMENT_ID",
+ referencedColumnName="IMAGE_ID")
+ private Image image;
+
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "FROM_USER_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USER_ID")
+ private User author;
+
+ @Column(length = 1024, nullable = false)
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String message;
+
+ public Long getId() {
+ return id;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public User getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(User author) {
+ this.author = author;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+}
Property changes on:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Comment.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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -6,10 +6,13 @@
package org.richfaces.realworld.domain;
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;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@@ -18,12 +21,16 @@
import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+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;
import org.hibernate.validator.NotNull;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
@@ -54,19 +61,29 @@
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String name;
@Column(length = 1024, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String path;
- @org.hibernate.annotations.CollectionOfElements(targetElement =
java.lang.String.class)
+ @OneToOne
+ @JoinColumn(name="RANK_ID")
+ private Rank rank;
+
+/* @org.hibernate.annotations.CollectionOfElements(targetElement =
java.lang.String.class)
@JoinTable(name = "IMAGE_TAGS", joinColumns = @JoinColumn(name =
"IMAGE_ID"))
@Column(name = "TAG", nullable = false)
- private Set<String> tags = new HashSet<String>();
+ private Set<String> tags = new HashSet<String>();*/
@Column(length = 1024)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String description;
@Transient
@@ -78,6 +95,16 @@
@Temporal(TemporalType.TIMESTAMP)
private Date created;
+ @OneToMany(mappedBy = "parent", cascade = { CascadeType.ALL }, fetch =
FetchType.LAZY)
+
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
+ @org.hibernate.annotations.OrderBy(clause = "tag asc")
+ private List<MetaTag> tags = new ArrayList<MetaTag>();
+
+ @OneToMany(mappedBy = "image", cascade = { CascadeType.ALL }, fetch =
FetchType.LAZY)
+
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
+ @org.hibernate.annotations.OrderBy(clause="date asc")
+ private List<Comment> comments = new ArrayList<Comment>();
+
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="IMG_ALBUM_ID",
referencedColumnName="ALBUM_ID")
@@ -179,13 +206,13 @@
this.created = created;
}
- public Set<String> getTags() {
+ /*public Set<String> getTags() {
return tags;
}
public void setTags(Set<String> tags) {
this.tags = tags;
- }
+ }*/
public Album getAlbum() {
return album;
@@ -205,4 +232,68 @@
public void setAlbumName(String albumName) {
this.albumName = albumName;
}
+
+ public List<MetaTag> getTags() {
+ return tags;
+ }
+
+ public void setTags(List<MetaTag> tags) {
+ this.tags = tags;
+ }
+
+ //---------------------------Business methods
+
+ public void addMetaTag(MetaTag metaTag) {
+ if (metaTag == null) {
+ throw new IllegalArgumentException("Null metaTag!");
+ }
+ if (metaTag.getParent() != null && !this.equals(metaTag.getParent())) {
+ metaTag.getParent().getTags().remove(metaTag);
+ }
+ metaTag.setParent(this);
+ tags.add(metaTag);
+ }
+
+ public void removeMetaTag(MetaTag metaTag) {
+ if (metaTag == null) {
+ throw new IllegalArgumentException("Null metaTag");
+ }
+ metaTag.setParent(null);
+ tags.remove(metaTag);
+ }
+
+ public void addComment(Comment comment) {
+ if (comment == null) {
+ throw new IllegalArgumentException("Null comment!");
+ }
+ if (comment.getImage() != null && !this.equals(comment.getImage())) {
+ comment.getImage().getComments().remove(comment);
+ }
+ comment.setImage(this);
+ comments.add(comment);
+ }
+
+ public void removeComment(Comment comment) {
+ if (comment == null) {
+ throw new IllegalArgumentException("Null comment");
+ }
+ comment.setImage(null);
+ comments.remove(comment);
+ }
+
+ public List<Comment> getComments() {
+ return comments;
+ }
+
+ public void setComments(List<Comment> comments) {
+ this.comments = comments;
+ }
+
+ public Rank getRank() {
+ return rank;
+ }
+
+ public void setRank(Rank rank) {
+ this.rank = rank;
+ }
}
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -0,0 +1,86 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+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 javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.Name;
+@Entity
+@Name("message")
+@Table(name = "messages")
+public class Message implements Serializable{
+
+ @Id
+ @GeneratedValue
+ @Column(name = "MESSAGE_ID")
+ private Long id;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date date;
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "AUTHOR_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERS_ID")
+ private User author;
+
+ @Column(length = 2000, nullable = false)
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String message;
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "OWNER_ID", nullable = false, updatable = false)
+ @org.hibernate.annotations.ForeignKey(name = "FK_FROM_USERS2_ID")
+ private User owner;
+
+ public Long getId() {
+ return id;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public User getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(User author) {
+ this.author = author;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public User getOwner() {
+ return owner;
+ }
+
+ public void setOwner(User owner) {
+ this.owner = owner;
+ }
+
+}
Property changes on:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Message.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -0,0 +1,60 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+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")
+@Table(name = "metatags")
+public class MetaTag implements Serializable{
+ @Id
+ @GeneratedValue
+ @Column(name = "METATAG_ID")
+ private Long id;
+
+ @Column(length = 255, nullable = false)
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String tag;
+
+ @ManyToOne
+ @JoinColumn(name="IMAGE_METATAG_ID",
+ referencedColumnName="IMAGE_ID")
+ private Image parent;
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+
+ public Image getParent() {
+ return parent;
+ }
+
+ public void setParent(Image image) {
+ this.parent = image;
+ }
+}
Property changes on:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -0,0 +1,69 @@
+package org.richfaces.realworld.domain;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.jboss.seam.annotations.Name;
+
+@Entity
+@Name("rank")
+@Table(name = "Ranks")
+public class Rank implements Serializable{
+
+ @Id
+ @GeneratedValue
+ @Column(name = "RANK_ID")
+ private Long id;
+
+ private Long total;
+
+ private Long hits;
+
+ @OneToOne(mappedBy = "rank")
+ private Image image;
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getTotal() {
+ return total;
+ }
+
+ public void setTotal(Long total) {
+ this.total = total;
+ }
+
+ public Long getHits() {
+ return hits;
+ }
+
+ public void setHits(Long hits) {
+ this.hits = hits;
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ public double getRating() {
+ double total2 = (double)total;
+ double result = total2/hits;
+ BigDecimal x = new BigDecimal(result);
+ x = x.setScale(2, BigDecimal.ROUND_HALF_UP);
+ return x.doubleValue();
+ }
+
+}
Property changes on:
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/Rank.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/User.java
===================================================================
---
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -13,6 +13,9 @@
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
@@ -22,7 +25,10 @@
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.Scope;
@@ -54,35 +60,61 @@
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String firstName;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String secondName;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Pattern(regex=".+@.+\\.[a-z]+", message="Not valid e-mail")
private String email;
@Column(length = 255)
- @NotNull
private String avatarPath;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String login;
@Column(length = 255, nullable = false)
@NotNull
+ @NotEmpty
+ @Length(min=3)
private String password;
+ @Transient
+ @NotNull
+ @NotEmpty
+ @Length(min=3)
+ private String confirmPassword;
+
+ @ManyToMany(mappedBy = "sharedOwners")
+ private List<Album> sharedAlbums = new ArrayList<Album>();
+
+ @ManyToMany
+ @JoinTable(
+ name = "USER_FRIENDS",
+ joinColumns = @JoinColumn(name = "USER1_ID"),
+ inverseJoinColumns = @JoinColumn(name = "USER2_ID")
+ )
+ private Set<User> friends;
+
@Temporal(TemporalType.TIMESTAMP)
private Date birthDate;
@OneToMany(mappedBy = "owner", cascade = { CascadeType.ALL }, fetch =
FetchType.LAZY)
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
@org.hibernate.annotations.OrderBy(clause = "NAME asc")
- private Set<Album> childAlbums = new HashSet<Album>();
+ private List<Album> childAlbums = new ArrayList<Album>();
//private Address address;
@@ -152,11 +184,11 @@
return id;
}
- public Set<Album> getChildAlbums() {
+ public List<Album> getChildAlbums() {
return childAlbums;
}
- public void setChildAlbums(Set<Album> childAlbums) {
+ public void setChildAlbums(List<Album> childAlbums) {
this.childAlbums = childAlbums;
}
@@ -190,4 +222,28 @@
album.setOwner(null);
childAlbums.remove(album);
}
+
+ public String getConfirmPassword() {
+ return confirmPassword;
+ }
+
+ public void setConfirmPassword(String confirmPassword) {
+ this.confirmPassword = confirmPassword;
+ }
+
+ public Set<User> getFriends() {
+ return friends;
+ }
+
+ public void setFriends(Set<User> friends) {
+ this.friends = friends;
+ }
+
+ public List<Album> getSharedAlbums() {
+ return sharedAlbums;
+ }
+
+ public void setSharedAlbums(List<Album> sharedAlbums) {
+ this.sharedAlbums = sharedAlbums;
+ }
}
\ 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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -4,6 +4,7 @@
import org.jboss.seam.annotations.Destroy;
import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Comment;
import org.richfaces.realworld.domain.Image;
public interface IImageAction {
@@ -30,5 +31,9 @@
public abstract void destroy();
public abstract void addImage(Image image);
+
+ public void deleteComment(Comment comment);
+
+ public void addComment(Comment comment);
}
\ 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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/IUserAction.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -5,6 +5,7 @@
import javax.ejb.Remove;
import org.jboss.seam.annotations.Destroy;
+import org.richfaces.realworld.domain.User;
@Local
public interface IUserAction {
@@ -14,4 +15,10 @@
@Destroy
public void destroy();
+
+ public void register(User user);
+ public boolean isUserExist(String login);
+ public void updateUser(User user);
+
+ public void resetUser(User user);
}
\ 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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -11,6 +11,7 @@
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;
@@ -77,4 +78,13 @@
em.persist(image);
em.flush();
}
+
+ public void deleteComment(Comment comment){
+ comment.getImage().removeComment(comment);
+ em.flush();
+ }
+
+ public void addComment(Comment comment){
+
+ }
}
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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/java/org/richfaces/realworld/service/UserAction.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -1,5 +1,9 @@
package org.richfaces.realworld.service;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.ejb.Stateless;
@@ -14,6 +18,9 @@
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.User;
@Stateful
@@ -31,7 +38,7 @@
.setParameter("username", username)
.setParameter("password", password)
.getSingleResult();
- return user != null;
+ return user != null;
}
@Remove
@@ -43,4 +50,32 @@
public void destroy(){
}
+
+ public void register(User user) {
+ em.persist(user);
+ this.user = user;
+ }
+
+ public void updateUser(User user) {
+ em.merge(user);
+ em.flush();
+ this.user = user;
+ }
+
+ public void resetUser(User user) {
+ em.refresh(user);
+ em.flush();
+ this.user = user;
+ }
+
+ public boolean isUserExist(String login) {
+ try{
+ User tempuser = (User)em.createQuery("from User u where u.login = :login")
+ .setParameter("login", login)
+ .getSingleResult();
+ }catch(Exception e){
+ return false;
+ }
+ return true;
+ }
}
\ 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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/ejb/src/main/resources/META-INF/persistence.xml 2008-11-28
16:00:59 UTC (rev 11437)
@@ -8,11 +8,17 @@
<persistence-unit name="realworld">
<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="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>
</persistence-unit>
Modified: trunk/test-applications/realworld/ejb/src/main/resources/import.sql
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-11-28
14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/resources/import.sql 2008-11-28
16:00:59 UTC (rev 11437)
@@ -1,25 +1,79 @@
INSERT INTO Users(user_id, obj_version, firstname, secondname, email, avatarpath, login,
password, birthdate) VALUES (1, 0, 'Andrey', 'Markhel',
'amarkhel(a)exadel.com', 'avatar.gif', '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(a)exadel.com', 'avatar.gif', '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(a)exadel.com', 'avatar.gif', 'qqqq', '12345',
'1985-01-08');
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id)
VALUES (1, 0, 'Album 1', 'Simple Album', true, 1);
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id)
VALUES (2, 0, 'Album 2', 'Simple Album 2', false, 1);
INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id)
VALUES (3, 0, 'Album 3', 'Simple Album 3', false, 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (1, 0, 'Picture 1', 'pic1.jpg', 'Just
picture', true, '1985-01-08', 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (2, 0, 'Picture 2', 'pic2.jpg', 'Just
picture', true, '1985-01-08', 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (3, 0, 'Picture 33', 'pic3.jpg', 'Just
picture', true, '1985-01-08', 1);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (4, 0, 'Picture 2', 'pic4.jpg', 'Just
picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (5, 0, 'Picture 3', 'pic5.jpg', 'Just
picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (6, 0, 'Picture 4', 'pic6.jpg', 'Just
picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (7, 0, 'Picture 5', 'pic7.jpg', 'Just
picture', true, '1985-01-08', 2);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (8, 0, 'Picture 1', 'pic8.jpg', 'Just
picture', true, '1985-01-08', 3);
-INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id) VALUES (9, 0, 'Picture 2', 'pic9.jpg', 'Just
picture', true, '1985-01-08', 3);
-INSERT INTO image_tags(image_id, tag) VALUES (1, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (1, 'Cool2');
-INSERT INTO image_tags(image_id, tag) VALUES (2, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (3, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (4, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (5, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (6, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (7, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (7, 'Cool2');
-INSERT INTO image_tags(image_id, tag) VALUES (7, 'Cool3');
-INSERT INTO image_tags(image_id, tag) VALUES (8, 'Cool');
-INSERT INTO image_tags(image_id, tag) VALUES (9, 'Cool');
\ No newline at end of file
+INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id)
VALUES (4, 0, 'Album 1', 'Simple Album', true, 2);
+INSERT INTO albums(album_id, obj_version, name, description, shared, album_user_id)
VALUES (5, 0, 'Album 2', 'Simple Album 2', false, 2);
+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 (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 (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 (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 (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);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (3, 0, 'Picture 33', 'pic3.jpg', 'Just
picture', true, '1985-01-08', 1, 3);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (4, 0, 'Picture 2', 'pic4.jpg', 'Just
picture', true, '1985-01-08', 2, 4);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (5, 0, 'Picture 3', 'pic5.jpg', 'Just
picture', true, '1985-01-08', 2, 5);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (6, 0, 'Picture 4', 'pic6.jpg', 'Just
picture', true, '1985-01-08', 2, 6);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (7, 0, 'Picture 5', 'pic7.jpg', 'Just
picture', true, '1985-01-08', 2, 7);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (8, 0, 'Picture 1', 'pic8.jpg', 'Just
picture', true, '1985-01-08', 3, 8);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (9, 0, 'Picture 2', 'pic9.jpg', 'Just
picture', true, '1985-01-08', 3, 9);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (10, 0, 'Picture 1', 'pic1.jpg', 'Just
picture', true, '1985-01-08', 4, 10);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (11, 0, 'Picture 2', 'pic2.jpg', 'Just
picture', true, '1985-01-08', 4, 11);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (12, 0, 'Picture 33', 'pic3.jpg', 'Just
picture', true, '1985-01-08', 4, 12);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (13, 0, 'Picture 2', 'pic4.jpg', 'Just
picture', true, '1985-01-08', 5, 13);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (14, 0, 'Picture 3', 'pic5.jpg', 'Just
picture', true, '1985-01-08', 5, 14);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (15, 0, 'Picture 4', 'pic6.jpg', 'Just
picture', true, '1985-01-08', 5, 15);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (16, 0, 'Picture 5', 'pic7.jpg', 'Just
picture', true, '1985-01-08', 5, 16);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (17, 0, 'Picture 1', 'pic8.jpg', 'Just
picture', true, '1985-01-08', 6, 17);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (18, 0, 'Picture 2', 'pic9.jpg', 'Just
picture', true, '1985-01-08', 6, 18);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (19, 0, 'Picture 1', 'pic1.jpg', 'Just
picture', true, '1985-01-08', 7, 19);
+INSERT INTO images(image_id, obj_version, name, path, description, shared, created,
img_album_id, rank_id) VALUES (20, 0, 'Picture 2', 'pic2.jpg', 'Just
picture', true, '1985-01-08', 7, 20);
+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 (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 (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 (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 (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 (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 (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 (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 (20, 'Cool', 19);
+INSERT INTO metatags(metatag_id, tag, image_metatag_id) VALUES (21, 'Cool', 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) VALUES (1,
'1985-01-08', 'Hello I am user', 2, 1);
+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
Modified: trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml
===================================================================
--- trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml 2008-11-28
14:12:17 UTC (rev 11436)
+++ trunk/test-applications/realworld/ejb/src/main/resources/realworld-ds.xml 2008-11-28
16:00:59 UTC (rev 11437)
@@ -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/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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/AvatarUpload.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -1,20 +1,26 @@
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 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")
+(a)Scope(ScopeType.PAGE)
public class AvatarUpload {
-
- @In @Out
- private User user;
@In(create=true)
private FileManager fileManager;
@@ -24,22 +30,14 @@
private boolean autoUpload = false;
public void avatarListener(UploadEvent event){
- //UploadItem item = event.getUploadItem();
- //System.out.println("File : '" + item.getFileName() + "' was
uploaded");
- //try {
UploadItem item = event.getUploadItem();
FileItem file = new FileItem();
file.setLength(item.getData().length);
- file.setName(item.getFileName());
+ Image image = new Image();
+ image.setName(item.getFileName());
+ file.setImage(image);
file.setData(item.getData());
this.setAvatarItem(file);
-
//fileManager.deleteAllFromDirectory(user.getLogin()+fileManager.getFileSeparator()+"avatars");
- //fileManager.addImage(user.getLogin()+fileManager.getFileSeparator()+normaliseFileName(item.getFileName()),
item.getData());
- //user.setAvatarPath(normaliseFileName(item.getFileName()));
- //} catch (Exception e) {
- // TODO: handle exception
- //facesMessages.add("Error during fileUpload");
- //}
}
public synchronized void paintAvatar(OutputStream stream, Object object) throws
IOException {
@@ -48,6 +46,52 @@
public boolean isAutoUpload() {
return autoUpload;
}
+
+ /*public FileItem loadAvatar(User user){
+ FileItem file = new FileItem();
+ file.setName(user.getAvatarPath());
+ File image = fileManager.getImage(user.getLogin() + fileManager.getFileSeparator() +
"avatars"+ fileManager.getFileSeparator() + user.getAvatarPath());
+ 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();
+ }
+ }
+ }
+ file.setData(data);
+ return file;
+ }*/
public void setAutoUpload(boolean autoUpload) {
this.autoUpload = autoUpload;
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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -1,9 +1,10 @@
package org.richfaces.realworld.fileupload;
+import org.richfaces.realworld.domain.Image;
+
public class FileItem {
- private String Name;
- private String mime;
+ private Image image = new Image();
private boolean selected;
private long length;
private byte[] data;
@@ -13,27 +14,7 @@
public void setData(byte[] data) {
this.data = data;
}
- public String getName() {
- return Name;
- }
- public void setName(String name) {
- Name = name;
- int extDot = name.lastIndexOf('.');
- if(extDot > 0){
- String extension = name.substring(extDot +1);
- if("bmp".equals(extension)){
- mime="image/bmp";
- } else if("jpg".equals(extension)){
- mime="image/jpeg";
- } else if("gif".equals(extension)){
- mime="image/gif";
- } else if("png".equals(extension)){
- mime="image/png";
- } else {
- mime = "image/unknown";
- }
- }
- }
+
public long getLength() {
return length;
}
@@ -41,13 +22,16 @@
this.length = length;
}
- public String getMime(){
- return mime;
- }
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/FileUploadBean.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2008-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -55,7 +55,7 @@
@In
TreeSelectionManager treeSelectionManager;
- @In
+ @In(create=true)
TreeActionManager treeActionManager;
@In(create=true)
@@ -82,9 +82,16 @@
UploadItem item = event.getUploadItem();
FileItem file = new FileItem();
file.setLength(item.getData().length);
- file.setName(item.getFileName());
file.setData(item.getData());
file.setSelected(false);
+ Image image = new Image();
+ image.setCreated(new Date());
+ image.setDescription("Sample Description");
+ image.setName("Sample Name");
+ image.setPath(item.getFileName());
+ image.setAlbumName(treeSelectionManager.getSelectedAlbum().getName());
+ image.setAlbum(treeSelectionManager.getSelectedAlbum());
+ file.setImage(image);
files.add(file);
}
@@ -104,21 +111,14 @@
for(FileItem file:files){
if(file.isSelected()){
//Save file to disk
- String fileName = user.getLogin() + fileManager.getFileSeparator() +
treeSelectionManager.getSelectedAlbumItem().getAlbum().getName() +
fileManager.getFileSeparator() + file.getName();
+ String fileName = user.getLogin() + fileManager.getFileSeparator() +
treeSelectionManager.getSelectedAlbum().getName() + fileManager.getFileSeparator() +
file.getImage().getPath();
try {
fileManager.addImage(fileName , file.getData());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- //Update domain model
- Image image = new Image();
- image.setCreated(new Date());
- image.setPath(file.getName());
- image.setName("TODO");
- image.setDescription("TODO");
- image.setAlbum(treeSelectionManager.getSelectedAlbumItem().getAlbum());
- treeActionManager.addImage(image);
+ treeActionManager.addImage(file.getImage());
}
}
}
@@ -126,7 +126,7 @@
public void storeAll() {
for(FileItem file:files){
//Save file to disk
- String fileName = user.getLogin() + fileManager.getFileSeparator() +
treeSelectionManager.getSelectedAlbumItem().getAlbum().getName() +
fileManager.getFileSeparator() + file.getName();
+ String fileName = user.getLogin() + fileManager.getFileSeparator() +
treeSelectionManager.getSelectedAlbum().getName() + fileManager.getFileSeparator() +
file.getImage().getPath();
try {
fileManager.addImage(fileName , file.getData());
} catch (IOException e) {
@@ -134,13 +134,7 @@
e.printStackTrace();
}
//Update domain model
- Image image = new Image();
- image.setCreated(new Date());
- image.setPath(file.getName());
- image.setName("TODO");
- image.setDescription("TODO");
- image.setAlbum(treeSelectionManager.getSelectedAlbumItem().getAlbum());
- treeActionManager.addImage(image);
+ treeActionManager.addImage(file.getImage());
}
}
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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/session/Authenticator.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -1,11 +1,20 @@
package org.richfaces.realworld.session;
+import java.io.IOException;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
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.User;
+import org.richfaces.realworld.fileupload.AvatarUpload;
import org.richfaces.realworld.fileupload.FileManager;
import org.richfaces.realworld.service.IUserAction;
@@ -23,7 +32,10 @@
@In(create = true)
FileManager fileManager;
-
+
+ @In(create = true)
+ AvatarUpload avatarUpload;
+
/* (non-Javadoc)
* @see org.richfaces.realworld.service.IAuthenticator#authenticate()
*/
@@ -44,4 +56,47 @@
}
return false;
}
+
+ 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");
+ FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()),
new FacesMessage(
+ 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");
+ FacesContext.getCurrentInstance().addMessage(component.getClientId(FacesContext.getCurrentInstance()),
new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "User with this login already exist" ,
"User with this login already exist"));
+ errorHappened = true;
+ }
+ if(errorHappened){
+ return "";
+ }
+ userAction.register(user);
+ if(avatarUpload.getAvatarItem() != null){
+ user.setAvatarPath(avatarUpload.getAvatarItem().getImage().getName());
+ fileManager.deleteDirectory(user.getLogin() + fileManager.getFileSeparator() +
"avatars");
+ fileManager.addDirectory(user.getLogin() + fileManager.getFileSeparator() +
"avatars");
+ try {
+ fileManager.addImage(user.getLogin() + fileManager.getFileSeparator() +
"avatars" + fileManager.getFileSeparator() + user.getAvatarPath(),
avatarUpload.getAvatarItem().getData());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return "main";
+ }
+
+ /**
+ * 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/tree/TreeActionManager.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java 2008-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeActionManager.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -45,7 +45,8 @@
treeRoot.addAlbumToTree(albumItem);
fileManager.addDirectory(user.getLogin() + fileManager.getFileSeparator() +
album.getName());
treeSelectionManager.setSelectedImage(null);
- treeSelectionManager.setSelectedAlbumItem(albumItem);
+ treeSelectionManager.setSelectedAlbum(albumItem.getAlbum());
+
}
public void editAlbum(Album album){
@@ -64,6 +65,7 @@
}
albumAction.editAlbum(album);
treeRoot.updateChild(album);
+
}
public void deleteAlbum(Album album){
@@ -74,7 +76,7 @@
treeRoot.removeChild(album.getId());
fileManager.deleteDirectory(user.getLogin() + fileManager.getFileSeparator() +
albumName);
treeSelectionManager.setSelectedImage(null);
- treeSelectionManager.setSelectedAlbumItem(null);
+ treeSelectionManager.setSelectedAlbum(null);
}
public void deleteImage(Image image){
@@ -100,8 +102,8 @@
String fileNameOld = user.getLogin() + fileManager.getFileSeparator() +
image.getAlbum().getName() + fileManager.getFileSeparator() + image.getPath();
String fileNameNew = user.getLogin() + fileManager.getFileSeparator() +
image.getAlbumName() + fileManager.getFileSeparator() + image.getPath();
fileManager.renameImage(fileNameOld, fileNameNew);
- treeSelectionManager.setSelectedImage(imageItem);
- treeSelectionManager.setSelectedAlbumItem(albumItem);
+ treeSelectionManager.setSelectedImage(imageItem.getImage());
+ treeSelectionManager.setSelectedAlbum(albumItem.getAlbum());
}else{
TreeImageItem imageItem = (TreeImageItem)parent.getChild(image.getId());
imageItem.setImage(image);
@@ -113,7 +115,7 @@
TreeAlbumItem albumItem = treeRoot.getAlbumByName(image.getAlbumName());
TreeImageItem imageItem = new TreeImageItem(image.getId(),albumItem,image);
albumItem.addChild(image.getId(), imageItem);
- treeSelectionManager.setSelectedImage(imageItem);
- treeSelectionManager.setSelectedAlbumItem(albumItem);
+ treeSelectionManager.setSelectedImage(imageItem.getImage());
+ treeSelectionManager.setSelectedAlbum(albumItem.getAlbum());
}
}
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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeRootItem.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -123,5 +123,4 @@
public List<SelectItem> getAvailableAlbums() {
return availableAlbums;
}
-
}
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-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/tree/TreeSelectionManager.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -30,6 +30,8 @@
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
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;
@@ -44,31 +46,31 @@
private NavigationEnum mainArea = NavigationEnum.IMAGE_PREVIEW;
- private TreeNode selectedImage;
+ private Image selectedImage;
- private TreeAlbumItem selectedAlbumItem;
+ private Album selectedAlbum;
@In(create=true)
FileManager fileManager;
private String nodeTitle;
- public TreeAlbumItem getSelectedAlbumItem() {
- return selectedAlbumItem;
+ public Album getSelectedAlbum() {
+ return selectedAlbum;
}
public void showFileUpload(TreeAlbumItem item){
- this.setSelectedAlbumItem(item);
+ this.setSelectedAlbum(item.getAlbum());
if(item.isLeaf()){
this.setSelectedImage(null);
}else{
- this.setSelectedImage(item.getImages().get(0));
+ this.setSelectedImage(((TreeImageItem)(item.getImages().get(0))).getImage());
}
this.setMainArea(NavigationEnum.FILE_UPLOAD);
}
public void scrollerListener(DataScrollerEvent event) {
- List<TreeNode> images = this.getSelectedAlbumItem().getImages();
+ List<Image> images = this.getSelectedAlbum().getImages();
if (event.getNewScrolVal().equals("previous")) {
for(int index = 0 ; index < images.size(); index++){
if(images.get(index) == this.getSelectedImage()){
@@ -80,9 +82,8 @@
} else if (event.getNewScrolVal().equals("next")) {
for(int index = 0 ; index < images.size(); index++){
if(images.get(index) == this.getSelectedImage()){
- if(images.size() > index + 1){
this.setSelectedImage(images.get(index + 1));
- }
+ return;
}
}
} else if (event.getNewScrolVal().equals("first")) {
@@ -95,15 +96,25 @@
if (null == data) {
return;
}
- File imageResource = fileManager.getImage(user.getLogin() +
fileManager.getFileSeparator() + this.getSelectedAlbumItem() +
fileManager.getFileSeparator() + data.toString());
+ File imageResource = fileManager.getImage(user.getLogin() +
fileManager.getFileSeparator() + this.getSelectedAlbum().getName() +
fileManager.getFileSeparator() + data.toString());
if (imageResource != null) {
- InputStream paintData = new BufferedInputStream(new FileInputStream(imageResource));
+ 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();
+ }
}
}
@@ -188,37 +199,37 @@
return index;
}
- public void setSelectedAlbumItem(TreeAlbumItem selectedAlbumItem) {
- this.selectedAlbumItem = selectedAlbumItem;
- }
-
- public TreeNode getSelectedImage() {
+ public Image getSelectedImage() {
return selectedImage;
}
- public void setSelectedImage(TreeNode selectedImage) {
+ public void setSelectedImage(Image selectedImage) {
this.selectedImage = selectedImage;
}
+ public void setSelectedAlbum(Album selectedAlbum) {
+ this.selectedAlbum = selectedAlbum;
+ }
+
public Boolean adviseNodeSelected(UITree tree) {
TreeRowKey treeRowKey = (TreeRowKey) tree.getRowKey();
TreeNode treeNode = (TreeNode) tree.getRowData(treeRowKey);
if(treeNode instanceof TreeAlbumItem){
TreeAlbumItem currentNode = (TreeAlbumItem)treeNode;
- if(this.getSelectedAlbumItem() != null){
- return treeNode == this.getSelectedAlbumItem() && null ==
this.getSelectedImage() ? Boolean.TRUE: Boolean.FALSE;
+ if(this.getSelectedAlbum() != null){
+ return currentNode.getAlbum() == this.getSelectedAlbum() && null ==
this.getSelectedImage() ? Boolean.TRUE: Boolean.FALSE;
}else{
- this.setSelectedAlbumItem(currentNode);
- if((currentNode).isLeaf()){
+ this.setSelectedAlbum(currentNode.getAlbum());
+ if(currentNode.isLeaf()){
return Boolean.TRUE ;
}else{
- this.setSelectedImage((currentNode).getImages().get(0));
+ this.setSelectedImage(((TreeImageItem)(currentNode.getImages().get(0))).getImage());
return Boolean.FALSE ;
}
}
}else if(treeNode instanceof TreeImageItem){
- return treeNode == this.getSelectedImage() ? Boolean.TRUE : Boolean.FALSE;
+ return ((TreeImageItem)treeNode).getImage() == this.getSelectedImage() ? Boolean.TRUE
: Boolean.FALSE;
}
return null;
}
@@ -228,12 +239,12 @@
TreeNode treeNode = (TreeNode) tree.getRowData(treeRowKey);
if(treeNode instanceof TreeAlbumItem){
TreeAlbumItem currentNode = (TreeAlbumItem)treeNode;
- if(this.getSelectedAlbumItem() != null){
- return treeNode == this.getSelectedAlbumItem() ? Boolean.TRUE: Boolean.FALSE;
+ if(this.getSelectedAlbum() != null){
+ return currentNode.getAlbum() == this.getSelectedAlbum() ? Boolean.TRUE:
Boolean.FALSE;
}else{
- this.setSelectedAlbumItem(currentNode);
- if(!(currentNode).isLeaf()){
- this.setSelectedImage((currentNode).getImages().get(0));
+ this.setSelectedAlbum(currentNode.getAlbum());
+ if(!currentNode.isLeaf()){
+ this.setSelectedImage(((TreeImageItem)currentNode.getImages().get(0)).getImage());
}
return Boolean.TRUE ;
}
@@ -251,23 +262,26 @@
.getName();
}
TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
- if (currentNode.isLeaf()) {
- selectedImage = currentNode;
- if(((TreeAlbumItem)currentNode.getParent()) != this.getSelectedAlbumItem()){
- this.setSelectedAlbumItem((TreeAlbumItem)currentNode.getParent());
- }
- return;
- } else {
- if(currentNode == this.getSelectedAlbumItem()){
+ if(currentNode instanceof TreeImageItem){
+ this.setSelectedImage(((TreeImageItem)currentNode).getImage());
+ if(((TreeAlbumItem)currentNode.getParent()).getAlbum() != this.getSelectedAlbum()){
+ this.setSelectedAlbum(((TreeAlbumItem)currentNode.getParent()).getAlbum());
+ }
return;
+ }else if(currentNode instanceof TreeAlbumItem){
+ TreeAlbumItem node = (TreeAlbumItem)currentNode;
+ if (node.isLeaf()) {
+ this.setSelectedImage(null);
+ Album album = node.getAlbum();
+ this.setSelectedAlbum(album);
}else{
- setSelectedAlbumItem((TreeAlbumItem) currentNode);
- if(((TreeAlbumItem) currentNode).isLeaf()){
- this.setSelectedImage(null);
+ if(node.getAlbum() == this.getSelectedAlbum()){
+ return;
}else{
- this.setSelectedImage(((TreeAlbumItem) currentNode).getImages().get(0));
- }
- }
+ setSelectedAlbum(node.getAlbum());
+ this.setSelectedImage(node.getAlbum().getImages().get(0));
+ }
+ }
}
}
Added:
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
(rev 0)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.java 2008-11-28
16:00:59 UTC (rev 11437)
@@ -0,0 +1,78 @@
+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;
+
+@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.getTags().add(metaTag);
+ return null;
+ }
+
+ public void addTag(Image image){
+ MetaTag metaTag = new MetaTag();
+ metaTag.setTag("");
+ metaTag.setParent(image);
+ image.getTags().add(metaTag);
+ //image.getMeta().add("");
+ }
+
+ public void removeTag(MetaTag tag, Image image){
+ image.getTags().remove(tag);
+ //image.getMeta().remove(tag);
+ }
+}
Property changes on:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageHelper.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/webapp/WEB-INF/tags/templates/addComment.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/realworld/web/src/main/webapp/WEB-INF/tags/templates/addComment.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
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/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/layout/menu.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/template.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/main.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/realworld/web/src/main/webapp/navigation.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/realworld/web/src/main/webapp/register.xhtml
===================================================================
(Binary files differ)
Added: trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
(rev 0)
+++ trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js 2008-11-28
16:00:59 UTC (rev 11437)
@@ -0,0 +1,13 @@
+
+function storeButtonDisabled(){
+ var nodes = $$('.rich-message-label');
+ var disabled = false;
+ for(var i = 0; i < nodes.length; i++){
+ var node = nodes[i];
+ if(node.innerHTML != ""){
+ disabled = true;
+ break;
+ }
+ }
+ return disabled;
+ }
\ No newline at end of file
Property changes on:
trunk/test-applications/realworld/web/src/main/webapp/scripts/realworld.js
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css
===================================================================
---
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css 2008-11-28
14:12:17 UTC (rev 11436)
+++
trunk/test-applications/realworld/web/src/main/webapp/stylesheet/realworld.css 2008-11-28
16:00:59 UTC (rev 11437)
@@ -82,6 +82,7 @@
margin-bottom: 5px;
background-color: #F0F8FF;
font-size: 12px;
+ color: red;
}
.name {
@@ -101,6 +102,7 @@
.error {
float: left;
padding: 5px;
+ color: red;
}
.errors {
color: red;
Modified: trunk/test-applications/realworld/web/src/main/webapp/tree.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/userPrefs.xhtml
===================================================================
(Binary files differ)