AnsweredAssumed Answered

How to create root node in the spacesStore?

Question asked by davidsun on Feb 13, 2015
Latest reply on Feb 13, 2015 by davidsun
I have a data model as following and now I want to create root node in the spaces store, just like out-of-box Catetory_root in the contentModel.xml.

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="sc:somecompanymodel" xmlns="">
   <!– Optional meta-data about the model –>
   <description>SomeCompany Content Model</description>
   <author>Some Guy</author>

   <!– Imports are required to allow references to definitions in other models –>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="" prefix="d" />
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="" prefix="cm" />
      <import uri="" prefix="sys" />

   <!– Introduction of new namespaces defined by this model –>
      <namespace uri="" prefix="sc" />

      <type name="sc:searchField">
         <title>Search Fields</title>
         <description>The search field payer organization defined</description>
            <property name="sc:organizationId">
               <mandatory enforced="true">true</mandatory>
            <property name="sc:definedSearchedFields">
               <mandatory enforced="true">true</mandatory>
      <type name="sc:searchFields_root">
         <title>Search Field Root</title>
            <child-association name="sc:searchFields">

I get spaces store in the following way:

       List<StoreRef> stores = nodeService.getStores();
       StoreRef store = null;
       for(StoreRef s : stores) {
          if(s.getProtocol().equalsIgnoreCase(StoreRef.PROTOCOL_WORKSPACE) && s.getIdentifier().equalsIgnoreCase("SpacesStore")) {
             store = s;

but nodeService only have function to create NodeRef under another NodeRef. How can I create a root node in the Spaces Store?

Thank you!