Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

svn commit: r426608 [2/2] - in /lenya/trunk/src: impl/java/org/apache/lenya: msg#00231

cms.lenya.cvs

Subject: svn commit: r426608 [2/2] - in /lenya/trunk/src: impl/java/org/apache/lenya/cms/publication/ impl/test/org/apache/lenya/cms/publication/ impl/test/org/apache/lenya/cms/publication/util/ impl/test/org/apache/lenya/cms/site/usecases/ java/org/apache/leny...

Modified:
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeNodeID.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
(original)
+++
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
Fri Jul 28 09:37:34 2006
@@ -26,12 +26,12 @@
import org.apache.lenya.cms.publication.DocumentBuildException;
import org.apache.lenya.cms.publication.DocumentBuilder;
import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.DocumentManager;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.util.DocumentSet;
import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.cms.site.SiteException;
import org.apache.lenya.cms.site.SiteUtil;
import org.apache.lenya.cms.usecase.DocumentUsecase;
import org.apache.lenya.cms.usecase.UsecaseException;
@@ -133,8 +133,8 @@
if (!builder.isValidDocumentName(nodeId)) {
addErrorMessage("The document ID is not valid.");
} else {
- Document document = getTargetDocument();
- if (document.exists()) {
+ DocumentLocator target = getTargetLocator();
+ if (SiteUtil.contains(this.manager, getDocumentFactory(),
target)) {
addErrorMessage("The document does already exist.");
}
}
@@ -148,16 +148,10 @@
}
}

- protected Document getTargetDocument() throws DocumentBuildException {
- DocumentFactory identityMap = getDocumentFactory();
+ protected DocumentLocator getTargetLocator() throws DocumentBuildException
{
String nodeId = getParameterAsString(NODE_ID);
- DocumentLocator parentLocator =
getSourceDocument().getLocator().getParent();
- Document parent = identityMap.get(parentLocator);
- String parentPath = parent.getPath();
- Publication publication = getSourceDocument().getPublication();
- Document document = identityMap.get(publication,
getSourceDocument().getArea(), parentPath
- + "/" + nodeId, getSourceDocument().getLanguage());
- return document;
+ DocumentLocator parent = getSourceDocument().getLocator().getParent();
+ return parent.getChild(nodeId);
}

/**
@@ -166,8 +160,9 @@
protected void doExecute() throws Exception {
super.doExecute();

+ Document targetDoc;
Document source = getSourceDocument();
- Document target = getTargetDocument();
+ DocumentLocator target = getTargetLocator();
DocumentManager documentManager = null;
LinkRewriter rewriter = null;
try {
@@ -175,7 +170,7 @@
DocumentSet subsite = SiteUtil.getSubSite(this.manager, source);
Map targets = SiteUtil.getTransferedSubSite(this.manager,
source,
- getTargetDocument(),
+ getTargetLocator(),
SiteUtil.MODE_CANCEL);
Document[] subsiteDocs = subsite.getDocuments();
List nodes = new ArrayList();
@@ -195,8 +190,10 @@
documentManager = (DocumentManager)
this.manager.lookup(DocumentManager.ROLE);
documentManager.moveAll(source, target);

+ targetDoc = getDocumentFactory().get(target);
+
rewriter = (LinkRewriter) this.manager.lookup(LinkRewriter.ROLE);
- rewriter.rewriteLinks(source, target);
+ rewriter.rewriteLinks(source, targetDoc);
} finally {
if (documentManager != null) {
this.manager.release(documentManager);
@@ -206,7 +203,7 @@
}
}

- setTargetDocument(getTargetDocument());
+ setTargetDocument(targetDoc);
}

/**
@@ -216,9 +213,12 @@
protected String getNewDocumentId() {
String nodeId = getParameterAsString(NODE_ID);

- Document document = getSourceDocument();
-
- String oldPath = document.getPath();
+ String oldPath;
+ try {
+ oldPath = SiteUtil.getPath(this.manager, getSourceDocument());
+ } catch (SiteException e) {
+ throw new RuntimeException(e);
+ }
int lastSlashIndex = oldPath.lastIndexOf("/");
String strippedDocumentId = oldPath.substring(0, lastSlashIndex + 1);
String newDocumentId = strippedDocumentId + nodeId;

Modified:
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
(original)
+++
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
Fri Jul 28 09:37:34 2006
@@ -36,6 +36,7 @@
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentException;
import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.DocumentManager;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
@@ -138,8 +139,7 @@

documentManager = (DocumentManager)
this.manager.lookup(DocumentManager.ROLE);

- DocumentFactory map = getDocumentFactory();
- Document document = map.get(getPublication(),
+ DocumentLocator locator =
DocumentLocator.getLocator(getPublication().getId(),
getArea(),
getNewDocumentPath(),
getParameterAsString(LANGUAGE));
@@ -151,20 +151,23 @@
if (getParameterAsString(SAMPLE) != null
&& getParameterAsString(SAMPLE).length() > 0)
resourceType.setSampleURI(getParameterAsString(SAMPLE));
- documentManager.add(document,
+ documentManager.add(getDocumentFactory(),
+ locator,
resourceType,
getSourceExtension(),
getParameterAsString(DublinCore.ELEMENT_TITLE),
getVisibleInNav());
resourceType.setSampleURI(""); // reset to default sample
} else {
- documentManager.add(document,
+ documentManager.add(locator,
initialDocument,
getSourceExtension(),
getParameterAsString(DublinCore.ELEMENT_TITLE),
getVisibleInNav());
}

+ Document document = getDocumentFactory().get(locator);
+
setMetaData(document);

// the location to navigate to after completion of usecase
@@ -226,14 +229,18 @@
throw new IllegalArgumentException("parameter document may not be
null");

MetaData dcMetaData = document.getMetaData(DublinCore.DC_NAMESPACE);
-
- dcMetaData.setValue(DublinCore.ELEMENT_TITLE,
getParameterAsString(DublinCore.ELEMENT_TITLE));
- dcMetaData.setValue(DublinCore.ELEMENT_CREATOR,
getParameterAsString(DublinCore.ELEMENT_CREATOR));
+
+ dcMetaData.setValue(DublinCore.ELEMENT_TITLE,
+ getParameterAsString(DublinCore.ELEMENT_TITLE));
+ dcMetaData.setValue(DublinCore.ELEMENT_CREATOR,
+ getParameterAsString(DublinCore.ELEMENT_CREATOR));
dcMetaData.setValue(DublinCore.ELEMENT_PUBLISHER,
getParameterAsString(DublinCore.ELEMENT_PUBLISHER));
- dcMetaData.setValue(DublinCore.ELEMENT_SUBJECT,
getParameterAsString(DublinCore.ELEMENT_SUBJECT));
+ dcMetaData.setValue(DublinCore.ELEMENT_SUBJECT,
+ getParameterAsString(DublinCore.ELEMENT_SUBJECT));
dcMetaData.setValue(DublinCore.ELEMENT_DATE,
getParameterAsString(DublinCore.ELEMENT_DATE));
- dcMetaData.setValue(DublinCore.ELEMENT_RIGHTS,
getParameterAsString(DublinCore.ELEMENT_RIGHTS));
+ dcMetaData.setValue(DublinCore.ELEMENT_RIGHTS,
+ getParameterAsString(DublinCore.ELEMENT_RIGHTS));
dcMetaData.setValue(DublinCore.ELEMENT_LANGUAGE,
getParameterAsString(LANGUAGE));
}


Modified:
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java
(original)
+++
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java
Fri Jul 28 09:37:34 2006
@@ -158,8 +158,7 @@
DocumentFactory map = getDocumentFactory();

DocumentLocator loc = doc.getLocator().getAreaVersion(getTargetArea());
- Document target = doc.getFactory().get(loc);
- target = SiteUtil.getAvailableDocument(this.manager, target);
+ loc = SiteUtil.getAvailableLocator(this.manager, map, loc);

DocumentSet docsToCopy = getTargetDocsToCopy();

@@ -180,9 +179,9 @@
Document existingSourceDoc =
DocumentHelper.getExistingLanguageVersion(sourceDoc,
doc.getLanguage());
DocumentLocator targetLoc =
existingSourceDoc.getLocator().getAreaVersion(getTargetArea());
- Document targetDoc = map.get(targetLoc);
- documentManager.copyDocument(existingSourceDoc, targetDoc);
- if (!targetDoc.getArea().equals(Publication.AUTHORING_AREA)) {
+ documentManager.copyDocument(existingSourceDoc, targetLoc);
+ if (!targetLoc.getArea().equals(Publication.AUTHORING_AREA)) {
+ Document targetDoc = getDocumentFactory().get(targetLoc);
targetDoc.setPlaceholder();
}
}
@@ -216,7 +215,7 @@
}
}

- setTargetDocument(target);
+ setTargetDocument(getDocumentFactory().get(loc));

}


Modified:
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Paste.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Paste.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Paste.java
(original)
+++
lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Paste.java
Fri Jul 28 09:37:34 2006
@@ -23,6 +23,7 @@
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentBuildException;
import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.DocumentManager;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.util.DocumentSet;
@@ -107,9 +108,15 @@
nodes.addAll(AssetUtil.getAssetNodes(subsiteDocs[i],
this.manager, getLogger()));
}
String id =
subsiteDocs[i].getId().substring(clippedBase.length());
- Document targetSubsiteDoc = map.get(pub, area, targetBase +
id, subsiteDocs[i].getLanguage());
+ Document targetSubsiteDoc = map.get(pub,
+ area,
+ targetBase + id,
+ subsiteDocs[i].getLanguage());
nodes.add(targetSubsiteDoc.getRepositoryNode());
- nodes.addAll(AssetUtil.getCopiedAssetNodes(subsiteDocs[i],
targetSubsiteDoc, this.manager, getLogger()));
+ nodes.addAll(AssetUtil.getCopiedAssetNodes(subsiteDocs[i],
+ targetSubsiteDoc,
+ this.manager,
+ getLogger()));
}

} catch (Exception e) {
@@ -130,15 +137,15 @@
Publication pub = getSourceDocument().getPublication();
Document clippedDocument = clipboard.getDocument(identityMap, pub);

- Document targetDocument = getTargetDocument();
+ DocumentLocator target = getTargetLocator();
DocumentManager documentManager = null;
try {
documentManager = (DocumentManager)
this.manager.lookup(DocumentManager.ROLE);

if (clipboard.getMethod() == Clipboard.METHOD_COPY) {
- documentManager.copyAll(clippedDocument, targetDocument);
+ documentManager.copyAll(clippedDocument, target);
} else if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
- documentManager.moveAll(clippedDocument, targetDocument);
+ documentManager.moveAll(clippedDocument, target);
} else {
throw new RuntimeException("This clipboard method is not
supported!");
}
@@ -149,7 +156,7 @@
}
}

- protected Document getTargetDocument() throws SiteException,
DocumentBuildException,
+ protected DocumentLocator getTargetLocator() throws SiteException,
DocumentBuildException,
ServiceException {
DocumentFactory identityMap = getDocumentFactory();
Clipboard clipboard = new ClipboardHelper().getClipboard(getContext());
@@ -159,12 +166,13 @@
String targetArea = getSourceDocument().getArea();
String language = clippedDocument.getLanguage();
String nodeId = clippedDocument.getName();
- String potentialDocumentId = getSourceDocument().getId() + "/" +
nodeId;
+ String potentialPath = getSourceDocument().getId() + "/" + nodeId;

- Document potentialDocument =
identityMap.get(getSourceDocument().getPublication(),
+ DocumentLocator potentialLoc =
DocumentLocator.getLocator(getSourceDocument().getPublication()
+ .getId(),
targetArea,
- potentialDocumentId,
+ potentialPath,
language);
- return SiteUtil.getAvailableDocument(this.manager, potentialDocument);
+ return SiteUtil.getAvailableLocator(this.manager,
getDocumentFactory(), potentialLoc);
}
}

Modified:
lenya/trunk/src/modules/resource/java/test/org/apache/lenya/cms/publication/ResourceWrapperTest.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/resource/java/test/org/apache/lenya/cms/publication/ResourceWrapperTest.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/resource/java/test/org/apache/lenya/cms/publication/ResourceWrapperTest.java
(original)
+++
lenya/trunk/src/modules/resource/java/test/org/apache/lenya/cms/publication/ResourceWrapperTest.java
Fri Jul 28 09:37:34 2006
@@ -95,12 +95,11 @@
* @throws DocumentException
* @throws MetaDataException
*/
- public static Document createResource(DocumentFactory factory, Publication
pub, String documentId,
- ServiceManager manager, Logger logger)
- throws ServiceException, DocumentBuildException,
PublicationException,
- MalformedURLException, IOException, RepositoryException,
DocumentException,
- MetaDataException {
-
+ public static Document createResource(DocumentFactory factory, Publication
pub,
+ String documentId, ServiceManager manager, Logger logger) throws
ServiceException,
+ DocumentBuildException, PublicationException,
MalformedURLException, IOException,
+ RepositoryException, DocumentException, MetaDataException {
+
String extension = "png";

Document doc = null;
@@ -111,14 +110,19 @@

try {
docManager = (DocumentManager)
manager.lookup(DocumentManager.ROLE);
- doc = factory.get(pub, Publication.AUTHORING_AREA, documentId,
pub.getDefaultLanguage());
+ DocumentLocator loc = DocumentLocator.getLocator(pub.getId(),
+ Publication.AUTHORING_AREA,
+ documentId,
+ pub.getDefaultLanguage());
+
+ SiteUtil.getSiteStructure(manager, factory, pub,
Publication.AUTHORING_AREA)
+ .getRepositoryNode()
+ .lock();

- SiteUtil.getSiteStructure(manager, doc).getRepositoryNode().lock();
-
selector = (ServiceSelector) manager.lookup(ResourceType.ROLE +
"Selector");
resourceType = (ResourceType) selector.select("resource");

- docManager.add(doc, resourceType, extension, "Test Resource",
true);
+ doc = docManager.add(factory, loc, resourceType, extension, "Test
Resource", true);

ResourceWrapper resource = new ResourceWrapper(doc, manager,
logger);
resource.write(IMAGE_URL);

Modified:
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/DefaultSiteTree.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/DefaultSiteTree.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/DefaultSiteTree.java
(original)
+++
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/DefaultSiteTree.java
Fri Jul 28 09:37:34 2006
@@ -75,11 +75,11 @@
* @param logger The logger.
* @throws SiteException if an error occurs.
*/
- protected DefaultSiteTree(Publication publication, String _area,
ServiceManager manager, Logger logger)
- throws SiteException {
-
+ protected DefaultSiteTree(Publication publication, String _area,
ServiceManager manager,
+ Logger logger) throws SiteException {
+
ContainerUtil.enableLogging(this, logger);
-
+
this.sourceUri = publication.getSourceURI() + "/content/" + _area + "/"
+ SITE_TREE_FILENAME;
this.area = _area;
@@ -145,14 +145,12 @@
}
NodeList nodes = node.getChildNodes();

-
for (int i = 0; i < nodes.getLength(); i++) {
NamedNodeMap attributes = nodes.item(i).getAttributes();

if (attributes != null) {
Node idAttribute = attributes.getNamedItem("id");

-
if (idAttribute != null &&
!"".equals(idAttribute.getNodeValue())
&& idAttribute.getNodeValue().equals(ids.get(0))) {
return findNode(nodes.item(i), ids.subList(1, ids.size()));
@@ -171,6 +169,7 @@
public synchronized void addNode(SiteTreeNode node, String refDocumentId)
throws SiteException {
addNode(node.getParent().getAbsoluteId(),
node.getId(),
+ node.getUUID(),
node.getLabels(),
node.visibleInNav(),
node.getHref(),
@@ -181,11 +180,11 @@

/**
* @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
java.lang.String,
- * org.apache.lenya.cms.site.Label[], boolean)
+ * String, org.apache.lenya.cms.site.Label[], boolean)
*/
- public synchronized void addNode(String parentid, String id, Label[]
labels,
+ public synchronized void addNode(String parentid, String id, String uuid,
Label[] labels,
boolean visibleInNav) throws SiteException {
- addNode(parentid, id, labels, visibleInNav, null, null, false);
+ addNode(parentid, id, uuid, labels, visibleInNav, null, null, false);
}

/**
@@ -196,11 +195,11 @@
}

/**
- * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
+ * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
String,
* org.apache.lenya.cms.site.Label[], boolean, java.lang.String,
java.lang.String, boolean,
* java.lang.String)
*/
- public synchronized void addNode(String documentid, Label[] labels,
boolean visibleInNav,
+ public synchronized void addNode(String documentid, String uuid, Label[]
labels, boolean visibleInNav,
String href, String suffix, boolean link, String refDocumentId)
throws SiteException {
StringBuffer buf = new StringBuffer();
StringTokenizer st = new StringTokenizer(documentid, "/");
@@ -211,33 +210,33 @@
}
String parentid = buf.toString();
String id = st.nextToken();
- addNode(parentid, id, labels, visibleInNav, href, suffix, link,
refDocumentId);
+ addNode(parentid, id, uuid, labels, visibleInNav, href, suffix, link,
refDocumentId);
}

/**
- * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
+ * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
String,
* org.apache.lenya.cms.site.Label[], boolean, java.lang.String,
java.lang.String, boolean)
*/
- public synchronized void addNode(String documentid, Label[] labels,
boolean visibleInNav,
+ public synchronized void addNode(String documentid, String uuid, Label[]
labels, boolean visibleInNav,
String href, String suffix, boolean link) throws SiteException {
- addNode(documentid, labels, visibleInNav, href, suffix, link, null);
+ addNode(documentid, uuid, labels, visibleInNav, href, suffix, link,
null);
}

/**
- * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
java.lang.String,
+ * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
java.lang.String, String,
* org.apache.lenya.cms.site.Label[], boolean, java.lang.String,
java.lang.String, boolean)
*/
- public synchronized void addNode(String parentid, String id, Label[]
labels,
+ public synchronized void addNode(String parentid, String id, String uuid,
Label[] labels,
boolean visibleInNav, String href, String suffix, boolean link)
throws SiteException {
- addNode(parentid, id, labels, visibleInNav, href, suffix, link, null);
+ addNode(parentid, id, uuid, labels, visibleInNav, href, suffix, link,
null);
}

/**
- * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
java.lang.String,
+ * @see org.apache.lenya.cms.site.tree.SiteTree#addNode(java.lang.String,
java.lang.String, String,
* org.apache.lenya.cms.site.Label[], boolean, java.lang.String,
java.lang.String, boolean,
* java.lang.String)
*/
- public synchronized void addNode(String parentid, String id, Label[]
labels,
+ public synchronized void addNode(String parentid, String id, String uuid,
Label[] labels,
boolean visibleInNav, String href, String suffix, boolean link,
String refDocumentId)
throws SiteException {

@@ -264,6 +263,7 @@
NamespaceHelper helper = new NamespaceHelper(NAMESPACE_URI, "",
this.document);
Element child = helper.createElement(SiteTreeNodeImpl.NODE_NAME);
child.setAttribute(SiteTreeNodeImpl.ID_ATTRIBUTE_NAME, id);
+ child.setAttribute(SiteTreeNodeImpl.UUID_ATTRIBUTE_NAME, uuid);

if (visibleInNav) {
child.setAttribute(SiteTreeNodeImpl.VISIBLEINNAV_ATTRIBUTE_NAME,
"true");
@@ -520,9 +520,12 @@
assert newParent != null;
String parentId = newParent.getAbsoluteId();
String id = newid;
+
+ String uuid = subtreeRoot.getUUID();

this.addNode(parentId,
id,
+ uuid,
subtreeRoot.getLabels(),
subtreeRoot.visibleInNav(),
subtreeRoot.getHref(),
@@ -622,6 +625,22 @@
return Boolean.valueOf(value).booleanValue();
} else {
return true;
+ }
+ }
+
+ public SiteTreeNode getNodeByUUID(String uuid) throws SiteException {
+ String xPath = "//*[@uuid = '" + uuid + "']";
+ Node element;
+ try {
+ element = (Element) XPathAPI.selectSingleNode(this.document,
xPath);
+ } catch (TransformerException e) {
+ throw new SiteException(e);
+ }
+ if (element == null) {
+ // TODO: remove when UUIDs are fully functional
+ return getNode(uuid);
+ } else {
+ return new SiteTreeNodeImpl(element);
}
}


Modified:
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTree.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTree.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTree.java
(original)
+++
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTree.java
Fri Jul 28 09:37:34 2006
@@ -38,18 +38,20 @@
*
* @param parentid where the node is to be added
* @param id e.g. "concepts"
+ * @param uuid The UUID.
* @param labels the labels of the node that is to be added
* @param visibleInNav the visibility of a node in the navigation. It is
meant to hide specific nodes within the "public" navigation whereas the node is
visible within the info/site area.
*
* @throws SiteException if the addition failed
*/
- void addNode(String parentid, String id, Label[] labels, boolean
visibleInNav) throws SiteException;
+ void addNode(String parentid, String id, String uuid, Label[] labels,
boolean visibleInNav) throws SiteException;

/**
* Add a node. TODO: Lenya 1.2.X supports argument visibleInNav
*
* @param parentid the node where the new node is to be inserted
* @param id the node id
+ * @param uuid The UUID.
* @param labels the labels
* @param visibleInNav determines the visibility of a node in the
navigation. It is meant to hide specific nodes within the "public" navigation
whereas the node is visible within the info/site area.
* @param href the href of the new node (internal and external references)

@@ -58,7 +60,7 @@
*
* @throws SiteException if the addition failed
*/
- void addNode(String parentid, String id, Label[] labels, boolean
visibleInNav, String href, String suffix,
+ void addNode(String parentid, String id, String uuid, Label[] labels,
boolean visibleInNav, String href, String suffix,
boolean link) throws SiteException;

/**
@@ -66,6 +68,7 @@
*
* @param parentid the node where the new node is to be inserted
* @param id the node id
+ * @param uuid The UUID.
* @param labels the labels
* @param visibleInNav determines the visibility of a node in the
navigation
* @param href the href of the new node
@@ -75,7 +78,7 @@
*
* @throws SiteException if the addition failed
*/
- void addNode(String parentid, String id, Label[] labels, boolean
visibleInNav, String href, String suffix,
+ void addNode(String parentid, String id, String uuid, Label[] labels,
boolean visibleInNav, String href, String suffix,
boolean link, String refDocumentId) throws SiteException;

/**
@@ -83,6 +86,7 @@
*
* @param documentid the document-id of the new node. From this the
parent-id and the id are
* computed
+ * @param uuid The UUID.
* @param labels the labels
* @param visibleInNav determines the visibility of a node in the
navigation
* @param href the href
@@ -91,7 +95,7 @@
*
* @throws SiteException if the addition failed
*/
- void addNode(String documentid, Label[] labels, boolean visibleInNav,
String href, String suffix, boolean link)
+ void addNode(String documentid, String uuid, Label[] labels, boolean
visibleInNav, String href, String suffix, boolean link)
throws SiteException;

/**
@@ -100,6 +104,7 @@
*
* @param documentid the document-id of the new node. From this the
parent-id and the id are
* computed
+ * @param uuid The UUID.
* @param labels the labels
* @param visibleInNav determines the visibility of a node in the
navigation
* @param href the href
@@ -109,7 +114,7 @@
*
* @throws SiteException if the addition failed
*/
- void addNode(String documentid, Label[] labels, boolean visibleInNav,
String href, String suffix, boolean link,
+ void addNode(String documentid, String uuid, Label[] labels, boolean
visibleInNav, String href, String suffix, boolean link,
String refDocumentId) throws SiteException;

/**
@@ -238,5 +243,12 @@
* @throws SiteException if an error occurs.
*/
void save() throws SiteException;
+
+ /**
+ * @param uuid The UUID.
+ * @return A node.
+ * @throws SiteException
+ */
+ SiteTreeNode getNodeByUUID(String uuid) throws SiteException;

}

Modified:
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTreeNodeImpl.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTreeNodeImpl.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTreeNodeImpl.java
(original)
+++
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/SiteTreeNodeImpl.java
Fri Jul 28 09:37:34 2006
@@ -105,7 +105,13 @@
getLogger().warn("Node equals OwnerDocument: " + this);
return "";
}
- return
this.node.getAttributes().getNamedItem(UUID_ATTRIBUTE_NAME).getNodeValue();
+ Element element = (Element) this.node;
+ if (element.hasAttribute(UUID_ATTRIBUTE_NAME)) {
+ return element.getAttribute(UUID_ATTRIBUTE_NAME);
+ }
+ else {
+ return getAbsoluteId();
+ }
}

/**

Modified:
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/TreeSiteManager.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/TreeSiteManager.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/TreeSiteManager.java
(original)
+++
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/tree/TreeSiteManager.java
Fri Jul 28 09:37:34 2006
@@ -24,9 +24,11 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.PublicationUtil;
import org.apache.lenya.cms.repository.RepositoryItemFactory;
import org.apache.lenya.cms.site.AbstractSiteManager;
import org.apache.lenya.cms.site.Label;
@@ -107,8 +109,8 @@
* @see
org.apache.lenya.cms.site.SiteManager#requires(org.apache.lenya.cms.publication.DocumentFactory,
* org.apache.lenya.cms.site.SiteNode,
org.apache.lenya.cms.site.SiteNode)
*/
- public boolean requires(DocumentFactory map, SiteNode dependingResource,
SiteNode requiredResource)
- throws SiteException {
+ public boolean requires(DocumentFactory map, SiteNode dependingResource,
+ SiteNode requiredResource) throws SiteException {
return getAncestors(dependingResource).contains(requiredResource);
}

@@ -116,7 +118,8 @@
* @see
org.apache.lenya.cms.site.SiteManager#getRequiredResources(org.apache.lenya.cms.publication.DocumentFactory,
* org.apache.lenya.cms.site.SiteNode)
*/
- public SiteNode[] getRequiredResources(DocumentFactory map, SiteNode
resource) throws SiteException {
+ public SiteNode[] getRequiredResources(DocumentFactory map, SiteNode
resource)
+ throws SiteException {
List ancestors = getAncestors(resource);
return (SiteNode[]) ancestors.toArray(new SiteNode[ancestors.size()]);
}
@@ -163,28 +166,12 @@
*/
public boolean contains(Document resource) throws SiteException {
SiteTree tree = getTree(resource);
- SiteTreeNode node = tree.getNode(resource.getPath());
+ SiteTreeNode node = tree.getNodeByUUID(resource.getUUID());
boolean exists = node != null && node.getLabel(resource.getLanguage())
!= null;
return exists;
}

/**
- * @see
org.apache.lenya.cms.site.SiteManager#getUUID(org.apache.lenya.cms.publication.Document)
- */
- public String getUUID(Document resource) throws SiteException {
- String uuid = null;
- SiteTree tree = getTree(resource);
- SiteTreeNode node = tree.getNode(resource.getPath());
- if (node != null) {
- uuid = node.getUUID();
- }
- if (uuid == null) {
- getLogger().warn("No UUID: " + resource);
- }
- return uuid;
- }
-
- /**
* @see
org.apache.lenya.cms.site.SiteManager#containsInAnyLanguage(org.apache.lenya.cms.publication.Document)
*/
public boolean containsInAnyLanguage(Document resource) throws
SiteException {
@@ -241,6 +228,7 @@

if (siblingDocId == null) {
destinationTree.addNode(destinationDocument.getPath(),
+ destinationDocument.getUUID(),
labels,
sourceNode.visibleInNav(),
sourceNode.getHref(),
@@ -248,6 +236,7 @@
sourceNode.hasLink());
} else {
destinationTree.addNode(destinationDocument.getPath(),
+ destinationDocument.getUUID(),
labels,
sourceNode.visibleInNav(),
sourceNode.getHref(),
@@ -340,7 +329,7 @@
Label label = null;
SiteTree siteTree = getTree(document);
if (siteTree != null) {
- SiteTreeNode node = siteTree.getNode(document.getPath());
+ SiteTreeNode node = siteTree.getNodeByUUID(document.getUUID());
if (node == null) {
throw new SiteException("Node for document [" + document + "]
does not exist!");
}
@@ -348,7 +337,7 @@
}

if (label == null) {
- throw new SiteException("The label of document [" + document +
"] is null!");
+ throw new SiteException("The label of document [" + document + "]
is null!");
}

return label;
@@ -366,7 +355,7 @@

for (int i = 1; i < allNodes.size(); i++) {
SiteTreeNode node = (SiteTreeNode) allNodes.get(i);
- Document doc = map.get(publication, area,
node.getAbsoluteId());
+ Document doc = map.get(publication, area, node.getUUID());
String[] languages = doc.getLanguages();
for (int l = 0; l < languages.length; l++) {
documents.add(map.getLanguageVersion(doc, languages[l]));
@@ -381,7 +370,7 @@
/**
* @see
org.apache.lenya.cms.site.SiteManager#add(org.apache.lenya.cms.publication.Document)
*/
- public void add(Document document) throws SiteException {
+ public void add(String path, Document document) throws SiteException {

if (contains(document)) {
throw new SiteException("The document [" + document + "] is
already contained!");
@@ -389,12 +378,12 @@
SiteTree tree = getTree(document);
Label label = new Label("", document.getLanguage());

- SiteTreeNode node = tree.getNode(document.getPath());
+ SiteTreeNode node = tree.getNode(path);
if (node == null) {
Label[] labels = { label };
- tree.addNode(document.getPath(), labels, true, null, null, false);
+ tree.addNode(path, document.getUUID(), labels, true, null, null,
false);
} else {
- tree.addLabel(document.getPath(), label);
+ tree.addLabel(path, label);
}

}
@@ -421,26 +410,21 @@
* @see
org.apache.lenya.cms.site.SiteManager#getSiteStructure(org.apache.lenya.cms.publication.DocumentFactory,
* org.apache.lenya.cms.publication.Publication, java.lang.String)
*/
- public SiteStructure getSiteStructure(DocumentFactory map, Publication
publiation,
- String area) throws SiteException {
+ public SiteStructure getSiteStructure(DocumentFactory map, Publication
publiation, String area)
+ throws SiteException {
return getTree(map, publiation, area);
}

/**
- * @see
org.apache.lenya.cms.site.SiteManager#getAvailableDocument(org.apache.lenya.cms.publication.Document)
+ * @see
org.apache.lenya.cms.site.SiteManager#getAvailableLocator(DocumentFactory,
+ * org.apache.lenya.cms.publication.DocumentLocator)
*/
- public Document getAvailableDocument(Document document) throws
SiteException {
- String availableDocumentId = computeUniqueDocumentId(document);
- Document availableDocument;
- try {
- availableDocument =
document.getFactory().get(document.getPublication(),
- document.getArea(),
- availableDocumentId,
- document.getLanguage());
- } catch (DocumentBuildException e) {
- throw new SiteException(e);
- }
- return availableDocument;
+ public DocumentLocator getAvailableLocator(DocumentFactory factory,
DocumentLocator locator)
+ throws SiteException {
+ return DocumentLocator.getLocator(locator.getPublicationId(),
+ locator.getArea(),
+ computeUniquePath(factory, locator),
+ locator.getLanguage());
}

/**
@@ -450,23 +434,30 @@
* @return the unique documentid
* @throws SiteException if an error occurs.
*/
- protected String computeUniqueDocumentId(Document document) throws
SiteException {
- String documentId = document.getPath();
+ protected String computeUniquePath(DocumentFactory factory,
DocumentLocator locator)
+ throws SiteException {
+ String path = locator.getPath();

- SiteTree tree = getTree(document);
+ Publication pub;
+ try {
+ pub = PublicationUtil.getPublication(this.manager,
locator.getPublicationId());
+ } catch (PublicationException e) {
+ throw new SiteException(e);
+ }
+ SiteTree tree = getTree(factory, pub, locator.getArea());

- SiteTreeNode node = tree.getNode(documentId);
+ SiteTreeNode node = tree.getNode(path);
String suffix = null;
int version = 0;
String idwithoutsuffix = null;

if (node != null) {
- int n = documentId.lastIndexOf("/");
+ int n = path.lastIndexOf("/");
String lastToken = "";
- String substring = documentId;
- if ((n < documentId.length()) && (n > 0)) {
- lastToken = documentId.substring(n);
- substring = documentId.substring(0, n);
+ String substring = path;
+ if ((n < path.length()) && (n > 0)) {
+ lastToken = path.substring(n);
+ substring = path.substring(0, n);
}

int l = lastToken.length();
@@ -481,12 +472,12 @@

while (node != null) {
version = version + 1;
- documentId = idwithoutsuffix + "-" + version;
- node = tree.getNode(documentId);
+ path = idwithoutsuffix + "-" + version;
+ node = tree.getNode(path);
}
}

- return documentId;
+ return path;
}

public boolean isVisibleInNav(Document document) throws SiteException {
@@ -494,11 +485,48 @@
return tree.isVisibleInNav(document.getPath());
}

- public String getPath(String area, String uuid) throws SiteException {
- return uuid;
+ public String getPath(DocumentFactory factory, Publication pub, String
area, String uuid)
+ throws SiteException {
+ SiteTree tree = getTree(factory, pub, area);
+ SiteTreeNode node = tree.getNodeByUUID(uuid);
+ if (node == null) {
+ throw new SiteException("No node found for [" + pub.getId() + ":"
+ area + ":" + uuid
+ + "]");
+ }
+ return node.getAbsoluteId();
}

- public String getUUID(String area, String path) throws SiteException {
- return path;
+ public String getUUID(DocumentFactory factory, Publication pub, String
area, String path)
+ throws SiteException {
+ SiteTree tree = getTree(factory, pub, area);
+ SiteTreeNode node = tree.getNode(path);
+ if (node == null) {
+ throw new SiteException("No node found for [" + pub.getId() + ":"
+ area + ":" + path
+ + "]");
+ }
+ return node.getUUID();
}
+
+ public boolean contains(DocumentFactory factory, Publication pub, String
area, String path)
+ throws SiteException {
+ SiteTree tree = getTree(factory, pub, area);
+ return tree.getNode(path) != null;
+ }
+
+ public boolean contains(DocumentFactory factory, DocumentLocator locator)
throws SiteException {
+ Publication pub;
+ try {
+ pub = PublicationUtil.getPublication(this.manager,
locator.getPublicationId());
+ } catch (PublicationException e) {
+ throw new SiteException(e);
+ }
+ SiteTree tree = getTree(factory, pub, locator.getArea());
+ SiteTreeNode node = tree.getNode(locator.getPath());
+ if (node == null) {
+ return false;
+ } else {
+ return node.getLabel(locator.getLanguage()) != null;
+ }
+ }
+
}

Modified:
lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java
(original)
+++
lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/DefaultSiteTreeTest.java
Fri Jul 28 09:37:34 2006
@@ -52,17 +52,23 @@

Label label = new Label("Foo", "en");
Label[] fooLabels = { label };
- this.siteTree.addNode("/foo", fooLabels, true, null, null, false);
+ this.siteTree.addNode("/foo", "foo-uuid", fooLabels, true, null, null,
false);
label = new Label("Home", "en");
Label[] homeLabels = { label };
- this.siteTree.addNode("/index", homeLabels, true, null, null, false);
+ this.siteTree.addNode("/index", "index-uuid", homeLabels, true, null,
null, false);
label = new Label("Bar", "en");
Label label_de = new Label("Stab", "de");
Label[] barLabels = { label, label_de };
- this.siteTree.addNode("/foo/bar", barLabels, true, "http://exact.biz";,
"suffix", true);
+ this.siteTree.addNode("/foo/bar",
+ "foo-bar-uuid",
+ barLabels,
+ true,
+ "http://exact.biz";,
+ "suffix",
+ true);
label = new Label("Lala", "en");
Label[] lalaLabels = { label };
- this.siteTree.addNode("/foo/lala", lalaLabels, true, null, null,
false);
+ this.siteTree.addNode("/foo/lala", "foo-lala-uuid", lalaLabels, true,
null, null, false);
}

/**
@@ -96,10 +102,12 @@
Label label = new Label("Tutorial", null);
Label[] labels = { label };

- this.siteTree.addNode("/foo", "tutorial", labels, true);
+ String uuid = "12345";
+ this.siteTree.addNode("/foo", "tutorial", uuid, labels, true);
SiteTreeNode node = this.siteTree.getNode("/foo/tutorial");
assertNotNull(node);
assertEquals(node.getId(), "tutorial");
+ assertEquals(node.getUUID(), uuid);
}

/**
@@ -119,7 +127,7 @@
Label label2 = new Label("Ding", "en");
Label[] labels = { label1, label2 };

- this.siteTree.addNode("/foo/ding", labels, true, null, null, false);
+ this.siteTree.addNode("/foo/ding", "foo-ding-uuid", labels, true,
null, null, false);

assertNotNull(this.siteTree.getNode("/foo/ding"));
assertEquals(this.siteTree.getNode("/foo/ding").getId(), "ding");
@@ -133,8 +141,10 @@
Label label1 = new Label("Doh", "en");
Label label2 = new Label("Ding", "en");
Label[] labels = { label1, label2 };
+
+ String uuid = "123";

- this.siteTree.addNode("/foo", "baz", labels, true, null, null, false);
+ this.siteTree.addNode("/foo", "baz", uuid, labels, true, null, null,
false);

assertNotNull(this.siteTree.getNode("/foo/baz"));
assertEquals(this.siteTree.getNode("/foo/baz").getId(), "baz");
@@ -181,11 +191,11 @@
Label label2 = new Label("Ho", "en");
Label[] labels1 = { label1, label2 };

- this.siteTree.addNode("/hi", labels1, true, null, null, false);
+ this.siteTree.addNode("/hi", "hi-uuid", labels1, true, null, null,
false);

Label[] labels2 = { label1, label2 };

- this.siteTree.addNode("/hi/ho", labels2, true, null, null, false);
+ this.siteTree.addNode("/hi/ho", "hi-ho-uuid", labels2, true, null,
null, false);

assertNotNull(this.siteTree.getNode("/hi/ho"));

@@ -247,13 +257,14 @@

Label label = new Label("root", "en");
Label[] rootLabels = { label };
- newSiteTree.addNode("/root", rootLabels, true, null, null, false);
+ newSiteTree.addNode("/root", "root-uuid", rootLabels, true, null,
null, false);
label = new Label("foo", "en");
Label[] fooLabels = { label };
- newSiteTree.addNode("/root/foo", fooLabels, true, null, null, false);
+ newSiteTree.addNode("/root/foo", "root-foo-uuid", fooLabels, true,
null, null, false);
label = new Label("subtree", "en");
Label[] subtreeLabels = { label };
newSiteTree.addNode("/root/subtree",
+ "root-subtree-uuid",
subtreeLabels,
true,
"http://exact.biz";,
@@ -261,7 +272,7 @@
true);
label = new Label("child", "en");
Label[] childLabels = { label };
- newSiteTree.addNode("/root/subtree/child", childLabels, true, null,
null, false);
+ newSiteTree.addNode("/root/subtree/child", "root-subtree-child-uuid",
childLabels, true, null, null, false);
SiteTreeNode node = newSiteTree.getNode("/root/subtree");
assertNotNull(node);
SiteTreeNode parentNode = this.siteTree.getNode("/foo/lala");

Modified:
lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java
(original)
+++
lenya/trunk/src/modules/sitetree/java/test/org/apache/lenya/cms/site/tree/SiteTreeNodeImplTest.java
Fri Jul 28 09:37:34 2006
@@ -50,11 +50,11 @@

Label label = new Label("Foo", "en");
Label[] fooLabels = { label };
- siteTree.addNode("/foo", fooLabels, true, null, null, false);
+ siteTree.addNode("/foo", "foo-uuid", fooLabels, true, null, null,
false);
label = new Label("Bar", "en");
Label label_de = new Label("Stab", "de");
Label[] barLabels = { label, label_de };
- siteTree.addNode("/foo/bar", barLabels, true, "http://exact.biz";,
"suffix", true);
+ siteTree.addNode("/foo/bar", "foo-bar-uuid", barLabels, true,
"http://exact.biz";, "suffix", true);

this.node = siteTree.getNode("/foo/bar");
}

Modified:
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Mkcol.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Mkcol.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Mkcol.java
(original)
+++
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Mkcol.java
Fri Jul 28 09:37:34 2006
@@ -26,8 +26,10 @@
import org.apache.lenya.cms.metadata.dublincore.DublinCore;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.DocumentManager;
import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.site.SiteUtil;
import org.apache.lenya.cms.site.usecases.Create;
import org.apache.lenya.workflow.WorkflowManager;

@@ -77,16 +79,17 @@
documentManager = (DocumentManager)
this.manager.lookup(DocumentManager.ROLE);

DocumentFactory map = getDocumentFactory();
- Document document = map.get(getPublication(),
+ String path = SiteUtil.getPath(this.manager, doc);
+ DocumentLocator locator =
DocumentLocator.getLocator(getPublication().getId(),
doc.getArea(),
- doc.getUUID(),
+ path,
doc.getLanguage());

resourceType = (ResourceType) selector.select(TYPE);
- documentManager.add(document, resourceType, EXTENSION,
doc.getName(), true);
+ documentManager.add(map, locator, resourceType, EXTENSION,
doc.getName(), true);

- setMetaData(document);
- doc = document;
+ doc = map.get(locator);
+ setMetaData(doc);
} finally {
if (documentManager != null) {
this.manager.release(documentManager);

Modified:
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java
URL:
http://svn.apache.org/viewvc/lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java?rev=426608&r1=426607&r2=426608&view=diff
==============================================================================
---
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java
(original)
+++
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java
Fri Jul 28 09:37:34 2006
@@ -31,6 +31,7 @@
import org.apache.lenya.cms.metadata.dublincore.DublinCore;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.DocumentManager;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
@@ -106,15 +107,16 @@
documentManager = (DocumentManager)
this.manager.lookup(DocumentManager.ROLE);

DocumentFactory map = getDocumentFactory();
- Document document = map.get(getPublication(),
+ String path = SiteUtil.getPath(this.manager, doc);
+ DocumentLocator locator =
DocumentLocator.getLocator(getPublication().getId(),
doc.getArea(),
- doc.getUUID(),
+ path,
doc.getLanguage());
//lookupResourceType(extension)
resourceType = lookUpExtension(extension, selector);
- documentManager.add(document, resourceType, extension,
doc.getName(), true);
- setMetaData(document);
- doc = document;
+ documentManager.add(map, locator, resourceType, extension,
doc.getName(), true);
+ doc = map.get(locator);
+ setMetaData(doc);
} finally {
if (documentManager != null) {
this.manager.release(documentManager);


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
user-groups.jax...    php.zend.framew...    os.solaris.open...    web.quixote.use...    java.openjdk.ho...    ietf.secmech/20...    gnu.glpk/2004-0...    recreation.cars...    network.smokepi...    linux.drivers.i...    cms.opencms.dev...    fonts.gfontview...    text.xml.soap.u...    voip.nist-sip/2...    debian.ports.hp...    xfree86.interna...    science.biology...    qnx.openqnx.dev...    mail.sylpheed.c...    busybox/bios/20...    emulators.kvm.s...    hardware.openco...    apple.fink.begi...    kde.german/2006...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation