Alfresco Developer Guide

Alfresco Developer Guide
eBook: $35.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 30%!
Print + free eBook + free PacktLib access to the book: $95.98    Print cover: $59.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Learn to customize the entire Alfresco platform, including both Document Management and Web Content Management
  • Jam-packed with real-world, step-by-step examples to jump start your development
  • Content modeling, custom actions, Java API, RESTful web scripts, advanced workflow
  • This book covers Alfresco Enterprise Edition version 2.2

Appendix C

Book Details

Language : English
Paperback : 556 pages [ 235mm x 191mm ]
Release Date : October 2008
ISBN : 1847193110
ISBN 13 : 9781847193117
Author(s) : Jeff Potts
Topics and Technologies : Alfresco, All Books, CMS and eCommerce, Content Management (CMS), Open Source

Table of Contents

Chapter 1: The Alfresco Platform
Chapter 2: Getting Started with Alfresco
Chapter 3: Working with Content Models
Chapter 4: Handling Content Automatically with Actions, Behaviors, Transformers, and Extractors
Chapter 5: Customizing the Web Client User Interface
Chapter 6: Exposing Content through a RESTful API with Web Scripts
Chapter 7: Advanced Workflow
Chapter 8: Web Content Management
Chapter 9: Security
Appendix A: API Reference and Examples
Appendix B: Alfresco Configuration Reference
  • Chapter 1: The Alfresco Platform
    • Alfresco in the Real World
      • Basic Document Management
      • Web Content Management
        • Content Authoring Tools
        • Separation of Presentation from Content
        • Systematic Publication or Deployment
        • Alfresco WCM Example
      • Custom Content-Centric Applications
    • Example Used throughout This Book
    • Alfresco Architecture
      • High-Level Architecture
        • Add-Ons
      • Open Source Components
      • Major Standards and Protocols Supported
    • Customizing Alfresco
      • Basic Customization
        • Dashlets
        • Custom Views
        • Rules and Rule Actions
        • Simple Workflow
      • Advanced Customization
        • Examples of Advanced Customizations
        • Extend the Content Model
        • Perform Automatic Operations on Content
        • Customize the Web Client
        • Create a RESTful API
        • Streamline Complex Business Processes with Advanced Workflows
        • Get Your Web sites under Control
        • Integrate with Other Systems
    • Dusting Off Your Toolbox
      • What about Adobe Flex?
    • Understanding Alfresco's Editions
      • Significant Feature Differences
      • What's Used in This Book
    • Summary
  • Chapter 2: Getting Started with Alfresco
    • Obtaining the SDK
      • Step-by-Step: Building Alfresco from Source
    • Setting up the SDK in Eclipse
      • Step-by-Step: Importing the SDK into Eclipse
    • Extending Alfresco
      • Understanding the Extension Mechanism
        • Standard Java Web Application Files
        • Framework Files
    • Packaging and Deploying Customizations
      • Separating Server-Specific Customizations
      • Step-by-Step: Packaging and Deploying a Simple Customization
        • Taking a Look at the Build File
    • Troubleshooting
      • Log4j
      • Step-by-Step: Debugging from within Eclipse
      • Node Browser
    • Starting Over
    • Summary
  • Chapter 3: Working with Content Models
    • Defining SomeCo's Content Model
      • Step-by-Step: Starting the Custom Content Model with Custom Types
        • Types
      • Step-by-Step: Adding Properties to Types
        • Properties and Property Types
        • Constraints
      • Step-by-Step: Relating Types with Associations
        • Associations
      • Step-by-Step: Adding Aspects to the Content Model
        • Aspects
      • Step-by-Step: Finishing up the Model
    • Modeling Summary
      • Custom Behavior
    • Modeling Best Practices
      • Out of the Box Models
    • Configuring the UI
      • Step-by-Step: Adding Properties to the Property Sheet
        • Externalizing Display Labels
        • Making Properties Read-Only
      • Step-by-Step: Adding Types and Aspects to WebClient Dropdowns
      • Step-by-Step: Adding Properties and Types to Advanced Search
      • Step-by-Step: Setting Externalized Label Values
        • Setting up Additional Locales
    • Working with Content Programmatically
      • Step-by-Step: Creating Content with JavaScript
        • Leveraging Root Objects
        • Knowing When to Save Documents
        • Using JavaScript for Batch Manipulation
        • Writing Content to the Content Property
      • Creating Content with Java Web Services
        • Step-by-Step: Run SomeCoDataCreator Class to Create Content
      • Creating Content with PHP Web Services
      • Creating Associations
      • Searching for Content
        • Step-by-Step: Run SomeCoDataQueries Class to See Lucene Example
      • Deleting Content
        • Step-by-Step: Running SomeCoDataCleaner Class to Delete Content
    • Summary
  • Chapter 4: Handling Content Automatically with Actions, Behaviors, Transformers, and Extractors
    • Encapsulating Content Operations in Actions
      • Step-by-Step: Creating a Basic Action
      • Hiding the Action from End Users
      • Creating Actions that Require User-Specified Parameters
        • Step-by-Step: Creating an Action that Accepts Parameters
      • Incorporating Parameter Values in the Action Description
      • Specifying Parameters when Code Executes an Action
    • Binding Logic to Custom Types with Behaviors
      • Step-by-Step: Writing a Simple Behavior in Java
      • Binding to Multiple Types/Aspects
      • Frequency
      • Figuring Out to Which Policies to Bind
      • Step-by-Step: Writing a Simple Behavior in JavaScript
      • Binding Behavior to Child Types
        • Step-by-Step: Writing a User Ratings Calculator
        • Step-by-Step: Testing the New Rating Behavior
      • Handling Deleted Ratings
    • Extracting Metadata from Files
      • Customizing Metadata Extractors
        • Step-by-step: Customizing the Metadata Mapping
      • Overriding the Default Mapping
      • Leveraging Out of the box Metadata Extractors
      • Digging into an Extractor Class
        • Step-by-Step: Customizing a Metadata Extractor Class
    • Transforming Content from One Format to Another
      • Step-by-Step: Writing a Custom Transformer
    • Summary
  • Chapter 5: Customizing the Web Client User Interface
    • Knowing When to Customize Alfresco's Web Client and When to Write Your Own
    • Adding New Menu Items with UI Actions
      • Step-by-Step: Adding a Simple UI Action
      • Showing/Hiding the Label
      • Leveraging Out of the Box Examples
      • Using Other Types of UI Actions
      • Step-by-Step: Adding a UI Action to Set the Web Flag
      • Restricting the UI Action by Permission
    • Writing Action Evaluators to Show/Hide UI Actions
      • Step-by-Step: Evaluating Whether or Not to Show the Set Web Flag UI Actions
    • Changing How the Web Client Renders Data with Custom Component Renderers
      • Step-by-Step: Making a Text Field a Specific Size
      • What Just Happened
      • Overriding the Generator for All Properties
      • Step-by-Step: Changing the Status Field on the Details Page to Display as a Stoplight Indicator
      • Overriding and Customizing Components
    • Creating Custom Dialogs
      • Step-by-Step: Creating a Dialog to Execute Scripts
      • Passing the Context to the Dialog
      • Understanding the JSP
      • Enabling and Disabling the OK Button
    • Creating Custom Wizards
      • Step-by-Step: Stubbing Out the Wizard
      • Step-by-Step: Finishing Out the Wizard
      • Adding Conditions to Wizard Step Pages
      • Receiving Interview Feedback via Email
      • Persisting Interviewer Choices
      • Copying Alfresco's Code into Your Customizations
    • Customizing Web Client JSP Pages
      • Overriding Navigation Rules with Type-specific Settings
    • Summary
  • Chapter 6: Exposing Content through a RESTful API with Web Scripts
    • Introducing the Web Script Framework
      • Step-by-Step: Hello World Web Script
      • What Just Happened?
      • Following the Model-View-Controller Pattern
      • Adding Controller Logic
      • Configuring the Web Script
        • Specifying the HTTP Method
        • Specifying Arguments
        • Specifying the Response Format
      • Deploying Web Scripts
      • Building Solutions with the Web Script Framework
    • Planning the SomeCo Whitepapers and Ratings API
    • Retrieving Data with Web Scripts
      • Step-by-Step: Writing a Web Script to List Whitepapers
      • Debugging
      • Fast Facts
      • Organizing Web Scripts
      • Overriding Web Scripts
      • Choosing a URL
      • Choosing between the Repository and the File System
      • Step-by-Step: Retrieving the Rating for a Whitepaper
      • Specifying Optional Arguments
      • Handling Errors
    • Writing Java-Backed Web Scripts
      • Step-by-Step: Writing a Java-Backed Web Script to Handle Ratings Posts
      • Using the Correct ID for Web Script Beans
      • Using both Java and JavaScript for Controller Logic
    • Wiring a Web Script to UI Widgets
      • Step-by-Step: Using a Widget to Post Ratings
      • Implementing the Delete Ratings Link
      • Adding the Web Script Calls to SomeCo's Whitepaper Web Page
      • Making Other Types of Content "Rateable"
      • Dealing with the Cross-Domain Scripting Limitation
    • Handling Form Data
      • Step-by-Step: Implementing a Form-Based Hello World
      • Step-by-Step: Using File Upload in a Multipart Request
    • Customizing the Web Client with Web Scripts
      • Step-by-Step: Running a Web Script as a Dashlet
      • Understanding Web Script Runtimes
    • Advanced Web Scripts
      • Running Web Scripts as JSR-168 Portlets
      • Dealing with Web Script Authentication
      • Controlling Web Script Cache
      • Executing Remote Web Scripts
        • Refactoring the Rating Service
    • Summary
  • Chapter 7: Advanced Workflow
    • What is a Workflow?
      • Workflow Options
    • Creating Process Definitions
      • Step-by-Step: Creating a Hello World Process Definition
      • Organizing Processes
    • Using the jBPM Graphical Process Designer
      • Step-by-Step: Using jBPM Process Designer to Create and Deploy Processes
        • Tokens
        • Node Types
        • Versioning Process Definitions
        • Deploying Dependencies
        • Using Alternative Deployment Methods
    • Wiring a Process to the Alfresco UI
      • Step-by-Step: Grabbing the Hello World Argument from the User
        • Understanding Workflow-Specific Content Models
    • Assigning Tasks to Users and Groups
      • Step-by-Step: Creating the Initial Whitepaper Submission Workflow
      • Controlling What Actions Can Be Taken from the Task Management Dialog
      • Enabling the Workflow Initiator to Select Users and Groups
    • Adding Logic to Workflows with Actions and Process Variables
      • Storing Data in Process Variables
      • Step-by-Step: Adding Logic to the Whitepaper Submission Workflow
      • Using Java Classes for Decisions
      • Getting Access to the Content in the Workflow
      • Selecting the Right Event for Your Logic
      • Using ForEachFork
    • Using the Workflow API
      • Step-by-Step: Implementing Third-Party Review
      • Using a Task-Node Instead of a State
      • Making the Third-Party Review More Robust
    • Using Timers
      • Step-by-Step: Adding a Timer to the Third-Party Review
      • Understanding Timer Syntax
    • Debugging Workflows
    • Comparing Alfresco Workflow Options
    • Summary
  • Chapter 8: Web Content Management
    • Understanding the Difference between Alfresco DM and Alfresco WCM
    • Obtaining Alfresco WCM
      • Step-by-Step: Installing Alfresco WCM
    • Creating Web Projects
      • Step-by-Step: Creating the SomeCo Web Project
      • What Just Happened
      • Playing Nicely in the Sandbox
      • Inviting Users
      • Mounting Sandboxes via CIFS
      • Virtualization and Layering
    • Creating Web Forms
      • Step-by-Step: Creating a SomeCo Press Release Web Form
      • Mapping XML Schema Types to Web Form Controls
        • Localizing Web Forms with Labels and Alerts
      • Generating XSD Dynamically
      • Step-by-Step: Creating a Press Release Index Page
      • Making Changes to an Existing Web Form
      • Using Web Forms Outside the WCM User Interface
    • Deploying Content
      • Step-by-Step: Deploying Content Using the File System Receiver (FSR)
      • Setting the FSR Target User and Password
      • Viewing Deployment Reports
      • Deploying to Test Servers
      • Enabling Deployment Targets for Auto Deploy
      • Step-by-Step: Deploying to an Alfresco System Receiver (ASR)
    • Performing Post-Deployment Processing
      • Step-by-Step: Running Post-Deployment Code in an FSR Deployment
      • Handling Deletes
      • Step-by-Step: Implementing ASR Deployment Callbacks
    • Modifying and Creating WCM Workflows
      • Using Launch Dates, Expiration Dates, and Link Checking
        • Launch Dates
        • Expiration Dates
        • Link Checking
      • Step-by-Step: Creating a No-Approval Workflow for Job Postings
    • Working with the AVM API
      • Step-by-Step: Writing a Web Script to Query AVMNodes
      • Step-by-Step: Writing a Web Script to Trigger Deployments
        • Implementing a Web Script for Submit
    • Using the AVM Console
    • Summary
  • Chapter 9: Security
    • Authenticating and Synchronizing with LDAP
      • Step-by-Step: Setting Up a Local OpenLDAP Server
      • Step-by-Step: Configuring Alfresco to Authenticate against LDAP
      • Step-by-Step: Configuring Chaining
      • Step-by-Step: Synchronizing LDAP with Alfresco
        • Handling Large Directories
    • Setting Up Single Sign-On (SSO)
      • Step-by-Step: Implementing SSO
        • Logging Out
      • Step-by-Step: Configuring CAS to Use LDAP for Authentication
    • Working with Security Services
      • Securing the Admin User
      • Granting Additional Users Admin Rights
        • Step-by-Step: Making tpublisher1 an Admin
      • Creating Users and Groups Programmatically
        • Step-by-Step: Creating Users and Groups through the API
      • Understanding Permission Definitions
        • Permission Groups
        • Permissions
        • Permission Sets
        • Step-by-Step: Setting Up A Portal Publisher Custom Role
        • Global Permissions
        • Mapping Permissions to Methods
    • Summary
  • Appendix A: API Reference and Examples
    • Foundation API Public Services
      • ActionService
      • ActivityService (3.0 Labs)
      • AttributeService
      • AuditService
      • AuthenticationService
      • AuthorityService
      • AVMService
      • AVMLockingService
      • AVMSyncService
      • CategoryService
      • CheckOutCheckInService
      • ConfigurableService
      • ContentUsageService (3.0 Labs)
      • ContentService
      • CopyService
      • CrossRepositoryCopyService
      • DeploymentService
      • DescriptorService
      • DictionaryService
      • EditionService
      • EmailService
      • ExporterService
      • FileFolderService
      • ImporterService
      • LinkValidationService
      • LockService
      • MailService
      • MimetypeService
      • ModuleService
      • MultilingualContentService
      • NamespaceService
      • NodeService
      • OwnableService
      • PermissionService
      • PersonService
      • RegistryService
      • RepoAdminService (3.0 Labs)
      • RepositoryExporterService
      • RuleService
      • SearchService
      • ScriptService
      • SiteService (3.0 Labs)
      • TaggingService (3.0 Labs)
      • TemplateService
      • ThumbnailService (3.0 Labs)
      • TransactionService
      • VersionService
      • WorkflowService
    • Lucene Queries
      • Basic Lucene Syntax
      • Property Search
      • Proximity Search
      • Range Search
      • Field Search
    • JavaScript
      • Root Objects
      • JavaScript API
    • API Examples
      • Create a Node
      • Perform a Search
      • Persist Content
      • Add an Aspect
      • Set a Property
      • Set Permissions
      • Start a Workflow
  • Appendix B: Alfresco Configuration Reference
    • Actions
      • Actions Available in both Enterprise and Labs
      • Actions Available in Labs Only
    • Web Client Config Elements
      • Conditional Configuration Elements
      • Unconditional Configuration Elements
    • Action Groups
      • Core Web Client Action Groups
      • Forums-Related UI Action Groups
      • Workflow-Related Action Groups
      • WCM-Related Action Groups
    • Metadata Extractors
    • Transformers
    • Graphical View of the Alfresco Content Model
      • System Model
      • User Model
      • Content Model
      • App Model
      • BPM Model
      • Workflow Model
      • WCM Model
      • WCM App Model
      • WCM Workflow Model

Jeff Potts

Jeff Potts leads the industry’s largest group of certified Alfresco consultants as the Director of the Enterprise Content Management (ECM) Practice at Optaros. Jeff brings over 10 years of ECM practice leadership and over 16 years of IT and technology implementation experience in IT departments and professional services organizations.

Jeff began working with and blogging about Alfresco in November of 2005. In 2006 and 2007, Jeff published a series of Alfresco tutorials and published them on his blog, That work, together with other Community activity in Alfresco's forum, wiki site, and Jira earned him Alfresco's 2007 Community Contributor of the Year Award. The same year, Optaros earned Alfresco's Global Partner of the Year and Implementation of the Year awards.

Jeff’s areas of business expertise include document management, content management, workflow, collaboration, portals, and search. Throughout his consulting career he has worked on a number of projects for Fortune 500 clients across the Media & Entertainment, Airline, Consumer Packaged Goods, and Retail sectors.

Prior to Optaros, Mr. Potts was a Vice President at Hitachi Consulting (formerly Navigator Systems, Inc.) where he founded and grew the ECM practice around legacy knowledge management, document management, Web Content Management (WCM), and collaboration solutions in addition to custom development.

Contact Jeff Potts

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 13 submitted: last submission 19 Feb 2014

Errata type: Code | Page number: 285

deploy alfresco|extension |workflows|Hello-world|processdefinition.xml should be deploy alfresco|extension|workflows|HelloWorld|processdefinition.xml


Errata type: Code | Page number: 222

The code that is provided with the book includes “/someco” in the descriptor, so that is part of the URL. But the snippet in the book omits the “/someco” in the descriptor which means the URLs should not contain “/someco”. So remove “/someco” from the URLs on page 222 and then the code snippets in the book will be consistent with the rest of the text or correct the book to match the source code.


Errata type: Code | Page number: 104

Error boolean activeFlag = (Boolean)action.getParameterValue(PARAM_ACTIVE); Correct Boolean activeFlag = (Boolean)action.getParameterValue(PARAM_ACTIVE);


Errata type: Code | Page number: 87

In the script "createContent.js" : whitepaperNode.addAspect(sc:webable); should be replaced by : whitepaperNode.addAspect("sc:webable"); (with double quotes) Otherwise when executing the script, an error occurs.


Errata type: Code | Page number: 78

Create a new class in your java|src should be Create a new class in your src|java


Errata type: Code | Page number: 34

Building alfresco from source Step 3 It should be: "ant build.xml" -> "ant -f build.xml" instead of: "ant build.xml" -> "ant build.xml"


Errata type: Code | Page number: 445

WEB-INF|alfresco|classes|alfresco|mode|permissionDefinitions.xml should be WEB-INF|classes|alfresco|model|permissionDefinitions.xml


Errata type: Code | Page number: 375

The fourth bullet under #11 should reference the file "application-context.xml" rather than "application-config.xml


Errata type: Others | Page number: 47

The text at the bottom of the page states: "More details on working with AMPs can be found in the Appendix".Here Appendix refers to Appendix C which is available on our web site.


Errata type: Typo | Page number: 469

Under the heading SiteService (3.0 Labs),change "Spring Bean ID ScriptService" to "Spring Bean ID Site Service".


Errata type: Code | Page number: 80

Code in numbered bullet 2 : Change config evaluator to <config evaluator

Also in sc:marketingDoc" />++, the ++ should be removed.

Errata type: Code | Page number: 104

The numbered bullet 1 should read:

Create a new class in your src | java directory called com.someco.web.action.executer.SetWebFlag.


Errata type: Code | Page numbers: 284

In step 4, setting logging to debug we have to set instead of ;


Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Alfresco Developer Guide +    IBM Cognos TM1 Developer's Certification guide =
50% Off
the second eBook
Price for both: €40.00

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Set up your development environment using Eclipse, Apache Ant, and MySQL
  • Extend Alfresco's content model with business-specific metadata
  • Write custom actions, metadata extractors, content transformers, and behaviors using Java and JavaScript
  • Customize the Alfresco web client with new UI actions, JavaServer Faces components, custom JSPs, dialogs, and wizards
  • Roll your own REST API to enable a front-end web site to interact with the repository via AJAX
  • Automate business processes using the embedded JBoss jBPM engine, adding logic to business processes using Alfresco's JavaScript and Java API's, and expose the business process to non-Alfresco users via a REST API
  • Create a web form to allow non-technical content owners to contribute content into the repository, transform the content using XSLT and FreeMarker, and expos the content via REST
  • Learn how to write a Java service that is accessible from the JavaScript API
  • Expose the WCM deployment actions external to the Alfresco web client using the AVM API and RESTful web scripts
  • Secure the repository by defining custom roles, configuring Alfresco to authenticate against LDAP (including setting up your own OpenLDAP server), and integrating Alfresco with JA-SIG CAS, an open source Single Sign-On (SSO) solution

In Detail

Alfresco is an open source platform for Enterprise Content Management (ECM) solutions. ECM includes things like Document Management, Web Content Management, Collaboration/Enterprise 2.0, Digital Asset Management, Records Management, and Imaging. At its core is a repository for rich content like documents, web assets, XML, and multimedia. The repository is surrounded by a services layer (supporting both SOAP and REST) that makes getting content into and out of the repository a breeze, which is why so many next generation Internet solutions are built on Alfresco.

Implementing Alfresco usually involves extending the repository to accommodate your business-specific metadata and business logic. These extensions are done using some combination of Java, JavaScript, XML, and FreeMarker.
This book takes you through a set of exercises as if you were rolling out and customizing the platform for a fictional organization called SomeCo, which wants to roll out Alfresco enterprise-wide. Each department has a set of requirements that need addressed. We will show you how to extend Alfresco to meet these requirements. By the time you've worked through the entire book, you will be familiar with the entire platform. You'll be prepared to make your own customizations whether they are part of a Document Management solution, a web site that uses Alfresco for content storage, or an entire custom application built on Alfresco's REST API. This book will give you the knowledge and confidence you need to make Alfresco do what you need it to do

Alfresco Developer Guide walks you through the customizations made as part of an enterprise-wide rollout of Alfresco; from custom actions to RESTful web scripts and everything in between.
Jeff Potts, Optaros' ECM Practice Director, blogger, and Alfresco's Community Contributor of the Year, takes you step-by-step through advanced customization examples. Whether it is customizing Alfresco's web client or creating your own application that interact with Alfresco via RESTful web scripts, it is all covered here.


This book focuses on teaching by example. Every chapter provides a bit of an overview, and then dives right in to hands-on examples so you can see and play with the solution in your own environment. All code samples run on both the latest Enterprise and Labs release.

Who this book is for

This book will be most useful to developers who are writing code to customize Alfresco for their organization or who are creating custom applications that sit on top of Alfresco.

This book is for Java developers, and you will get most from the book if you already work with Java but you need not have prior experience on Alfresco. Although Alfresco makes heavy use of open source frameworks such as Spring, Hibernate, JavaServer Faces, and Lucene, no prior experience using these is assumed or necessary.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software