org.apache.lenya.cms.ant
Class ComputeNewDocumentId

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.lenya.cms.ant.PublicationTask
              extended by org.apache.lenya.cms.ant.ComputeNewDocumentId
Direct Known Subclasses:
ComputeArchiveDocumentId, ComputeCopyDocumentId, ComputeRenameDocumentId

public class ComputeNewDocumentId
extends PublicationTask

Ant task to set the property "newdocumentid" in the project with the value of computed unique document id, needed for the destination file Overriden for copy/move/rename.


Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
ComputeNewDocumentId()
          Creates a new instance of ComputeNewDocumentId
 
Method Summary
protected  java.lang.String compute(java.lang.String firstdocumentid, java.lang.String secdocumentid)
          Method to be overriden to compute the document id of the destination.
protected  java.lang.String computeUniqueId(java.lang.String documentid, java.lang.String area)
          Compute the unique document id: append a "_version number" to the id, if there is already a node in the sitetree with this id.
 void execute()
           
 java.lang.String getArea()
           
protected  java.lang.String getFirstdocumentid()
           
protected  java.lang.String getSecdocumentid()
           
 void setArea(java.lang.String string)
          set the value of the area in which is the sitetree
 void setFirstdocumentid(java.lang.String string)
          set the value of the document id of the source
protected  void setNewProperty(java.lang.String documentid)
          Set the property node.newdocumentid for the project
 void setSecdocumentid(java.lang.String string)
           
 
Methods inherited from class org.apache.lenya.cms.ant.PublicationTask
assertString, getContextPrefix, getPublication, getPublicationDirectory, getPublicationId, getServletContext
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComputeNewDocumentId

public ComputeNewDocumentId()
Creates a new instance of ComputeNewDocumentId

Method Detail

getArea

public java.lang.String getArea()
Returns:
string The area in which is the sitetree.

setArea

public void setArea(java.lang.String string)
set the value of the area in which is the sitetree

Parameters:
string - The area of the sitetree.

getFirstdocumentid

protected java.lang.String getFirstdocumentid()
Returns:
string The document id of the source

setFirstdocumentid

public void setFirstdocumentid(java.lang.String string)
set the value of the document id of the source

Parameters:
string - The document id of the source

getSecdocumentid

protected java.lang.String getSecdocumentid()
Returns:
string The document id of the parent of the destination or the new name in case of rename

setSecdocumentid

public void setSecdocumentid(java.lang.String string)
Parameters:
string - The document id of the parent of the destination or the new name in case of rename

compute

protected java.lang.String compute(java.lang.String firstdocumentid,
                                   java.lang.String secdocumentid)
Method to be overriden to compute the document id of the destination.

Parameters:
firstdocumentid - The document id of the source.
secdocumentid - Some string to characterize the destination (ex document id of parent, new name).
Returns:
string. The new document id

computeUniqueId

protected java.lang.String computeUniqueId(java.lang.String documentid,
                                           java.lang.String area)
Compute the unique document id: append a "_version number" to the id, if there is already a node in the sitetree with this id.

Parameters:
documentid - The document id.
area - The area in which is the sitetree.
Returns:
newdocumentid The unique document id.

setNewProperty

protected void setNewProperty(java.lang.String documentid)
Set the property node.newdocumentid for the project

Parameters:
documentid - The new document id.

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException
See Also:
Task.execute()


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.