cancel
Showing results for 
Search instead for 
Did you mean: 

Apply custom view to space

monitloth
Champ on-the-rise
Champ on-the-rise
I would like to add a custom view to a space. Getting the list of the spaces is no problem. I did not found in the ContentModel any PROP or ASPECT to add or edit custom views.

I also want to activate that custom view. I mean, when going in the project, the custom view window must be automatically updated. It is not opened by default.

Thanks by advance.
2 REPLIES 2

monitloth
Champ on-the-rise
Champ on-the-rise
I see that templates are aspects (ContentModel.xml):

<aspect name="cm:templatable">
<title>Templatable</title>
  <properties>
   <property name="cm:template">
    <title>Template</title>
    <type>d:noderef</type>
    <mandatory>false</mandatory>
   </property>
  </properties>
</aspect>
So I use the following code:
projectProps.put(ContentModel.PROP_TEMPLATE, presFile);
Where presFile is the noderef of the .ftl file. The file is found correctly. The custom view is not set.

Any ideas?

cheng_lee
Champ in-the-making
Champ in-the-making
I'm adding my research on this so it is documented somehow.

In addition to setting the PROP_TEMPLATE, you should also add an aspect to the space. So the complete code would be:

      Map<QName, Serializable> map = new HashMap<QName, Serializable>();
      map.put(ContentModel.PROP_TEMPLATE, "workspace://SpacesStore/" + myNodeRef().getId());
      nodeService.addAspect(newFolderNodeRef, ContentModel.ASPECT_TEMPLATABLE, map);