I want to edit a content page within a Beanshell script using the API.
This is the script part I tried:
Currently I get the following Error when I try to lock the page in the first step:
Target exception: java.lang.UnsupportedOperationException: lock is not supported for release store elements
Does anybody why this Exception occurs and how I can avoid it.
Or is there another way to edit the page?
Thanks in Advanced
thanks for the quick answer. How can I select the element of the correct current store?
Currently my workflow is as follows:
1. First find a specific template:
StoreElementAgent sea = context.requireSpecialist(StoreElementAgent.TYPE);
template = sea.loadStoreElement(TEMPLATE_UID, SectionTemplate.UID_TYPE, false);
2. Find all usages of this template:
3. select the parent-page for each reference
section = ref.getReferencedElement();
page = section.getParent().getParent();
Unfortunately these pages are always in the release store (page.isInReleaseStore() returns true).
How can I edit the pages? What am I doing wrong?
the „isInReleaseStore()“ does not tell if the element is FROM the release store but (just) if that node (also) exists there. AFAIR It will only return false for never released elements.
It should help to check the ReferenceEntry itself whether it points to an element from the releaseStore and ignore those: