AnsweredAssumed Answered

Adding my aspects to default Company Home

Question asked by ianpriest on Jan 16, 2006
Latest reply on Jan 18, 2006 by davidc
Hi,

I've developed a couple of aspects that I use to define additional versioning behaviour on content. It works as follows:

I have a POLICY aspect that is applied to spaces. It has a property that may contain a specific versioning policy or may contain the value PARENT, in which case the aspect will default to the policy defined by its primary parent space. PARENT is the default value.

I have a VERSIONABLE aspect that is applied to content and which uses cm:versionable as its parent. It adds a little extra functionality to versioning. The VERSIONABLE aspect on the content node looks to it's parent space to decide how it should behave when content is changed.

At system start-up I want my new POLICY aspect to be attached to the root-node of every store with some value other than PARENT. That way there is always a node with a non-PARENT policy that spaces in that store can inherit their POLICY from. I've tried doing it a couple of ways, neither of which I'm especially happy with. I wondered if you guys had any comments?

The first approach I took was to use policy handlers. I developed a handler for onCreateStore() and onCreateNode(). These worked fine except at system bootstrap. The bootstrapImporter appears to turn off all policy behaviour when it creates the CompanyHome node, (and all other nodes), so my POLICY aspect doesn't get applied. This means that when sub-nodes look to CompanyHome for a policy they don't find one.

The second approach is that I could change the config files so that my POLICY aspect is declared as a mandatory aspect on sys:root and cm:folder, with some default values defined for sys:root. Unfortunately this leads to problems with the order in which dictionary definintions are loaded. My POLICY aspect would have to be imported before systemConfig, so I could attach it to sys:root types, but my VERSIONABLE aspect must be loaded after contentModel as it inherits from cm:versionable. This makes it impossible to declare my aspects in the same config file. It's not a huge issue but it seems a bit "hacky" to not define all my aspects in the same place.

At the moment I tend to prefer the second approach, but I wondered if you guys could suggest some other way that I can get my aspects into your bootstrap nodes. Can I perhaps do anything in the files used to define the bootstrap config, such as system.xml or bootstrap-spaces.properties?

Apologies for asking such a long-winded question!

Cheers,
Ian.

Outcomes