About the Alfresco Developer Tutorial Series

The “Alfresco Developer” series of tutorials is aimed at developers new to Alfresco who need an overview of the main customization points. The series uses a single business case as an example that covers many different technical aspects of Alfresco. Each tutorial takes you through hands-on customizations, step-by-step, and includes ready-to-build source code so you can follow along using your own local installation.

Much of the information can be found in the official Alfresco documentation, in the forums, in Jira, and, of course, in the source–my goal was to pull it together into a cohesive, step-by-step story.

Note: The tutorials linked on this page are for SDK 4.0 which works with Alfresco 6.x. For tutorials that use SDK 3.0, which works with Alfresco 4.2 through Alfresco 5.2, use the SDK-3.0.1 tag.

The tutorials are shown below in a rough recommended order of progression:

Getting Started with the Alfresco Maven SDK, Updated July, 2021.

This tutorial shows you how to use the Alfresco Maven SDK to create projects that produce AMPs (Alfresco Module Packages) for both the repository tier and the Alfresco Share tier. AMPs are the recommended best practice for deploying customizations to your Alfresco installation. The Alfresco Maven SDK supersedes the old Ant-based SDK.

Working with Custom Content Types, June, 2007. Updated July, 2021.

This tutorial shows how to extend Alfresco with your own content model, how to configure Alfresco Share to create content that uses your custom content model, and how to use the OpenCMIS API and the CMIS Query Language to create, query, and delete content in your Alfresco repository.

This tutorial introduces the fictitious “SomeCo” company that is planning on using Alfresco for both document management and web content management. SomeCo is going to use Alfresco to manage the authoring process around whitepapers which are subsequently published to their web site. The remaining articles in the series build on the SomeCo example.

“Developing Custom Actions”, January, 2007. Updated July, 2021.

This tutorial builds on the custom content types tutorial. It shows how to create rule actions and UI actions.

“Implementing Custom Behaviors”, September, 2007. Updated July, 2021.

This tutorial builds on the custom content types tutorial by adding support to the content model for user-contributed ratings of whitepapers. The custom behavior is used to calculate the average rating for each piece of rated content.

“Intro to the Web Script Framework”, October, 2007. Updated July, 2021.

The intent of the tutorial is to walk through some hands-on examples using Alfresco’s Web Script Framework. The tutorial shows how to use Web Scripts to create a RESTful API for creating user-contributed ratings.

“Creating Custom Advanced Workflows in Alfresco”, February, 2012. Updated July, 2021.

The tutorial starts by describing high-level workflow concepts and steps for implementing advanced workflows in Alfresco using Activiti and then dives into the details by walking you through an example.

The example extends the “SomeCo Whitepapers” story from earlier articles in the Alfresco Developer series by implementing a business process to enable SomeCo’s engineering team, marketing team, and third-party partners to review whitepapers before being published to the SomeCo web site.

The integration of third-party partners is handled through email–recipients simply click a link to approve or reject the workflow task. The link invokes web scripts to signal the workflow to take the appropriate path in the process.

“Getting Started with CMIS”, November, 2009.

The article first takes you through an overview of the specification. Then, I do several examples. The examples start out using curl to make GET, PUT, POST, and DELETE calls against Alfresco to perform CRUD functions on folders, documents, and relationships in the repository.

Once you’ve felt both the joy and the pain of talking directly to the CMIS AtomPub Binding, I take you through some very short examples using JavaScript and Java. For Java I show Apache Abdera, Apache Chemistry, and the Apache Chemistry TCK.

You might also be interested in “Getting Started with CMIS” on SlideShare.

Source Code

The source code for these tutorials resides on GitHub. The version of the tutorials that work with SDK 4.0 is on a branch in that project.

License

All of the articles in the series are licensed under the Creative Common Attribution-Share Alike 2.5/3.0 License.

Feedback

Many of you have provided feedback on specific articles or the series as a whole via comments on this blog, in person, or via email. Regardless of the method, feedback is welcome and encouraged.

Alfresco Developer Guide

The response to the Alfresco Developer Series was so positive, I decided to take it one step further. I used several of these tutorials as the starting point for a book which was published in 2008. Most of the material has been re-worked although there is some duplication. The actions and behaviors material changed the most. The book is called Alfresco Developer Guide and is available from Packt Publishing and other book stores. All of my blog posts related to the book are categorized under Alfresco Book. All resources related to the book have been centrally indexed on the Alfresco Developer Guide page.

The second editions of these tutorials and the 2014 updates were written after the book was published.

Archive

These are old versions of the tutorials and are no longer being actively maintained.

“Working with Custom Content Types”, June, 2007.

“Working with Custom Content Types, 2nd Edition”, January, 2012. Updated for Alfresco Share and CMIS.

“Developing custom actions”, January, 2007.

“Developing custom actions, 2nd Edition”, January, 2012. Updated for Alfresco Share.

“Implementing custom behaviors”, September, 2007.

“Intro to the Web Script Framework”, October, 2007.

“Advanced Workflows”, November, 2007. Covers jBPM and Alfresco Explorer

“Advanced Workflows, 2nd Edition”, February, 2012. Covers Activiti and Alfresco Share

If you are running the 2nd Edition Advanced Workflows tutorial against Alfresco Community Edition 4.x or higher, please use this code instead of what is linked in the PDF.

77 comments

  1. Jeff Potts says:

    Yes, you can kick off a workflow when a document is added to a folder. You can do that through a rule on the folder.

    A smart folder is really a “virtual folder” defined by a query. When a document is added to a smart folder Alfresco looks at the smart folder’s “filing rule” to determine the actual folder to place the document into. So I think in your example it is the actual folder where the rule would be defined, and that will trigger the workflow.

    Using a rule to trigger a workflow requires using the “execute script” rule action to run a script that you’ve uploaded to the Data Dictionary. That script will contain a few lines of server-side JavaScript to actually initiate the workflow and add the document to the workflow package.

  2. Jerome F says:

    Thank you Mr. Potts, I’m actually troubled configuring and trying your tutorials about Creating Custom Advanced Workflows in Alfresco, I have the Setup tools, but after I created archetypes, APM etc. I got an error, when I’m trying to install the mvn and run.bat. I’ll hope you’ll help me in my situation, I’m currently followed your tutorials but I’m stuck in Maven etc. and Thank you again for the support.

  3. Jerome F says:

    I have problem setting MAVEN_OPTS, the environment variable. When I run the mvn -v. The springloaded Failed to run.

  4. Jeff Potts says:

    SDK 3.0.x works with Alfresco 4.2.7 and above. You are referring to 4.1 documentation, so I wanted to make sure you are using a newer version.

    WQS is being deprecated in 6.0, so do not get too attached to it, see https://community.alfresco.com/community/ecm/blog/2018/01/03/architecture-changes-for-alfresco-content-services-version-60.

    With all of that said, WQS is deployed as an AMP. If you are launching the embedded Tomcat server using the SDK you have to add the WQS AMPs as “platformModules” and “shareModules” in the root pom.xml. Even if you do that, WQS also has an associated JAR, so I’m not sure it will work with the SDK. If it doesn’t, you may have to deploy to a local standalone instance of Alfresco.

  5. ayoub says:

    Hi,
    I have developped an application java/jee application for customer & contract management, and I will integrate alfresco as a ged for upload, search, archive, scan my docs. I would like to know if it is possible to make the integration or I must remake my project via alfrescoo from scratch. if possible how can Integrate theses functionality in my current application (upload, search, archive, scan, versioning)

  6. Jeff Potts says:

    Ayoub,

    The best way to integrate with Alfresco is via its API. Do not try to embed Alfresco within your application. Hit it remotely instead.

    Take a look at the Alfresco API Explorer to understand the 5.2 REST API. Another option is using CMIS and a client library from Apache Chemistry.

  7. ayoub says:

    Hi,
    I’m surprised ti get a response asap
    thanks very very much
    I’m newer to alfresco, I meet it because I’m in need of a GED.
    Q1) you mean that I must do 2 servers, 2 architectures , one is my application and the second is the 2 client & server architecture for alfresco ?
    Q2) with your proposal, can I manip these actions (upload, search, archive, scan, versioning and OCR) of docs ?

    Q3) in term of performance, advantages, functionality, it is the same as I remake my work with alfresco

    Q4) Can you send me if possible an image presented an architecture fit with my need

    Q5) Is there a tutorial that do an example of my need (call extern alfresco action like versioning, upload, ocr utility).

    thanks a lot Jeff

  8. Jeff Potts says:

    Ayoub,

    You have an existing application for customer and contract management. You would like to leverage Alfresco for document-centric functionality. I am assuming, for example, to store the actual contracts.

    In a very simple, very basic installation, you can install Alfresco on one machine. It needs an application sever to run (Tomcat), a database to store its metadata in (MySQL or PostgreSQL), and a file system to store content files. In a production installation you will likely move the database to its own server and the Solr application to its own server to free up resources for Alfresco and to allow each of those components to be tuned independently.

    I have no idea of the architecture of your custom application but I will assume it also needs Tomcat and a database.

    For demonstration or development purposes you can install your custom application on the same server as Alfresco. You could run your WAR file in the same Tomcat, but it might be cleaner to use a separate Tomcat for your custom application.

    Any time your custom application needs to upload documents, search documents, or version documents, you will call the Alfresco API to do that. I don’t know what “archive” means in your context but if it means “move the document to a different folder in Alfresco” then that is also in scope.

    Scanning happens on a scanner, not in Alfresco.

    OCR, which is the process of turning an image of text into machine readable text, does not ship with Alfresco out-of-the-box but there are open source OCR libraries you can integrate with Alfresco. You might also look at Addons for OCR modules that work with Alfresco.

    I hope that helps. If not, consider creating a post in the Alfresco Community with as much detail as you can provide and what you are getting stuck on. I’m not always able to respond so quickly here and there is an entire global community of Alfresco folks who might be able to help.

  9. _proto says:

    Hi Jeff,
    Topic: group/roles/users migration from 3.1 to 5.2. Are all that stuff stores in nodes? Wich API to use to migrate all that? Thanks!

  10. Jeff Potts says:

    You will likely not be successful migrating directly from 3.1 to 5.2. The documented upgrade path is 3.1 -> 4.2 -> 5.1 -> 5.2, but, in my experience, you may have to go 3.1 -> 3.2 -> 3.4 -> 4.2 -> 5.0 -> 5.1 -> 5.2.

    Regardless, users and groups are all stored as nodes which ultimately map to database tables. You don’t have to worry about any of those details–Alfresco handles the schema upgrades for you–unless, of course, there is a problem.

  11. Rodrigo says:

    Thank you very much for all the information posted here by you Jeff Potts,
    This information has taught me a lot about the Alfresco platform!

    Congratulations!

  12. Keon Joh says:

    Dear Jeff,
    Thank you for your great tutorial and your effort. I truly appreciate it.
    I’m now following “Working with Custom Content Types” tutorial part 3.
    I have a question.
    I want to follow your tutorial by using my installed alfresco-community-edition instead of which made from part 1.
    Could you tell me how to do that?
    If here is wrong place to ask, so sorry.

    Have a nice day,
    Keon

  13. Jeff Potts says:

    Keon,

    If I understand correctly, you would like to use CMIS, which is covered in part 3, to make calls against your already-installed Alfresco Community Edition server instead of making calls against Alfresco running in the embedded Tomcat as part of the SDK.

    If that is correct, all you have to do is change the CMIS service URL to point to your existing server instead of localhost.

    If you want to follow the tutorial exactly, including querying for instances of the SomeCo content model, you’ll have to deploy the content-tutorial-platform-jar AMP and the content-tutorial-share-jar AMP to your existing server.

    Jeff

  14. Riadh Azzouz says:

    I am new with alfresco, and I am working on a project about making some customization. I’ve been following this tutorial for 9 days. Then, I figured out that I should use Alfresco ADF (I don’t know if that’s the right thing to do). So, what I want to know is, what is the relation between the ADF and the all-in-one archetype project, and from where I should start.

  15. Jeff Potts says:

    Riadh,

    Thanks for reading the blog, working through the tutorials, and for your question. The all-in-one archetype project sets up a project that creates a repository tier AMP and a Share tier AMP. Before ADF, there was nothing else. Those two things–Alfresco as the repository and Share as the front-end web client–were all that was needed.

    The ADF introduces a new development framework. Among other things, it includes Angular components and a client-side JavaScript library. There is also a new web client called the Alfresco Digital Workspace, which was built with the ADF. The ADF and its components, as well as any application built with the ADF, is entirely client-side. The ADF does not include a repository. So, if you intend to do anything on the Alfresco server-side such as extend the content model, write custom behaviors, actions, or web scripts, you’ll still need to build a repository tier AMP, which you can do with the all-in-one archetype.

    So, whether or not you need to understand the ADF depends entirely on whether or not you intend to build a custom client using the ADF Angular components or customize the Alfresco Digital Workspace. If not, you do not need it. If so, you’ll need to understand the back-end through these tutorials first, then start learning ADF.

    Jeff

  16. NagRao says:

    Dear,
    I want to add a new action for “selected items” in the tool bar of share as I want to apply an action to several documents at the same time.
    As example I tried with the “someco-web-enable” chapter 4 in the “Alfresco One 5.x Developer’s Guide at packt publishing.
    The action works well for document details or for browser-view. Unfortunately not for selected items (Share tool bar)

    I tried many different options which newer work, below is one of my trials which also didn’ t work.

    I modified the share config custom as follow :

    onActionSimpleRepoAction
    set-web-flag
    true
    message.web-flag.enabled
    message.web-flag.failure

    onActionSimpleRepoAction
    set-web-flag
    false
    message.web-flag.disabled
    message.web-flag.failure

    onActionSimpleRepoAction
    set-web-flag
    true
    message.web-flag.enabled
    Library
    message.web-flag.failure

    It is not working, what did i missed. Thank you in advance for your help.

  17. oumar says:

    Hello,
    how to change the alfresco community edition 5.2 H2 database to local postgresql database?
    I used Alfresco SDK 3 to create my project and chose the archetype all in one. thank you in advance

  18. Jeff Potts says:

    The SDK is used to package a repo-tier AMP and a Share tier AMP. Once those are packaged you will deploy them to an actual Alfresco installation. The alfresco-global.properties file that lives in $TOMCAT_HOME/shared/classes is where you will find the setting for the database name, URL, and driver. If you have additional questions about this, refer to https://docs.alfresco.com.

  19. Yasbind says:

    Please give tutorial on Alfresco Junit Test using Spring Junit Framework or any other suggested by Alfresco

  20. Jeff Potts says:

    Hi Syed, Thanks for reading the tutorials. No, I don’t have anything on creating a custom OCR action, but my custom actions tutorial is applicable. Once you find an OCR library that you like you should be able to call it from your own custom action without a problem.

Comments are closed.