AEM - Using PageFilter to filter children of a page

Adobe CQ Nov 23, 2015

getPageFilter() method

    public static PageFilter getPageFilter (final String filterTemplatePath, final String filterValue) {
        PageFilter pageFilter = new PageFilter() {
            public boolean includes(Page p) {
                ValueMap props = p.getProperties();
                String templatePath = props.get("cq:template", String.class);
                String customPropertyName = props.get("customPropertyName", String.class);
                return (filterTemplatePath.equals(templatePath) && customPropertyName.equalsIgnoreCase(filterValue)) ? true : false;
        return pageFilter;

Call the method

    Iterator<Page> children = parentPage.listChildren(getPageFilter(template, value));
Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.