cancel
Showing results for 
Search instead for 
Did you mean: 

Adding my aspects to default Company Home

ianpriest
Champ in-the-making
Champ in-the-making
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.
1 REPLY 1

davidc
Star Contributor
Star Contributor
Hi Ian,

I can't think of any other solutions at this point in time, so sticking with the second approach is probably best.

I'll think about this and see if there's anything simple we can do to allow this kind of configuration.