Hello,we did not encounter any problems with the UI of either object-finder or the documentlibrary in Share - both components retrieve any child independent of the type of child association. There are some components though which are rather hard-coded to the FileFolderService and its reliance on cm:contains - e.g. all file server protocols and Sharepoint do not work correctly without cm:contains. In cases where we require these features, we alter our approach a little - we move the new child to the correct child association, but create a secondary child association with cm:contains as a kind of "shadow" to let the FileFolderService-reliant components handle the content their way.Actually, we did not re-define a child association - we rather added our own:
<type name="opapp:company">
<title>Company</title>
<description></description>
<parent>cm:folder</parent>
<associations>
<child-association name="opapp:businessUnit">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>opapp:businessUnit</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</child-association>
</associations>
</type>
A behaviour written in Java could look something like this:
public void onCreateNode(final ChildAssociationRef childAssocRef) {
final NodeRef element = childAssocRef.getChildRef();
final QName assocType = childAssocRef.getTypeQName();
if (assocType.equals(ContentModel.ASSOC_CONTAINS)) {
this.nodeService.moveNode(element, childAssocRef.getParent(), OurModel.ASSOC_BUSINESS_UNIT, childAssocRef.getQName());
// create a secondary cm:contains assoc for FileFolder-based features
this.nodeService.addChild(childAssocRef.getParent(), element, ContentModel.ASSOC_CONTAINS, childAssocRef.getQName());
}
}
The behavior above would need to be registered on the event OnCreateNode and the type opapp:businessUnit to be called at the correct point in time - also it would of course need to include checks wether the parent is indeed a opapp:company which actually has a child association opapp:businessUnit.In more recent customizations of Share we have also used a different approach:* the upload.post.js web script has been altered to allow passing in a target child association by an uploader* the upload action and uploader component in the documentlibrary have been customized to already set the correct document type and pass the appropriate target child association dynamically, depending on the current location in the UIAlfresco and Share are very flexible on how you can achieve something like this depending on the specific requirements. Instead of using a behavior we could have also chosen to rely on rules and actions for this. For what you are trying to achieve, rules and actions may actually be the way to go - instead of hardwiring this all into Java, you could provide a small script which does the trick and configure a rule to trigger the script. Now when you copy spaces from a space template, the rules you have configured are automatically copied as well and ensure that your newly created spaces behave appropriately.RegardsAxel