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/12/01 18:26:46 UTC
svn commit: r350281 - in
/lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr:
ContentNodeProxy.java SiteNodeProxy.java mapping/AbstractNodeProxy.java
mapping/RepositoryFacade.java
Author: andreas
Date: Thu Dec 1 09:26:38 2005
New Revision: 350281
URL: http://svn.apache.org/viewcvs?rev=350281&view=rev
Log:
JCR integration: simplified node removal
Modified:
lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/ContentNodeProxy.java
lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteNodeProxy.java
lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/AbstractNodeProxy.java
lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/RepositoryFacade.java
Modified: lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/ContentNodeProxy.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/ContentNodeProxy.java?rev=350281&r1=350280&r2=350281&view=diff
==============================================================================
--- lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/ContentNodeProxy.java (original)
+++ lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/ContentNodeProxy.java Thu Dec 1 09:26:38 2005
@@ -115,8 +115,4 @@
setProperty(DOCUMENT_TYPE_PROPERTY, documentType);
}
- public void remove() throws RepositoryException {
- getRepository().removeProxy(this);
- }
-
}
Modified: lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteNodeProxy.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteNodeProxy.java?rev=350281&r1=350280&r2=350281&view=diff
==============================================================================
--- lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteNodeProxy.java (original)
+++ lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/SiteNodeProxy.java Thu Dec 1 09:26:38 2005
@@ -129,8 +129,4 @@
}
}
- public void remove() throws RepositoryException {
- getRepository().removeProxy(this);
- }
-
}
Modified: lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/AbstractNodeProxy.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/AbstractNodeProxy.java?rev=350281&r1=350280&r2=350281&view=diff
==============================================================================
--- lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/AbstractNodeProxy.java (original)
+++ lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/AbstractNodeProxy.java Thu Dec 1 09:26:38 2005
@@ -198,4 +198,16 @@
}
}
+ /**
+ * Removes the node.
+ * @throws RepositoryException if an error occurs.
+ */
+ public void remove() throws RepositoryException {
+ try {
+ getNode().remove();
+ } catch (javax.jcr.RepositoryException e) {
+ throw new RepositoryException(e);
+ }
+
+ }
}
Modified: lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/RepositoryFacade.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/RepositoryFacade.java?rev=350281&r1=350280&r2=350281&view=diff
==============================================================================
--- lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/RepositoryFacade.java (original)
+++ lenya/trunk/src/modules/jcr/java/src/org/apache/lenya/cms/jcr/mapping/RepositoryFacade.java Thu Dec 1 09:26:38 2005
@@ -17,7 +17,6 @@
package org.apache.lenya.cms.jcr.mapping;
import javax.jcr.Node;
-import javax.jcr.NodeIterator;
import javax.jcr.Session;
import javax.jcr.query.InvalidQueryException;
@@ -147,6 +146,15 @@
return path.getNodes(getSession());
}
+ /**
+ * Adds a node by name.
+ * @param parentPath The parent path.
+ * @param primaryNodeType The primary node type of the new node.
+ * @param className The class name.
+ * @param name The name of the node.
+ * @return The created node.
+ * @throws RepositoryException if the node already exists.
+ */
public NodeProxy addByName(Path parentPath, String primaryNodeType, String className,
String name) throws RepositoryException {
try {
@@ -169,6 +177,17 @@
}
+ /**
+ * Adds a node by property.
+ * @param parentPath The parent path.
+ * @param primaryNodeType The primary node type of the new node.
+ * @param className The class name of the proxy.
+ * @param name The node name.
+ * @param propertyName The name of the identifying property.
+ * @param propertyValue The identifying property value.
+ * @return The new node.
+ * @throws RepositoryException if the node already exists.
+ */
public NodeProxy addByProperty(Path parentPath, String primaryNodeType, String className,
String name, String propertyName, String propertyValue) throws RepositoryException {
try {
@@ -199,29 +218,20 @@
return createProxy(node);
}
+ /**
+ * @return The document type registry.
+ */
public DocumentTypeRegistry getDocumentTypeRegistry() {
return this.doctypeRegistry;
}
private MetaDataRegistry metaDataRegistry;
+ /**
+ * @return The meta data registry.
+ */
public MetaDataRegistry getMetaDataRegistry() {
return this.metaDataRegistry;
}
- public void removeProxy(NodeProxy proxy) throws RepositoryException {
-
- try {
- for (NodeIterator i = proxy.getNode().getNodes(); i.hasNext();) {
- Node node = i.nextNode();
- removeProxy(getProxy(node));
- }
-
- Node node = proxy.getNode();
- node.remove();
- } catch (javax.jcr.RepositoryException e) {
- throw new RepositoryException(e);
- }
-
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org