Search in sources :

Example 6 with Reference

use of com.day.cq.wcm.api.reference.Reference in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class CaConfigReferenceProvider method findReferences.

@Override
public List<Reference> findReferences(Resource resource) {
    if (!enabled) {
        return Collections.emptyList();
    }
    List<Reference> references = new ArrayList<>();
    // If the resource is not part of a page: stop the processing
    PageManager pageManager = resource.getResourceResolver().adaptTo(PageManager.class);
    if (pageManager == null) {
        return references;
    }
    Page page = pageManager.getContainingPage(resource);
    if (page == null) {
        return references;
    }
    for (String config : configurationManager.getConfigurationNames()) {
        addCaConfigReference(config, resource, references);
    }
    return references;
}
Also used : PageManager(com.day.cq.wcm.api.PageManager) Reference(com.day.cq.wcm.api.reference.Reference) ArrayList(java.util.ArrayList) Page(com.day.cq.wcm.api.Page)

Aggregations

Reference (com.day.cq.wcm.api.reference.Reference)6 Resource (org.apache.sling.api.resource.Resource)4 Page (com.day.cq.wcm.api.Page)3 PageManager (com.day.cq.wcm.api.PageManager)3 Test (org.junit.jupiter.api.Test)3 ArrayList (java.util.ArrayList)2 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)2 DataLayerConfig (com.adobe.cq.wcm.core.components.internal.DataLayerConfig)1 Design (com.day.cq.wcm.api.designer.Design)1 Designer (com.day.cq.wcm.api.designer.Designer)1 HashSet (java.util.HashSet)1