public class CMSUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> @NotNull java.util.List<T> |
adaptResources(java.util.Collection<org.apache.sling.api.resource.Resource> resources,
java.lang.Class<T> type)
Adapts the collection of resources ensuring that if any cannot be adapted it
is excluded from the returned list.
|
static <T> @NotNull java.util.List<T> |
adaptResources(org.apache.sling.api.resource.Resource[] resources,
java.lang.Class<T> type)
Adapts the array of resources ensuring that if any cannot be adapted it is
excluded from the returned list.
|
static @Nullable org.apache.sling.api.resource.Resource |
findParentResourceofType(org.apache.sling.api.resource.Resource resource,
java.lang.String type)
Looks up the resource tree to find the parent resource with the specified
jcr:primaryType.
|
static @Nullable org.apache.sling.api.resource.Resource |
findPublishableParent(org.apache.sling.api.resource.Resource resource)
Look up the resource tree to find a parent of a publishable type.
|
static boolean |
isPublished(org.apache.sling.api.resource.Resource resource)
Return true of the resource (or it's publishable parent) is published or
false otherwise.
|
@NotNull public static final <T> @NotNull java.util.List<T> adaptResources(java.util.Collection<org.apache.sling.api.resource.Resource> resources, java.lang.Class<T> type)
T
- the type to which the resources are adaptedresources
- the collection of resources to adapttype
- the type to which to adapt the resources@NotNull public static final <T> @NotNull java.util.List<T> adaptResources(org.apache.sling.api.resource.Resource[] resources, java.lang.Class<T> type)
T
- the type to which the resources are adaptedresources
- the array of resources to adapttype
- the type to which to adapt the resources@Nullable public static final @Nullable org.apache.sling.api.resource.Resource findParentResourceofType(org.apache.sling.api.resource.Resource resource, java.lang.String type)
resource
- the resource to search fromtype
- the primary type to find@Nullable public static final @Nullable org.apache.sling.api.resource.Resource findPublishableParent(org.apache.sling.api.resource.Resource resource)
resource
- the resource to search frompublic static final boolean isPublished(org.apache.sling.api.resource.Resource resource)
resource
- the resource to checkCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.