Posts

Bootstrapping Rules to Existing Folders in Alfresco

Image
Overview There are times when we need to bootstrap one or more rules to a site that already exists.  Perhaps you need to add a rule to sites folder to handle applying a site template to a site, need to add new rules to the Unfiled folder in a Records Management site, or you simply need to add a new rule to an existing site. In this case you can't simply upload an ACP file as the folder already exists.  Rather we just need to bootstrap the rules to the folder in question.  In the example I am going through I am assuming the folder in question already has one or more rules attached to it.  If in your example it doesn't then you will need to create the rule folder (I'll highlight below how you would do that). My example in this case is going to be to add a new rule to the Unfiled folder of the Records Management site.  For those who haven't worked with Records Management (RM) in Alfresco you are only allowed one RM site per Alfresco cluster.  This RM site would need

Test Driven Development with Alfresco - Part 3 Test Doubles

So far in this series I have given an overview of Test Driven Development and briefly described Inversion of Control.  Proper unit testing requires testing a unit in isolation of its dependencies.  The only thing you care about in relation to a unit's dependencies is how the unit interacts with those dependencies not so much what those dependencies do.  Inversion of Control (IoC) allows us to separate the creation of dependencies from the unit itself but we still need to inject something into our units that we can use for each dependencies.  This is where test doubles come in.  A test double takes the place of an actual dependency. Types of Test Doubles There are a lot of different opinions on what test doubles are but the most commonly accepted standard would be from Gerard Meszaros book xUnit Test Patterns: Refactoring Test Code (Addison-Wesley).  These are: Dummy Doesn't do anything and returns null, zero, or the return types nearest equivalent.  Essentially a dummy d

Test Driven Development with Alfresco - Part 2 Inversion of Control

In my last post I briefly described the process of TDD.  In that discussion I stated that a unit test will test in isolation; meaning that you don't want to test a unit's dependencies only the unit itself.  In the real world our code doesn't run in isolation, in the real world our code has dependencies.  I also stated that in a future post I would talk about test doubles, however before I can talk about that we need to discuss how we isolate our class from the world around it.  Of course we can't isolate it completely, a completely isolated class is generally useless, but we can decrease the dependencies.  This dependency on other classes is referred to as coupling and coupling is generally considered bad. An excellent way to reduce coupling is called inversion of control, which is also referred to as dependency injection.  Many people when they think of inversion of control think of frameworks such as Spring, JUICE, or Java EE.  Although these frameworks offer invers

Test Driven Development with Alfresco - Part 1 Introduction to TDD

This is the first in what I hope to be a series of blog posts on Test Driven Development (TDD) with Alfresco.  Before I can jump into the topic I want to make sure we are all on the same page with TDD.  I have heard a lot of definitions of TDD (primarily from interview candidates that haven't actually done TDD) and I know there is a lot of confusion as to what TDD is. Unit Testing Before I dive into TDD I want to talk a little bit about unit testing.  There are different types of testing, unit testing, integration testing, and system testing (there are others but all of them are out of scope of this blog except unit testing anyway :)).  Unit testing is the testing of a unit in isolation.  A unit of code in Java is generally a class.  The idea is that you are only testing the unit not the unit's dependencies (we will explore test doubles in a future post, for now just know there are ways to isolate your unit from its dependencies). With unit testing there are two sets of so

Emailing to Custom Folders Types in Alfresco

I recently had an issue come across my virtual desk that turned out a little more complex than I originally thought.  Before I begin this was done in Alfresco Enterprise 4.1.2 but I would expect it would work with any version above 4.0 (probably anything above 3.2). I have a client which is sending emails directly into Alfresco.  Originally the plan was to send the emails into a specific folder within a site and then move the emails to the correct location.  I was asked if they could just email the documents into the correct location. Didn't seem like an issue to me so I just updated the view for my custom folder types to show the DB ID of the node and viola everything should be kosher.  It didn't work out that way; the first email that was sent in almost immediately returned with an error message like the following: 5.3.0 - Other mail system problem 554-"Email message handler was not found for node type 'eha:myCustomFolderType'." (delivery attempts: 0)