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 2003/09/01 19:02:20 UTC

cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/ant InitWorkflowHistoryTask.java

andreas     2003/09/01 10:02:20

  Modified:    src/java/org/apache/lenya/cms/ant
                        InitWorkflowHistoryTask.java
  Log:
  writing initial state on history initialization
  
  Revision  Changes    Path
  1.7       +44 -11    cocoon-lenya/src/java/org/apache/lenya/cms/ant/InitWorkflowHistoryTask.java
  
  Index: InitWorkflowHistoryTask.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ant/InitWorkflowHistoryTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InitWorkflowHistoryTask.java	13 Aug 2003 17:21:57 -0000	1.6
  +++ InitWorkflowHistoryTask.java	1 Sep 2003 17:02:20 -0000	1.7
  @@ -62,10 +62,10 @@
   import org.apache.lenya.cms.publication.DocumentTypeBuilder;
   import org.apache.lenya.cms.publication.Publication;
   import org.apache.lenya.cms.workflow.WorkflowFactory;
  +import org.apache.lenya.workflow.Situation;
   
   import org.apache.tools.ant.BuildException;
   
  -
   /**
    * @author andreas
    *
  @@ -76,6 +76,38 @@
       private String language;
   
       /**
  +     * Returns the machine IP address from which the history was initialized.
  +     * @return A string.
  +     */
  +    public String getMachineIp() {
  +        return machineIp;
  +    }
  +
  +    /**
  +     * Sets the machine IP address from which the history was initialized.
  +     * @param machineIp A string.
  +     */
  +    public void setMachineIp(String machineIp) {
  +        this.machineIp = machineIp;
  +    }
  +
  +    /**
  +     * Returns the ID of the user who initialized the history.
  +     * @return A string.
  +     */
  +    public String getUserId() {
  +        return userId;
  +    }
  +
  +    /**
  +     * Sets the ID of the user who initialized the history.
  +     * @param userId A string.
  +     */
  +    public void setUserId(String userId) {
  +        this.userId = userId;
  +    }
  +
  +    /**
        * @see org.apache.tools.ant.Task#execute()
        */
       public void execute() throws BuildException {
  @@ -92,20 +124,18 @@
           Document document;
   
           try {
  -            document =
  -                DefaultDocumentBuilder.getInstance().buildDocument(
  -                    getPublication(),
  -                    url);
  +            document = DefaultDocumentBuilder.getInstance().buildDocument(getPublication(), url);
           } catch (DocumentBuildException e) {
               throw new BuildException(e);
           }
   
           try {
  +            String[] roles = new String[0];
  +            Situation situation =
  +                WorkflowFactory.newInstance().buildSituation(roles, getUserId(), getMachineIp());
               DocumentType type =
  -                DocumentTypeBuilder.buildDocumentType(
  -                    getDocumentType(),
  -                    getPublication());
  -            WorkflowFactory.initHistory(document, type.getWorkflowFileName());
  +                DocumentTypeBuilder.buildDocumentType(getDocumentType(), getPublication());
  +            WorkflowFactory.initHistory(document, type.getWorkflowFileName(), situation);
           } catch (Exception e) {
               throw new BuildException(e);
           }
  @@ -152,7 +182,7 @@
           assertString(aDocumentType);
           documentType = aDocumentType;
       }
  -    
  +
       /**
        * Get the language.
        *  
  @@ -170,5 +200,8 @@
       public void setLanguage(String string) {
           language = string;
       }
  +
  +    private String userId = "";
  +    private String machineIp = "";
   
   }
  
  
  

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