This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag 
org.apache.sling.resourcecollection-1.0.0
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcecollection.git

commit fc2c8303382cc6cfbc7c34e7ecacd280798ef4db
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon May 6 12:37:19 2013 +0000

    SLING-2853 : Simplify resource type setting
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/collection@1479549
 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  2 +-
 .../impl/ResourceCollectionManagerImpl.java        | 28 +++++++++-------------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/pom.xml b/pom.xml
index cc15821..9184268 100755
--- a/pom.xml
+++ b/pom.xml
@@ -83,7 +83,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.3.0</version>
+            <version>2.4.0</version>
             <scope>provided</scope>
         </dependency>
         
diff --git 
a/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
 
b/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
index 450bc7c..66acdb7 100755
--- 
a/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
+++ 
b/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
@@ -25,14 +25,13 @@ import java.util.Map;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.jcr.resource.JcrResourceConstants;
 import org.apache.sling.resource.collection.ResourceCollection;
 import org.apache.sling.resource.collection.ResourceCollectionManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * 
+ *
  * Implements <code>ResourceCollectionManger</code> interface. And provides
  * create, delete, get apis for ResourceCollection.
  *
@@ -55,11 +54,11 @@ public class ResourceCollectionManagerImpl implements 
ResourceCollectionManager
        if (resource != null) {
                if (resource.isResourceType(ResourceCollection.RESOURCE_TYPE)) {
                 return new ResourceCollectionImpl(resource);
-            } 
+            }
        } else {
                throw new IllegalArgumentException("resource can not be null");
        }
-       
+
        return null;
     }
 
@@ -76,7 +75,7 @@ public class ResourceCollectionManagerImpl implements 
ResourceCollectionManager
      */
     public ResourceCollection createCollection(Resource parentResource, String 
name,
             Map<String, Object> properties) throws PersistenceException {
-        
+
         if (parentResource != null) {
                String fullPath = parentResource.getPath() + name;
 
@@ -84,21 +83,16 @@ public class ResourceCollectionManagerImpl implements 
ResourceCollectionManager
                 throw new IllegalArgumentException("invalid path, " + fullPath
                     + "resource already exists");
             }
-            
+
             if (properties == null) {
                 properties = new HashMap<String, Object>();
             }
 
-            if 
(properties.get(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY) != null
-                && 
!ResourceCollection.RESOURCE_TYPE.equals(properties.get(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY)))
 {
-                properties.put(
-                    JcrResourceConstants.SLING_RESOURCE_SUPER_TYPE_PROPERTY,
+            // make sure correct resource type is used
+            properties.put(
+                    ResourceResolver.PROPERTY_RESOURCE_TYPE,
                     ResourceCollection.RESOURCE_TYPE);
-            } else {
-                properties.put(
-                    JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY,
-                    ResourceCollection.RESOURCE_TYPE);
-            }
+
             Resource collectionRes = resolver.create(parentResource, name, 
properties);
             resolver.create(collectionRes, "members", null);
             log.debug("collection  {} created", fullPath);
@@ -114,7 +108,7 @@ public class ResourceCollectionManagerImpl implements 
ResourceCollectionManager
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @throws PersistenceException
      */
     public boolean deleteCollection(Resource resource)
@@ -127,7 +121,7 @@ public class ResourceCollectionManagerImpl implements 
ResourceCollectionManager
                throw new IllegalArgumentException("resource can not be null");
        }
     }
-    
+
     /**
      * {@inheritDoc}
      */

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to