Custom Predicate For Pathfield

How to use:

http://dev.day.com/docs/en/cq/5-5/widgets-api/index.html?class=CQ.form.PathField

var pathfield = new CQ.form.PathField({
    rootPath: "/",
    predicate: "<Your custom Predicate Name>",
    showTitlesInTree: false
});

Custom Predicate Class:

import javax.jcr.Node;

import javax.jcr.RepositoryException;

import org.apache.commons.collections.Predicate;

import com.day.cq.commons.jcr.JcrConstants;

import com.day.cq.commons.predicate.AbstractNodePredicate;

/**

  * @scr.component metatype="no"

 * @scr.property name="predicate.name" value="<Your custom Predicate Name>"

 * @scr.service interface="Predicate"

 */

public class HierarchyNotFilePredicate extends AbstractNodePredicate implements Predicate {

    public boolean evaluate(Node node) throws RepositoryException {

        return <Your Logic>

    }

}

Comments