<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Prefill data, rules and/or execute actions on Site Creation in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241285#M194415</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm developing a custom Site preset. I've already defined the preset and the "placeholders" for the future custom components and dashlets, as well as the "out of the box" ones required in the site. So far so good.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I would like some data and some behaviour or rules automatically applied to some of the folders in the Site when it is created. I've a couple of approaches on mind for solving the problem but I don't feel very confortable with them, and they do have some caveats. I wonder if there isn't a cleaner way to do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;First approach&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Site's main folders have property "{&lt;/SPAN&gt;&lt;A href="http://www.alfresco.org/model/site/1.0}sitePreset" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/site/1.0}sitePreset&lt;/A&gt;&lt;SPAN&gt;" so I could make a rule for /Company Home/Sites folder that fires when a folder with the id of my preset is created. Other different but similar approach would be defining a Behaviour that is attached to "{&lt;/SPAN&gt;&lt;A href="http://www.alfresco.org/model/site/1.0}site" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.org/model/site/1.0}site&lt;/A&gt;&lt;SPAN&gt;" type's creation. The former seems easier if the action to be executed is a script and the later seems easier if yout intend to fire heavy "Java" actions. The second approach also seems easier to "install" as I don't know a easy way to bootstrap a rule to an already existing folder (is it possible at all?).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once the Java action or Javascript launches we could just copy the required data. Each component's folder does not exist until it is first time accesed, so we would probably have to create them, but not like normal folders but using the &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/3.2_JavaScript_Services_API#Get_container_folder_for_component_id" rel="nofollow noopener noreferrer"&gt;Site's service API&lt;/A&gt;&lt;SPAN&gt;, other ways the Site might become corrupt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But… what about the content ? AFAIK there is not such a thing as the "Site Discussion API" or the "Site Blog API". &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Copying normal cm:content to the document library &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Share#Open_Questions" rel="nofollow noopener noreferrer"&gt;is said to work&lt;/A&gt;&lt;SPAN&gt;, but what about discussions, blogs or wikis ? Would it be possible just to have a "template" and copy it in place ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to make this right we could call the same API's that Share calls. Does it make any sense ? Could the repository itself "call itself" ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Second approach&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The second approach would be making an "invisible" dashlet appear in the Site's dashboard. The only use of the dashlet would be executing the required actions to prefill the Site's content as soon as it is executed. The main "advantage" here is that we are requesting at the "Share" site so we could use the "remote" object to call the required APIs and generate all the content.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This idea has severarl tricks or gotchats: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;We have to control if it is the first executio, maybe with an aspect set in the site folder or even better, if it is possible, by taking out the dashlet by itself after execution.&lt;/UL&gt;&lt;UL&gt;The dashlet would probably appear as an option to the person customizing the site.&lt;/UL&gt;&lt;UL&gt;This smells like a really really really nasty hack&lt;/UL&gt;&lt;SPAN&gt;Buff, it's been a long post…. So… What do you think ? Does any of those approaches sound reasonable to you ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Aug 2010 13:58:10 GMT</pubDate>
    <dc:creator>iblanco</dc:creator>
    <dc:date>2010-08-17T13:58:10Z</dc:date>
    <item>
      <title>Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241285#M194415</link>
      <description>I'm developing a custom Site preset. I've already defined the preset and the "placeholders" for the future custom components and dashlets, as well as the "out of the box" ones required in the site. So far so good.Now I would like some data and some behaviour or rules automatically applied to some of</description>
      <pubDate>Tue, 17 Aug 2010 13:58:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241285#M194415</guid>
      <dc:creator>iblanco</dc:creator>
      <dc:date>2010-08-17T13:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241286#M194416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi iblanco,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm running 3.3, but I'm looking to do the same thing.&amp;nbsp; Have you found good documentation on creating new presets?&amp;nbsp; I've been staring at presets.xml, slack-jawed and not sure what to do with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As for your proposed approaches… Your first approach makes the most sense to me and your second approach does smell like a dirty hack.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you think about creating a private site and making sure the required folders exist in there (ie, discussions, etc…), then applying a rule to folders created in the main Sites folder that executes a script?&amp;nbsp; The script could copy the desired folders from your template site into the newly created site.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm just about to leave the office for the day, but I'll try this approach tomorrow and I'll post my results!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 21:19:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241286#M194416</guid>
      <dc:creator>zbennett</dc:creator>
      <dc:date>2010-08-26T21:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241287#M194417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I like your first approach. You've hit on a topic that I have also been giving some thought to, but I have been holding off on digging in since I've seen references in the roadmap to the inclusion of site templates - Q211.&amp;nbsp; I can live without this feature for now, so I have the option of waiting.&amp;nbsp; If you have wants/needs in this area that aren't covered by what is mentioned below you might want to get that entered into Jira for consideration.&amp;nbsp;&amp;nbsp;&amp;nbsp; This is from the roadmap wiki: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Site/Space Templates&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Simplify creation of application specific sites and spaces and enforce standards though site and space templates. Create Sites based site templates to allow sites to include predefine spaces, content and rules. Allow spaces in the document library to be created from space templates that include other spaces, content, rules etc.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 22:10:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241287#M194417</guid>
      <dc:creator>stevegreenbaum</dc:creator>
      <dc:date>2010-08-26T22:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241288#M194418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi both,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have developed the first approach. I made a behaviour that hooks to the creation of a site and at execution time it checks the preset. If the preset is not the desired one it just skips execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The behaviour configuration bean receives several parameters mos notably the preset name, that is checked on creation time and an action. I wanted the behaviour to be generic and reusable so I decided not to put in it what to do on creation time, instead it gets a "standard" Alfresco action.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So now I can develop Java actions and hook them using configuration, or use an already existing action or even better, hook the ScriptActionExecuter passing a script location to it, so I can execute a javascript executed in the claspath. I had some &lt;/SPAN&gt;&lt;A href="http://forums.alfresco.com/en/viewtopic.php?f=4&amp;amp;t=28768" rel="nofollow noopener noreferrer"&gt;problem with this las step&lt;/A&gt;&lt;SPAN&gt; but I managed to achieve it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I have created a script that fills some discussions topics and creates and fills a new datalist on creation time. It seemed quite complex at first as each application (discussions, datalist…) is differente from each other but by checking with Firebug the scripts Share itself calls I managed to find "the correct way" of doing its thing. Using the Alfresco Javascript Debugger in the repository, and looking to share code also was key, as I was able to inspect the siteService object and discover some API calls that are not present or correct in the wiki yet, for example getContainer does not seem to create a container if it does not exist, but you can check for existence with hasContainer and create it with createContainer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Obviously having a prefilled site template would be a nicer option, and probably easier to maintain but for now I'm reasonably happy with the solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The idea of the rule in Company Home/Sites sounds good also and easier, but how is a rule bootstrapped from the classpath ? Sure there is an option but I'm not very experimented with this part of Alfresco.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Concerning documentation about defining a predefined site template, I used the &lt;/SPAN&gt;&lt;A href="http://www.alfresco.com/community/resources/books/professional-alfresco/index.jsp" rel="nofollow noopener noreferrer"&gt;Professional Alfresco&lt;/A&gt;&lt;SPAN&gt;. The book is not as good as I expected from the people in Alfresco Company but it was a quite good starting point for share, so although it's not a book you'll enjoy much it's at least worth the money. But don't take it as a complain about the book, we must admit that it is very very hard to write a better book about such a solution when it still is in fast evolution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far the best Alfresco development book I've read is Jeff Pott's &lt;/SPAN&gt;&lt;A href="http://www.amazon.com/Alfresco-Developer-Guide-Jeff-Potts/dp/1847193110" rel="nofollow noopener noreferrer"&gt;Alfresco Developer Guide&lt;/A&gt;&lt;SPAN&gt;, but it doesn't talk about share, is older than that. I hope Jeff writes a second edition or a new book about share.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Aug 2010 16:30:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241288#M194418</guid>
      <dc:creator>iblanco</dc:creator>
      <dc:date>2010-08-27T16:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241289#M194419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Look at Alfresco Developer Guide - page 106 and 107 to see if that gives what you are looking for regarding deploying your rule action.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Aug 2010 17:23:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241289#M194419</guid>
      <dc:creator>stevegreenbaum</dc:creator>
      <dc:date>2010-08-27T17:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241290#M194420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not really, that example registers and action and then sets a rule that runs that action, but doesn't solve the problem of setting the rule on extension's installation time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Aug 2010 06:24:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241290#M194420</guid>
      <dc:creator>iblanco</dc:creator>
      <dc:date>2010-08-30T06:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241291#M194421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, I was referring to the line in the book saying use Ant Deploy script. I've never looked at those scripts, but I wonder if they contain what you are looking for.&amp;nbsp; There are supposed to be sample scripts that come with the book.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 19:43:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241291#M194421</guid>
      <dc:creator>stevegreenbaum</dc:creator>
      <dc:date>2010-09-03T19:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241292#M194422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've accomplished much of this using JavaScript and rules. I wrote up some tutorials about it last week and posted them on a new blog. The tutorials include all of the code you need to accomplish what I've accomplished and they should be easy enough for anyone to follow (even non-programmer Alfresco newbies, for the most part).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are some links you may find useful:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How to add custom Site dashboard preset types to Alfresco Share: &lt;/SPAN&gt;&lt;A href="http://zandadev.com/zach/alf/?p=21" rel="nofollow noopener noreferrer"&gt;http://zandadev.com/zach/alf/?p=21&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Creating a Site Template, Part 1: Folders, Files, and Rules: &lt;/SPAN&gt;&lt;A href="http://zandadev.com/zach/alf/?p=37" rel="nofollow noopener noreferrer"&gt;http://zandadev.com/zach/alf/?p=37&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I plan to post more tutorials as I solidify the processes I develop, as the blog is going to serve as documentation for my current project.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 12:23:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241292#M194422</guid>
      <dc:creator>zbennett</dc:creator>
      <dc:date>2010-09-21T12:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241293#M194423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for posting this solution.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 12:46:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241293#M194423</guid>
      <dc:creator>stevegreenbaum</dc:creator>
      <dc:date>2010-09-21T12:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241294#M194424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;deep copy javascript function doesn't copy the permissions assigned to the source folder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it was available in 3.1 community edition but not available in 3.3g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I copied copyPermissons in CopyServiceImpl from 3.1 to 3.3g, now permissions are getting copied but Share manage permissions pop up shows default permissions only.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any idea why Share interface is not showing copied permissions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for any help. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@iblanco&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope I haven't hijacked your post, since its related to custom site template solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Sep 2010 13:31:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241294#M194424</guid>
      <dc:creator>nikes</dc:creator>
      <dc:date>2010-09-25T13:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Prefill data, rules and/or execute actions on Site Creation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241295#M194425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt; , You're welcome Nikes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Sep 2010 15:42:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/prefill-data-rules-and-or-execute-actions-on-site-creation/m-p/241295#M194425</guid>
      <dc:creator>iblanco</dc:creator>
      <dc:date>2010-09-25T15:42:16Z</dc:date>
    </item>
  </channel>
</rss>

