<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!–
Define the model factory used to generate object models suitable for use with freemarker templates.
–>
<bean id="templateActionModelFactory" class="org.alfresco.repo.action.scheduled.FreeMarkerWithLuceneExtensionsModelFactory">
<property name="serviceRegistry">
<ref bean="ServiceRegistry"/>
</property>
</bean>
<!– 1
Exemple de deplacement du contenu d'un dossier
pour cet exemple le dossier est situe dans : Company Home > Data Dictionary > RM > Espace_Actes_Actifs
le fichier de script est : Deplacement_de_contenu.js
–>
<bean id="Deplacement_de_contenu_runScriptAction" class="org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition">
<property name="actionName">
<value>script</value>
</property>
<property name="parameterTemplates">
<map>
<entry>
<key>
<value>script-ref</value>
</key>
<value>${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts/cm:Deplacement_de_contenu.js"' )}</value>
</entry>
</map>
</property>
<property name="templateActionModelFactory">
<ref bean="templateActionModelFactory"/>
</property>
<property name="dictionaryService">
<ref bean="DictionaryService"/>
</property>
<property name="actionService">
<ref bean="ActionService"/>
</property>
<property name="templateService">
<ref bean="TemplateService"/>
</property>
</bean>
<!– 2
Exemple de suppression du contenu d'un dossier
pour cet exemple le dossier est situe dans : Company Home > Data Dictionary > RM > Espace_Actes_Semi_Actifs
le fichier de script est : Deplacement_de_contenu.js
–>
<bean id="Suppression_de_contenu_runScriptAction" class="org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition">
<property name="actionName">
<value>script</value>
</property>
<property name="parameterTemplates">
<map>
<entry>
<key>
<value>script-ref</value>
</key>
<value>${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts/cm:Suppression_de_contenu.js"' )}</value>
</entry>
</map>
</property>
<property name="templateActionModelFactory">
<ref bean="templateActionModelFactory"/>
</property>
<property name="dictionaryService">
<ref bean="DictionaryService"/>
</property>
<property name="actionService">
<ref bean="ActionService"/>
</property>
<property name="templateService">
<ref bean="TemplateService"/>
</property>
</bean>
<!–
Exemple de deplacement du contenu d'un dossier
pour cet exemple le dossier est situe dans : Company Home > Data Dictionary > RM > Espace_Actes_Actifs
le fichier de script est : Deplacement_de_contenu.js
–>
<bean id="Deplacement_de_contenu_runScript" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
<property name="transactionMode">
<value>UNTIL_FIRST_FAILURE</value>
</property>
<property name="compensatingActionMode">
<value>IGNORE</value>
</property>
<property name="searchService">
<ref bean="SearchService"/>
</property>
<property name="templateService">
<ref bean="TemplateService"/>
</property>
<property name="queryLanguage">
<value>lucene</value>
</property>
<property name="stores">
<list>
<value>workspace://SpacesStore</value>
</list>
</property>
<property name="queryTemplate">
<value>PATH:"/app:company_home"</value>
</property>
<property name="cronExpression">
<!– Deplacement_de_contenu –>
<value>5 0/5 * * * ?</value>
<!– 0 0 0 * * ? –>
</property>
<property name="jobName">
<value>jobD</value>
</property>
<property name="jobGroup">
<value>jobGroup</value>
</property>
<property name="triggerName">
<value>triggerD</value>
</property>
<property name="triggerGroup">
<value>triggerGroup</value>
</property>
<property name="scheduler">
<ref bean="schedulerFactory"/>
</property>
<property name="actionService">
<ref bean="ActionService"/>
</property>
<property name="templateActionModelFactory">
<ref bean="templateActionModelFactory"/>
</property>
<property name="templateActionDefinition">
<ref bean="Deplacement_de_contenu_runScriptAction"/>
<!– This is name of the action (bean) that gets run –>
</property>
<property name="transactionService">
<ref bean="TransactionService"/>
</property>
<property name="runAsUser">
<value>System</value>
</property>
</bean>
<!– 2
Exemple de suppression du contenu d'un dossier
pour cet exemple le dossier est situe dans : Company Home > Data Dictionary > RM > Espace_Actes_Semi_Actifs
le fichier de script est : Deplacement_de_contenu.js
–>
<bean id="Suppression_de_contenu_runScript" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
<property name="transactionMode">
<value>UNTIL_FIRST_FAILURE</value>
</property>
<property name="compensatingActionMode">
<value>IGNORE</value>
</property>
<property name="searchService">
<ref bean="SearchService"/>
</property>
<property name="templateService">
<ref bean="TemplateService"/>
</property>
<property name="queryLanguage">
<value>lucene</value>
</property>
<property name="stores">
<list>
<value>workspace://SpacesStore</value>
</list>
</property>
<property name="queryTemplate">
<value>PATH:"/app:company_home"</value>
</property>
<property name="cronExpression">
<!– Suppression_de_contenu –>
<value>15 0/5 * * * ?</value>
</property>
<property name="jobName">
<value>jobS</value>
</property>
<property name="jobGroup">
<value>jobGroup</value>
</property>
<property name="triggerName">
<value>triggerS</value>
</property>
<property name="triggerGroup">
<value>triggerGroup</value>
</property>
<property name="scheduler">
<ref bean="schedulerFactory"/>
</property>
<property name="actionService">
<ref bean="ActionService"/>
</property>
<property name="templateActionModelFactory">
<ref bean="templateActionModelFactory"/>
</property>
<property name="templateActionDefinition">
<ref bean="Suppression_de_contenu_runScriptAction"/>
<!– This is name of the action (bean) that gets run –>
</property>
<property name="transactionService">
<ref bean="TransactionService"/>
</property>
<property name="runAsUser">
<value>System</value>
</property>
</bean>
</beans>
// Definir l'espace racine de stackage des actes en etat actif
var Espace_Actes_Actifs = companyhome.childByNamePath("RM/Espace_Actes_Actifs");
Fonction_Recursive_Actif(Espace_Actes_Actifs);
// Fonction de parcours recursif
function Fonction_Recursive_Actif(currentSpace)
{
if (currentSpace != null)
{
// Lancement de l'action sur l'espace courant
Deplacer_Espace(currentSpace);
if (currentSpace.children != null)
{
for each ( child in currentSpace.children )
{
if ( child.isContainer ) // Si c'est un repertoire…
{
Fonction_Recursive_Actif(child);
}
}
}
}
}
// fonction qui deplace le contenu d'un espace source vers un espace destinataire
function Deplacer_Espace(ElementCourant)
{
if ((ElementCourant.properties["adg:AspectEtatActif"]) && (ElementCourant.isContainer))
{
var today = new Date();
var TodayInt = Date.parse(today.toGMTString());
var EtatActif = ElementCourant.properties["adg:AspectEtatActif"];
var Last_ParentPath = ElementCourant.displayPath;
var position = Last_ParentPath.indexOf("Espace_Actes_Actifs");
// recuperer le chemin du dossier apres l'espace : Espace_Actes_Actifs
var New_ParentPath = Last_ParentPath.substring(position+19);
// ajouter le chemin recupere apares l'espace : Espace_Actes_Semi_Actifs pour tomber dans le meme espace du dossier courant
var Espace_Actes_Semi_Actifs = companyhome.childByNamePath("RM/Espace_Actes_Semi_Actifs"+New_ParentPath);
var dateDeplacement = new Date(ElementCourant.properties["cm:created"]);
var newYear = dateCreation.getFullYear() + EtatActif;
dateDeplacement.setFullYear(newYear);
var dateDeplacementInt = Date.parse(dateDeplacement.toGMTString());
if(TodayInt >= dateDeplacementInt)
{
ElementCourant.move(Espace_Actes_Semi_Actifs);
}
}
}
// Definir l'espace racine de stackage des actes en etat semi actif
var Espace_Actes_Semi_Actifs = companyhome.childByNamePath("RM/Espace_Actes_Semi_Actifs");
Fonction_Recursive_Semi_Actif(Espace_Actes_Semi_Actifs);
// Fonction de parcours recursif sur l'espace des actes en etat semi actif
function Fonction_Recursive_Semi_Actif(currentSpace)
{
if (currentSpace != null)
{
// Lancement de l'action sur l'espace courant
Supprimer_Espace(currentSpace);
if (currentSpace.children != null)
{
for each ( child in currentSpace.children )
{
if ( child.isContainer ) // Si c'est un repertoire…
{
Fonction_Recursive_Semi_Actif(child);
}
}
}
}
}
// fonction qui supprime le contenu de l'espace destinataire
function Supprimer_Espace(ElementCourant)
{
var today = new Date();
var TodayInt = Date.parse(today.toGMTString());
if ((ElementCourant.properties["adg:AspectEtatSemiActif"]) && (ElementCourant.isContainer))
{
var EtatSemiActif = ElementCourant.properties["adg:AspectEtatSemiActif"];
var dateModification = new Date(ElementCourant.properties["cm:modified"]);
var dateSuppression = new Date(ElementCourant.properties["cm:modified"]);
var newYear = dateModification.getFullYear() + EtatSemiActif;
dateSuppression.setFullYear(newYear);
var dateSuppressionInt = Date.parse(dateSuppression.toGMTString());
if(TodayInt > dateSuppressionInt)
{
ElementCourant.remove();
}
}
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.