cancel
Showing results for 
Search instead for 
Did you mean: 

content archiving

nancyaggarwal
Champ in-the-making
Champ in-the-making
Hi

I am using alfresco community edition 4.2c and i want to archive the document library content in alfresco. How i can do this.

Thanks

Nancy Aggarwal
7 REPLIES 7

ddraper
World-Class Innovator
World-Class Innovator
This is quite an open-ended question. There various threads on these forums that address archiving (for example: http://forums.alfresco.com/forum/general/non-technical-alfresco-discussion/document-archiving-alfres...) and also information on the docs (and even other locations such as StackOverflow). Maybe you could have a read through that thread in particular and then add some more context to your question.

Thanks,
Dave

Thanks Dave for your reply.

I want the documents in document library which are not modified from the last six months automatically go into another content store and when someone searches for older documents they can be fetched back from that location.

Please tell me how i can do this.

Thanks
Nancy Aggarwal

mitpatoliya
Star Collaborator
Star Collaborator
Simple way is to create a scheduled job which run every day to check documents older then six month from your document library and move them to archive store.You can either use java or javascript for the scheduled job.
You can add extra aspect to all those documents which are processed to make it more convenient to search.
Few links for reference
http://wiki.alfresco.com/wiki/Scheduled_Actions
http://docs.alfresco.com/3.4/topic/com.alfresco.Enterprise_3_4_0.doc/concepts/scheduled-jobs.html

Thanks Mits for your reply. But can you elaborate the steps for doing this.

Thanks
Nancy Aggarwal

mitpatoliya
Star Collaborator
Star Collaborator
1) Create scheduled action which will be called every day and invoke a script
2) Script search for all documents older then six month
3) Add Archive aspect(you custom aspect just to make it easily searchable) to those document
4) Move them to archive store.

Thanks Mits

I understood the steps but at which location i have to put this script?

Nancy

Hi

I have defined scheduled process that execute the action defined in xml but still my documents which are older than six months are not moving to an archive store.

Below is my scheduled-action-services-context.xml and my javascript.
scheduled-action-services-context.xml

<?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>
   
<!– run the script–>
<bean id="runscript" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">

        <property name="transactionMode">

            <value>ISOLATED_TRANSACTIONS</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/st:sites"</value>

        </property>

        <property name="cronExpression">

            <value>0 0/15 * * * ?</value>

        </property>

        <property name="jobName">

            <value>jobA</value>

        </property>

        <property name="jobGroup">

            <value>jobGroup</value>

        </property>

        <property name="triggerName">

            <value>triggerA</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="moveoldfiles"/>

        </property>

        <property name="transactionService">

            <ref bean="TransactionService"/>

        </property>

        <property name="runAsUser">

            <value>System</value>

        </property>

    </bean>

<!–Execute the script–>

    <bean id="moveoldfiles" 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:archive.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>
   </beans>

my javascript

function addMonths(date, months) {
  date.setMonth(date.getMonth() + months);
  return date;
}


var docs = search.luceneSearch("PATH:\"/app:company_home/st:sites//*\" AND @cm\\:modified:[addMonths(new Date(), -6)]");

for(var dest : docs)
dest.move(C:\Alfresco\alf_data\archive)

can anyone help me with this?

Thanks
Nancy