Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to create custom pathbrowser predicate?

Avatar

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:
  Location:
    com/day/cq/commons/predicate/AbstractResourcePredicate.<init>()V @1: return
  Reason:
    Error exists in the bytecode
  Bytecode:
    0x0000000: 2ab1  

 

any ideas?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor
1 Reply

Avatar

Correct answer by
Employee Advisor