Alfresco One 5.x Developer's Guide - Second Edition

5 (1 reviews total)
By Benjamin Chevallereau , Jeff Potts
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. The Alfresco Platform

About this book

Do you want to create more reliable and secure solutions for enterprise apps? Alfresco One 5.x is your gateway to developing the best industry-standard enterprise apps and this book will help you to become a pro with Alfresco One 5.x development. This book will help you create a complete fully featured app for your organization and while you create that perfect app, you will explore and implement the new and intriguing features of Alfresco.

The book starts with an introduction to the Alfresco platform and you’ll see how to configure and customize it. You will learn how to work with the content in a content management system and how you can extend it to your own use case. Next, you will find out how to work with Alfresco Share, an all-purpose user interface for general document management, and customize it. Moving on, you write web scripts that create, read, and delete data in the back-end repository. Further on from that, you’ll work with a set of tools that Alfresco provides; to generate a basic AnglularJS application supporting use cases, to name a few authentication, document list, document view. Finally, you’ll learn how to develop your own Alfresco Mobile app and understand how Smart Folders and Search manager work.

By the end of the book, you’ll know how to configure Alfresco to authenticate against LDAP, be able to set up Single Sign-On (SSO), and work with Alfresco’s security services.

Publication date:
February 2017
Publisher
Packt
Pages
528
ISBN
9781787128163

 

Chapter 1. The Alfresco Platform

This chapter introduces the Alfresco platform and answers the question, "What can I do with this thing?" A few examples will be provided to help answer this question from the solving business problems perspective. The chapter then skims over basic configuration and customization before introducing the advanced customization concepts covered throughout the book. The chapter concludes with a brief discussion on the different Alfresco editions that are available.

In this chapter, we will go through the following points:

  • Examples of practical solutions built on Alfresco

  • High-level components of the Alfresco platform

  • Examples of the types of customizations that you will likely perform as a part of your implementation

  • Technologies you will use to extend the platform

 

Alfresco in the real world


Alfresco will tell you that the product is a platform for enterprise content management (ECM). But ECM is a somewhat nebulous and nefarious term. What does it really mean? It depends on who is saying it. ECM vendors usually use it as an umbrella term to describe a collection of content-centric technologies as follows:

  • Document management ( DM ): This is used for capturing, organizing, and sharing binary files. These files are typically produced from office-productivity software, but the scope of the files being managed is unlimited.

  • Web content management ( WCM ): This is used for managing files and content specifically intended to be delivered to the Web. The key theme of WCM is to reduce the "web developer" bottleneck and empower non-technical content owners to publish their own content.

  • Digital asset management ( DAM ): This is used for managing graphics, video, and audio. You can think of this as DM with added functionality specific to the needs of working with rich media such as thumbnailing, transcoding, and editing. Like WCM, the intent is to streamline the production process.

  • Records management( RM ): This is used for managing content as a legal record. Like DAM, RM starts with DM and adds functionality specific to the world of RM such as retention policies, records plans, and audit trails.

  • Knowledge management( KM ): This is used for capturing knowledge from employees or customers and providing it in a form that others can use.

  • Case management( CM ): This is used managing information related to a case, such as an insurance claim, an investigation, or personnel processing.

  • Imaging : This includes capturing, tagging, and routing images of documents from scanners.

Most people will also include collaboration, search, and occasionally, portals as well.

Practitioners have a different perspective. They will say that ECM is less about the technology and more about how you capture, organize, and share information across the entire enterprise. For them, the how is more important than the what.

What's important to know from an Alfresco perspective is that Alfresco is a platform for doing all these things.

So rather than worrying about a concise definition of ECM, let's look at a few examples to illustrate how clients are using Alfresco today, particularly in Alfresco's sweet spots such as DM and WCM.

Basic document management

Alfresco started its life as a document management repository with some basic services for document management. Alfresco focused on this smart area initially for two reasons. First, it allowed Alfresco to establish a strong foundation and then build upon that foundation by expanding into other areas of ECM. Second, there is a huge market for systems that can manage unstructured content (aka "documents").

The market is so big because document management is a problem for everyone. All companies generate files that benefit from the kind of features document management provides such as check-in/check-out, versioning, metadata, security, full-text search, and workflow.

Examples of classic document management are often found in insurance, manufacturing, packaged goods, or other companies with large research and development divisions. As you can imagine, companies such as these deal with thousands of documents every day. The documents are in a variety of formats and languages, and are created and leveraged by many different types of stakeholders from various parts of the company.

The critical functionality required for basic document management includes things such as:

  • Easy integration with authoring tools : If users can't get documents into and out of the repository easily, user adoption will suffer. This means users must be able to open and save documents to the repository from applications such as Microsoft Office, Microsoft Windows Explorer, and e-mail.

  • Security: Many documents, particularly legal documents and anything around new product development, are very sensitive. Employees must be able to log in with their normal username and password, and see only the documents they have access to.

  • Library services: This is a grouping of foundational document management functionality that includes check-in/check-out, versioning, metadata, and search. The ability to offer these library services is one of the things that sets a document repository apart from a plain filesystem.

  • Workflow: Quite literally, workflow describes the "flow of work" or business process related to a document. Requirements vary widely in this area and not everyone will leverage workflows right away. Workflows can be used to streamline and automate manual business processes by letting the document management system keep track of who needs to do what to a document at any particular time.

  • Scalability/Reliability: The system needs to scale in order to support several hundred or more users and hundreds of thousands or even millions of documents with some percentage of growth each year. Because the repository holds content that's critical to the business, it needs to be highly available.

  • Customizable user interface: Alfresco is split into two web applications. The first one contains only the core engine capabilities that are required for all Alfresco installation. The second one is the out-of-the-box Alfresco Share client made for generic document management, which may be appropriate in many cases. Most clients will want to make at least some customizations to the web client to help increase productivity and improve user adoption. It's possible as well to develop your own frontend from scratch.

The following diagram shows an example of high-level architecture to understand how basic document management might be implemented:

The diagram shows a single instance of Alfresco authenticating against a Directory Server (such as LDAP). Some content managers are using Alfresco Share via HTTP/S, while others are using Windows Explorer, Microsoft Office, and other thick clients to work with content via one or more protocols such as CIFS, WebDAV, FTP, or SMTP. As noted in the diagram, Alfresco stores metadata in a relational database and the actual content files on the filesystem.

Most of the techniques for customizing Alfresco for DM solutions apply to other ECM solutions such as WCM, RM, Imaging, and DAM. Of course, there are business concepts and technical implementation details specific to each that make them unique, but the details provided in this book apply to all because the specialized solutions are built as extensions to the core Alfresco repository. This books dedicates an entire chapter, Chapter 9, Amazing Extensions, to some very famous extensions as Alfresco Mobile and Alfresco Analytics.

Web content management

On the surface, WCM is very similar to document management. In both cases, content owners store files in a repository. Often, the content is assigned metadata, secured, indexed for search, and routed through a workflow. The most obvious difference between DM and WCM is that the content being managed is meant specifically to be published on a website or as part of a web application. Beyond that high-level distinction, there are several other differences that make WCM worthy of separate discussion. These include:

  • Content authoring tools used to create content

  • Separation of presentation from content

  • Systematic publication or deployment of content

Let's briefly look at each of these.

Content authoring tools

The majority of document management solutions deal with files generated by an office suite. Of course, there are exceptions such as various types of graphics files, CAD/CAM drawing formats, and other specialized tools. But mostly, the files are generated by a small number of different tools and an even smaller number of different software vendors.

In the case of WCM, there is a wide variety of tools involved from text editors to integrated development environments (IDEs) to graphics programs with multiple vendors in each category. This means the WCM solution needs to be very flexible in the way it integrates with authoring tools. The alternative, which is forcing authors to give up their favorite tools in favor of a standard, can be a management nightmare.

Separation of presentation from content

WCM does not require the separation between content's appearance on the web site and its storage. But many implementations take advantage of this principle because it makes redesigning the site easier, facilitates multichannel publishing, and enables people to author content without web skills.

To understand why this is so, think about a website that has its content and presentation of that content merged together. When it is time to redesign the site, you have to touch every single web page because every page contains presentation markup. Similarly, content authoring is limited to people with technical skills. Otherwise, there is a risk that the content owner (for example, the person writing a press release or a job posting) will inadvertently clobber the page design.

One way to address this is to separate the content (the press release copy) from the presentation of that content. A common way to do that is to store the content as presentation-independent XML. The XML can then be transformed into any presentation that's needed. A redesign is as simple as changing the presentation in a single place, and then regenerating all of the pages.

The impact of separating content from presentation is three-fold. First, assuming the content consumers aren't interested in reading raw XML, something has to be responsible for transforming the content. Depending on the implementation, it may be up to the WCM system or a frontend web application.

Second, in the case of static content, any change in the underlying content has to trigger a transformation so that the presentation will be up-to-date, keeping in mind that there may be more than one file affected by the change. For example, data from a job posting appears in the job posting detail as well as the list of job postings. If the posting and the job posting index are both static, the list has to be regenerated whenever the job posting changes.

Third, content authors lose the benefit of WYSIWYG (What You See Is What You Get) content authoring because the content doesn't immediately look the way it will as soon as it is published to the web site. The WCM system, then, has to be able to let content authors preview the content as they author it, preferably in the context of the entire site.

Systematic publication or deployment

A document management system is a lot like a relational database in the sense that it is typically an authoritative, centralized repository. There are exceptions, but for the most part, content resides in the repository and is retrieved by the systems and applications that need it. On the other hand, a WCM system often faces a publication or deployment challenge. Files go into the repository, but must be delivered somewhere to be consumed. This might happen on a schedule, at the request of a user, as part of a workflow, or all of the above. Granted, some websites retrieve their content dynamically; but most sites have at least a subset of content that should be statically delivered to a web server.

Alfresco WCM example

Let's look at an example of a basic corporate website. Most companies have a mix of About Us content that probably doesn't change very often, Press releases or News sections that might get updated daily, and maybe some document-based content such as marketing slicks, product information sheets, technical specifications, and so on. There's also some content that is used to build the site such as HTML, XML, JavaScript, Flash, CSS, and image files.

It is likely that there are several different teams with several different skill sets, all collaborating to produce the site. In this example, suppose the About Us and News pages come from the marketing team, the site is built by the web team and the document-based content can come from many organizations within the company.

Alfresco WCM sits on top of the core Alfresco product to provide additional WCM-specific functionality. An important distinction between Alfresco WCM and other open source content management systems (CMS) is that Alfresco is a decoupled CMS while something such as Drupal is a coupled CMS. This means that Alfresco manages the website but does not concern itself with presentation unlike Drupal, which is both a repository and a presentation framework. This doesn't mean that Alfresco can only manage static sites. You can easily query the repository in any number of ways. It just means it is up to you to provide the frontend from the ground up.

Custom content-centric applications

Content-centric applications are those in which the primary purpose of the application is to process, produce, archive, collaborate on, or manage unstructured or semi-structured content.

The Alfresco Share client is an example of a content-centric application, although it is meant for a very general, all-purpose use case. When solutions are very close to basic document management, Alfresco Share can be customized as previously discussed. At some point, it makes more sense to build a separate custom application with Alfresco as the backend repository for that application.

Consider the sales process within a company, for example. Sales people create proposals. Those proposals are usually routed internally for review and approval, and then are delivered to the client. If the client accepts the proposal, a contract is drawn up and the product is delivered. The out-of-the-box Alfresco Share could be used to manage these documents, assign metadata, manage the review process through workflows, and make it all searchable. But the sales team might be even more productive if it used a purpose-built user interface. For this solution, a frontend built on top of NodeJS and Angular, a custom Spring web application, or even a custom mobile application might be a good option. Alfresco would provide the document management services. The frontend would talk to Alfresco via CMIS or RESTful services.

Another example is using Alfresco in a digitization project. More and more companies are trying to reduce the use of paper-based process for many different reasons. Alfresco can be integrated with various scanning solutions as Ephesoft via CMIS, or Kofax via the connector supported by Alfresco. Documents can be ingested and processed by the scanning solution and exported to Alfresco. Alfresco will be responsible to store, index and secure the scanned documents. Using the integrated Activiti framework, Alfresco can automatically start a process depending of the document type. If an invoice has been scanned, Alfresco will start a review process for the financial team. If it's a job application, Alfresco will start a new process for the HR team to track the different stages of this application.

As discussed previously, Alfresco provides two out-of-the-box web applications. The first one is the Alfresco repository engine. The first one provides only administration capabilities from a user interface point of view. The second one is the default web interface Alfresco Share. Many clients appreciate this separation because it gives them complete freedom with regard to how they build the frontend. Depending of your use case, you may want to use the standard Alfresco Share user interface; or including some customizations; or even build the frontend from scratch.

Alfresco Share provides many different options if you need customizations. The basic level is to configure some forms and pages to display your custom metadata. If you need further customization, you may want to customize an existing Dashlet or to develop a new one to add on the user or site dashboard. You may need to create custom actions in the use interface. If it's not enough, it's even possible to create new pages within Alfresco Share reusing the entire UI framework. Finally, if it's not sufficient, Alfresco can be integrated to any frontend using CMIS or REST API.

We'll see in one of the following chapters how Alfresco created tools to generate Angular applications from scratch:

The openness of the Alfresco repository, particularly its ability to be easily exposed as a set of services, makes Alfresco an ideal platform for content-centric applications. As the examples have shown, custom content-centric web applications use Alfresco as the backend. As a result, they have complete flexibility in frontend technology choices from portals to lower-level frameworks to no framework at all.

 

Example used throughout this book


In this book, we'll assume we are rolling out Alfresco throughout a consulting firm. Professional services firms make great examples because they tend to generate a variety of different documents. The other reason is that document and content management is usually a big challenge, which is the core to the business. But the examples should be applicable to any business that generates a significant amount of documents.

The example firm, SomeCo, wants to leverage document and content management throughout the organization to make it easier to find important information, streamline certain business processes, and secure sensitive documents.

SomeCo's company organization is pretty standard. It consists of operations, sales, human resources, marketing, and finance/legal. Examples of the different types of content each department is concerned with are shown in the following table:

Department

Example document types

Format and process notes

Finance/legal

Client proposals for project work

Statements of work

Master services agreements

Non-disclosure agreements

  • Microsoft Word and Adobe PDF.

  • Several iterations between the firm and the client before a final version is completed.

  • Some documents may require internal review and approval.

Marketing

Case studies

Whitepapers

Marketing plans

Marketing slicks/promotional material

  • Microsoft Word, Microsoft PowerPoint, Adobe PDF, and Adobe Flash.

  • Mostly single-author content.

  • Some content may come from third parties.

  • Some content may need to be published on the website.

Human resources

Job postings

Resumes

Interview feedback

Offer letters

Employee profiles

/Biographies

Project reviews

Annual reviews

  • Microsoft Word, Adobe PDF, and HTML.

  • Single-author content with consumers being spread throughout the company.

  • Some content formats are unpredictable (such as resumes). Some are very standard and could be templatized (such as offer letters).

  • With the exception of job postings, none of this content should go near the Web.

  • Some content needs strict internal permissions.

Sales

Forecast

Presentations

Proformas

  • Microsoft Excel and Microsoft PowerPoint.

  • Some business process and automated document-handling possibilities such as forecast.

  • Searchability of presentations is important.

Operations

Methodology

Utilization reports

Status reports

  • All Microsoft Office formats.

  • Some opportunity for integration into enterprise systems such as time tracking and project management.

Examples throughout the rest of the book will show how Alfresco can be implemented and customized to meet the needs of the various organizations within SomeCo. During a real implementation, time would be spent gathering requirements, selecting the appropriate components to integrate with the solution, finalizing architecture, and structuring the project. There are plenty of other books and resources that discuss how to roll out content management across an enterprise and others that cover project methodologies. So none of that will be covered here.

 

Alfresco architecture


Many of Alfresco's competitors (particularly in the closed-source space) have sprawling footprints composed of multiple, sometimes competing, technologies that have been acquired and integrated over time. Some have undergone massive infrastructure overhauls over the years, resulting in bizarre vestigial tails of sorts. Luckily, Alfresco doesn't suffer from these traits. On the contrary, Alfresco's architecture shows the following characteristics:

  • It is relatively straightforward

  • It is built with state-of-the-art frameworks and open source components

  • It supports several important content management and related standards

Let's look at each of these characteristics, starting with a high-level look at the Alfresco architecture.

High-level architecture

The following diagram shows Alfresco's high-level architecture. By the time you finish this book, you'll be intimately familiar with just about every box in the diagram:

The important takeaways at this point are as follows:

  • There are many ways to get content into or out of the repository, whether that's via the protocols (for example CIFS on the diagram) or the APIs on the left.

  • Alfresco runs as a web application within a servlet container. From Alfresco 5.x, this web application doesn't provide anymore a user interface for end users. It includes only an administration console. If you need a user interface, you'll need to deploy the Alfresco Share web application (in the same container or not) and an extension package in the Alfresco web application to provide all web scripts required by Alfresco Share. You can as well implement your own user interface on top of your Alfresco repository.

  • Customizations and extensions run as part of the Alfresco repository or Share web application. An extension mechanism separates customizations from the core product to keep the path clear for future upgrades.

  • Metadata resides in a relational database. In a typical Alfresco installation, content files are usually stored in a different server than Alfresco itself (as compared to filesystem). Solr indexes needs to be located in the system as the Solr web application that can reside in a dedicated server too.

Add-ons

The add-ons are pieces of functionality not found in the core Alfresco distribution. If you are working with the binary distribution, it means you'll have additional files to download and install on top of the base Alfresco or Share installation.

Add-ons are provided by Alfresco, third-party software vendors, and members of the Alfresco community such as partners and customers. Alfresco makes several add-on modules available such as Records Management, Google Docs, Office Services or Kofax integration. Members of the Alfresco community create and share add-on modules via the Alfresco add-Ons (https://addons.alfresco.com/), a website set up by Alfresco for that purpose. At the time of writing, this website contains 444 different add-ons compatible with Alfresco Enterprise and/or Community.

Open source components

One of the reasons Alfresco has been able to create a viable offering so quickly is because it didn't start from scratch. The Alfresco engineers assembled the product from many finer-grained open source components. Why does this matter? First, instead of reinventing the wheel, they used proven components. This saved them time, but it also resulted in a more robust, more standard-based product. Second, it eases the transition for people new to the platform. If a developer already knows Spring, for example, many of the customization concepts are going to be familiar. Alfresco uses Surf, a Spring framework extension for building or extending MVC applications. And besides, as a developer, wouldn't you rather invest your time and effort in learning standard development frameworks rather than proprietary development kits?

The following table lists some of the major open source components used to build Alfresco:

Open source component

Use in Alfresco

Apache Solr (http://lucene.apache.org/solr/)

Full-text and metadata search

Hibernate (http://www.hibernate.org/)

Database persistence

FreeMarker (http://freemarker.org/)

Web script framework views, custom views in the web client, web client dashlets, email templates

Mozilla Rhino JavaScript Engine (http://www.mozilla.org/rhino/)

Web script framework controllers, server-side JavaScript, actions

OpenSymphony Quartz (http://www.quartz-scheduler.org/)

Scheduling of asynchronous processes

Spring ACEGI (http://projects.spring.io/spring-security/)

Security (authorization), roles, and permissions

Apache Axis (http://ws.apache.org/axis/)

Web services

LibreOffice (http://www.libreoffice.org/)

Conversion of office documents into PDF

Apache FOP (http://xmlgraphics.apache.org/fop/)

Transformation of XSL:FO into PDF

Apache POI (http://poi.apache.org/)

Metadata extraction from Microsoft Office files

Activiti (http://www.activiti.org/)

Advanced workflow

ImageMagick (http://www.imagemagick.org/)

Image file manipulation

GhostScript (http://www.ghostscript.com/)

Image file manipulation

Does this mean you have to be an expert in all open source components used to build Alfresco to successfully implement and customize the product? Not at all! Developers looking to contribute significant product enhancements to Alfresco or those making major, deep customizations to the product may require experience with a particular component, depending on exactly what they are trying to do. Everyone else will be able to customize and extend Alfresco using basic Java and web application development skills.

Major standards and protocols supported

Software vendors love buzz words. As new acronyms climb the hype cycle, vendors scramble to figure out how they can at least appear to support the standard or protocol so that the prospective clients can check that box on the Request for proposal (RFP). Commercial open source vendors are still software vendors and thus are no less guilty of this practice. But because open source software is developed in the open by a community of developers, its compliance to standards tends to be more genuine. It makes more sense for an open source project to implement a standard than to go off in some new direction because it saves time. It promotes interoperability with other open source projects, and stays true to what open source is all about-freedom and choice.

Here, are the significant standards and protocols Alfresco supports:

Standard/protocol

Comment

HTTP

The main protocol used to access Alfresco content repository via for example the Alfresco REST APIs.

CMIS

CMIS is a standard allowing information sharing between different content management systems. Alfresco supports the version 1.0. and 1.1 of the CMIS standard.

FTP

Content can be contributed to the repository via FTP.

WebDAV

WebDAV is an HTTP-based protocol commonly supported by content management vendors. It is one way to make the repository look like a file system.

CIFS

CIFS allows the repository to be mounted as a shared drive by other machines. As opposed to WebDAV, systems (and people) can't tell the difference between an Alfresco repository mounted as a shared drive through CIFS and a traditional file server.

IMAP

IMAP protocol is used by any modern email clients. Directly from your client, you can connect to your Alfresco repository.

SMTP

It is possible to email content into the repository (InboundSMTP). A folder can be dedicated as an email target.

SPP

Enables Alfresco to act as a Microsoft SharePoint Server. Allows Microsoft Office users to access documents within the Alfresco repository.

Alfresco Office Services

Using Alfresco Office Services (AOS), you can access your documents directly via all Microsoft Office software. AOS replaces and improves the Microsoft SharePoint protocol available in the previous versions.

SOAP

The Alfresco Web Services API uses SOAP-based web services.

OpenSearch (http://www.opensearch.org)

Alfresco repositories can be configured as an OpenSearch data source, which allows Alfresco to participate in federated search queries.

XSLT, XSL:FO

Web form data can be transformed using XSL 1.0.

LDAP

Alfresco can authenticate against an LDAP directory or a Microsoft Active Directory server.

 

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.

 

Dusting off your toolbox


Looking across both the basic and advanced customizations provides some idea about the extensibility of the platform. A commonly asked question at this point in the architecture discussion is, Does Alfresco have an API? Actually, it has several. Let's look at what APIs are available and where they are used. This should also give you some idea as to the tools and skills you'll need to have in your toolbox as you embark on your own projects.

The following table shows the APIs available and where they are used:

Alfresco API

Where Used

Comments

Foundation API

Rule actions, behaviors, Java-based web scripts, web client customizations, Activiti, standalone applications that embed the Alfresco repository.

As the name suggests, this is the core Alfresco API.

Alfresco One API

Web and non-web applications that need remote access to the repository.

The Alfresco One API was introduced with Alfresco 4.x, and is also present in the public cloud version of Alfresco. It provides the main remote API, and is the recommended API for developing remote client applications.

CMIS API

Web and non-web applications that need remote access to the repository.

CMIS provides a standardized set of common services for working with content repositories. Alfresco provides an implementation of CMIS Web service and RESTful bindings.

FreeMarker API

Custom views, mail templates, web script view logic.

FreeMarker is an open source templating engine.

Web script framework

Web and non-web applications that need to use REST to interact with the repository.

More of a framework than an API, web scripts implement a MVC pattern that relies on the JavaScript, FreeMarker, and Foundation APIs.

As the list of APIs shows, knowing Java will be the key to just about any successful customization effort. FreeMarker and JavaScript are important, but are easily picked up using Alfresco's code and online resources as references.

 

Understanding Alfresco's editions


Alfresco has three editions of its ECM products: Alfresco One, Alfresco in the Cloud, and Alfresco Community Edition. We won't describe the other BPM products offered by Alfresco, because they are not in the scope of this book.

Alfresco One is the package installable on premise supported by Alfresco. It provides hybrid capabilities with selective content-sync to the included SaaS Alfresco in the Cloud. Alfresco One provides as well different modules including content encryption, records management, analytics, and media management.

Alfresco in the cloud offers almost all out-of-the-box features provided by Alfresco Share without on-premises installation. It provides full mobile access and workflow for document review and approval. This product is well suited for smaller teams with multiple offices or branches that don't want to manage servers and don't require the full customization, extra modules or integrations offered by Alfresco One. This product can be used as well in a hybrid mode. Only documents that need to be shared with the outside world can be published into Alfresco Cloud. Content can be configured to synchronize between Alfresco Cloud and on premise Alfresco installations.

Alfresco community is intended for developers and technical enthusiasts who want the power of Alfresco in non-critical environments. However, some big organizations use Alfresco community in production. Be aware that Alfresco won't provide any support for this product. In terms of features, Alfresco community is usually the first product to receive the new features to allow the community to test. However, some features are provided only by Alfresco One including the administration console, the content encryption or the Activiti console.

Significant feature differences

At the time of this writing, the latest supported release from Alfresco is Alfresco One 5.1. The latest community release is Alfresco Community 201605 (for May 2016).

What's used in this book

The vast majority of examples used in this book will work on both the Enterprise and Community editions (5.1 and 201605, respectively). Where a specific release is required, it will be noted wherever possible.

 

Summary


Hopefully, this chapter has given you several ideas about how Alfresco can be used to implement DM, WCM, and custom content-centric applications by walking through examples of each. The details may still be fuzzy, but the goal was to introduce the major components and capabilities of the Alfresco platform.

In this chapter, we discovered in which kind of use case Alfresco is a good fit. The potential and flexibility of Alfresco can be used to solve a variety of different content-related business problems. Then, we introduced the different configuration points that you can use in your organization without writing one line of code. Even if Alfresco provides you a lot of capabilities, we'll discover in the rest of the book how it can be customized and extended based on the fictitious consulting firm that we created called SomeCo. Next we covered the major open source components included in Alfresco, and the different protocols and standards that can be used to integrate Alfresco in your ecosystem.

About the Authors

  • 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.

    Browse publications by this author
  • 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.

    Browse publications by this author

Latest Reviews

(1 reviews total)
Book very useful for newcomers to Alfresco as well as a good reference for those with more advanced knowledge.
Book Title
Unlock this full book FREE 10 day trial
Start Free Trial