[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/admin  ...
From:       Bolesaw Dawidowicz <bdaw () o2 ! pl>
Date:       2005-08-31 21:21:17
Message-ID: E1EAa1F-000897-Vw () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]

  User: bdaw    
  Date: 05/08/31 17:21:17

  Modified:    forums/src/main/org/jboss/portlet/forums/commands/admin 
                        Tag: JBoss_Portal_Branch_2_0
                        DeleteMoveCategoryCommand.java
  Log:
  JBPORTAL-354: Delete category with it's content movement.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +40 -11    \
jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/admin/DeleteMoveCategoryCommand.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DeleteMoveCategoryCommand.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/admin/DeleteMoveCategoryCommand.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -b -r1.3 -r1.3.2.1
  --- DeleteMoveCategoryCommand.java	25 Apr 2005 09:52:09 -0000	1.3
  +++ DeleteMoveCategoryCommand.java	31 Aug 2005 21:21:17 -0000	1.3.2.1
  @@ -14,25 +14,33 @@
   import org.jboss.portal.core.modules.ModuleException;
   import org.jboss.portlet.forums.ForumsModule;
   import org.jboss.portlet.forums.commands.AbstractCommand;
  -import org.jboss.portlet.forums.model.Category;
  +import org.jboss.portlet.forums.model.*;
   import org.jboss.portlet.JBossActionRequest;
   import org.jboss.portlet.JBossActionResponse;
   
  +import java.util.*;
  +
   /**
    * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
    * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.3.2.1 $
    */
   public class DeleteMoveCategoryCommand
      extends AbstractCommand
   {
  -   /** DOCUMENT_ME */
  +   /**
  +    * DOCUMENT_ME
  +    */
      public Category source;
   
  -   /** DOCUMENT_ME */
  +   /**
  +    * DOCUMENT_ME
  +    */
      public Category target;
   
  -   /** DOCUMENT_ME */
  +   /**
  +    * DOCUMENT_ME
  +    */
      public ForumsModule module;
   
      public DeleteMoveCategoryCommand(JBossActionRequest request, \
JBossActionResponse response)  @@ -47,13 +55,34 @@
       */
      public Result execute()
      {
  +      try
  +      {
         if ((source != null) && (target != null) && \
!source.getID().equals(target.getID()))  {
  -         module.addAllForums(source, target);
  +            //module.addAllForums(source, target);
  +
  +            /* OK. this is really piece of shit... It's nessesary with current \
wrong hibernate schema  +             * with a lot of cached fields and not working \
cascade delete. All dependancies have to be  +             * cleanded in this wird \
style before removing category. It should be replaced after */  +            Iterator \
it = module.findForumsByCategoryID(source.getID()).iterator();  +            while \
(it.hasNext())  +            {
  +               Forum f = (Forum)it.next();
  +               if(f.getLastPost() != null){
  +                  f.getLastPost().getTopic().getForum().setCategory(target);
  +                  \
f.getLastPost().getTopic().getLastPost().getTopic().getForum().setCategory(target);  \
+                  f.getLastPost().getTopic().getFirstPost().getTopic().getForum().setCategory(target);
  }
  +               f.setCategory(target);
   
  -      try
  +               Iterator itn = module.findTopics(f).iterator();
  +               while (itn.hasNext())
         {
  +                  Topic t = (Topic)itn.next();
  +                  t.getForum().setCategory(target);
  +               }
  +            }
  +         }
            module.removeCategory(source);
            return TYPE_CATEGORY_REMOVED;
         }
  
  
  


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic