AnsweredAssumed Answered

Use of Policies to enforce node creation constraints

Question asked by jamen on Sep 8, 2008
Hi,

Just a general question around the best way to enforce constraints around the creation of a node of a particular type in a custom space at the repository level (if possible).  I have custom space types called "customns:customSpace1" and "customns:customSpace2".  I also have a custom document type called "customns:customDoc1".  If I wanted to enforce the following rules, is using a policy a good way of doing this:-
1. customDoc1 documents can only exist in customSpace2 spaces
2. customSpace2 spaces can only exist in customSpace1 spaces

That is I have new custom behaviour bound either to the onCreateNode or the onCreateAssociation policies (thoughts on the choice of which one would be welcome?).  Alternatively I would be setting up logic to ensure that these constraints are met in overriding the web client behaviour.

My concern with using policies is that the policy events fire after the node is created.  If any of the relevant policy behaviour conditions are not met for above, then an exception would be thrown.  The issue with this I have observed is that the error message that comes back isn't really friendly.  Secondly if a policy fails to execute successfully, numerous attempts of retrying seem to take place.

If anyone can provide some helpful thoughts on this scenario it would be greatly appreciated.

Regards
Jamen

Outcomes