![JAR search and dependency download from the Maven repository](/logo.png)
com.day.cq.wcm.workflow.process.ResourceCollectionHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-sdk-api Show documentation
Show all versions of aem-sdk-api Show documentation
The Adobe Experience Manager SDK
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2017 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.workflow.process;
import com.adobe.granite.workflow.collection.ResourceCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import java.util.ArrayList;
import java.util.List;
public class ResourceCollectionHelper {
private static final Logger log = LoggerFactory.getLogger(ResourceCollectionHelper.class);
private static final String[] ALLOWED_NODE_PRIMARY_AND_RESOURCE_TYPES = {"cq:Page", "dam:Asset",
"wcm/core/components/policy/policy",
"cq/tagging/components/tag"};
public ResourceCollectionHelper(){}
public static List getPaths(String path, List rcCollections) {
return getPaths(path, rcCollections, ALLOWED_NODE_PRIMARY_AND_RESOURCE_TYPES);
}
public static List getPaths(String path, List rcCollections, String[] allowedNodes) {
List paths = new ArrayList();
if (rcCollections == null || rcCollections.size() == 0) {
paths.add(path);
} else {
log.debug("ResourceCollections detected");
for (ResourceCollection rcCollection : rcCollections) {
// this is a resource collection. the collection itself is not
// replicated. only its members
try {
List members = rcCollection.list(allowedNodes);
for (Node member : members) {
String mPath = member.getPath();
paths.add(mPath);
}
} catch (RepositoryException re) {
log.error("Cannot build path list out of the resource collection " + rcCollection.getPath());
}
}
}
return paths;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy