Using Alfresco One, it is very simple to extend the document structure that is deployed upon a Site creation. An automatic structure deployment can allow for a group of rules, folder structure and documents and other functionalities to be created within a site, when the site is instantiated. The nice thing about this functionality, is that it can be implemented from the GUI with the use of Rules, Scripts and Space Templates.
To implement this functionality, first we will define our folder structure under /Data Dictionary/Space Templates. The folder structure that we define can be simple structures, or smart structures with additional rules and actions. For the purposes of this project, we’ll use the example template for a Software Engineering Project, as depicted in the following photo. The Software Engineering Project template is provided by the default installation of Alfresco, and contains a subdirectory structure for maintaing artifacts of a typical Software Engineering project.
Import Software Engineering Space Template.js
[crayon-5e293c6c3ebed545052996/] In the last step of our configurations, we will add a rule to the /Sites folder, where all sites in the system are created. This rule will listen for onCreate events within the directory, and execute whenever a folder with the Component Id property of the Site Container Aspect is set to documentLibrary. Which is one of the unique properties that identifies the Document Library within a site. This attribute can be selected by selecting “Show More” of the “If all criteria are met” section of the Rules definition form.
Selecting this option will open a modal window with a list of categories to choose from. In that list, choose “Aspects” on the left, and followed by “Site Container.” When Site Container is selected, you will have the option to select the Component Id property of the aspect to utilize in your rules criteria.
Once the Component Id is selected, set the validator expression to say “Equals” and fill in “documentLibrary” for the value. This rule will now execute when a folder with the Aspect of SiteContainer and Container Id property set to “documentLibrary.”
Finally, select the checkbox “Rule applies to subfolders” and hit “Create.”
Our configurations are now completed, and we can test it by creating a new site and validating that our templates were copied.