Hi, I want to develop a custom search component in my page to seek for keywords in communitiy pages, I have tried to do using the ootb forum component (/libs/social/forum/components/hbs/forum) that uses the default storage method(I think it is JSRP).
I have seen that topics and answers are created in: "/content/usergenerated/asi/jcr/content/projectname/page/jcr:content/par/forum/", that contains all the info that i need, but I don't know how to access this folder within my Java classes, I have tried to use :
Resource r = request.getResourceResolver().getResource("/content/usergenerated/asi/jcr"); Node rootNode = r.adaptTo(Node.class);
But if i try to use rootNode.getNodes() in that folder or any folder inside that one I get an error. Is there another way to get to get the posts and their content to use it in my Java classes?.
Thank you in advance
Juan
Views
Replies
Total Likes
If you're just reading information from the JCR and not writing to it, no need to adapt away from Resource. Per the AEM - Quick Reference, it's best practice to use Resource and ValueMap to retrieve information.
Also, you could continue to traverse the resource tree as you're trying to do now, or you could use QueryBuilder to search for what you want. There's a good usage example in the documentation I linked.
Views
Replies
Total Likes
Hi Juan,
you should be using the SocialResourceProvider API as it will hide the underlying persistance model being used .i.e MSRP, ASRP or JSRP. You should not be setting the path yourself.
The example in the docs[0] is slightly incorrect:
import com.adobe.cq.social.srp.utilities.api.SocialResourceUtilities;
String ugcPath = SocialResourceUtilities.resourceToUGCStoragePath(final Resource resource);
As you need to get the OSGI service and you can get the path by passing in your resource.
@Reference
private SocialResourceUtilities socialResourceUtilities;
Then you can use this in your code.
Regards,
Opkar
[0]https://docs.adobe.com/docs/en/aem/6-1/develop/communities/scf/srp.html
Views
Replies
Total Likes
Hi, thank for the help.
I have tried to use: "import com.adobe.cq.social.srp.utilities.api.SocialResourceUtilities;" but eclipse cannot resolve the incluse, is there a jar or something to be done before using that class?
Regards,
Juan C
Views
Replies
Total Likes
Juan Camacho I. wrote...
Hi, thank for the help.
I have tried to use: "import com.adobe.cq.social.srp.utilities.api.SocialResourceUtilities;" but eclipse cannot resolve the incluse, is there a jar or something to be done before using that class?
Regards,
Juan C
I believe you may need to include the social API as it appears to have been separated from the Uber JAR. (Documentation: https://docs.adobe.com/docs/en/aem/6-1/develop/communities/code-guide/maven.html#Communities API Jar Artifact)
<dependency> <groupId>com.adobe.cq.social</groupId> <artifactId>cq-socialcommunities-api</artifactId> <version>1.7.197</version> <scope>provided</scope> </dependency>
Views
Replies
Total Likes
In addition to dependency above you would need to deploy the communities package. This available to customers with the appropriate license.
Regards,
Opkar
Views
Replies
Total Likes
Please upgrade to the latest version of Communities : FP4.
After upgrade you'll need to change the version for maven to 1.8.386
- JK
Views
Replies
Total Likes
Thanks to Opkar, the documentation has been corrected.
- JK
Views
Replies
Total Likes
Hi,
if you are using the forum component[0] that is listed in the communities components[0], then you would need a license[1]. I don't see a forum component in the page authoring components list[2].
Regards,
Opkar
[0] https://docs.adobe.com/docs/en/aem/6-1/author/communities/forum.html
[1]https://docs.adobe.com/docs/en/aem/6-1/author/communities.html
[2]https://docs.adobe.com/docs/en/aem/6-1/author/page-authoring/default-components/editmode.html
Views
Replies
Total Likes