Expand my Community achievements bar.

SOLVED

AEM Filter.xml

Avatar

Level 3

I made below changes in filter.xml file:
<filter root="/etc/msm/rolloutconfigs/" mode="update"/>

 

There are certain rollout-configs listed under path /etc/msm/rolloutconfigs

 

/etc/msm/rolloutconfigs/rollout-config-sample has some value for 'editMap' property at editProperties node ( /etc/msm/rolloutconfigs/rollout-config-dealer/jcr:content/editProperties).

rollout-config-sample is not part of the code base and I did some modification in editMap value for which I created a package and Installed on the server. After each deployment, my modified value gets overwritten even though I've set mode="update".
I was expecting it to add the new content while keeping the existing value in place.

Could anyone please help me understand why mode="update" didn't work as expected here or I understood it wrong?


1 Accepted Solution

Avatar

Correct answer by
Level 4

Just replace mode ="merge"

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @MeenuRajput, I think what you should try mode="merge". I think the update mode is working as expected.

update : Existing content is updated, new content is added and none is deleted.

Please find more information about each mode under https://jackrabbit.apache.org/filevault/filter.html#Filter_Elements

Avatar

Level 3

Hi @lukasz-m Thanks for you response. With mode="update" We expect that Existing content is updated, new content is added and none is deleted.

My situation is that I’m installing a package which is adding some content at /etc/msm/rolloutconfigs/rollout-config-same path. Once i deploy code, it is overwriting the line of code I added with the old/previous value.
 

Before update, I also tried merge on a particular filter path like 

	<filter root="/etc/msm/rolloutconfigs/rollout-config-dealer" mode="merge"/> 

With this, once I deployed the code, it was completely deleting the "/etc/msm/rolloutconfigs/rollout-config-dealer" node from /etc/msm/rolloutconfigs/ path. 


Avatar

Community Advisor

@MeenuRajputcould you please share list of all filters related to /etc that you are using in your package?

Avatar

Level 3

In the filter.xml, I added the update mode on the parent level folder as below : 
<filter root="/etc/msm/rolloutconfigs/" mode="update"/>

In crx, I've list of nodes under /etc/msm/rolloutconfigs like 
/etc/msm/rolloutconfigs/rollout-config-sample

/etc/msm/rolloutconfigs/dk-dealers-rollout-sample1

/etc/msm/rolloutconfigs/dk-dealers-rollout-sample2

 

Out of above mentioned configs, '/etc/msm/rolloutconfigs/rollout-config-sample' is not part of code base, since I made some modifications in editMap value and wanted it to persist after code deployment, I created a package of '/etc/msm/rolloutconfigs/rollout-config-sample', and installed on AEM server. After this step, when I deployed code from my branch which doesn't include '/etc/msm/rolloutconfigs/rollout-config-sample' , I expected the modified value at this node to persist as I modified my filter.xml. 
But as an output, changes that I made at /etc/msm/rolloutconfigs/rollout-config-sample/jcr:content/editProperties node in editMap property was reverted to previous value (Excluding my changes).

I don't understand why mode update didn't play it's role here. However I was able to make it work by completely removing any type of mode from filter.xml and adding the code for "/etc/msm/rolloutconfigs/rollout-config-sample/jcr:content/editProperties" in the code base.

Avatar

Community Advisor

This is weird. What else came into my mind is to use exclude option. So your filter could look like this:

<filter root="/etc/msm/rolloutconfigs" mode="merge">
   <exclude pattern="/etc/msm/rolloutconfigs/rollout-config-sample" />
</filter>

Avatar

Correct answer by
Level 4

Just replace mode ="merge"