[richfaces-svn-commits] JBoss Rich Faces SVN: r13753 - trunk/examples/photoalbum/ejb/src/main/java/org/richfaces/photoalbum/domain.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Apr 22 05:05:50 EDT 2009


Author: Alex.Kolonitsky
Date: 2009-04-22 05:05:50 -0400 (Wed, 22 Apr 2009)
New Revision: 13753

Modified:
   trunk/examples/photoalbum/ejb/src/main/java/org/richfaces/photoalbum/domain/Image.java
Log:
formatting

Modified: trunk/examples/photoalbum/ejb/src/main/java/org/richfaces/photoalbum/domain/Image.java
===================================================================
--- trunk/examples/photoalbum/ejb/src/main/java/org/richfaces/photoalbum/domain/Image.java	2009-04-22 08:37:54 UTC (rev 13752)
+++ trunk/examples/photoalbum/ejb/src/main/java/org/richfaces/photoalbum/domain/Image.java	2009-04-22 09:05:50 UTC (rev 13753)
@@ -25,10 +25,17 @@
  */
 package org.richfaces.photoalbum.domain;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
+import org.hibernate.annotations.OrderBy;
+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.AutoCreate;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.photoalbum.service.ActionTools;
 
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
@@ -47,41 +54,32 @@
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
-import javax.persistence.UniqueConstraint;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotEmpty;
-import org.hibernate.validator.NotNull;
-import org.hibernate.annotations.LazyCollection;
-import org.hibernate.annotations.LazyCollectionOption;
-import org.hibernate.annotations.OrderBy;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.photoalbum.service.ActionTools;
-
 @NamedQueries({
-    @NamedQuery(
-            name = "tag-byName",
-            query = "from MetaTag m where m.tag =:tag"
-    ), 
-    @NamedQuery(
-            name = "tag-popular",
-            query = "select new MetaTag(m.id, m.tag) from MetaTag m join m.images img group by m.id, m.tag order by count(img) desc"
-    ), 
-    @NamedQuery(
-            name = "user-shelves",
-            query = "select distinct s from Shelf s where (s.shared = true and s.owner.preDefined = true) order by s.name"
-    ),
-    @NamedQuery(
-            name = "image-exist",
-            query = "from Image i where i.path = :path and i.album = :album"
-       ),
-    @NamedQuery(
-            name = "tag-suggest",
-            query = "select m from MetaTag m where lower(m.tag) like :tag"
-    )})
+	@NamedQuery(
+			name = "tag-byName",
+			query = "from MetaTag m where m.tag =:tag"
+	),
+	@NamedQuery(
+			name = "tag-popular",
+			query = "select new MetaTag(m.id, m.tag) from MetaTag m join m.images img group by m.id, m.tag order by count(img) desc"
+	),
+	@NamedQuery(
+			name = "user-shelves",
+			query = "select distinct s from Shelf s where (s.shared = true and s.owner.preDefined = true) order by s.name"
+	),
+	@NamedQuery(
+			name = "image-exist",
+			query = "from Image i where i.path = :path and i.album = :album"
+	),
+	@NamedQuery(
+			name = "tag-suggest",
+			query = "select m from MetaTag m where lower(m.tag) like :tag"
+	)})
 /**
  * Class for representing Image Entity
  *  EJB3 Entity Bean
@@ -96,87 +94,93 @@
 @AutoCreate
 public class Image implements Serializable {
 
-    private static final long serialVersionUID = -7042878411608396483L;
+	private static final long serialVersionUID = -7042878411608396483L;
 
-    @Id
-    @GeneratedValue
-    @Column(name = "IMAGE_ID")
-    private Long id = null;
+	public static final int STRING_LENGTH = 255;
+	public static final int TEXT_LENGTH = 1024;
 
-    @Column(length = 255, nullable = false)
-    @NotNull
-    @NotEmpty
-    @Length(min = 3)
-    private String name;
-    
-    @Transient
-    private boolean covering;
+	@Id
+	@GeneratedValue
+	@Column(name = "IMAGE_ID")
+	private Long id = null;
 
-    @Column(length = 1024, nullable = false)
-    @NotNull
-    @NotEmpty
-    @Length(min = 3)
-    private String path;
 
-    @ManyToMany(cascade = CascadeType.PERSIST)
-    @JoinTable(name = "IMAGES_METATAGS",
-            joinColumns =
-            @JoinColumn(name = "CI_IMAGE_ID",
-                    referencedColumnName = "IMAGE_ID"),
-            inverseJoinColumns =
-            @JoinColumn(name = "CI_METATAG_ID",
-                    referencedColumnName = "METATAG_ID"))
-    protected List<MetaTag> imageTags = new ArrayList<MetaTag>();
+	@Column(length = STRING_LENGTH, nullable = false)
+	@NotNull
+	@NotEmpty
+	@Length(min = 3)
+	private String name;
 
-    @Transient
-    private boolean visited;
-    /*
-     * Comma separated tag value
-     * */
-    @Transient
-    private String meta = "";
+	@Transient
+	private boolean covering;
 
-    @Column(length = 255)
-    private String cameraModel;
+	@Column(length = TEXT_LENGTH, nullable = false)
+	@NotNull
+	@NotEmpty
+	@Length(min = 3)
+	private String path;
 
-    private int height;
+	@ManyToMany(cascade = CascadeType.PERSIST)
+	@JoinTable(name = "IMAGES_METATAGS",
+			joinColumns =
+			@JoinColumn(name = "CI_IMAGE_ID",
+					referencedColumnName = "IMAGE_ID"),
+			inverseJoinColumns =
+			@JoinColumn(name = "CI_METATAG_ID",
+					referencedColumnName = "METATAG_ID"))
+	private List<MetaTag> imageTags = new ArrayList<MetaTag>();
 
-    private double size;
+	@Transient
+	private boolean visited;
+	/*
+		 * Comma separated tag value
+		 * */
+	@Transient
+	private String meta = "";
 
-    private int width;
+	@Column(length = STRING_LENGTH)
+	private String cameraModel;
 
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date uploaded;
+	private int height;
 
-    @Column(length = 1024)
-    @NotNull
-    @NotEmpty
-    @Length(min = 3)
-    private String description;
+	private double size;
 
-    @Temporal(TemporalType.TIMESTAMP)
-    private Date created;
+	private int width;
 
-    @OneToMany(mappedBy = "image", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
-    @LazyCollection(LazyCollectionOption.EXTRA)
-    @OrderBy(clause = "date asc")
-    private List<Comment> comments = new ArrayList<Comment>();
+	@Temporal(TemporalType.TIMESTAMP)
+	private Date uploaded;
 
-    @ManyToOne(fetch = FetchType.LAZY)
-    @JoinColumn(name = "ALBUM_ID", referencedColumnName = "ALBUM_ID")
-    private Album album;
+	@Column(length = TEXT_LENGTH)
+	@NotNull
+	@NotEmpty
+	@Length(min = 3)
+	private String description;
 
-    @NotNull
-    private boolean allowComments;
+	@Temporal(TemporalType.TIMESTAMP)
+	private Date created;
 
+	@OneToMany(mappedBy = "image", cascade = {
+			CascadeType.ALL}, fetch = FetchType.LAZY)
+	@LazyCollection(LazyCollectionOption.EXTRA)
+	@OrderBy(clause = "date asc")
+	private List<Comment> comments = new ArrayList<Comment>();
+
+	@ManyToOne(fetch = FetchType.LAZY)
+	@JoinColumn(name = "ALBUM_ID", referencedColumnName = "ALBUM_ID")
+	private Album album;
+
+	@NotNull
+	private boolean allowComments;
+
 	private Boolean showMetaInfo = true;
+
 	/**
-     * Getter for property preDefined
-     *
-     * @return is this shelf is predefined
-     */
-    public boolean isPreDefined() {
-		return getAlbum() != null? getAlbum().isPreDefined() : false;
+	 * Getter for property preDefined
+	 *
+	 * @return is this shelf is predefined
+	 */
+	public boolean isPreDefined() {
+		return getAlbum() != null && getAlbum().isPreDefined();
 	}
 
 	// ********************** Accessor Methods ********************** //
@@ -189,415 +193,352 @@
 		this.showMetaInfo = showMetaInfo;
 	}
 
-    /**
-     * Getter for property id
-     *
-     * @return id of image
-     */
-    public Long getId() {
-        return id;
-    }
+	public Long getId() {
+		return id;
+	}
 
-    /**
-     * Getter for property name
-     *
-     * @return name of image
-     */
-    public String getName() {
-        return name;
-    }
+	public String getName() {
+		return name;
+	}
 
-    /**
-     * Setter for property name
-     *
-     * @param name - name of image
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
+	public void setName(String name) {
+		this.name = name;
+	}
 
-    /**
-     * Getter for property description
-     *
-     * @return description of image
-     */
-    public String getDescription() {
-        return description;
-    }
+	public String getDescription() {
+		return description;
+	}
 
-    /**
-     * Setter for property description
-     *
-     * @param description - description of image
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
+	public void setDescription(String description) {
+		this.description = description;
+	}
 
-    /**
-     * Getter for property path.
-     * Represent file-system structure, relative at uploadRoot dir(determined at startup, by default is system temp dir)
-     * Usually is user.GetLogin() + SLASH + image.getAlbum().getId() + SLASH + fileName,
-     * for example "amarkhel/15/coolPicture.jpg"
-     *
-     * @return relative path of image
-     */
-    public String getPath() {
-        return path;
-    }
+	/**
+	 * Getter for property path.
+	 * Represent file-system structure, relative at uploadRoot dir(determined at startup, by default is system temp dir)
+	 * Usually is user.GetLogin() + SLASH + image.getAlbum().getId() + SLASH + fileName,
+	 * for example "amarkhel/15/coolPicture.jpg"
+	 *
+	 * @return relative path of image
+	 */
+	public String getPath() {
+		return path;
+	}
 
-    /**
-     * Setter for property path
-     *
-     * @param path - relative path to image
-     */
-    public void setPath(String path) {
-        this.path = path;
-    }
+	/**
+	 * Setter for property path
+	 *
+	 * @param path - relative path to image
+	 */
+	public void setPath(String path) {
+		this.path = path;
+	}
 
-    /**
-     * Getter for property created
-     *
-     * @return date of creation of this image
-     */
-    public Date getCreated() {
-        return created;
-    }
+	public Date getCreated() {
+		return created;
+	}
 
-    /**
-     * Setter for property created
-     *
-     * @param created - date of creation
-     */
-    public void setCreated(Date created) {
-        this.created = created;
-    }
+	public void setCreated(Date created) {
+		this.created = created;
+	}
 
-    /**
-     * Getter for property album
-     *
-     * @return containing album
-     */
-    public Album getAlbum() {
-        return album;
-    }
+	/**
+	 * Getter for property album
+	 *
+	 * @return containing album
+	 */
+	public Album getAlbum() {
+		return album;
+	}
 
-    /**
-     * Setter for property album
-     *
-     * @param album - album, that will contain this image
-     */
-    public void setAlbum(Album album) {
-        this.album = album;
-    }
+	/**
+	 * Setter for property album
+	 *
+	 * @param album - album, that will contain this image
+	 */
+	public void setAlbum(Album album) {
+		this.album = album;
+	}
 
-    /**
-     * Getter for property comments
-     *
-     * @return collection of comments, belongs to that image
-     */
-    public List<Comment> getComments() {
-        return comments;
-    }
+	/**
+	 * Getter for property comments
+	 *
+	 * @return collection of comments, belongs to that image
+	 */
+	public List<Comment> getComments() {
+		return comments;
+	}
 
-    /**
-     * Getter for property imageTags
-     *
-     * @return collection of MetaTags, associated to that image
-     */
-    public List<MetaTag> getImageTags() {
-        return imageTags;
-    }
+	/**
+	 * Getter for property imageTags
+	 *
+	 * @return collection of MetaTags, associated to that image
+	 */
+	public List<MetaTag> getImageTags() {
+		return imageTags;
+	}
 
-    /**
-     * Setter for property meta
-     *
-     * @param meta - string representation of metatags, associated to image. Used at jsf page.
-     */
-    public void setMeta(String meta) {
-        this.meta = meta;
-    }
+	/**
+	 * Setter for property meta
+	 *
+	 * @param meta - string representation of metatags, associated to image. Used at jsf page.
+	 */
+	public void setMeta(String meta) {
+		this.meta = meta;
+	}
 
-    /**
-     * Getter for property meta 
-     * 
-     * @return string representation of metatags, associated to image. Used at jsf page.
-     */
-    public String getMetaString(){
-    	return meta;
-    }
-    
-    /**
-     * Getter for property cameraModel
-     *
-     * @return model of camera
-     */
-    public String getCameraModel() {
-        return cameraModel;
-    }
+	/**
+	 * Getter for property meta
+	 *
+	 * @return string representation of metatags, associated to image. Used at jsf page.
+	 */
+	public String getMetaString() {
+		return meta;
+	}
 
-    /**
-     * setter for property cameraModel
-     *
-     * @param cameraModel- model of camera
-     */
-    public void setCameraModel(String cameraModel) {
-        this.cameraModel = cameraModel;
-    }
+	public String getCameraModel() {
+		return cameraModel;
+	}
 
-    /**
-     * Getter for property height
-     *
-     * @return height of image
-     */
-    public int getHeight() {
-        return height;
-    }
+	public void setCameraModel(String cameraModel) {
+		this.cameraModel = cameraModel;
+	}
 
-    /**
-     * setter for property height
-     *
-     * @param height - height of image
-     */
-    public void setHeight(int height) {
-        this.height = height;
-    }
+	public int getHeight() {
+		return height;
+	}
 
-    /**
-     * Getter for property size
-     *
-     * @return size of image in KB
-     */
-    public double getSize() {
-        return size;
-    }
+	public void setHeight(int height) {
+		this.height = height;
+	}
 
-    /**
-     * setter for property size
-     *
-     * @param size - size of image in KB
-     */
-    public void setSize(double size) {
-        this.size = size;
-    }
+	/**
+	 * Getter for property size
+	 *
+	 * @return size of image in KB
+	 */
+	public double getSize() {
+		return size;
+	}
 
-    /**
-     * Getter for property width
-     *
-     * @return width of image
-     */
-    public int getWidth() {
-        return width;
-    }
+	/**
+	 * setter for property size
+	 *
+	 * @param size - size of image in KB
+	 */
+	public void setSize(double size) {
+		this.size = size;
+	}
 
-    /**
-     * setter for property width
-     *
-     * @param width - width of image
-     */
-    public void setWidth(int width) {
-        this.width = width;
-    }
+	public int getWidth() {
+		return width;
+	}
 
-    /**
-     * Getter for property uploaded
-     *
-     * @return date of upload to site of this image
-     */
-    public Date getUploaded() {
-        return uploaded;
-    }
+	public void setWidth(int width) {
+		this.width = width;
+	}
 
-    /**
-     * setter for property uploaded
-     *
-     * @param uploaded - date of upload
-     */
-    public void setUploaded(Date uploaded) {
-        this.uploaded = uploaded;
-    }
-    
-    /**
-     * Getter for property allowComments. If true, other user may comment this image.
-     *
-     * @return is other users may comment this image
-     */
-    public boolean isAllowComments() {
-        return allowComments;
-    }
+	/**
+	 * Getter for property uploaded
+	 *
+	 * @return date of upload to site of this image
+	 */
+	public Date getUploaded() {
+		return uploaded;
+	}
 
-    /**
-     * @param allowComments the allowComments to set
-     */
-    public void setAllowComments(boolean allowComments) {
-        this.allowComments = allowComments;
-    }
+	/**
+	 * setter for property uploaded
+	 *
+	 * @param uploaded - date of upload
+	 */
+	public void setUploaded(Date uploaded) {
+		this.uploaded = uploaded;
+	}
 
-    /**
-     * 
-     * @return if this image is covering for containing album
-     */
-    public boolean isCovering() {
-        return covering;
-    }
+	/**
+	 * Getter for property allowComments. If true, other user may comment this image.
+	 *
+	 * @return is other users may comment this image
+	 */
+	public boolean isAllowComments() {
+		return allowComments;
+	}
 
-    /**
-     * 
-     * @param covering - determine if this image is covering for containing album
-     */
-    public void setCovering(boolean covering) {
-        this.covering = covering;
-    }
-    
-    /**
-     * Getter for property visited
-     *
-     * @return boolean value, that indicated is user visit this image already
-     */
-    public boolean isVisited() {
+	/**
+	 * @param allowComments the allowComments to set
+	 */
+	public void setAllowComments(boolean allowComments) {
+		this.allowComments = allowComments;
+	}
+
+	/**
+	 * @return if this image is covering for containing album
+	 */
+	public boolean isCovering() {
+		return covering;
+	}
+
+	/**
+	 * @param covering - determine if this image is covering for containing album
+	 */
+	public void setCovering(boolean covering) {
+		this.covering = covering;
+	}
+
+	/**
+	 * Getter for property visited
+	 *
+	 * @return boolean value, that indicated is user visit this image already
+	 */
+	public boolean isVisited() {
 		return visited;
 	}
 
-    /**
-     * Setter for property visited
-     *
-     * @param visited - boolean value, that indicated is user visit this image already
-     */
+	/**
+	 * Setter for property visited
+	 *
+	 * @param visited - boolean value, that indicated is user visit this image already
+	 */
 	public void setVisited(boolean visited) {
 		this.visited = visited;
 	}
-	
+
 	/**
-     * Determine if this image should be marked as new(on jsf page, for example in tree)
-     *
-     * @return boolean value, that indicated is this image should be marked as new
-     */
-	public boolean isNew(){
-		if(!visited){
+	 * Determine if this image should be marked as new(on jsf page, for example in tree)
+	 *
+	 * @return boolean value, that indicated is this image should be marked as new
+	 */
+	public boolean isNew() {
+		if (!visited) {
 			return this.getUploaded().after(ActionTools.getRecentlyDate());
 		}
 		return false;
 	}
-    
-    //---------------------------Business methods
 
-    /**
-     * Add comment to this image.
-     *
-     * @param comment - comment to add
-     */
-    public void addComment(Comment comment) {
-        if (comment == null) {
-            throw new IllegalArgumentException("Null comment!");
-        }
-        comment.setImage(this);
-        comments.add(comment);
-    }
+	//---------------------------Business methods
 
-    /**
-     * Remove comment from list of comments, belongs to that image.
-     *
-     * @param comment - comment to delete
-     */
-    public void removeComment(Comment comment) {
-        if (comment == null) {
-            throw new IllegalArgumentException("Null comment");
-        }
-        if(comment.getImage().equals(this)){
-        	comment.setImage(null);
-            comments.remove(comment);
-        }else{
-        	throw new IllegalArgumentException("Comment not belongs to this image");
-        }
-    }
+	/**
+	 * Add comment to this image.
+	 *
+	 * @param comment - comment to add
+	 */
+	public void addComment(Comment comment) {
+		if (comment == null) {
+			throw new IllegalArgumentException("Null comment!");
+		}
+		comment.setImage(this);
+		comments.add(comment);
+	}
 
-    /**
-     * Add metatag to this image.
-     *
-     * @param metatag - metatag to add
-     */
-    public void addMetaTag(MetaTag metatag) {
-        if (metatag == null) {
-            throw new IllegalArgumentException("Null metatag!");
-        }
-        if (!imageTags.contains(metatag)) {
-            metatag.addImage(this);
-            imageTags.add(metatag);
-        }
-    }
+	/**
+	 * Remove comment from list of comments, belongs to that image.
+	 *
+	 * @param comment - comment to delete
+	 */
+	public void removeComment(Comment comment) {
+		if (comment == null) {
+			throw new IllegalArgumentException("Null comment");
+		}
+		if (comment.getImage().equals(this)) {
+			comment.setImage(null);
+			comments.remove(comment);
+		} else {
+			throw new IllegalArgumentException("Comment not belongs to this image");
+		}
+	}
 
-    /**
-     * Remove metatag from list of metatag, associated to that image.
-     *
-     * @param metatag - metatag to delete
-     */
-    public void removeMetaTag(MetaTag metatag) {
-        if (metatag == null) {
-            throw new IllegalArgumentException("Null metatag!");
-        }
-        if (imageTags.contains(metatag)) {
-            metatag.removeImage(this);
-            imageTags.remove(metatag);
-        }
-    }
+	/**
+	 * Add metatag to this image.
+	 *
+	 * @param metatag - metatag to add
+	 */
+	public void addMetaTag(MetaTag metatag) {
+		if (metatag == null) {
+			throw new IllegalArgumentException("Null metatag!");
+		}
+		if (!imageTags.contains(metatag)) {
+			metatag.addImage(this);
+			imageTags.add(metatag);
+		}
+	}
 
-    /**
-     * Return MetaTag object by string representation
-     *
-     * @param s - string representation of metatag
-     */
-    public MetaTag getTagByName(String s) {
-        for (MetaTag t : imageTags) {
-            if (t.getTag().equals(s)) {
-                return t;
-            }
-        }
-        return null;
-    }
+	/**
+	 * Remove metatag from list of metatag, associated to that image.
+	 *
+	 * @param metatag - metatag to delete
+	 */
+	public void removeMetaTag(MetaTag metatag) {
+		if (metatag == null) {
+			throw new IllegalArgumentException("Null metatag!");
+		}
+		if (imageTags.contains(metatag)) {
+			metatag.removeImage(this);
+			imageTags.remove(metatag);
+		}
+	}
 
-    /**
-     * Return Comma separated tag value for presentation in view
-     *
-     */
-    public String getMeta() {
-        final StringBuilder s = new StringBuilder();
-        for (MetaTag tag : this.imageTags) {
-            s.append(tag.getTag()).append(", ");
-        }
-        //Remove ',' from end
+	/**
+	 * Return MetaTag object by string representation
+	 *
+	 * @param s - string representation of metatag
+	 */
+	public MetaTag getTagByName(String s) {
+		for (MetaTag t : imageTags) {
+			if (t.getTag().equals(s)) {
+				return t;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Return Comma separated tag value for presentation in view
+	 */
+	public String getMeta() {
+		final StringBuilder s = new StringBuilder();
+		for (MetaTag tag : this.imageTags) {
+			s.append(tag.getTag()).append(", ");
+		}
+		//Remove ',' from end
 		if (s.length() >= 2) {
 			s.delete(s.length() - 2, s.length());
 		}
 		return s.toString();
-    }
-    
-    /**
-     * Return relative path of this image in file-system(relative to uploadRoot parameter)
-     *
-     */
-    public String getFullPath(){
-		if(getAlbum() != null && getAlbum().getOwner() != null && getAlbum().getPath() != null){
+	}
+
+	/**
+	 * Return relative path of this image in file-system(relative to uploadRoot parameter)
+	 */
+	public String getFullPath() {
+		if (getAlbum() != null
+				&& getAlbum().getOwner() != null
+				&& getAlbum().getPath() != null) {
 			return getAlbum().getPath() + this.path;
 		}
 		return null;
 	}
-    
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
 
-        Image image = (Image) o;
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj) {
+			return true;
+		}
 
-        if (id != null ? !id.equals(image.id) : image.id != null) return false;
-        if (path != null ? !path.equals(image.path) : image.path != null) return false;
+		if (obj == null || getClass() != obj.getClass()) {
+			return false;
+		}
 
-        return true;
-    }
+		final Image image = (Image) obj;
 
-    public int hashCode() {
-        int result;
-        result = (id != null ? id.hashCode() : 0);
-        result = 31 * result + (path != null ? path.hashCode() : 0);
-        return result;
-    }
+		return (id == null ? image.getId() == null : id.equals(image.getId()))
+				&& (path == null ? image.getPath() == null : path.equals(image.getPath()));
+	}
+
+	@Override
+	public int hashCode() {
+		int result = id != null ? id.hashCode() : 0;
+		result = 31 * result + (path != null ? path.hashCode() : 0);
+		return result;
+	}
 }




More information about the richfaces-svn-commits mailing list