incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1479549 - in /sling/trunk/contrib/extensions/collection: pom.xml src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
Date Mon, 06 May 2013 12:37:19 GMT
Author: cziegeler
Date: Mon May  6 12:37:19 2013
New Revision: 1479549

URL: http://svn.apache.org/r1479549
Log:
SLING-2853 : Simplify resource type setting

Modified:
    sling/trunk/contrib/extensions/collection/pom.xml
    sling/trunk/contrib/extensions/collection/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java

Modified: sling/trunk/contrib/extensions/collection/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/collection/pom.xml?rev=1479549&r1=1479548&r2=1479549&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/collection/pom.xml (original)
+++ sling/trunk/contrib/extensions/collection/pom.xml Mon May  6 12:37:19 2013
@@ -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>
         

Modified: sling/trunk/contrib/extensions/collection/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/collection/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java?rev=1479549&r1=1479548&r2=1479549&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/collection/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
(original)
+++ sling/trunk/contrib/extensions/collection/src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionManagerImpl.java
Mon May  6 12:37:19 2013
@@ -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 ResourceCollectionManagerIm
     	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 ResourceCollectionManagerIm
      */
     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 ResourceCollectionManagerIm
                 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 ResourceCollectionManagerIm
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @throws PersistenceException
      */
     public boolean deleteCollection(Resource resource)
@@ -127,7 +121,7 @@ public class ResourceCollectionManagerIm
     		throw new IllegalArgumentException("resource can not be null");
     	}
     }
-    
+
     /**
      * {@inheritDoc}
      */



Mime
View raw message