Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

How to create custom pathbrowser predicate?


Level 3
Here is part of the dialog <path jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" fieldDescription="Select media list item link" fieldLabel="Media List Item link" name="./path" predicate="predicate" rootPath="/content"> </path> import org.apache.commons.collections.Predicate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; import org.apache.sling.api.resource.Resource; import com.day.cq.commons.predicate.AbstractResourcePredicate; import com.day.cq.wcm.api.Page; @Component(label = "Content-page Predicate", description = "This predicate is used to restricted to allow selection of pages that have template content-page") @Service(value = Predicate.class) @Properties({ @Property(label = "Predicate Name", name = "predicate.name", value = "predicate", propertyPrivate = true) }) public class ContentPagePredicate extends AbstractResourcePredicate { private static final String CQ_TEMPLATE_CONTENT = "/conf/pattern-lab/settings/wcm/templates/content-page"; @Override public boolean evaluate(Resource resource) { if (null != resource) { if (!resource.getResourceType().equals("cq:Page")) { return false; } Page page = resource.adaptTo(Page.class); return page.getTemplate().getName().equals(CQ_TEMPLATE_CONTENT); } return false; } }

Caused by: java.lang.VerifyError: Constructor must call super() or this() before return
Exception Details:
    com/day/cq/commons/predicate/AbstractResourcePredicate.<init>()V @1: return
    Error exists in the bytecode
    0x0000000: 2ab1  


any ideas?

1 Accepted Solution


Correct answer by
Employee Advisor
1 Reply


Correct answer by
Employee Advisor