AnsweredAssumed Answered

How to properly bootstrap folder in Company Home?

Question asked by patrykl on Jul 4, 2013
Latest reply on Jul 9, 2013 by patrykl
I'm using Alfresco Community Edition 4.2.c. As I'm starting my journey with Alfresco I want to achieve something simple. I want to bootstrap new folder called MyFolder in Company Home space. I'm following this tutorial:

I have simple module with following module-context.xml file:

<?xml version='1.0' encoding='UTF-8'?>

   <bean id="customSpacesBootstrap" parent="spacesStoreImporter"
      <property name="useExistingStore">
      <property name="bootstrapViews">
               <prop key="path">/${spaces.company_home.childname}</prop>
               <prop key="location">alfresco/module/myModule/bootstrap.xml</prop>

And my bootstrap.xml is also very simple:

<view:view xmlns:view=""
   xmlns:cm="" xmlns:app=""

   <cm:folder view:childName="cm:MyFolder">
      <app:uifacets />

And the problem is that it isn't creating MyFolder. I have tried to redeploy Alfresco with this module many times, including tests with wiping up Alfresco data repository folder and its database. I'm using default Tomcat with Postgres and Jetty + H2 - both behave the same. To make it work I have to change 'useExistingStore' to true. After that change and redeploy MyFolder is being created. But it creates another problem: when I redeploy again, Alfresco throws Exception during Spring context spin up, complaining about duplicate node name (MyFolder) and deeper about unique constraint violation from DB. So I have to change useExistingStore to false again. This is very inconvenient for final production environment.

From what I have read about useExistingStore, when set to false, it should behave exactly how I would like: create folder once and then skip any changes and touching it when it exists.

I have also read Alfresco spaces.xml and import-export-context.xml file. I can easily reproduce the problem in these files as well. For example in spaces.xml top level Company Home folder is created. When I add another top level folder besides it, lets call it CompanyHome2 and redeploy Alfresco - CompanyHome2 won't be created (but it does not exist so should be). But when I wipe out Alfresco data and redeploy then it will be created.

What am I doing wrong?