jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1127533 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoBuilder.java
Date Wed, 25 May 2011 13:52:16 GMT
Author: mduerig
Date: Wed May 25 13:52:15 2011
New Revision: 1127533

URL: http://svn.apache.org/viewvc?rev=1127533&view=rev
Log:
JCR-2975: Make ItemInfoBuilder name space aware

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoBuilder.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoBuilder.java?rev=1127533&r1=1127532&r2=1127533&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoBuilder.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoBuilder.java
Wed May 25 13:52:15 2011
@@ -151,6 +151,7 @@ public final class ItemInfoBuilder {
 
         private String name;
         private int index = Path.INDEX_DEFAULT;
+        private String namespace;
         private Name primaryTypeName = NameConstants.NT_UNSTRUCTURED;
         private final List<Name> mixins = new ArrayList<Name>();
         private boolean includeChildInfos = true;
@@ -242,6 +243,17 @@ public final class ItemInfoBuilder {
         }
 
         /**
+         * Set the namespace
+         *
+         * @param namespace
+         * @return
+         */
+        public NodeInfoBuilder setNamespace(String namespace) {
+            this.namespace = namespace;
+            return this;
+        }
+
+        /**
          * Set the name of the primary type.
          * @param name
          * @see NodeInfo#getNodetype()
@@ -361,7 +373,8 @@ public final class ItemInfoBuilder {
                 return PathFactoryImpl.getInstance().getRootPath();
             }
             else {
-                Name name = NameFactoryImpl.getInstance().create(Name.NS_DEFAULT_URI, this.name);
+                String namespace = this.namespace == null ? Name.NS_DEFAULT_URI : this.namespace;
+                Name name = NameFactoryImpl.getInstance().create(namespace, this.name);
                 return PathFactoryImpl.getInstance().create(parent.getPath(), name, true);
             }
         }
@@ -407,6 +420,7 @@ public final class ItemInfoBuilder {
         private final Listener listener;
 
         private String name;
+        private String namespace;
         private final List<QValue> values = new ArrayList<QValue>();
         private int type = PropertyType.UNDEFINED;
         private boolean isMultivalued = true;
@@ -433,6 +447,17 @@ public final class ItemInfoBuilder {
         }
 
         /**
+         * Set the namespace
+         *
+         * @param namespace
+         * @return
+         */
+        public PropertyInfoBuilder setNamespace(String namespace) {
+            this.namespace = namespace;
+            return this;
+        }
+
+        /**
          * Set the <code>{@link PropertyType type}</code> of this property
          *
          * @param type
@@ -656,7 +681,8 @@ public final class ItemInfoBuilder {
                 stale = true;
 
                 NodeId parentId = parent.getId();
-                Name propertyName = NameFactoryImpl.getInstance().create(Name.NS_DEFAULT_URI,
this.name);
+                String namespace = this.namespace == null ? Name.NS_DEFAULT_URI : this.namespace;
+                Name propertyName = NameFactoryImpl.getInstance().create(namespace, this.name);
                 Path path = PathFactoryImpl.getInstance().create(parentId.getPath(), propertyName,
true);
                 PropertyId id = IdFactoryImpl.getInstance().createPropertyId(parentId, propertyName);
 



Mime
View raw message