Get your Alfresco ‘flow on

With the busy holiday season approaching, it’s hard to find time to streamline your content-centric business processes. Here’s a tip: Buy everyone gift cards. Use the time saved to learn how to implement advanced workflows using Alfresco‘s embedded JBoss jBPM engine. This article and the accompanying source code should be everything you need to get started and then some.

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

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

The integration of third-party partners is handled through email–recipients simply click a link to approve or reject the workflow task.

As in prior articles, the source code bundle is cumulative–it contains all of the “SomeCo” code we’ve worked on thus far.

About the “Alfresco Developer” series of articles

The Alfresco Developer Series of articles is a collection of technical tutorials aimed at getting you up-to-speed quickly on the key aspects of Alfresco. The series covers extensions and customizations performed during a typical Alfresco implementation by walking through a realistic example that is expanded upon in each successive article. The content is based on real-world Alfresco projects executed by the Optaros ECM practice for clients around the globe.

Past articles include:

33 comments

  1. ian says:

    This is too many steps – it seems a solution similar to Yahoo Pipes is more appropriate and will win over time:
    http://video.google.com/videoplay?docid=8569811679113799879

    not just the web visual editor, but the much simpler process language too – of course I’m not arguing for more complexity with BPEL 🙂

    I first experimented with jpdl/jbpm enabled content-repositories in a very similar open source project: http://en.wikipedia.org/wiki/Daisy_(software)
    and became frustrated with the debug cycle – we had many command line analysis applications to integrate with human workflows. Daisy is actually quite nice in many respects though – and has generally been ahead of the curve for the features that are important to me. Alfresco has now been on my radar screen more (with the latest releases), but it seems to still be catching up to Daisy on e.g. REST interface w/ full query language, etc.. Of course there are several features unique to Alresco too, and I’m very eager to see what the future brings, since the development cycle has been very rapid. Perhaps when you release scaling statements, you can release the results in the context of a comparison with Alfresco’s common cited peers.

    The problem with Alfresco, Daisy, and most other applications is: complex relationships are stored in a single table of triples which can quickly become overwhelmed with joins. A few apps are now allowing you to extract subsets of triples into a new db table once a sufficient number accumulate, which is better, but still doomed to fail with large complex models. So, projects such as hadoop using hbase as a distributed database, and also now including a REST API, perhaps (one day) with a light workflow language, appear to be the way forward to scale the management of large content stores, and provide an analysis toolchain.

    just my opinions – and my needs are perhaps narrow: scaling to large amounts of metadata and files (TB’s w/ up to 100 GB files) – complex relationships, graphs actually – and the need to mine the content for new relationships, perhaps using a simple visual dataflow language (timers, etc) to orchestrate various batch operations and human workflows

    so -daisy, alfresco, hadoop hbase/RDF, or one of the other RDF + filestore hybrids – all seem interesting in this context

  2. Luis Sanchez says:

    Jeff, thanks for your commitment with us.

    Would you consider to pack those articles and some extra ones in a book ?. Alfresco Cookbook on the press !. I’m pretty sure the guys at Packt Publishing would consider your excellent work.

    Thank you again.

  3. richard says:

    Hi,
    Just want to thank you for these great articles.

    My high level impression is that the sphere of influence for Alfresco is widening very quickly, while the baseline content manager is likely suffering in adoption because of difficulties around learning what i think of as “best practices”.

    For example your first article ( “Implementing custom behaviours” has probably the clearest explanation of the TWO extension directories ( server and client) available. This is a vital piece of information for a new admin/user but is hopelessly buried in the wiki and forums ( across multiple releases of alf).

    In a simlar vein try doing a forum search on “repository.properties” or “custom-repository.properties” and one rapidly balks at the 35 _pages_ of forum topics containing some relevance to the phrase.

    I find myself currently longing for some sort of alfresco admin/developer “best practices” whitepaper that is written so that, for example, one can command line run org.tools.alfresco.Import without a 180 jar temporary class path list for jave -cp xxxx, or know that under linux install the tomcat “endorsed” folder doesn’t unpack on its own ( but it does in an XP install)…

    In short the community of new admins needs someone with clear writing skills such as yourself to shine a light on the endless “gotcha’s” that plague the baseline content manager installs; sure this is where Alfresco and Optaros et.al. can make money in support. That said my sense is the volume of their sphere of influence is growing much faster than a linear support model can handle and things will start to go badly if the core content manager (mistakenly) earns a rep of “difficult to support” simply because of lack of obtainable knowledge about “best practices” in administration and dev environments.

    The Sharriff book is a good primer, but long in the tooth in terms of version… may be it is time for an update, but more likely the real need is for some sort of orthogonal view on how to think about ALF and how to have a personal environment that makes working around it easy / easier.

    Your articles tend to exhibit that orthogonality and for that I am grateful.

    thanks again.
    ..rr

  4. mabayona says:

    Yes, Please a book is most welcome. Something along the lines: “Advanced Alfresco”

    In fact, i think it is almost there with your articles pus some more content:

    – advanced administration (e.g. how to tackle migrations and repository corruption)
    – little bit more of jBPM (may be a complex workflow with sub-preocesses) plus debugging
    – Integration od reporting engines (e.g. pentaho, Jasper Reports, BIRT)
    – Console/Dashlet to manage Advance workflows (e.g. REST based)

    Please a book!!

    Anyway, thanks for your most needed articles.

  5. jpotts says:

    @Richard, This is exactly why I’m writing the articles and tying them together with a single cohesive business case. The Alfresco wiki does a decent job of showing small examples of very specific pieces of functionality, but there’s no bigger story there, and as you point out, it can be frustrating to find what you’re looking for.

    I hope that after reading these articles people have a better understanding of how different pieces of functionality within Alfresco can be pulled together into an actual solution. And, if I can help people that may be familiar with content management but not with Alfresco specifically get a jump start, that’s great too.

  6. jpotts says:

    @mabayona, migrations can be tricky. We’re actually struggling with this internally. We have a North American Alfresco repository and a European Alfresco repository and we’d like to merge the two into a new, centralized repo, but we’ve had all sorts of trouble figuring out how to do that without losing version history. The size of the export ACP files also tends to give the importer trouble (out of memory), although I think we’re closing in on that problem by splitting the export/import into smaller chunks.

    If you are interested in reporting integration, and several clients mention reporting as a requirement, you should check out the Alfresco Forge. I saw a project in there the other day around reporting integration although I have not yet played with it.

    A user-friendly workflow console is a much-needed piece of functionality. Alfresco has heard this feedback before but you should repeat your specific needs to them. The API’s are there and I think something simple could be done that would yield a lot of benefits. Like just showing a list of the outstanding tasks with maybe the task start date and who the task is waiting on would be a good start.

    Thanks for reading.

  7. Hi,

    We have created a solution to generate the Alfresco configuration from models. The goal is to simplify the use of Alfresco. This simplification is, for us, a real need and more particularly with the workflow. We have tried to write your workflow definition (of your tutorial) with our tools. We can have more information here :
    http://www.bluexml.com/wiki/index.php/Alfresco_Advanced_Workflows

    Our solution can use class diagram, use case diagram, security diagram and process diagram.

    I want to thank you for all your work. Your tutorial are very interesting and complete.

    Thanks again.

  8. Le Van says:

    I want to thank you for your works. I get basic Alfresco as a admin or user but as a developer I know nothing. With all your articles I grab an outline of Alfresco programming models.
    Have you got any experience in Alfresco integration. Forum integration, blog integration, portal integration or anything similar…
    Thanks again.

  9. jpotts says:

    @Le Van,

    Thanks for reading. I’m glad you found the articles helpful. My company, Optaros, has done a significant amount of the kind of work you are asking about. For example, check out the demo of Endeca’s EDeN community solution at http://www.bostonconferencing.com/flash/eden/demo.html. We built that using Alfresco, Liferay Portal, and WordPress. The main integration with Alfresco was with Liferay. We used the Alfresco Web Services API in this particular case, but web scripts are also an option.

    Hope that helps,

    Jeff

  10. Javier says:

    Hi.

    I’m new to Alfresco and I need to understand it and customize it in just a couple of weeks. I find your articles really useful. I’m looking forward to an article about custom meta-data extraction.

    Keep up the good work.

  11. Jeff Small says:

    Hi Jeff,

    Love your articles! They are an essential supplement to Alfresco’s poorly documented technology. IMHO, I think Alfresco should hire you to help them document their technology.

    Don’t get me wrong, I think Alfresco is extremely import, core business fabric technology and I love the way it’s architected, I just think the could increase adoption if they had good documentation, which they don’t.

    But, that’s not why I am responding. I’ve read your Advanced Workflow article at least a couple of times and have tried to get your sample code working, but am having problems. I am able to have the workflow appear and I can execute it, but the review tasks don’t ever show up in the Engineering or Marketing group members task list. I am using the Enterprise 2.2 version of Alfresco. Any ideas?

    Best,

    Jeff Small

  12. salaboy says:

    Hi Jeff (jpotts), this is a great article, but i was look for an answer to a question.
    How can i link the properties of my custom model to the task variables to use in the UI?

    I read all your articles but i can not figured out the correct implementation for this.

    Can you give me some pointers?

  13. jpotts says:

    Salaboy,

    Conceptually it may help to think of it like this: There are two content models. One describes the properties on your content objects. The other describes properties of a workflow.

    In your process definition file you will specify task nodes that have the same name as types in your workflow model. Properties of those types can be referenced by code (like JavaScript) that is part of your process definition.

    If you want to take a variable that gets set by your process definition and store it on a property of the content object you must do that yourself using code. It would be something like:

    bpm_package.children[0].properties[“scwf:someField”] = bpm_assignee;

    I hope I’m on the right track here and that this is helpful.

    Jeff

  14. Giampiero says:

    Hi, I just bought your book. I found it very useful to learn and customize alfresco.

    I’m trying to use alfresco with jBPM. I’ve some problems to create web scripts (with a js controller) that allows the change state(node) in a process. I use Labs 3.0

    Have you some simple examples?

  15. jpotts says:

    Giampiero,

    Thanks for reading the book. I’m glad you found it helpful.

    There is a “third-party review” example in the book that uses a web script to signal a workflow node but I’m using the Java API to do that.

    The JavaScript API has only recently begun to deal with workflow so it may still be solidifying.

    If Java is an option for you I’d go that route for doing something like this.

    Jeff

  16. Gael says:

    Hi Jeff,
    I’m reading your book and it is really helpfull.
    Currently I’m trying your Advanced Workflow example but I can’t finish the HelloWorldUI one.
    Instead of having the “Name” field in the workflow options I have a read-only “Owner” field. Any idea where this field can come from ? I have never defined it and I have followed step by step your explanations so I don’t understand.
    Thanks for your help.

    Gael

  17. Gael says:

    I just solved the issue with the help of Alfresco forum users, thanks to Algoworks.
    In fact, in the books there is a config part that is missing. It is necessary to add in web-client-config-custom.xml a task config like:

  18. gary vergara says:

    please jeff I’m tryoing to get started with Alfresco and jBPM. The thing is that I’ve got some trouble when i’m deploying my process definition into Alfresco. there is and error ocurred when it is trying to map the URI. I wrote my own URI in the content model I called it uri:”http://www.refundation.com/content/1.0″ but it says that taht URI can not be found. Thanks in advance for your help

  19. jpotts says:

    That indicates that your custom content model is not being loaded. Double-check that you’ve got a custom content model context file that points to your custom model file.

    Some examples show the custom workflow model file listed alongside other custom models, but you can also use the workflow bootstrap to load your workflow model, like this:

    <bean id=”someco.dictionaryBootstrap” parent=”dictionaryModelBootstrap” depends-on=”dictionaryBootstrap”>
    <property name=”models”>
    <list>
    <value>alfresco/extension/model/scModel.xml</value>
    </list>
    </property>
    </bean>
    <bean id=”someco.workflowBootstrap”
    parent=”workflowBootstrap”>
    <property name=”models”>
    <list>
    <value>alfresco/extension/model/scWorkflowModel.xml</value>
    </list>
    </property>
    </bean>

    So I would try this style and see if it picks up your model.

    Hope that helps,

    Jeff

  20. jpotts says:

    Vin,

    Tell me what you’re trying to do, what you’ve tried so far, and what resources you’ve look at for help.

    Jeff

  21. jpbarba says:

    Hi,
    I wouldd like to implement an advanced workflow based on rules. The problem is that only simple workflows are allowed. I have seen that they could be implemented with ‘Ejecute script’ action, but it is not really what I want. There is no wizard to select people, time, etc, so you must wire these parameters in the script (*.js), and that is no so elegant. I hope you would understand the problem. I think this functionality is very useful but I don’t know why it is not implemented.

    Greetings.

  22. jpotts says:

    Correct, you can launch an advanced workflow from a script using the start-workflow action. As you mentioned, when you take that approach you have to specify all of the workflow parameters and assignees in script.

    It sounds like what you want is to be able to configure a rule to launch a workflow, and as part of the rule configuration, you’d like to provide a user interface to set the workflow parameters. This would require you to create a custom action that might extend the start-workflow action. The difference is that you’ll add a handler that provides a UI for setting your workflow properties. The easy, but potentially inflexible, approach would be if you only allowed a certain set of parameters to be set such as the assignee, due date, etc. If you want to do something fancier, like look at the workflow model and figure out how to build the UI based on the parameters that need to be set as part of the action handler, that’s a more complex customization–you’re essentially going to follow the start workflow dialog logic. But if you’re going to keep the config to a static set of parameters, that shouldn’t be a big deal–it’s just like any other action handler.

    I agree that it would be cool if this were out-of-the-box.

    Jeff

  23. Phemelo says:

    Hi Jeff iam following the instruction from your book, and keep getting this error: Could not import bootstrap model alfresco/extension/model/scModel.xml but i have checked that my file is correct, i tryed the someco.workflowBootstrap bean id still not working

  24. LAx says:

    Grateful for the article. Thank you so much. Wondering how to get the swimlanes working. I set up group called “marketing” and added people. End result is you log in as one of the group members and you get “My Tasks To Do… No tasks found.” Also if you could comment on the screen that the initiator sees… how do you limit the options to “Description:” and “Email:”? Advice is much appreciated!

Comments are closed.