Details
-
Improvement
-
Resolution: Won't Do
-
Neutral
-
1.2
-
None
-
-
Yes
-
Empty show more show less
Description
At the moment there is the possibility to set a single node type in a CommandEventListener, but in some cases this may not be enough.
Using data module, if you want to version contents upon modification, you can set a listerer for each type. But this could be a problem if you have subtypes: if you want to version also subtypes and add corresponding listeners, an exception might be raised during versioning, because you will version concurrently the subtype item and its parent (subtype path contains also parent path, so even if you have two listeners with two different types, both are going to be versioned). It does not happen in memory, but happens a lot using a db and clustering.
The attached class, which is mostly a copy of RestrictToNodeTypeEventListener, allows you to set a list of node types that should be listened, so when the event is triggered on a subtype, the listener will catch just the highest level node, avoiding unwanted propagation to the parent node.
On the other side, without this class, you can set a restriction on node type on the "parent" listener configuration (the config node that is a parent of the node in which you define the listener class), and copy that entire configuration for each node type or subtype you need.