jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r159492 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: ItemImpl.java xml/WorkspaceImporter.java
Date Wed, 30 Mar 2005 16:27:46 GMT
Author: stefan
Date: Wed Mar 30 08:27:45 2005
New Revision: 159492

URL: http://svn.apache.org/viewcvs?view=rev&rev=159492
Log:
re-implementing Workspace.importXML [work in progress...]



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

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java?view=diff&r1=159491&r2=159492
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java Wed Mar 30
08:27:45 2005
@@ -766,7 +766,7 @@
 
         // now that all NodeReferences objects have been updated,
         // walk through 'removed' nodes and verify that no node that is still
-        // being referenced, is removed
+        // being referenced is removed
         Iterator iter = removedNodes.iterator();
         while (iter.hasNext()) {
             NodeState nodeState = (NodeState) iter.next();

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=159491&r2=159492
==============================================================================
--- 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
Wed Mar 30 08:27:45 2005
@@ -599,6 +599,7 @@
             if (parent == null) {
                 // parent node was skipped, skip this child node also
                 parents.push(null); // push null onto stack for skipped node
+                succeeded = true;
                 log.debug("skipping node " + nodeName);
                 return;
             }
@@ -618,6 +619,7 @@
                     if (def.isProtected() && entExisting.includesNodeType(ntName))
{
                         // skip protected node
                         parents.push(null); // push null onto stack for skipped node
+                        succeeded = true;
                         log.debug("skipping protected node "
                                 + resolveJCRPath(existing.getId()));
                         return;
@@ -635,16 +637,18 @@
             if (node == null) {
                 // there's no node with that name...
                 if (uuid == null) {
+                    // no potential uuid conflict, always create new node
+
                     ChildNodeDef def =
                             wsp.findApplicableNodeDefinition(nodeName, ntName, parent);
                     if (def.isProtected()) {
                         // skip protected node
                         parents.push(null); // push null onto stack for skipped node
+                        succeeded = true;
                         log.debug("skipping protected node " + nodeName);
                         return;
                     }
 
-                    // no potential uuid conflict, always create new node:
                     // check if new node can be added (check access rights &
                     // node type constraints only, assume locking & versioning status
                     // has already been checked on ancestor)
@@ -652,7 +656,7 @@
                             WorkspaceImpl.CHECK_ACCESS
                             | WorkspaceImpl.CHECK_CONSTRAINTS);
                     // do create new node
-                    node = createNode(parent, nodeName, ntName, mixins, null);
+                    node = createNode(parent, nodeName, ntName, mixins, null, def);
                 } else {
                     // potential uuid conflict
                     NodeState conflicting;
@@ -667,7 +671,18 @@
                         // resolve uuid conflict
                         node = resolveUUIDConflict(parent, conflicting, nodeInfo);
                     } else {
-                        // create new with given uuid:
+                        // create new with given uuid
+
+                        ChildNodeDef def =
+                                wsp.findApplicableNodeDefinition(nodeName, ntName, parent);
+                        if (def.isProtected()) {
+                            // skip protected node
+                            parents.push(null); // push null onto stack for skipped node
+                            succeeded = true;
+                            log.debug("skipping protected node " + nodeName);
+                            return;
+                        }
+
                         // check if new node can be added (check access rights &
                         // node type constraints only, assume locking & versioning status
                         // has already been checked on ancestor)
@@ -675,7 +690,7 @@
                                 WorkspaceImpl.CHECK_ACCESS
                                 | WorkspaceImpl.CHECK_CONSTRAINTS);
                         // do create new node
-                        node = createNode(parent, nodeName, ntName, mixins, uuid);
+                        node = createNode(parent, nodeName, ntName, mixins, uuid, def);
                     }
                 }
             }
@@ -724,16 +739,16 @@
                         try {
                             // try single-valued
                             def = wsp.findApplicablePropertyDefinition(propName,
-                                    type, false, parent);
+                                    type, false, node);
                         } catch (ConstraintViolationException cve) {
                             // try multi-valued
                             def = wsp.findApplicablePropertyDefinition(propName,
-                                    type, true, parent);
+                                    type, true, node);
                         }
                     } else {
                         // can only be multi-valued (n == 0 || n > 1)
                         def = wsp.findApplicablePropertyDefinition(propName,
-                                type, true, parent);
+                                type, true, node);
                     }
 
                     if (def.isProtected()) {



Mime
View raw message