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!
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: custom_en.properties, custom_fr.properties, 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
2. Deploying AMPs
# cd ALFRESCO_HOME/tomcat/webapps
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:
# rm -rf alfresco
# rm -rf share
# cd ALFRESCO_HOME
# 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: