Details
-
New Feature
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
Description
Also known as property level initialization, as it being one of its main uses. This issue has been communicated over the mailing list, where the proposal is below. In summary is it currently not possible to make fine grained or more controlled import of content without having either to delete existing content first or being real careful about the order in which to import.
As you you can specify through the usage of the hippoecm-extension.xml files
that you want to auto-initialize certain content in the repository for the
CMS. In these extension files you specify the names of XML files that you
want to be imported into the repository if not already imported. The
importing finds place using the regular JCR method for importing content from
XML files (javax.jcr.Session.importXML(), albeit it a slightly enhanced
version).
There are however a number of limitations of importing content through these
specific XML files. One of the most striking is that you cannot simply set a
single property, but have to import an entire node, creating a problem when
the node is already there. Given this use case the improvement we will be
working on has become known as "property level initialization", but there are
in fact more uses we want to address.
One would be like to be able to for example:
- add values to a multi value properties, or insert at a specific position;
- insert nodes at a specfic location below ordered parent nodes;
- overriding the type, or adding a mixin and merge new properties;
Etcetera.
We discussed a number of options and although we could use a single approach
provide enough power to perform all kind of actions, there are different
audiences who want to use these improvements.
There for we /currently/ settled on the following three ways to improve the
initialization of content and configuration:
1) For a few, but very common uses, we could extend the possible actions that
you can specify in the hippoecm-extension.xml file. There should be only a
limited set of actions to be added to cover only the most uses (say only add
three of four but really stop at that, also not extend in future). We're
thinking about the following two:
a) add the functionality to SET a property to a single value. In case a
new value is not specified the property it either removed in case of a
single valued property or set to an empty list in case the value is
multi valued;
b) add a value to a multi value property, the value is added as the last
element of the list.
This should cover the most use cases as configuring the Xinha, perspective
tabs and htmlcleaner. In case you have very common other demands we'd like
your input.
2) Enhance the XML importer such that the XML file you are inputting can
contain additional directives. With these directives you can specify on a per
node or property level if content should be merged, overridden, removed or
inserted in a specific order. All of the above mentioned cases should be
covered with this.
3) Allow a programmatic initialization, in order write your own code to
initialize content. This requires more error prone programming, is a bit low
level and slower, but allows you to conditionally change content and provide
your own(tm) input format files and own(tm) api for importing content to be
build.
Especially when doing complex imports this might be very valuable, but this
approach would be there to cover the last 10 percent of the use-cases for
power users. On the upside, this method can already easily be supported
through UpdaterModule in the repository with a minor change.