Expand my Community achievements bar.

SOLVED

Change a multivalued property with the editproperties sync action

Avatar

Level 1

Hello,

We have a multisite setup, where one of the sites is a mobile version of another site. The mobile site is a livecopy from the desktop version. We are using an EditProperties sync action to modify the components and templates in the mobile site to their mobile counterparts, just like in the geometrix example site. This works fine.

The only problem is we are not able to modify the 'cq:allowedTemplates' property to contain the mobile versions of the templates. I'm trying something like this:

cq:allowedTemplates#/apps/kpngb-whitelabel/templates/contentpage#/apps/kpngb-whitelabel/templates/mobile/contentpage

But then I get the following exception when performing a roll-out:

 

Caused by: javax.jcr.ValueFormatException: property /content/kpngb-base-mobile/en/jcr:content/cq:allowedTemplates is a multi-valued property, so it's values can only be retrieved as an array
    at org.apache.jackrabbit.core.PropertyImpl.internalGetValue(PropertyImpl.java:483)
    at org.apache.jackrabbit.core.PropertyImpl.getValue(PropertyImpl.java:510)
    at org.apache.jackrabbit.core.PropertyImpl.getString(PropertyImpl.java:520)
    at com.day.cq.wcm.msm.impl.actions.PropertyEditor.editNode(PropertyEditor.java:95)
    at com.day.cq.wcm.msm.impl.actions.EditPropertiesActionFactory$EditPropertiesAction.doExecute(EditPropertiesActionFactory.java:101)
    at com.day.cq.wcm.msm.impl.actions.BaseAction.execute(BaseAction.java:53)
    ... 99 more

 

So my question is:

*) is it possible to change a multivalued property like cq:allowedTemplates with the EditProperties sync action

--) if it is, then what is the syntax of the replacement expression

--) if it is not, is there another way to do this (I suppose by writing a custom LiveAction?)

 

Kind regards,

 

Luc Feys

1 Accepted Solution

Avatar

Correct answer by
Level 6

As far as I know, it is not possible to use the Edit Properties functionality in MSN Rollout config for multivalued properies. That is due to the fact that the functionality is using a regular expression. And those are hard to write for String arrays.

The question is why you would like to restrict the cq:allowedTemplates on the mobile? Will it be possible for an author to go into the rolled out structure and create a non-synchronized node? If yes, then you have to write your own action.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

As far as I know, it is not possible to use the Edit Properties functionality in MSN Rollout config for multivalued properies. That is due to the fact that the functionality is using a regular expression. And those are hard to write for String arrays.

The question is why you would like to restrict the cq:allowedTemplates on the mobile? Will it be possible for an author to go into the rolled out structure and create a non-synchronized node? If yes, then you have to write your own action.

Avatar

Level 1

Hello Ove,

 

thank you for the quick reply.

Yes it should indeed be possible for the content editor to create some 'non-synchronized' content in the mobile site.

I will investigate how to create a custom action to do this.

Kind regards,

 

Luc Feys