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 2005/03/01 18:54:52 UTC
svn commit: r155805 -
lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
Author: andreas
Date: Tue Mar 1 09:54:50 2005
New Revision: 155805
URL: http://svn.apache.org/viewcvs?view=rev&rev=155805
Log:
DocumentManager: use copy+delete for move
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java?view=diff&r1=155804&r2=155805
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java Tue Mar 1 09:54:50 2005
@@ -315,14 +315,8 @@
* org.apache.lenya.cms.publication.Document)
*/
public void moveAll(Document source, Document target) throws PublicationException {
- DocumentIdentityMap identityMap = source.getIdentityMap();
- SiteManager manager = identityMap.getPublication().getSiteManager(identityMap);
- Document[] descendantsArray = manager.getRequiringResources(source);
- OrderedDocumentSet descendants = new OrderedDocumentSet(descendantsArray);
- descendants.add(source);
-
- DocumentVisitor visitor = new MoveVisitor(this, source, target);
- descendants.visitAscending(visitor);
+ copyAll(source, target);
+ deleteAll(source);
}
/**
@@ -331,17 +325,8 @@
*/
public void moveAllLanguageVersions(Document source, Document target)
throws PublicationException {
- DocumentIdentityMap identityMap = source.getIdentityMap();
- String[] languages = source.getLanguages();
- for (int i = 0; i < languages.length; i++) {
-
- Document sourceVersion = identityMap.getFactory().getLanguageVersion(source,
- languages[i]);
- Document targetVersion = identityMap.getFactory().get(target.getArea(),
- target.getId(),
- languages[i]);
- moveDocument(sourceVersion, targetVersion);
- }
+ copyAllLanguageVersions(source, target);
+ deleteAllLanguageVersions(source);
}
/**
@@ -485,31 +470,6 @@
DocumentFactory factory = getRootTarget().getIdentityMap().getFactory();
return factory.get(getRootTarget().getArea(), targetId, source.getLanguage());
}
- }
-
- /**
- * DocumentVisitor to move documents.
- */
- public class MoveVisitor extends SourceTargetVisitor {
-
- /**
- * Ctor.
- * @param manager The document manager.
- * @param source The root source.
- * @param target The root target.
- */
- public MoveVisitor(DocumentManager manager, Document source, Document target) {
- super(manager, source, target);
- }
-
- /**
- * @see org.apache.lenya.cms.publication.util.DocumentVisitor#visitDocument(org.apache.lenya.cms.publication.Document)
- */
- public void visitDocument(Document source) throws PublicationException {
- Document target = getTarget(source);
- getDocumentManager().moveAllLanguageVersions(source, target);
- }
-
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org