Reader small image

You're reading from  Alfresco One 5.x Developer???s Guide - Second Edition

Product typeBook
Published inFeb 2017
Reading LevelBeginner
PublisherPackt
ISBN-139781787128163
Edition2nd Edition
Languages
Concepts
Right arrow
Authors (2):
Benjamin Chevallereau
Benjamin Chevallereau
author image
Benjamin Chevallereau

Benjamin Chevallereau is a French software architect, based in London, who has been working on Alfresco projects for the last 8 years and Ephesoft projects for the last 3 years. He implemented solutions for small companies and global organizations in different domains such as transport, finance, and government. He has worked for different Alfresco-recognized partners in France, the UK, and USA, including Armedia LLC, Zaizi, Michelin / Wipro, and BlueXML. He is also one of the committers and PMC members of the Apache CMIS Chemistry project.
Read more about Benjamin Chevallereau

Jeff Potts
Jeff Potts
author image
Jeff Potts

Jeff Potts is the founder of Metaversant Group, Inc., a consulting firm focused on content management, search, and workflow. Jeff brings over 20 years of Enterprise Content Management implementation experience to organizations of all sizes including the Fortune 500. Throughout his consulting career he has worked on a number of projects for clients across the media and entertainment, airline, consumer packaged goods, and retail sectors. Jeff began working with and blogging about Alfresco in November of 2005. In 2006 and 2007, he published a series of Alfresco tutorials and published them on his blog, ecmarchitect.com. 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. In the past, Mr. Potts has worked for Alfresco Software, Inc. as Chief Community Officer, Optaros as Senior Practice Director, and Hitachi Consulting as Vice President where he ran the ECM practice.
Read more about Jeff Potts

View More author details
Right arrow

Customizing Alfresco


Alfresco offers a significant amount of functionality out of the box, but most implementers will customize it in some way. At a high level, the types of customizations typically done during an implementation can be divided into basic customizations and advanced customizations.

Basic customization

Many Alfresco customizations can be done without writing a single line of code. Some may be done even by end users through Alfresco Share. Others might require editing a properties file or an XML file. Let's look at some of them briefly here so that you can get an idea of what you don't have to code. Other customizations will be introduced in the Chapter 9, Amazing Extensions.

Dashlets

When users log in to Alfresco, the first thing that is usually displayed is the My Dashboard section. The dashboard is a user-configurable layout that contains dashlets. (If you are familiar with portals, think portal page and portlet). Users choose the layout of the dashboard (number of columns) as well as the specific dashlets they want displayed in each column.

There are a number of dashlets available out of the box, or you can develop your own and add them to the user-selectable list. Examples of out of the box dashlets include workflow-related dashlet such as My Tasks as well as content-related dashlets such as My Documents, My Sites or My Activities:

Currently most of these dashlets are Spring Surf Dashlets (http://docs.alfresco.com/5.1/concepts/dev-extensions-share-surf-dashlets.html), but they will eventually be converted to Aikau Dashlets (http://docs.alfresco.com/5.1/concepts/dev-extensions-share-aikau-dashlets.html). Aikau is the new UI framework developed by Alfresco, and available from Alfresco 4.2.Some of these existing dashlets allows you some configuration. Here are some examples:

  • Saved Search: This dashlet runs a specific search each time the dashboard is loaded:

  • Web View: This dashlet is used to display any website:

Obviously, developing custom dashlets is probably not something you'd let your business users do; but it is still considered a basic customization. It can be complex to develop new dashlet depending if you need to develop new web script for example.

Custom site configuration

The first concept that you'll discover using Alfresco Share is the concept of site. It's a secured area in the repository where a team, a project or a suborganization can share and manage any kind of contents, including documents of course. A site includes multiple pages, depending mainly of the type of content. Alfresco Share provides the following by default:

  • A document library page

  • A calendar page

  • A Wiki page

  • A forum page

  • A data-list page

  • A links page

  • A blog page

In each site, you can configure and select only what is needed by the users.

Each Alfresco Share site contains as well a dedicated dashboard that you can entirely customize with all out-of-the-box dashlets already provided.

Rules and actions

A rule is something that says, "When a piece of content is created, updated, or deleted, check these conditions. If these conditions are met, take these actions". Conditions may check whether a piece of content is a particular mime type, or a specific content type. They may also check whether a piece of content has a specific aspect applied, or whether the content's name property matches a particular pattern. Rules can be defined on any folder in the repository. Child folders can inherit rules from their parent.

Rule actions are repeatable operations that enable us to do things similar to those that can be done using JavaScript or Java. Out-of-the-box actions include things such as check-in content, check-out content, move an item to another folder, specialize the type of the content, add an aspect to the content, transform content from one format to another, and so on.

Configuring folders to run rule actions is something non-technical users can do through Alfresco Share. In Chapter 4, Handling Content Automatically with Actions, Behaviors, Transformers, and Extractors, you'll learn how to write your own custom rule actions using the Alfresco API.

Simple workflow

Alfresco has two options for implementing workflow: simple workflow or advanced workflow. The good thing about simple workflows is that end users can configure them as needed without any technical skills or developer support.

Here's how it works. A user creates a rule to add simple workflow to a document when it is placed in the folder. When an item enters a folder with this type of rule applied, it will have additional UI action items available. The rule to specify the user actions and flow of the content between folders is configured in the repository action. When the step is invoked, the content can be copied or moved to another folder. It's also possible to add complexity to a simple workflow by creating rules for other folders and passing content around from location to location. For example, there might be folders called Draft, In Review, and Approved. The state of a document is determined by the folder in which it resides.

Simple workflows have obvious limitations:

  • Workflows are limited to serial processes. Content can only move forward or backward, one step at a time.

  • Content can only be in only one simple workflow state at a given time.

  • Content must change physical locations to reflect a change in state.

  • There is no opportunity for capturing (and acting on) process-related metadata.

  • Tasks can't be assigned to individuals or groups. (Of course, you could limit folders to specific individuals or groups through permissions, which would have a similar effect to a task assignment. But you wouldn't be able to easily pull a list of tasks for a specific user across all simple workflows).

  • Other than creating additional rules and actions for the folders used in a simple workflow, there is no way to add logic for decisions or other more complex constructs. If you need to implement specific behavior depending of the state, you have to implement additional action and rule attached to each folder.

Advanced customization

The basic configuration and customizations show that there is quite a lot of tweaking and tailoring that can happen before a developer gets involved. This is a good thing. It means a good chunk of the customization requirements can be dealt with quickly. In the case of simple workflows, they can be delegated to the end users altogether! Hopefully, this leaves more time for the more advanced (and more interesting) customizations required for a successful implementation.

Examples of advanced customizations

The advanced customizations are the customizations that are likely to require code. They are the focus of the book. To give you an idea of what's possible (and in an effort to provide an appetizer before the main meal is served), let's go over some of the areas of advanced customization.

Extend the content model

Alfresco's out-of-the-box content model can be extended to define your own content types, content aspects, content metadata (properties), and relationships (associations). The out-of-the-box model is very generic, and defines only a minimal subset of the metadata that will probably need to be captured with the content.

For example, SomeCo might want to capture different metadata for its marketing documents than for its HR documents. Or maybe there is a set of metadata that doesn't belong to any one content type in particular, but should rather be grouped together in an aspect and attached to objects as needed. These and other content modeling concepts will be covered in Chapter 3, Working with Content Models.

Perform automatic operations on content

There are several hooks or places where you can insert logic or take action to handle content automatically. These include rule actions, behaviors, content transformers, and metadata extractors. Rule actions have already been discussed. Behaviors are like actions but instead of being something that an end user can invoke on any piece of content, behaviors are tightly bound to their content type or aspect. Content transformers, as the name suggests, transform content from one format to another. Metadata extractors inspect content as it is added to the repository, and pull out data to store in the content object's properties. These tools for handling content automatically will all be covered in Chapter 4, Handling Content Automatically with Actions, Behaviors, Transformers, and Extractors.

Customize Alfresco Share

Chapter 5, Customizing Alfresco Share, covers Share customization. Just about everything in the Share web application can be tweaked. In the document library, it's possible to configure the view of a content, or the edit form depending of the content type. It's possible as well to define a template renderer that changes the default view in the document list. Alfresco Share provides as well different views that you can customize, or even create new ones. And if you want more, you can even create your own page from scratch.

Create a RESTful API

Web scripts are one of the more exciting additions to the Alfresco architecture. The reason is that RESTful services are typically much easier to work with using scripting languages and AJAX toolkits than SOAP-based services, because they are invoked through plain old URLs.

The web script framework, based on the Model-View-Control (MVC) pattern, allows you to build your own RESTful API to the repository. It will be covered in detail in Chapter 7, Exposing Content through a RESTful API with Web Scripts, but the high-level summary is that URLs get mapped to a controller implemented as JavaScript or Java. The controller performs whatever logic is needed, then forwards the request to the view. The view is implemented as a FreeMarker template. The template could return anything from markup to XML to JSON. RESTful services via web scripts are the preferred way to integrate with the Alfresco repository.

Streamline complex business processes with advanced workflows

Advanced workflows provide a way to automate complex business processes. Alfresco's advanced workflows are executed by the embedded Activiti engine, which is a very powerful and popular open source workflow engine.

Rather than basic workflows, which are end-user configurable and limited to serial processes, advanced workflows offer the power of parallel flows, the ability to add logic to the process via JavaScript and Java, and much more.

A handful of advanced workflows are available out of the box. These are most useful as starting points for your own custom advanced workflows. Exactly how it has to be done will be covered in Chapter 8, Advanced Workflows.

Integrate with other systems

Most of the coding and configuration discussed so far can be divided into two parts:

  • Customizations made to the core Alfresco repository

  • Customizations made to Alfresco Share

There is a third bucket to be considered, which is coding and configuration related to integrating Alfresco with other solutions. Maybe Alfresco needs to authenticate against an LDAP directory. Maybe a portal will get its content from Alfresco, or perhaps some other third-party application needs to share content with Alfresco. Chapter 9, Amazing Extensions,discusses how to handle security and integration.

Previous PageNext Page
You have been reading a chapter from
Alfresco One 5.x Developer???s Guide - Second Edition
Published in: Feb 2017Publisher: PacktISBN-13: 9781787128163
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Authors (2)

author image
Benjamin Chevallereau

Benjamin Chevallereau is a French software architect, based in London, who has been working on Alfresco projects for the last 8 years and Ephesoft projects for the last 3 years. He implemented solutions for small companies and global organizations in different domains such as transport, finance, and government. He has worked for different Alfresco-recognized partners in France, the UK, and USA, including Armedia LLC, Zaizi, Michelin / Wipro, and BlueXML. He is also one of the committers and PMC members of the Apache CMIS Chemistry project.
Read more about Benjamin Chevallereau

author image
Jeff Potts

Jeff Potts is the founder of Metaversant Group, Inc., a consulting firm focused on content management, search, and workflow. Jeff brings over 20 years of Enterprise Content Management implementation experience to organizations of all sizes including the Fortune 500. Throughout his consulting career he has worked on a number of projects for clients across the media and entertainment, airline, consumer packaged goods, and retail sectors. Jeff began working with and blogging about Alfresco in November of 2005. In 2006 and 2007, he published a series of Alfresco tutorials and published them on his blog, ecmarchitect.com. 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. In the past, Mr. Potts has worked for Alfresco Software, Inc. as Chief Community Officer, Optaros as Senior Practice Director, and Hitachi Consulting as Vice President where he ran the ECM practice.
Read more about Jeff Potts