You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2018/01/12 13:37:53 UTC

[sling-org-apache-sling-api] branch feature/derived-resource-types created (now bcc5c8e)

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

kwin pushed a change to branch feature/derived-resource-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git.


      at bcc5c8e  SLING-7377 expose derived types of a given resource type

This branch includes the following new commits:

     new bcc5c8e  SLING-7377 expose derived types of a given resource type

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-api] 01/01: SLING-7377 expose derived types of a given resource type

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/derived-resource-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git

commit bcc5c8e24e4a2ec5ef13e8afc7e08e92bfcd2172
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Jan 12 14:37:45 2018 +0100

    SLING-7377 expose derived types of a given resource type
---
 .../org/apache/sling/api/resource/ResourceResolver.java  | 16 ++++++++++++++++
 .../java/org/apache/sling/api/resource/package-info.java |  2 +-
 .../sling/api/wrappers/ResourceResolverWrapper.java      |  6 ++++++
 .../java/org/apache/sling/api/wrappers/package-info.java |  2 +-
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/api/resource/ResourceResolver.java b/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
index 0e3cc65..2b68ca7 100644
--- a/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
+++ b/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
@@ -19,6 +19,7 @@
 package org.apache.sling.api.resource;
 
 import java.io.Closeable;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -674,6 +675,8 @@ public interface ResourceResolver extends Adaptable, Closeable {
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      * @since 2.3 (Sling API Bundle 2.4.0)
+     * @see ResourceResolver#getParentResourceType(String)
+     * @see ResourceResolver#getDerivedResourceTypes(String)
      */
     @CheckForNull String getParentResourceType(final Resource resource);
 
@@ -692,10 +695,23 @@ public interface ResourceResolver extends Adaptable, Closeable {
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      * @since 2.3 (Sling API Bundle 2.4.0)
+     * @see ResourceResolver#getParentResourceType(Resource)
+     * @see ResourceResolver#getDerivedResourceTypes(String)
      */
     public @CheckForNull String getParentResourceType(final String resourceType);
 
     /**
+     * Returns the derived resource types for the given type.
+     * The derived resource types either directly or transitively inherit from the given type via property {@code sling:resourceSuperType}.
+     * This is the inversion method of {@link #getParentResourceType(String)}.
+     *
+     * @param resourceType The resource type for which to retrieve the derived types
+     * @return The collection of resource types which inherit (directly or transitively) from the given resource type via property {@code sling:resourceSuperType}
+     * @since 2.11 (Sling API Bundle 2.16.6)
+     */
+    @Nonnull Collection<String> getDerivedResourceTypes(@Nonnull String resourceType);
+
+    /**
      * Returns <code>true</code> if the resource type or any of the resource's
      * super type(s) equals the given resource type.
      * 
diff --git a/src/main/java/org/apache/sling/api/resource/package-info.java b/src/main/java/org/apache/sling/api/resource/package-info.java
index 2928554..1ac279f 100644
--- a/src/main/java/org/apache/sling/api/resource/package-info.java
+++ b/src/main/java/org/apache/sling/api/resource/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.10.1")
+@Version("2.11")
 package org.apache.sling.api.resource;
 
 import org.osgi.annotation.versioning.Version;
diff --git a/src/main/java/org/apache/sling/api/wrappers/ResourceResolverWrapper.java b/src/main/java/org/apache/sling/api/wrappers/ResourceResolverWrapper.java
index b9d442e..ba7cb32 100644
--- a/src/main/java/org/apache/sling/api/wrappers/ResourceResolverWrapper.java
+++ b/src/main/java/org/apache/sling/api/wrappers/ResourceResolverWrapper.java
@@ -16,6 +16,7 @@
  ******************************************************************************/
 package org.apache.sling.api.wrappers;
 
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 import javax.annotation.Nonnull;
@@ -306,6 +307,11 @@ public class ResourceResolverWrapper implements ResourceResolver {
     }
 
     @Override
+    public Collection<String> getDerivedResourceTypes(String resourceType) {
+        return wrapped.getDerivedResourceTypes(resourceType);
+    }
+
+    @Override
     public boolean isResourceType(Resource resource, String resourceType) {
         return wrapped.isResourceType(resource, resourceType);
     }
diff --git a/src/main/java/org/apache/sling/api/wrappers/package-info.java b/src/main/java/org/apache/sling/api/wrappers/package-info.java
index e527a18..39ff070 100644
--- a/src/main/java/org/apache/sling/api/wrappers/package-info.java
+++ b/src/main/java/org/apache/sling/api/wrappers/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.6.1")
+@Version("2.7.0")
 package org.apache.sling.api.wrappers;
 
 import org.osgi.annotation.versioning.Version;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.