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

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/action   
                        UserSearch.java DocumentHome.java
                        DirectoryHome.java
  Log:
  Fixed atom feed updating/purging logic
  
  Revision  Changes    Path
  1.4       +1 -4      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserSearch.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UserSearch.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserSearch.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- UserSearch.java	21 Apr 2007 19:58:01 -0000	1.3
  +++ UserSearch.java	22 Apr 2007 10:15:33 -0000	1.4
  @@ -21,9 +21,6 @@
       @In
       private FacesMessages facesMessages;
   
  -    @In
  -    private NodeBrowser browser;
  -
       private User exampleUser;
       private String orderByProperty;
       private boolean orderDescending;
  
  
  
  1.13      +5 -6      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DocumentHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- DocumentHome.java	20 Apr 2007 09:10:12 -0000	1.12
  +++ DocumentHome.java	22 Apr 2007 10:15:33 -0000	1.13
  @@ -8,11 +8,8 @@
   import org.jboss.seam.wiki.core.action.prefs.DocumentEditorPreferences;
   import org.jboss.seam.Component;
   import org.jboss.seam.ScopeType;
  -import org.jboss.seam.core.Events;
   import org.jboss.seam.contexts.Contexts;
   
  -import javax.faces.application.FacesMessage;
  -
   @Name("documentHome")
   @Scope(ScopeType.CONVERSATION)
   public class DocumentHome extends NodeHome<Document> {
  @@ -70,7 +67,7 @@
   
           // Create feed entries (needs identifiers assigned, so we run after persist())
           if (outcome != null && getInstance().getReadAccessLevel() == UserRoleAccessFactory.GUESTROLE_ACCESSLEVEL) {
  -            feedDAO.createFeedEntries(isPushOnSiteFeed(), getInstance());
  +            feedDAO.createFeedEntry(isPushOnSiteFeed(), getInstance());
               getEntityManager().flush();
           }
   
  @@ -86,8 +83,10 @@
           if (!isMinorRevision()) {
   
               // Update feed entries
  -            if (getInstance().getReadAccessLevel() == UserRoleAccessFactory.GUESTROLE_ACCESSLEVEL)
  -                feedDAO.updateFeedEntries(isPushOnSiteFeed(), getInstance());
  +            if (getInstance().getReadAccessLevel() == UserRoleAccessFactory.GUESTROLE_ACCESSLEVEL) {
  +                feedDAO.updateFeedEntry(isPushOnSiteFeed(), getInstance());
  +                feedDAO.purgeOldFeedEntries(); // TODO: Move this into maintenance thread to run periodically
  +            }
   
               historicalCopy.setId(getInstance().getId());
               getNodeDAO().persistHistoricalNode(historicalCopy);
  
  
  
  1.8       +21 -0     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DirectoryHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- DirectoryHome.java	19 Apr 2007 18:36:12 -0000	1.7
  +++ DirectoryHome.java	22 Apr 2007 10:15:33 -0000	1.8
  @@ -5,10 +5,12 @@
   import org.jboss.seam.annotations.datamodel.DataModel;
   import org.jboss.seam.annotations.datamodel.DataModelSelection;
   import org.jboss.seam.ScopeType;
  +import org.jboss.seam.Component;
   import org.jboss.seam.wiki.core.model.Directory;
   import org.jboss.seam.wiki.core.model.Node;
   import org.jboss.seam.wiki.core.model.Document;
   import org.jboss.seam.wiki.core.model.Feed;
  +import org.jboss.seam.wiki.core.dao.FeedDAO;
   
   import javax.faces.application.FacesMessage;
   import java.util.List;
  @@ -98,6 +100,7 @@
       @Transactional
       private void createOrRemoveFeed() {
           if (hasFeed && getInstance().getFeed() == null) {
  +            // Does have no feed but user wants one, create it
               Feed feed = new Feed();
               feed.setDirectory(getInstance());
               feed.setAuthor(getInstance().getCreatedBy().getFullname());
  @@ -110,6 +113,7 @@
                   "Created syndication feed for this directory");
   
           } else if (!hasFeed && getInstance().getFeed() != null) {
  +            // Does have feed but user doesn't want it anymore... delete it
               getEntityManager().joinTransaction();
               getEntityManager().remove(getInstance().getFeed());
               getInstance().setFeed(null);
  @@ -119,7 +123,9 @@
                   "feedRemoved",
                   "Removed syndication feed of this directory");
           } else if (getInstance().getFeed() != null) {
  +            // Does have a feed and user still wants it, update the feed
               getInstance().getFeed().setTitle(getInstance().getName());
  +            getInstance().getFeed().setAuthor(getInstance().getCreatedBy().getFullname());
           }
       }
   
  @@ -154,4 +160,19 @@
           this.hasFeed = hasFeed;
       }
   
  +    public void resetFeed() {
  +        if (getInstance().getFeed() != null) {
  +            getLog().debug("resetting feed of directory");
  +            /**
  +            FeedDAO feedDAO = (FeedDAO)Component.getInstance("feedDAO");
  +            feedDAO.resetFeed(getInstance().getFeed());
  +             */
  +            getInstance().getFeed().getFeedEntries().clear();
  +            getFacesMessages().addFromResourceBundleOrDefault(
  +                FacesMessage.SEVERITY_INFO,
  +                "feedReset",
  +                "Queued removal of all feed entries from the syndication feed of this directory, please update to finalize");
  +        }
  +    }
  +
   }
  
  
  



More information about the jboss-cvs-commits mailing list