mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
onCreateNode script for app:project type now deep copies contents of Project space template when a New Project is created via the action in the Projects space
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7609 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,15 +1,35 @@
|
|||||||
// onCreateNode policy code for app:projectfolder
|
// onCreateNode policy code for app:projectfolder
|
||||||
var project = behaviour.args[0];
|
logger.log("onCreateNode policy code for app:projectfolder");
|
||||||
var results = search.luceneSearch("+PATH:\"" + project.qnamePath + "/*\" +ASPECT:\"{http://www.alfresco.org/model/emailserver/1.0}aliasable\"");
|
var project = behaviour.args[0].child;
|
||||||
if (results.length == 1)
|
if (project.children.length == 0)
|
||||||
{
|
{
|
||||||
results[0].properties["emailserver:alias"] = normalise(project.name);
|
// perform deep copy of Project template contents into this node
|
||||||
results[0].save();
|
var templates = search.luceneSearch("+PATH:\"/app:company_home/app:dictionary/app:space_templates/*\" +TYPE:\"{http://www.alfresco.org/model/application/1.0}projectfolder\"");
|
||||||
logger.log("Applied email alias of: " + normalise(project.name));
|
if (templates.length == 0)
|
||||||
}
|
{
|
||||||
else
|
logger.log("No app:project templates found to copy!");
|
||||||
{
|
}
|
||||||
logger.log("No email folder found!");
|
else
|
||||||
|
{
|
||||||
|
logger.log("Copying app:project template into new project...");
|
||||||
|
for each (var child in templates[0].children)
|
||||||
|
{
|
||||||
|
child.copy(project, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// search for the email archive child folder
|
||||||
|
var results = search.luceneSearch("+PATH:\"" + project.qnamePath + "/*\" +ASPECT:\"{http://www.alfresco.org/model/emailserver/1.0}aliasable\"");
|
||||||
|
if (results.length == 1)
|
||||||
|
{
|
||||||
|
results[0].properties["emailserver:alias"] = normalise(project.name);
|
||||||
|
results[0].save();
|
||||||
|
logger.log("Applied email alias of: " + normalise(project.name));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.log("No email archive folder found!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalise(s)
|
function normalise(s)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<!-- Project behaviour registration -->
|
<!-- Project behaviour registration -->
|
||||||
<bean id="app_projectfolder_onCreateNode" class="org.alfresco.repo.policy.registration.ClassPolicyRegistration" parent="policyRegistration">
|
<bean id="app_projectfolder_onCreateNode" class="org.alfresco.repo.policy.registration.ClassPolicyRegistration" parent="policyRegistration">
|
||||||
<property name="policyName">
|
<property name="policyName">
|
||||||
<value>{http://www.alfresco.org}onUpdateNode</value>
|
<value>{http://www.alfresco.org}onCreateNode</value>
|
||||||
</property>
|
</property>
|
||||||
<property name="className">
|
<property name="className">
|
||||||
<value>{http://www.alfresco.org/model/application/1.0}projectfolder</value>
|
<value>{http://www.alfresco.org/model/application/1.0}projectfolder</value>
|
||||||
|
Reference in New Issue
Block a user