Alfresco Introduce

Alfresco is an open source Document Management System, below i will descript how it works base on my research in weekend.

1.Docasu UI:

There is a file named DocasuSearch.js locate in the docasu/wcs folder, It used to present the Search user interface(UI), In this file it uses EXTJS javascript library which is a UI.

And then in this library, it also have some build-in functions to submit the Form(in ExtJs)  to Server-Side program for processing.

var searchProxy = new{
url: ‘ui/search’,
method: ‘GET’

var searchResultsStore = new{
remoteSort: true,

proxy: searchProxy,

Here the proxy is for this purpose. In this Javascript file it will generate the URL path for search, just like  us/search?q = {text ?}…. because it actully do the work that submit a form to server.

And the ui/search is a URL, It use Restful technology. It can be associated to a webscript because of the system framework, This is so called Spring framework, this framework can generate some objects according to the XML file(docasu-context.xml). And in the xml, it will make the URL evently refer to the Search.class (in Docasu/wcs package ?). And this class do the actually work to search the Alfresco repository and return the data.


<bean name=””
class=”com.optaros.alfresco.docasu.wcs.Search” parent=”webscript”>
<property name=”customFileFolderService”
ref=”CustomFileFolderService” />
<property name=”serviceRegistry”>
<ref bean=”ServiceRegistry” />
<property name=”repositoryImageResolver”>
<ref bean=”webscripts.repo.imageresolver” />
//this so spring framework, use bean to generate POJO.

in JSP, all the class are located in Web-INF folder!

and this webscript xml:

<shortname>Custom UI – Search</shortname>
<description>Search the repository</description>
<format default=”json”>extension</format>

It designate the information which will be read by the classes in Search.class, and retrieve information to search from repository and return result.

At the same time, you can register javascript API by yourself. What this process do is to bridge for Javascript API(object) and Java class, this is script service. After the registeration, In Javascript can directly use object in alfresco class, and use their methods to operate at the data on alfresco. For example, create folder, delete folder and so on.

The common:

Ext UI use Ext.ajax.request or HttpProxy to connect a URL such as ui/search. And the system will search for the right webscript to match, and find the right Search.get.desc.xml file. Accompany this file it also have two another files, one is search.get.js and search.get.json.ftl. search.get.js is to connect the java class as describe before and execute the class methods to accomplish the actual work. and search.get.json.ftl is the format for returning data. Look at the files you will know.

2.Alfresco UI

Three main techonlogies used:

In the JSP file it use JSF technology the generate the UI. And there are a file called web-client-config-actions.xml which can work with JSF to customize the UI and do the actual work.

Here is an example:

Custom dialog disappears

Postby pau.carre on 19 Sep 2008, 10:44

Hi, I am developing an add-in for Alfresco. This add-in is a custom dialog linked to each document. I have had no problem since the dialog icon disappeared from all documents. After a lot of “trial and error” I finally had to reinstall Alfresco and then the new icon appeared. But, lately it disappeared again. I did not change any relevant file from the add in (just som JSPs). So I do not know why the icon disappears. I restart the server each time I deploy a new version and I do not see any error in the apache tomcat log.

Any idea of how to identify the problem?

Pau Carré Cardona


Code: Select all

<!-- Launch Add Aspect Dialog -->
<action id="afegir_signatura">
<label>Afegir signatura</label>
<param name="id">#{}</param>

<!-- Add action to more actions menu for each space -->
<action-group id="document_browse">
<action idref="afegir_signatura" />
Here is the really important position, it is the place that system designate the script to execute when a button click, just like event handler. And usually Dialog and in another XML file with name refer to "dialog".
<dialog name="afegirSignatura" page="/jsp/extension/add-signature.jsp" managed-bean="AddSignatureDialog"
icon="/images/icons/sign.png" title="Afegir signatura"
description="Afegeix una signatura al document actual" />



Code: Select all
package org.alfresco.sample;

import java.util.HashMap;
import java.util.List;
import javax.faces.context.FacesContext;
import org.alfresco.repo.content.RoutingContentService;
import org.alfresco.repo.model.filefolder.FileFolderServiceImpl;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;

import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.Node;

public class AddSignatureDialog extends BaseDialogBean {
protected String url = null;

protected String finishImpl(FacesContext context, String outcome)
throws Exception {
return outcome;

public boolean getFinishButtonDisabled() {
return false;

public String getURL() {
if (url == null) {
Node documentNode = browseBean.getDocument();
NodeRef documentNodeRef = documentNode.getNodeRef();
url = DownloadContentServlet.generateDownloadURL(documentNodeRef,
return url;

public void setURL(String url) {
this.url = url;


Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"




Code: Select all

<%@ taglib uri="" prefix="h" %>
<%@ taglib uri="" prefix="f" %>
<%@ taglib uri="" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ include file="base.jspf" %>

String target=base + "/jsp/extension/receive.jsp";
String codebase = "../extension/signatureapplet.jar,../extension/signaturaapi-2.2.jar";
String width = "700";
String height = "300";

<applet width="<%=width%>" height="<%=height%>" align="baseline"
source="<%=base%><c:out value="${DialogManager.bean.URL}"/>;jsesssionid=<%=session.getId()%>"

From this example you can know how it works.

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s