since ‎13-09-2018
‎10-12-2019
rajareddych
Level 2
Re: JUnit for Logic rajareddych - Adobe Experience Manager
I have resolved this myself. Thanks
557
Views
0
Likes
0
Answers
Re: JUnit for Logic rajareddych - Adobe Experience Manager
package service.core.workflows;import java.util.Collections;import java.util.UUID;import javax.jcr.Session;import org.apache.sling.api.resource.LoginException;import org.apache.sling.api.resource.ModifiableValueMap;import org.apache.sling.api.resource.Resource;import org.apache.sling.api.resource.ResourceResolver;import org.apache.sling.api.resource.ResourceResolverFactory;import org.apache.sling.jcr.resource.api.JcrResourceConstants;import org.osgi.framework.Constants;import org.osgi.service.co...
544
Views
0
Likes
0
Answers
Re: JUnit for Logic rajareddych - Adobe Experience Manager
did not help, i've gone through a lot of articles.Now I'm struck withif (childResource.getResourceType().equalsIgnoreCase(ServiceConstants.SOME_RESOURCE)) { name = "SomeResource"; } else if (childResource.getResourceType().equalsIgnoreCase(ServiceConstants.EXAMPLE_RESOURCE)) { name = "ExampleResource"; }
544
Views
0
Likes
0
Answers
JUnit for Logic rajareddych - Adobe Experience Manager
Help is appreciated in writing JUNIT for below code. @PostConstruct protected void invokepost() { super.Initialize(); qs = new ArrayList(); Iterator iteratorExp = resource.getChild("root/childParsys/").listChildren(); while (iteratorExp.hasNext()) { Resource childResource = iteratorExp.next(); SomeComponent map = childResource.adaptTo(SomeComponent.class); if(map != null) { qs.add(map); } if (childResource.getResourceType().equalsIgnoreCase(ServiceConstants.SOME_RESOURCE)) { name = "SomeResource...
1250
Views
0
Likes
6
Answers and Comments
JUnit for Workflow rajareddych - Adobe Experience Manager
Writing code is easy, but I'm finding it difficult to write JUnit tests for that code. Could anyone help in writing JUnit for the below workflow.public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) { log.info("\n------------- Workflow {Start} --------------------"); String contentPath = ""; WorkflowData workflowData = workItem.getWorkflowData(); final String type = workflowData.getPayloadType(); ResourceResolver resourceResolver = null; log.info("Workflow typ...
492
Views
0
Likes
0
Replies
Re: How to limit Parsys to one component dynamically. rajareddych - Adobe Experience Manager
I too got this idea, but unfortunately, I can use only 1 Parsys.
611
Views
0
Likes
0
Answers
How to limit Parsys to one component dynamically. rajareddych - Adobe Experience Manager
I have 2 components A & B and Parsys allowing both the 2 components.If I drag & drop component A, then the Parsys should only allow component A and should not be allowed for component B.If I drag & drop component B, then the Parsys should only allow component B and should not be allowed for component A.Can I achieve this condition? If so, how can I achieve this?
664
Views
0
Likes
2
Answers and Comments
Listener event not triggered rajareddych - Adobe Experience Manager
I am using below code to dynamically assign an ID to a component/template. Seems this is not getting triggered. Please helpimport javax.jcr.Node;import javax.jcr.RepositoryException;import javax.jcr.Session;import javax.jcr.observation.Event;import javax.jcr.observation.EventListener;import javax.jcr.observation.ObservationManager;import javax.jcr.observation.EventIterator;import org.apache.sling.api.resource.ResourceResolver;import org.apache.sling.api.resource.ResourceResolverFactory;import or...
1547
Views
0
Likes
2
Answers and Comments
Re: Generate Unique Component ID rajareddych - Adobe Experience Manager
I need a way to generate AEM inbuilt UUID for each component. I have read a lot of documents, but nothing has how to create it.
842
Views
0
Likes
0
Answers
Workflow process step to assign a value to a node property in crx/de rajareddych - Adobe Experience Manager
I want to create a workflow process step for assigning a value to a component node's property in crx/de, /content folder.
763
Views
0
Likes
1
Answers and Comments
Generate Unique Component ID rajareddych - Adobe Experience Manager
After I create a page, I need my default component in the page to generate a unique ID and display it.I have read a lot of threads related to this. UUID is something I could use and below code also i could usef(F.P1.AUTO_NUM.rawValue == null) { var d = new Date(); var code = d.getDay().toString() + d.getMonth().toString() + d.getFullYear().toString() + d.getHours().toString() + d.getMinutes().toString() + d.getSeconds().toString() + d.getMilliseconds().toString(); //Set to code the the text fiel...
1196
Views
0
Likes
3
Answers and Comments
Re: Splecial characters in RTE are displayed differently after conversion to JSON view rajareddych - Adobe Experience Manager
Thank you guys, I have used replace keyword instead of decoding, and is working as expected.
825
Views
0
Likes
1
Replies
Re: Splecial characters in RTE are displayed differently after conversion to JSON view rajareddych - Adobe Experience Manager
Answer Model is a JSON sling model exporter with 3 fields, 2 are RTE fields.
2364
Views
0
Likes
0
Replies
Re: Splecial characters in RTE are displayed differently after conversion to JSON view rajareddych - Adobe Experience Manager
[ERROR] /C:/Users/raja/Desktop/aem-release/core/src/main/java/com/core/servlets/qr/ContentServlet.java:[40,26] cannot find symbol symbol: method writeValueAsString(com.aetna.ahm.core.models.qr.AnswerModel) location: variable object of type java.lang.Object
2364
Views
0
Likes
4
Replies
Re: Splecial characters in RTE are displayed differently after conversion to JSON view rajareddych - Adobe Experience Manager
I have followed to crate similar servlet, I am getting error at json = object.writeValueAsString(answerModel); for writeValueAsString@SlingServlet(resourceTypes = {AHMJsonServiceConstants.ANSWER_RT},selectors = "servlet",extensions = "json",methods = "GET")public class ContentServlet extends SlingSafeMethodsServlet {private static final long serialVersionUID = -1765279544984834180L;private static Logger LOG = LoggerFactory.getLogger(AnswerModel.class);@Override protected void doGet(SlingHttpServ...
2364
Views
0
Likes
6
Replies
Splecial characters in RTE are displayed differently after conversion to JSON view rajareddych - Adobe Experience Manager
1. Created a custom component dialog, which has field='Answer Text' with richtext field2. Gave Special characters as input3. Create Sling Model Exporter for JSON output@PostConstructpublic void invokepost() {if (answerText != null && !answerText.isEmpty()) {answerText = formatAnswerRTEText(answerText);}}// In this method, rteText is passed as a parameter which needs to be trimmed and covered with double quotes and remove all the new lines in the textprivate String formatAnswerRTEText(String rteT...
2893
Views
0
Likes
12
Replies
Re: Resource Mapping rajareddych - Adobe Experience Manager
5359
Views
0
Likes
2
Replies
Resource Mapping rajareddych - Adobe Experience Manager
Scenario: For folders under /content/folderAAA/folderBBBI have mapped "sling:internalRedirect = /content/folderAAA/folderBBB/$1/jcr:content.dt.json" to "sling:match = localhost.4502/folderAAA/en-us/(.+)"Could anyone please provide solution on how to map content under both "/content/folderAAA/folderBBB" and "/content/folderAAA/folderBBB/folderCCC" to "sling:match = localhost.4502/folderAAA/en-us/(.+)"
5628
Views
0
Likes
4
Replies
Re: Sling Model Exporter rajareddych - Adobe Experience Manager
I had posted different code. Please let me know the updates I need for the below code.Here I'm checking for formID to be null or empty, I think, I also need to check for duplicate ID@PostConstructprotected void invokePost() {Node jcrNode = null;Node currentNode = resource.adaptTo(Node.class);PageManager pageManager = resource.getResourceResolver().adaptTo(PageManager.class);if (pageManager != null) {jcrNode = pageManager.getContainingPage(resource).getContentResource().adaptTo(Node.class);}try {...
1946
Views
0
Likes
2
Replies
Re: Sling Model Exporter rajareddych - Adobe Experience Manager
Could you please explain with my code.
1946
Views
0
Likes
4
Replies
Sling Model Exporter rajareddych - Adobe Experience Manager
I have a sling model exporter to generate IDs for pages created in AEM.Issue: When I create pages under new folders, duplicate IDs is generated.Eg: "Folder 1 has page with ID 1234, If page is created under Folder 2, it also has ID 1234"I want to generate Unique IDs for every page created, irrespective of folder.Please help me if anything to be changed in my code.My Code:public class SequentialNumberImpl implements SequentialNumberService {private static Logger log = LoggerFactory.getLogger(Seque...
2288
Views
0
Likes
7
Replies
Re: JSON output for a page with different components rajareddych - Adobe Experience Manager
Created a Page using Template having pathParsys, pathParsys allow component A multiple times. Component A has componentParsys, componentParsys allow component B, component C, component D, component E, component F, component G, component H multiple times. Component C & Component D are configured with 1 default Answer component and have answerParsys (to add additional answer components), answerParsys allow Answer component multiple times. Component H is configured with 2 default Answer componentsN...
2490
Views
0
Likes
1
Replies
Re: JSON output for a page with different components rajareddych - Adobe Experience Manager
Thanks Donald,My requirement is, export JSON forpage with contentParsys [allow only 1 component with componentsParsys],componentsParsys allow multiple components [components without parsys & components with answerParsys] multiple times,answerParsys allow only multiple Answer components.The complexity of this requirement is confusing me.
2490
Views
0
Likes
3
Replies
Re: JSON output for a page with different components rajareddych - Adobe Experience Manager
I appreciate the help guys. I could not relate the concepts present at links provided to my requirement.It would be nice to have a code preview for point 1 or 2.
2490
Views
0
Likes
5
Replies
JSON output for a page with different components rajareddych - Adobe Experience Manager
Could you please help me in writing Sling Model for generating custom JSON for1. Component with parsys (components can be added in parsys)2. Page level (with all the components and sub-components added)Any code example would help a lot.Thanks
3076
Views
0
Likes
9
Replies