Book Image

Alfresco Developer Guide

Book Image

Alfresco Developer Guide

Overview of this book

Table of Contents (17 chapters)
Alfresco Developer Guide
Credits
About the Author
About the Reviewers
Preface
Index

Binding Logic to Custom Types with Behaviors


So far, you've seen how to write code that works with custom content types, properties, aspects, and associations. But the code wasn't tightly coupled to the objects on which it operated. With an action, the business logic is triggered by something—an item in the user interface, a schedule, or a workflow—rather than being bound to the content type or aspect.

Actions are very useful when the business logic the action carries out is generic enough to be applied to many types of objects. The out of the box "add aspect" or SomeCo's custom "move replaced" actions are obvious examples of actions that work regardless of the underlying content type.

But there are times when you want code to be tightly coupled to a content type because you need to be sure it gets executed, rather than leaving it up to a rule on a space that triggers an action or a workflow that does the same. Fortunately, Alfresco provides just such a mechanism; it's called behaviors.

Step...