@ProviderType public interface ContentPolicyManager
Modifier and Type | Method and Description |
---|---|
ContentPolicy |
copyPolicy(ContentPolicy originalPolicy,
java.lang.String newTitle,
java.lang.String newDescription) |
java.util.List<ContentPolicy> |
getPolicies(java.lang.String path)
Get the list of policies for the given path
|
java.util.List<ContentPolicy> |
getPolicies(java.lang.String path,
java.lang.String policyResourceType)
Get the list of policies for the given path.
|
ContentPolicy |
getPolicy(ComponentContext componentContext)
Get the
ContentPolicy for the given ComponentContext . |
ContentPolicy |
getPolicy(Resource contentResource)
Get the
ContentPolicy for the given Resource . |
ContentPolicy |
getPolicy(Resource contentResource,
SlingHttpServletRequest request)
Get the
ContentPolicy for the given Resource . |
java.lang.String |
getPolicyLocation(Resource resource)
Returns the policy location for the given resource
Policies are located following their respective component path location under the settings/wcm/policies directory
The returned string is an absolute path to the directory that should contain policies for the given resource
This function only returns a path if the given resource is contained in a page making use of the editable template
If this requirement is not meet the returned string is null
|
ContentPolicyMapping |
getPolicyMapping(Resource resource) |
java.util.List<ContentPolicyMapping> |
getPolicyMappings(ContentPolicy contentPolicy) |
java.util.List<Template> |
getTemplates(java.lang.String policyAbsolutePath)
Get the templates a policy is used in
|
java.util.List<Template> |
getTemplates(java.lang.String policyAbsolutePath,
Predicate filter)
Get a filtered list of templates a policy is used in
|
boolean |
isPolicyUsed(java.lang.String policyAbsolutePath,
Predicate filter)
Verifies if there is any Template matching the given predicate and using the policy with given path
|
@Nullable ContentPolicy getPolicy(@Nonnull ComponentContext componentContext)
ContentPolicy
for the given ComponentContext
.componentContext
- The mandatory component context to get the content policy for.null
if none is configured.java.lang.IllegalArgumentException
- This exception is thrown, if the given component context is
null
.@Nullable ContentPolicy getPolicy(@Nonnull Resource contentResource)
ContentPolicy
for the given Resource
.contentResource
- The mandatory resource to get the content policy for.null
if none is configured.java.lang.IllegalArgumentException
- This exception is thrown, if the given resource is
null
.@Nullable ContentPolicy getPolicy(@Nonnull Resource contentResource, @Nullable SlingHttpServletRequest request)
ContentPolicy
for the given Resource
.contentResource
- The mandatory resource to get the content policy for.request
- Request from which to read specific attributes and parameters. Allows to resolve delegated policy resourcesnull
if none is configured.java.lang.IllegalArgumentException
- This exception is thrown, if the given resource is
null
.java.util.List<ContentPolicy> getPolicies(java.lang.String path)
path
- Path from where to start searching for policiesjava.util.List<ContentPolicy> getPolicies(java.lang.String path, java.lang.String policyResourceType)
path
- Path from where to start searching for policiespolicyResourceType
- Sling resource type associated with the policiesContentPolicy copyPolicy(ContentPolicy originalPolicy, java.lang.String newTitle, java.lang.String newDescription)
originalPolicy
- policy to be copiednewTitle
- The title of the target policynewDescription
- The Description o the target policyContentPolicyMapping getPolicyMapping(Resource resource)
resource
- The resource for which policy mapping to be fetchedContentPolicyMapping
java.util.List<ContentPolicyMapping> getPolicyMappings(ContentPolicy contentPolicy)
contentPolicy
- Policy for which policy mapping to be fetched.ContentPolicyMapping
java.lang.String getPolicyLocation(Resource resource)
resource
- Resource contained in a page making use of an editable templatejava.util.List<Template> getTemplates(java.lang.String policyAbsolutePath)
policyAbsolutePath
- absolute path to policyjava.util.List<Template> getTemplates(java.lang.String policyAbsolutePath, @Nullable Predicate filter)
policyAbsolutePath
- absolute path to policyfilter
- for the templatesboolean isPolicyUsed(java.lang.String policyAbsolutePath, @Nullable Predicate filter)
policyAbsolutePath
- a String
absolute path to policyfilter
- a Predicate
used to filter the templates on which lookup is performed; if the filter
is null
,
no filtering will be performedtrue
if there is any Template using the Policy with policyAbsolutePath
path and is matching the filter
, if provided.Copyright © 2010 - 2020 Adobe. All Rights Reserved