You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2004/08/02 14:29:25 UTC

cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/workflow CMSHistory.java

andreas     2004/08/02 05:29:25

  Modified:    src/java/org/apache/lenya/cms/workflow CMSHistory.java
  Log:
  delete enclosing directories when deleting workflow history file
  
  Revision  Changes    Path
  1.25      +18 -4     cocoon-lenya/src/java/org/apache/lenya/cms/workflow/CMSHistory.java
  
  Index: CMSHistory.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/workflow/CMSHistory.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- CMSHistory.java	1 Mar 2004 16:18:16 -0000	1.24
  +++ CMSHistory.java	2 Aug 2004 12:29:25 -0000	1.25
  @@ -24,6 +24,7 @@
   import org.apache.lenya.cms.publication.Document;
   import org.apache.lenya.cms.publication.DocumentIdToPathMapper;
   import org.apache.lenya.cms.publication.Publication;
  +import org.apache.lenya.util.FileUtil;
   import org.apache.lenya.workflow.Situation;
   import org.apache.lenya.workflow.WorkflowException;
   import org.apache.lenya.workflow.impl.History;
  @@ -53,8 +54,8 @@
       public static final String NAME_ATTRIBUTE = "name";
       public static final String IP_ATTRIBUTE = "ip-address";
   
  -    /** (non-Javadoc)
  -     * @see org.apache.lenya.cms.workflow.History#createVersionElement(org.apache.lenya.xml.NamespaceHelper, org.apache.lenya.workflow.Situation)
  +    /**
  +     * @see org.apache.lenya.workflow.impl.History#createVersionElement(org.apache.lenya.xml.NamespaceHelper, org.apache.lenya.workflow.Situation)
        */
       protected Element createVersionElement(NamespaceHelper helper, Situation situation) {
           Element element = super.createVersionElement(helper, situation);
  @@ -130,7 +131,9 @@
       }
   
       /**
  -     * @see org.apache.lenya.workflow.impl.History#getHistoryFile()
  +     * Returns the history file for a certain document.
  +     * @param document The document.
  +     * @return A file.
        */
       protected File getHistoryFile(Document document) {
           File historyFile =
  @@ -213,4 +216,15 @@
           return getHistoryPath(getDocument());
       }
   
  +    /**
  +     * Additionally to deleting the workflow history, the parent directories
  +     * are deleted up to the workflow history directory.
  +     * @see org.apache.lenya.workflow.impl.History#delete()
  +     */
  +    public void delete() throws WorkflowException {
  +        super.delete();
  +        
  +        File stopDirectory = new File(getDocument().getPublication().getDirectory(), HISTORY_PATH);
  +        FileUtil.deleteParentDirs(getHistoryFile(), stopDirectory);
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org