
com.day.cq.wcm.api.policies.ContentPolicyManager Maven / Gradle / Ivy
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2014 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*
**************************************************************************/
package com.day.cq.wcm.api.policies;
import aQute.bnd.annotation.ProviderType;
import com.day.cq.wcm.api.Template;
import com.day.cq.wcm.api.components.ComponentContext;
import org.apache.commons.collections.Predicate;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Content Policy Manager API.
*/
@ProviderType
public interface ContentPolicyManager {
/**
* Get the ContentPolicy
for the given ComponentContext
.
*
* @param componentContext The mandatory component context to get the content policy for.
*
* @return The content policy for the given component context or null
if none is configured.
* @throws java.lang.IllegalArgumentException This exception is thrown, if the given component context is
* null
.
*/
@Nullable
public ContentPolicy getPolicy(@Nonnull ComponentContext componentContext);
/**
* Get the ContentPolicy
for the given Resource
.
*
* @param contentResource The mandatory resource to get the content policy for.
*
* @return The content policy for the given resource or null
if none is configured.
* @throws java.lang.IllegalArgumentException This exception is thrown, if the given resource is
* null
.
*/
@Nullable
public ContentPolicy getPolicy(@Nonnull Resource contentResource);
/**
* Get the ContentPolicy
for the given Resource
.
*
* @param contentResource The mandatory resource to get the content policy for.
* @param request Request from which to read specific attributes and parameters. Allows to resolve delegated policy resources
*
* @return The content policy for the given resource or null
if none is configured.
* @throws java.lang.IllegalArgumentException This exception is thrown, if the given resource is
* null
.
*/
@Nullable
public ContentPolicy getPolicy(@Nonnull Resource contentResource, @Nullable SlingHttpServletRequest request);
/**
* Returns the list of policies for the given path
*
* @param path Path from where to start searching for policies
*
* @return
*/
public List getPolicies(String path);
/**
* Returns the list of policies for the given path. Here you can limit search to the given policy resource type
*
* Policy Resource Types are relative {@see ResourceResolver}
*
* @param path Path from where to start searching for policies
* @param policyResourceType Sling resource type associated with the policies
* @return
*/
public List getPolicies(String path, String policyResourceType);
/**
* @param originalPolicy
* @param newTitle
* @param newDescription
*
* @return
*/
public ContentPolicy copyPolicy(ContentPolicy originalPolicy, String newTitle, String newDescription);
/**
* @param resource
* @return
*/
public ContentPolicyMapping getPolicyMapping(Resource resource);
/**
* @param contentPolicy
*
* @return
*/
public List getPolicyMappings(ContentPolicy contentPolicy);
/**
* 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
*
* @param resource Resource contained in a page making use of an editable template
* @return The path to the directory that contains the policies for the given resource
*/
public String getPolicyLocation(Resource resource);
/**
* Get the templates a policy is used in
*
* @param policyAbsolutePath absolute path to policy
* @return list of templates where the policy is used in
*/
public List getTemplates(String policyAbsolutePath);
/**
* Get a filtered list of templates a policy is used in
*
* @param policyAbsolutePath absolute path to policy
* @param filter for the templates
* @return list of templates where the policy is used in
*/
public List getTemplates(String policyAbsolutePath, Predicate filter);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy