You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@apache.org on 2003/10/06 18:07:33 UTC
cvs commit: cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/transformation XMLDBTransformer.java
gianugo 2003/10/06 09:07:33
Modified: . status.xml
src/blocks/xmldb/java/org/apache/cocoon/transformation
XMLDBTransformer.java
Log:
Patch to XMLDBTransformer to generate a key on create if it is not provided
PR: 14485
Submitted by: Michael Homeijer <m....@devote.nl>
Revision Changes Path
1.169 +4 -2 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -r1.168 -r1.169
--- status.xml 3 Oct 2003 13:41:00 -0000 1.168
+++ status.xml 6 Oct 2003 16:07:33 -0000 1.169
@@ -191,7 +191,9 @@
<changes>
<release version="@version@" date="@date@">
-
+ <action dev="GR" type="add" fixes-bug="14845" due-to="Micheal Homeijer" due-to-email="m.homeijer@devote.nl">
+ Patch to XMLDBTransformer to generate a key on create if it is not provided
+ </action>
<action dev="SW" type="add">
New JavaScriptBinding for Woody, which allows writing specific binding strategies
with two JavaScript snippets (one for load, one for save).
1.7 +4 -3 cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
Index: XMLDBTransformer.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLDBTransformer.java 9 Sep 2003 18:52:32 -0000 1.6
+++ XMLDBTransformer.java 6 Oct 2003 16:07:33 -0000 1.7
@@ -188,7 +188,7 @@
/** Operation. One of: create, delete, update. */
private String operation;
- /** Document ID. Can be null if update is performed on collection. */
+ /** Document ID. Can be null if update or insert is performed on collection. */
private String key;
private StringWriter queryWriter;
@@ -344,7 +344,7 @@
}
this.key = a.getValue(XMLDB_QUERY_OID_ATTRIBUTE);
- if(!"update".equals(operation) && this.key == null) {
+ if("delete".equals(operation) && this.key == null) {
throw new SAXException("Object ID is missing in xmldb element");
}
processing = true;
@@ -414,6 +414,7 @@
String message = null;
if("create".equals(operation)) {
try {
+ if (key == null) key = collection.createId();
Resource resource = collection.createResource(key, "XMLResource");
resource.setContent(document);
collection.storeResource(resource);