활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
Hi All,
Suppose I want to delete two specific properties from a specific component, present on all pages in author.
Which would be the best way to do it. Any code snippet regarding this will be very helpful.
Any thoughts will be really helpful.
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
For doing this follow given steps -
first you have to search all pages those contains this component & for doing this you can use search query as shown below -
type=nt:unstructured
path=/content
property = cq:commerceType
property.value=product
This query will return all pages those contains a node having property cq:commerceType & value as product.
Second - Now just remove the properties from these result set resources by -
first adopt these resource into ModifiableValueMap this is a extension of ValueMap in AEM.
Then simply use map.put() method to change the value & the commit the resourceResolver using resourceResolver.commit() method.
It will do what you want.
Happy Coding
조회 수
답글
좋아요 수
For doing this follow given steps -
first you have to search all pages those contains this component & for doing this you can use search query as shown below -
type=nt:unstructured
path=/content
property = cq:commerceType
property.value=product
This query will return all pages those contains a node having property cq:commerceType & value as product.
Second - Now just remove the properties from these result set resources by -
first adopt these resource into ModifiableValueMap this is a extension of ValueMap in AEM.
Then simply use map.put() method to change the value & the commit the resourceResolver using resourceResolver.commit() method.
It will do what you want.
Happy Coding
조회 수
답글
좋아요 수
You can write a simple service using JCR API to do that for you !
You can refer this on using JCR API
https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html
조회 수
답글
좋아요 수
My favorite tool for this type of thing is the groovy console. Makes doing large scale changes such as this a lot easier
조회 수
답글
좋아요 수
Hi Bailey,
Thank you for your reply.
Did go through the code, but was not able to understand much.
Do you have any other references/simple code, so that I get some understanding on this.
조회 수
답글
좋아요 수
Hi Ankur,
Thanks a ton for your reply.
1] http://www.wemblog.com/2014/08/how-to-use-sessions-and-resource.html Looks like this has code similar to what you mentioned. Is that correct?
2] In the search query you provided(taking that as a reference), I want to remove property cq:commerceType from all the pages in author. That can be done based on the code provided in #1[above]?
Your thoughts/pointers will be really helpful.
조회 수
답글
좋아요 수