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 2008/03/04 02:40:33 UTC
svn commit: r633349 - in /lenya/sandbox/modules/forrest: config/module.xml
java/src/org/apache/lenya/modules/forrest/Importer.java
java/src/org/apache/lenya/modules/forrest/UpdateChanges.java
java/test/org/apache/lenya/modules/forrest/ImportTest.java
Author: andreas
Date: Mon Mar 3 17:40:30 2008
New Revision: 633349
URL: http://svn.apache.org/viewvc?rev=633349&view=rev
Log:
Updating forrest module to use navigation module.
Modified:
lenya/sandbox/modules/forrest/config/module.xml
lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java
lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/UpdateChanges.java
lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java
Modified: lenya/sandbox/modules/forrest/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/config/module.xml?rev=633349&r1=633348&r2=633349&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/config/module.xml (original)
+++ lenya/sandbox/modules/forrest/config/module.xml Mon Mar 3 17:40:30 2008
@@ -21,7 +21,7 @@
<module xmlns="http://apache.org/lenya/module/1.0">
<id>org.apache.lenya.modules.forrest</id>
<depends module="org.apache.lenya.modules.externallinks"/>
- <depends module="org.apache.lenya.modules.sitemeta"/>
+ <depends module="org.apache.lenya.modules.navigation"/>
<package>org.apache.lenya.modules</package>
<version>0.1-dev</version>
<name>Forrest</name>
Modified: lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java?rev=633349&r1=633348&r2=633349&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java (original)
+++ lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java Mon Mar 3 17:40:30 2008
@@ -38,7 +38,9 @@
import org.apache.excalibur.source.SourceResolver;
import org.apache.lenya.cms.cocoon.source.SourceUtil;
import org.apache.lenya.cms.linking.Link;
+import org.apache.lenya.cms.metadata.MetaData;
import org.apache.lenya.cms.metadata.MetaDataException;
+import org.apache.lenya.cms.metadata.dublincore.DublinCore;
import org.apache.lenya.cms.publication.Area;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentFactory;
@@ -49,9 +51,7 @@
import org.apache.lenya.cms.site.SiteStructure;
import org.apache.lenya.modules.externallinks.ExternalLinks;
import org.apache.lenya.modules.externallinks.ExternalLinksRewriter;
-import org.apache.lenya.modules.foldernode.FolderNodeTransformer;
-import org.apache.lenya.modules.linkdocument.LinkDocument;
-import org.apache.lenya.modules.sitemeta.SiteMetaDataTransformer;
+import org.apache.lenya.modules.navigation.SiteMetaDataTransformer;
import org.apache.lenya.xml.DocumentHelper;
import org.apache.lenya.xml.NamespaceHelper;
import org.apache.xpath.XPathAPI;
@@ -273,8 +273,8 @@
}
Document doc = createDocument(info, type, contentSourceUri, path, linkName, title);
if (isFolderNode) {
- doc.getMetaData(FolderNodeTransformer.NAMESPACE).setValue(
- FolderNodeTransformer.ELEM_FOLDERNODE, Boolean.toString(true));
+ doc.getMetaData(SiteMetaDataTransformer.NAMESPACE).setValue(
+ SiteMetaDataTransformer.ELEM_FOLDER_NODE, Boolean.toString(true));
}
}
}
@@ -380,6 +380,8 @@
log("Created " + extension.toUpperCase() + " document (" + info.counterToString()
+ ") [" + path + "] from [" + sourceUri + "]", INFO);
}
+
+ setTitle(doc, title);
Link link = new Link();
link.setUuid(doc.getUUID());
@@ -393,6 +395,11 @@
log("URI: '" + sourceUri + "'", ERROR);
throw e;
}
+ }
+
+ protected void setTitle(Document doc, String title) throws MetaDataException {
+ MetaData meta = doc.getMetaData(DublinCore.DC_NAMESPACE);
+ meta.setValue(DublinCore.ELEMENT_TITLE, title);
}
protected String convertToNodeName(String string) {
Modified: lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/UpdateChanges.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/UpdateChanges.java?rev=633349&r1=633348&r2=633349&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/UpdateChanges.java (original)
+++ lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/UpdateChanges.java Mon Mar 3 17:40:30 2008
@@ -40,7 +40,7 @@
import org.apache.lenya.cms.site.SiteNode;
import org.apache.lenya.cms.site.SiteStructure;
import org.apache.lenya.cms.usecase.AbstractUsecase;
-import org.apache.lenya.modules.sitemeta.SiteMetaDataTransformer;
+import org.apache.lenya.modules.navigation.SiteMetaDataTransformer;
import org.tmatesoft.svn.core.ISVNLogEntryHandler;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNLogEntry;
Modified: lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java?rev=633349&r1=633348&r2=633349&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java (original)
+++ lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java Mon Mar 3 17:40:30 2008
@@ -53,10 +53,10 @@
* @throws Exception if an error occurs.
*/
public void testImport() throws Exception {
- Session session = getFreshSession();
+ Session session = login("lenya");
Publication pub = getPublication(session, PUB_ID);
Area area = pub.getArea("authoring");
-
+ /*
Importer importer = new Importer(getManager(), getLogger());
importer.importSite(area);
session.commit();
@@ -64,11 +64,12 @@
assertTrue(area.getSite().contains("/index"));
updateChanges();
+ */
publish();
}
public void disabled_testUpdateTitles() throws Exception {
- Session session = getFreshSession();
+ Session session = login("lenya");
Publication pub = getPublication(session, PUB_ID);
Area area = pub.getArea("authoring");
Document[] docs = area.getDocuments();
@@ -81,7 +82,7 @@
}
public void disabled_testUpdateResourceType() throws Exception {
- Session session = getFreshSession();
+ Session session = login("lenya");
Publication pub = getPublication(session, PUB_ID);
Area area = pub.getArea("authoring");
Document[] docs = area.getDocuments();
@@ -196,7 +197,7 @@
forceCheckIn(doc);
forceCheckIn(doc.getAreaVersion("live"));
- Session session = getFreshSession();
+ Session session = login("lenya");
Document freshDoc = getFreshDocument(doc, session);
if (WorkflowUtil.canInvoke(getManager(), session, getLogger(), freshDoc, "edit")) {
System.out.println("Editing " + nodes[i].getPath());
@@ -204,21 +205,21 @@
session.commit();
}
- session = getFreshSession();
+ session = login("lenya");
freshDoc = getFreshDocument(doc, session);
if (WorkflowUtil.canInvoke(getManager(), session, getLogger(), freshDoc, "submit")) {
System.out.println("Submitting " + nodes[i].getPath());
invoker.invoke(url, SUBMIT_USECASE, Collections.EMPTY_MAP);
}
- session = getFreshSession();
+ session = login("alice");
freshDoc = getFreshDocument(doc, session);
if (WorkflowUtil.canInvoke(getManager(), session, getLogger(), freshDoc, "publish")) {
System.out.println("Publishing " + nodes[i].getPath());
invoker.invoke(url, PUBLISH_USECASE, Collections.EMPTY_MAP);
}
- session = getFreshSession();
+ session = login("lenya");
freshDoc = getFreshDocument(doc, session);
Workflowable newWf = WorkflowUtil.getWorkflowable(getManager(), session, getLogger(), freshDoc);
System.out.println("State: " + newWf.getLatestVersion().getState());
@@ -234,10 +235,6 @@
DocumentFactory newFactory = DocumentUtil.createDocumentFactory(getManager(), session);
Document newDoc = newFactory.get(doc.getIdentifier());
return newDoc;
- }
-
- protected Session getFreshSession() throws AccessControlException {
- return login("lenya");
}
protected void forceCheckIn(Document doc) throws RepositoryException {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org