Basically.. I was trying to only use sling apis.
Shall fix these.

From: david g. [mailto:notifications@github.com]
Sent: Thursday, March 06, 2014 9:56 AM
To: Adobe-Consulting-Services/acs-aem-commons
Cc: gopal Kalyanaraman
Subject: Re: [acs-aem-commons] Feature/designreferenceprovider (#133)


In bundle/src/main/java/com/adobe/acs/commons/referenceproviders/PagesReferenceProvider.java:

> +    }

> +

> +    private void search(Resource resource, Set<String> references,ResourceResolver resolver){

> +        findReferencesInResource(resource, references, resolver);

> +        for(Iterator<Resource> iter = resource.listChildren();iter.hasNext();){

> +            search(iter.next(), references, resolver);

> +        }

> +    }

> +    private void findReferencesInResource(Resource resource, Set<String> references, ResourceResolver resolver){

> +        ValueMap map = resource.adaptTo(ValueMap.class);

> +        for(String key :map.keySet()){

> +            String[] values = map.get(key, new String[0]);

> +            for(String value :values){

> +                if (pattern.matcher(value).find()) {

> +                   for(String path:getAllPathsInAProperty( value)){

> +                       if(isResourcePartOfAnotherPage(resolver , path)){

As mentioned below, these methods could be replaced with

final PageManager pageManager = resourceResolver.adaptTo(PageManager.class);

final Page page = pageManager.getContainingPage(path);

if(page != null) { references.add(page.getPath(); }

—
Reply to this email directly or view it on GitHub<https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/133/files#r10331260>.