jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r158328 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml: SessionImporter.java WorkspaceImporter.java
Date Sun, 20 Mar 2005 14:05:49 GMT
Author: stefan
Date: Sun Mar 20 06:05:48 2005
New Revision: 158328

URL: http://svn.apache.org/viewcvs?view=rev&rev=158328
Log:
JCR-31 sysview import cannot handle auto-created nodes

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java?view=diff&r1=158327&r2=158328
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/SessionImporter.java
Sun Mar 20 06:05:48 2005
@@ -172,7 +172,7 @@
 
         if (parent == null) {
             // parent node was skipped, skip this child node also
-            parents.push(null); // push null on stack for skipped node
+            parents.push(null); // push null onto stack for skipped node
             log.debug("skipping node " + nodeName);
             return;
         }
@@ -182,7 +182,7 @@
             NodeDef def = existing.getDefinition();
             if (def.isProtected() && existing.isNodeType(ntName)) {
                 // skip protected node
-                parents.push(null); // push null on stack for skipped node
+                parents.push(null); // push null onto stack for skipped node
                 log.debug("skipping protected node " + existing.safeGetJCRPath());
                 return;
             }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?view=diff&r1=158327&r2=158328
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
Sun Mar 20 06:05:48 2005
@@ -189,28 +189,51 @@
             QName ntName = nodeInfo.getNodeTypeName();
             QName[] mixins = nodeInfo.getMixinNames();
 
+            if (parent == null) {
+                // parent node was skipped, skip this child node also
+                parents.push(null); // push null onto stack for skipped node
+                log.debug("skipping node " + nodeName);
+                return;
+            }
 /*
-            if (uuid == null) {
-                // no potential uuid conflict, always add new node
-                node = createNode(parent, nodeName, ntName, mixins, null);
-            } else {
-                // potential uuid conflict
-                NodeState conflicting;
-                try {
-                    conflicting = (NodeImpl) session.getNodeByUUID(uuid);
-                } catch (ItemNotFoundException infe) {
-                    conflicting = null;
+            if (parent.hasChildNodeEntry(nodeName)) {
+                // a node with that name already exists...
+                ChildNodeDef nodeDef =
+                        wsp.findApplicableDefinition(nodeName, ntName, parent);
+                if (nodeDef.isProtected()) {
+                    // skip protected node
+                    parents.push(null); // push null onto stack for skipped node
+                    log.debug("skipping protected node " + nodeName);
+                    return;
+                }
+                if (nodeDef.isAutoCreate() && existing.isNodeType(ntName)) {
+                    // this node has already been auto-created, no need to create it
+                    node = existing;
+                } else {
+                    throw new ItemExistsException(existing.safeGetJCRPath());
                 }
-                if (conflicting != null) {
-                    // resolve uuid conflict
-                    node = resolveUUIDConflict(parent, conflicting, nodeInfo);
+            } else {
+                // there's no node with that name...
+                if (uuid == null) {
+                    // no potential uuid conflict, always add new node
+                    node = createNode(parent, nodeName, ntName, mixins, null);
                 } else {
-                    // create new with given uuid
-                    node = createNode(parent, nodeName, ntName, mixins, uuid);
+                    // potential uuid conflict
+                    NodeState conflicting;
+                    try {
+                        conflicting = (NodeImpl) session.getNodeByUUID(uuid);
+                    } catch (ItemNotFoundException infe) {
+                        conflicting = null;
+                    }
+                    if (conflicting != null) {
+                        // resolve uuid conflict
+                        node = resolveUUIDConflict(parent, conflicting, nodeInfo);
+                    } else {
+                        // create new with given uuid
+                        node = createNode(parent, nodeName, ntName, mixins, uuid);
+                    }
                 }
             }
-*/
-/*
             // store state
             stateMgr.store(state);
             succeeded = true;
@@ -308,6 +331,10 @@
             return;
         }
         NodeState node = (NodeState) parents.pop();
+        if (node == null) {
+            // node was skipped, nothing to do here
+            return;
+        }
         boolean succeeded = false;
         try {
             // check sanity of workspace/session first



Mime
View raw message