AEM 6.2 - Touch UI 'pathbrowser' predicate is being ignored | Community
Skip to main content
Level 2
November 29, 2017
Solved

AEM 6.2 - Touch UI 'pathbrowser' predicate is being ignored

  • November 29, 2017
  • 3 replies
  • 3170 views

I am noticing that the predicate defined in the Touch UI dialog in the pathbrowser widget is not picking up the predicate.

<testProperty

    jcr:primaryType="nt:unstructured"

    sling:resourceType="granite/ui/components/foundation/form/pathbrowser"

    fieldDescription="Select from a specific list"

    fieldLabel="Test Property"

    name="./testResult"

    predicate="testpredicate"

    rootPath="/content"/>

In the core project I have the predicate class (just showing the relevant code):

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

import org.apache.commons.collections.Predicate;

.....

@Service(value = Predicate.class)

@Component(metatype = false)

@Properties({

    @Property(label = "Predicate Name", name = "predicate.name", value = "testpredicate", propertyPrivate = true) })

public class TestThePredicate extends AbstractNodePredicate  {

.....

    @Override

    public final boolean evaluate(final Node node) throws RepositoryException {

        System.out.println("Entro a evaluate(Node)" + node);

        LOGGER.error("********* TestThePredicate: " + "In method evaluate(Node)" + node.getPath);

    }

}

The problem I am facing is that AEM does not pick up the predicate class. I must be missing something somewhere.

In the Felix console the jar is there and also the predicate class is "state satisfied".

Is there by any chance some sort of configuration I need to add?

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Giancarlo__Sapi

It's always embarrassing when you not only answer your own question, but have to admit you missed something. I would love to blame this on coffee or beer, but hey, it's pure sloppiness...

The solution is that in the class signature you need to implement the Predicate interface:

public class TestThePredicate extends AbstractNodePredicate implements Predicate {

After adding the missing part, the predicate works!

3 replies

Giancarlo__SapiAuthorAccepted solution
Level 2
November 29, 2017

It's always embarrassing when you not only answer your own question, but have to admit you missed something. I would love to blame this on coffee or beer, but hey, it's pure sloppiness...

The solution is that in the class signature you need to implement the Predicate interface:

public class TestThePredicate extends AbstractNodePredicate implements Predicate {

After adding the missing part, the predicate works!

smacdonald2008
Level 10
November 30, 2017

Awesome work here - if you send me a package of this - we would love to add this to a community HELPX article.

September 11, 2018

Hi,

I think  com.day.cq.commons.predicate.AbstractNodePredicate is deprecated in the AEM 6.4. Do you now another alternative for predicate?