Blog - comments

When I studied Oracle New Feature Guide "Media Failure: PDB SYSTEM Data File" , I was surprised tha...
Hayat Khan

Really a nice article to study.


Amol Bhoite

ana 100 goid


ana 100 gold



Tout d'abord merci pour cet article. J'aimerai savoir si ACFS est gratuit ?


Blog Morgan Patou Developing an archive action for Alfresco Share (2 of 2)

dbi services Blog

Welcome to the dbi services Blog! This blog focuses on IT infrastructure - featuring news, troubleshooting, and tips & tricks. It covers database, middleware, and OS technologies such as Oracle, Microsoft SQL Server, Documentum, MySQL, PostgreSQL, Sybase, Unix/Linux, etc. The dbi services blog represents the view of our consultants, not necessarily that of dbi services. Feel free to comment on the postings!

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that have been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
Posted by on in Middleware

Developing an archive action for Alfresco Share (2 of 2)

In my last article, I presented the first part of setting up a new action for Alfresco Share, which is an archive action. I advise you to read the first part if you have not read it yet since it is a prerequisite for the proper functioning of the action: Developping an archive action for Alfresco Share (1 of 2). The purpose of this part is to extend the user interface with the creation of an AMP for Alfresco Share. I remind you that ALF_AMP_HOME and SHARE_AMP_HOME references the location of the projects (e.g. C:/AlfrescoEclipseProjects/AlfrescoShareAMP).

1. Extension of Alfresco Share

So let's create a properties file that contains the display name of the action and messages that will be sent to the user at the end of the action:
In cases where Alfresco is used with multiple languages, you can manage this file with i18n. So you can add several files for different languages:,, aso...

As we did for the Java code, we have to tell to Alfresco Share that a new property file was added. For that purpose, create the following file:


The next step is to add a line in the list of actions on Alfresco Share interface. To do this, you will need to extend the file you certainly know:


Each action on Alfresco has a small image (16x16) that can be seen next to the name. Alfresco Share can automatically handles the dependency between the image and the action. For that purpose, you must add the following image:

The name of this image must be the id of the action that you define in the file share-config-custom.xml followed by the size of the image (16px): document-archive-16.png

The last thing to do is to create the JavaScript file that will be executed with a click on the action. This JavaScript file must be minified because Alfresco use by default the minify version of a JavaScript file when DEBUG mode is turned off. The build.xml file can do it for you if you have put the two jar files 'yui-compressor-ant-task-0.5.jar' and 'yuicompressor-2.4.2.jar' in /lib. This JavaScript file manage interaction with the user by offering messages of failure and success. It also allows you to pass parameters to the Web Script which is very useful:


2. Deploying AMPs

You now have all that is necessary to add an action in Alfresco Share v4.2. You can easily add other actions by taking the code and customizing it.

Once you have build your two projects, you should normally have two AMP files. Before deploying them the first time, I strongly advise you to make a backup of the original WAR files. You could create a script to deploy AMP files automatically with some of the following command lines:

# cd  ALFRESCO_HOME/tomcat/webapps
# rm  -rf  alfresco
# rm  -rf  share
# java  -jar  ALFRESCO_HOME/bin/alfresco-mmt.jar  install  ALF_AMP_HOME/dist/ALF_AMP_NAME.amp  ALFRESCO_HOME/tomcat/webapps/alfresco.war  -force
# java  -jar  ALFRESCO_HOME/bin/alfresco-mmt.jar  install SHARE_AMP_HOME/dist/SHARE_AMP_NAME.amp  ALFRESCO_HOME/tomcat/webapps/share.war  -force

ALFRESCO_HOME obviously represents the Alfresco installation folder, something that should look like C:/Alfresco or /opt/Alfresco-4.2.c. ALF_AMP_NAME and SHARE_AMP_NAME represents the name of the two AMPs that was created in your Eclipse Project.


Please also note that I join to this blog the zip file containing the archive action AND the file permissionDefinitions.xml which is used to create all groups. Feel free to modify all files:


Good luck!

Rate this blog entry:

Morgan Patou is Consultant at dbi services. He has more than four years of experience in Java/J2EE application building and deploying. He has expertise in the administration and deployment of open source technologies (Apache, OpenLDAP, Kerberos, etc.). He is specialized in the building, customization, extension and deployment of Intranet and Document Management System solutions with Liferay and Alfresco. Morgan Patou holds an Engineer’s Degree in Computer Science from the ENSISA (Ecole Nationale Supérieure d'Ingénieurs Sud Alsace) in Mulhouse (F). He is an Alfresco Certified Administrator and his branch-related experience covers Public Sector, Automotive, IT, Financial Services / Banking, etc.


  • Guest
    ubed Tuesday, 17 December 2013

    Hi Morgan,

    Can you please provide the details,
    i) get the all files from source path in alfresco and make it as zip file.
    ii) export these zip file in the destination of same alfresco server,
    using alfresco webscript.

    I am very thankful for this.


  • Guest
    Morgan Patou Tuesday, 17 December 2013

    Hi ubed,

    I'm not sure I understand what you want. Do you want some precision about how to deploy the action or some pieces of information about how to develop another action ?


  • Guest
    ubed Tuesday, 17 December 2013

    Hi Morgan,
    how someone can implement the zip.get.js webscript file in such a way that, that will
    get the source path, and do the zip creation with all available files in source path,
    and copy that .zip file into destination path.
    below is the path i am sending request to webscript

  • Guest
    Morgan Patou Wednesday, 18 December 2013

    Hi ubed,

    You could do it with Java-Backed WebScript: you will have to add some interaction with end-user to let him select the target location. This can be done on the JavaScript file (take a look at the "Copy to" or "Move to" action to see how you can do it, it's quite simple). Once you have the variables which contain the nodeRef of the source & the path of the target (or nodeRef of the target), you could set parameters to sent to the WebScript. This is done in JavaScript with the module: "this.modules.actions.genericAction" which will launch the execution of the Java part.

    Then from the Java, you could access to these variables and do the Job'. If you don't know how to zip files in Java, you could take a look at the following project:

    Hope this helps!

  • Guest
    Saran Kumar Friday, 10 January 2014

    Hi ,

    i am facing problem with zipping folder inside with in alfresco server.
    i need to pass source path to webscript, when i invoke webscript through url(ex : http://dev-alfresco:8080/alfresco/service/script/copy?srcpath=Sites/Production/Source),
    the source folder and its subfolders, files(.pdfs) will be zipped and that should be placed in the same location(source path). i am trying to do this alfresco web scripts, but i didn't get any way to do this.
    please help me...
    Saran Kumar.

Leave your comment

Guest Saturday, 19 April 2014
AddThis Social Bookmark Button
Deutsch (DE-CH-AT)   French (Fr)


Contact us now!

Send us your request!

Our workshops

dbi FlexService SLA - ISO 20000 certified.

dbi FlexService SLA ISO 20000

Expert insight from insiders!

Fixed Price Services

dbi FlexService SLA - ISO 20000 certified.

dbi FlexService SLA ISO 20000

A safe investment: our IT services at fixed prices!

Your flexible SLA

dbi FlexService SLA - ISO 20000 certified.

dbi FlexService SLA ISO 20000

ISO 20000 certified & freely customizable!

dbi services Newsletter