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
Solved! Go to Solution.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies