[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model ...

Christian Bauer christian at hibernate.org
Sun Apr 22 06:15:33 EDT 2007


  User: cbauer  
  Date: 07/04/22 06:15:33

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/core/model  
                        FeedEntry.java Feed.java
  Log:
  Fixed atom feed updating/purging logic
  
  Revision  Changes    Path
  1.6       +4 -16     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FeedEntry.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- FeedEntry.java	20 Apr 2007 09:10:12 -0000	1.5
  +++ FeedEntry.java	22 Apr 2007 10:15:33 -0000	1.6
  @@ -10,7 +10,7 @@
   
   @Entity
   @Table(name = "FEEDENTRY")
  -public class FeedEntry implements Serializable {
  +public class FeedEntry implements Serializable, Comparable {
   
       @Id
       @GeneratedValue(generator = "wikiSequenceGenerator")
  @@ -52,15 +52,6 @@
       @org.hibernate.annotations.ForeignKey(name = "FK_FEEDENTRY_DOCUMENT_ID")
       private Document document;
   
  -    @ManyToMany(fetch = FetchType.LAZY)
  -    @JoinTable(
  -        name = "FEED_FEEDENTRY",
  -        joinColumns = @JoinColumn(name = "FEEDENTRY_ID", nullable = false, updatable = false),
  -        inverseJoinColumns= @JoinColumn(name = "FEED_ID", nullable = false, updatable = false)
  -    )
  -    @org.hibernate.annotations.ForeignKey(name = "FK_FEED_FEEDENTRY_FEEDENTRY_ID", inverseName = "FK_FEED_FEEDENTRY_FEED_ID")
  -    private Set<Feed> feeds = new HashSet<Feed>();
  -
       public FeedEntry() {}
   
       // Immutable properties
  @@ -138,12 +129,9 @@
           this.document = document;
       }
   
  -    public Set<Feed> getFeeds() {
  -        return feeds;
  -    }
  -
  -    public void setFeeds(Set<Feed> feeds) {
  -        this.feeds = feeds;
  +    // Sort by date
  +    public int compareTo(Object o) {
  +        return getUpdatedDate().compareTo( ((FeedEntry)o).getUpdatedDate() );
       }
   
       public String toString() {
  
  
  
  1.4       +19 -1     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Feed.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Feed.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Feed.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- Feed.java	19 Apr 2007 18:36:11 -0000	1.3
  +++ Feed.java	22 Apr 2007 10:15:33 -0000	1.4
  @@ -1,7 +1,7 @@
   package org.jboss.seam.wiki.core.model;
   
   import javax.persistence.*;
  -import java.util.Date;
  +import java.util.*;
   import java.io.Serializable;
   
   @Entity
  @@ -38,6 +38,16 @@
       @org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
       private Directory directory;
   
  +    @ManyToMany(fetch = FetchType.LAZY)
  +    @JoinTable(
  +        name = "FEED_FEEDENTRY",
  +        joinColumns = @JoinColumn(name = "FEED_ID", nullable = false, updatable = false),
  +        inverseJoinColumns= @JoinColumn(name = "FEEDENTRY_ID", nullable = false, updatable = false)
  +    )
  +    @org.hibernate.annotations.ForeignKey(name = "FK_FEED_FEEDENTRY_FEED_ID", inverseName = "FK_FEED_FEEDENTRY_FEEDENTRY_ID")
  +    @org.hibernate.annotations.Sort(type = org.hibernate.annotations.SortType.NATURAL)
  +    private SortedSet<FeedEntry> feedEntries = new TreeSet<FeedEntry>();
  +
       public Feed() { }
   
       // Immutable properties
  @@ -95,6 +105,14 @@
           this.directory = directory;
       }
   
  +    public SortedSet<FeedEntry> getFeedEntries() {
  +        return feedEntries;
  +    }
  +
  +    public void setFeedEntries(SortedSet<FeedEntry> feedEntries) {
  +        this.feedEntries = feedEntries;
  +    }
  +
       public String toString() {
           return "Feed: " + getId();
       }
  
  
  



More information about the jboss-cvs-commits mailing list