predicate missing library | Community
Skip to main content
Level 4
January 14, 2016
Solved

predicate missing library

  • January 14, 2016
  • 3 replies
  • 1177 views

Hi,

I'm using cq5.5 and i have a code like this:

import javax.jcr.Node; import javax.jcr.RepositoryException; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.commons.predicate.Predicate; import com.day.cq.commons.predicate.AbstractNodePredicate; @Component @Service @Property(name = "predicate.name", value = "PredicateVideo") public class PredicateVideo extends AbstractNodePredicate implements Predicate { public boolean evaluate(Node node) throws RepositoryException { return true; } }

Up to AbstractNodePredicate my eclipse raises an error:

The type org.apache.commons.collections.Predicate cannot be resolved. It is indirectly referenced from required .class files

So i add this dependency:

<dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.0</version> </dependency>

but it doesn't resolve my problem.

Is it a problem of dependency? Which is the right dependency?

On the other hand if i remove the interface:

import org.apache.jackrabbit.commons.predicate.Predicate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Component @Service @Property(name = "predicate.name", value = "PredicateVideo") public class PredicateVideo implements Predicate { protected final Logger log = LoggerFactory.getLogger(this.getClass()); public boolean evaluate(Object obj) { return true; } }

This code is correct but if i use it with the property predicate="PredicateVideo" the log raises the error:

Unable to retrieve predicate PredicateVideo

 

Any idea?

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 kautuk_sahni

smacdonald2008 wrote...

We have an AEM community that show how to work with com.day.cq.commons.predicate.AbstractNodePredicate. This will point you in the right direction. See:

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

Hope this helps. 

 

Hi Scott

This is really a good article covering "how to use a custom predicate".

I hope this will help the samuel786431 .

Reference Link :-http://hashimkhan.in/tag/predicate/

//This links covers:-

1. Standard Predicates

2. Custom Predicate

Documentation link:- https://docs.adobe.com/docs/en/aem/6-0/develop/search/implementing-custom-predicate-evaluator.html

 

I hope this would help him.

Thanks and Regards

Kautuk Sahni

3 replies

kautuk_sahni
Community Manager
Community Manager
January 29, 2016

Hi

 

Check Sling/AEM dependencies you have in your POM file with Dependency Finder (you can find it there /system/console/depfinder). 

and put version in POM file accordingly.

 

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
smacdonald2008
Level 10
January 30, 2016

We have an AEM community that show how to work with com.day.cq.commons.predicate.AbstractNodePredicate. This will point you in the right direction. See:

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

Hope this helps. 

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
February 1, 2016

smacdonald2008 wrote...

We have an AEM community that show how to work with com.day.cq.commons.predicate.AbstractNodePredicate. This will point you in the right direction. See:

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

Hope this helps. 

 

Hi Scott

This is really a good article covering "how to use a custom predicate".

I hope this will help the samuel786431 .

Reference Link :-http://hashimkhan.in/tag/predicate/

//This links covers:-

1. Standard Predicates

2. Custom Predicate

Documentation link:- https://docs.adobe.com/docs/en/aem/6-0/develop/search/implementing-custom-predicate-evaluator.html

 

I hope this would help him.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni