lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/workflow WorkflowFactory.java CMSHistory.java
Date Tue, 05 Aug 2003 12:00:16 GMT
andreas     2003/08/05 05:00:16

  Modified:    src/java/org/apache/lenya/cms/workflow WorkflowFactory.java
                        CMSHistory.java
  Log:
  added method to initialize a workflow history based on an existing document
  
  Revision  Changes    Path
  1.16      +20 -9     cocoon-lenya/src/java/org/apache/lenya/cms/workflow/WorkflowFactory.java
  
  Index: WorkflowFactory.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/workflow/WorkflowFactory.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WorkflowFactory.java	29 Jul 2003 14:24:13 -0000	1.15
  +++ WorkflowFactory.java	5 Aug 2003 12:00:16 -0000	1.16
  @@ -70,14 +70,13 @@
   import java.util.List;
   import java.util.Map;
   
  -
   /**
    *
    * @author andreas
    */
   public class WorkflowFactory {
  -    public static final String WORKFLOW_DIRECTORY = "config/workflow".replace('/',
  -            File.separatorChar);
  +    public static final String WORKFLOW_DIRECTORY =
  +        "config/workflow".replace('/', File.separatorChar);
   
       /** Creates a new instance of WorkflowFactory */
       protected WorkflowFactory() {
  @@ -97,8 +96,7 @@
        * @return A workflow instance.
        * @throws WorkflowException when something went wrong.
        */
  -    public WorkflowInstance buildInstance(Document document)
  -        throws WorkflowException {
  +    public WorkflowInstance buildInstance(Document document) throws WorkflowException {
           assert document != null;
   
           return new CMSHistory(document).getInstance();
  @@ -124,7 +122,7 @@
       protected static Workflow buildWorkflow(Publication publication, String workflowFileName)
           throws WorkflowException {
           assert publication != null;
  -        assert (workflowFileName != null) && !"".equals(workflowFileName);
  +        assert(workflowFileName != null) && !"".equals(workflowFileName);
   
           File workflowDirectory = new File(publication.getDirectory(), WORKFLOW_DIRECTORY);
           File workflowFile = new File(workflowDirectory, workflowFileName);
  @@ -169,8 +167,21 @@
        * @param workflowId The ID of the workflow.
        * @throws WorkflowException When something goes wrong.
        */
  -    public static void initHistory(Document document, String workflowId)
  -        throws WorkflowException {
  +    public static void initHistory(Document document, String workflowId) throws WorkflowException
{
           new CMSHistory(document).initialize(workflowId);
       }
  +
  +    /**
  +     * Initializes the workflow history of a document that is a copy of
  +     * another document.
  +     * @param sourceDocument The original document.
  +     * @param destinationDocument The document to initialize the history for.
  +     * @throws WorkflowException When something goes wrong.
  +     */
  +    public static void initHistory(Document sourceDocument, Document destinationDocument)
  +        throws WorkflowException {
  +        CMSHistory history = new CMSHistory(sourceDocument);
  +        history.initialize(destinationDocument);
  +    }
  +
   }
  
  
  
  1.8       +13 -1     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CMSHistory.java	30 Jul 2003 16:40:32 -0000	1.7
  +++ CMSHistory.java	5 Aug 2003 12:00:16 -0000	1.8
  @@ -143,4 +143,16 @@
       public void setDocument(Document document) {
           this.document = document;
       }
  +    
  +    /**
  +     * Initializes the workflow history of another document using the same
  +     * workflow schema like this history.
  +     * @param newDocument The document to initialize the history for.
  +     * @throws WorkflowException when something went wrong.
  +     */
  +    protected void initialize(Document newDocument) throws WorkflowException {
  +        String workflowId = getWorkflowId();
  +        CMSHistory newHistory = new CMSHistory(newDocument);
  +        newHistory.initialize(workflowId);
  +    }
   }
  
  
  

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


Mime
View raw message