You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ed...@apache.org on 2003/10/29 14:41:28 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/ant CopyContentTask.java
edith 2003/10/29 05:41:28
Modified: src/java/org/apache/lenya/cms/ant CopyContentTask.java
Log:
check style and java doc
Revision Changes Path
1.4 +33 -13 cocoon-lenya/src/java/org/apache/lenya/cms/ant/CopyContentTask.java
Index: CopyContentTask.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ant/CopyContentTask.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CopyContentTask.java 21 Oct 2003 09:51:54 -0000 1.3
+++ CopyContentTask.java 29 Oct 2003 13:41:28 -0000 1.4
@@ -69,7 +69,8 @@
import org.apache.tools.ant.BuildException;
/**
- * Ant task to copy the contents (xml files) of a document
+ * Ant task to copy the contents (xml files) belonging to a subtree defined by a given document id and a given area.
+ * Visitor of the defined subtree (visitor pattern)
* @author edith
*/
public class CopyContentTask extends TwoDocumentsOperationTask {
@@ -89,13 +90,21 @@
DocumentBuilder builder = publication.getDocumentBuilder();
String parentid = node.getAbsoluteParentId();
- String srcDocumentid = parentid + "/" +node.getId();
- String destDocumentid = srcDocumentid.replaceFirst(getFirstdocumentid(),getSecdocumentid());
+ String srcDocumentid = parentid + "/" + node.getId();
+ String destDocumentid =
+ srcDocumentid.replaceFirst(
+ getFirstdocumentid(),
+ getSecdocumentid());
- Label[] labels = node.getLabels();
- for (int i=0 ; i<labels.length; i ++){
+ Label[] labels = node.getLabels();
+ for (int i = 0; i < labels.length; i++) {
String language = labels[i].getLanguage();
- String srcUrl = builder.buildCanonicalUrl(publication, getFirstarea(), srcDocumentid, language);
+ String srcUrl =
+ builder.buildCanonicalUrl(
+ publication,
+ getFirstarea(),
+ srcDocumentid,
+ language);
Document srcDoc;
try {
srcDoc = builder.buildDocument(publication, srcUrl);
@@ -104,10 +113,15 @@
}
File srcFile = srcDoc.getFile();
if (!srcFile.exists()) {
- log("There are no file "+srcFile.getAbsolutePath());
+ log("There are no file " + srcFile.getAbsolutePath());
return;
- }
- String destUrl = builder.buildCanonicalUrl(publication, getSecarea(), destDocumentid, language);
+ }
+ String destUrl =
+ builder.buildCanonicalUrl(
+ publication,
+ getSecarea(),
+ destDocumentid,
+ language);
Document destDoc;
try {
destDoc = builder.buildDocument(publication, destUrl);
@@ -116,14 +130,20 @@
}
File destFile = destDoc.getFile();
- log("copy file "+srcFile.getAbsolutePath() + "to file " + destFile.getAbsolutePath());
+ log(
+ "copy file "
+ + srcFile.getAbsolutePath()
+ + "to file "
+ + destFile.getAbsolutePath());
try {
- FileUtil.copy(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
+ FileUtil.copy(
+ srcFile.getAbsolutePath(),
+ destFile.getAbsolutePath());
} catch (FileNotFoundException e) {
throw new BuildException(e);
} catch (IOException e) {
throw new BuildException(e);
- }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org