You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jw...@apache.org on 2005/05/13 17:16:16 UTC
svn commit: r170034 - in /lenya/trunk/src:
java/org/apache/lenya/cms/site/usecases/
webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/
Author: jwkaltz
Date: Fri May 13 08:16:14 2005
New Revision: 170034
URL: http://svn.apache.org/viewcvs?rev=170034&view=rev
Log:
remove dependence on new document instance in usecases (first step towards refactoring of document creation code)
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateDocument.java
lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateLanguage.java
lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java?rev=170034&r1=170033&r2=170034&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java Fri May 13 08:16:14 2005
@@ -209,12 +209,11 @@
if (parentDocument != null)
parentId = parentDocument.getId().substring(1);
- String childId = document.getName();
ParentChildCreatorInterface creator = documentType.getCreator();
creator.create(
getInitialContentsURI(usecaseDocument, documentType),
new File(publication.getContentDirectory(area), parentId),
- childId,
+ getNewDocumentName(),
ParentChildCreatorInterface.BRANCH_NODE,
navigationTitle,
language,
@@ -229,6 +228,11 @@
return document;
}
+
+ /**
+ * @return the name of the document being created in the usecase
+ */
+ protected abstract String getNewDocumentName();
/**
* @return the id of the new document being created in the usecase
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateDocument.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateDocument.java?rev=170034&r1=170033&r2=170034&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateDocument.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateDocument.java Fri May 13 08:16:14 2005
@@ -76,10 +76,17 @@
}
/**
+ * @see Create#getNewDocumentName()
+ */
+ protected String getNewDocumentName() {
+ return getParameterAsString(DOCUMENT_ID);
+ }
+
+ /**
* @see Create#getNewDocumentId()
*/
protected String getNewDocumentId() {
- return getSourceDocument().getId() + "/" + getParameterAsString(DOCUMENT_ID);
+ return getSourceDocument().getId() + "/" + getNewDocumentName();
}
/**
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateLanguage.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateLanguage.java?rev=170034&r1=170033&r2=170034&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateLanguage.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/CreateLanguage.java Fri May 13 08:16:14 2005
@@ -99,6 +99,15 @@
}
/**
+ * For new language version of a document, name is the same
+ * as that document's
+ * @see Create#getNewDocumentName()
+ */
+ protected String getNewDocumentName() {
+ return getSourceDocument().getName();
+ }
+
+ /**
* For new language version of a document, id is the same
* as that document's
* @see Create#getNewDocumentId()
Modified: lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java?rev=170034&r1=170033&r2=170034&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java Fri May 13 08:16:14 2005
@@ -75,6 +75,10 @@
super.doCheckExecutionConditions();
}
+ protected String getNewDocumentName() {
+ return getParameterAsString(DOCUMENT_ID);
+ }
+
protected void doExecute() throws Exception {
super.doExecute();
@@ -84,7 +88,7 @@
Request request = ObjectModelHelper.getRequest(objectModel);
Session session = request.getSession(false);
- String documentId = "/" + getParameterAsString(DOCUMENT_ID);
+ String documentId = "/" + getNewDocumentName();
String title = getParameterAsString(DublinCore.ELEMENT_TITLE);
String documentTypeName = getDocumentTypeName();
@@ -114,8 +118,6 @@
documentType = documentTypeBuilder.buildDocumentType(documentTypeName, publication);
- String childId = document.getName();
-
HashMap allParameters = new HashMap();
allParameters.put(Identity.class.getName(), session.getAttribute(Identity.class.getName()));
allParameters.put("title", title);
@@ -123,7 +125,7 @@
documentType.getCreator().create(
documentType.getSampleContentLocation(),
new File(publication.getContentDirectory(area), ""),
- childId,
+ documentId,
ParentChildCreatorInterface.LEAF_NODE,
title,
language,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org