ModifiableValueMap put checkbox value
In my .content.xml, I have a property set by a checkbox:
<pinterestShareControl
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
fieldDescription="Controls code for displayihg Pinterest save button."
name="./showPinterestSave"
renderReadOnly="{Boolean}true"
text="Show Pinterest save button on images"
value="{Boolean}true">
<granite:data
jcr:primaryType="nt:unstructured"
allowBulkEdit="{Boolean}true"
cq-msm-lockable="showPinterestSave"/>
</pinterestShareControl>
I need to update this property from a servlet I'm writing. My code is here:
ResourceResolver resourceResolver = null;
resourceResolver = request.getResourceResolver();
Resource myResource = resourceResolver.getResource("/content/my-company/language-masters/en/path/to/the/content");
ModifiableValueMap properties = myResource.adaptTo(ModifiableValueMap.class);
properties.put("showPinterestSave", "True");
resourceResolver.commit();
This finds the resource, but I get the error:
"Value 'true' for property 'showPinterestSave' can't be put into node '/content/my-company/language-masters/en/path/to/the/content'"
I have tried sending a 1, true, "True", and "true". All of these give me the error about the value on the property. What is the proper way to format the value for this so my checkbox is updated to true?
Thanks!
Jeremy




