Trifork Blog

Category ‘Magnolia’

Persist beans to the Magnolia repository with the OM module

July 23rd, 2013 by
(http://blog.trifork.com/2013/07/23/persist-beans-to-the-magnolia-repository-with-the-om-module/)

Magnolia

Every once in a while when developing some integration with Magnolia CMS, you might want to save the contents of a bean to a Magnolia node. The other way around, from content node to a bean, has never been an issue due to the Content2Bean utilities that Magnolia provides. You might have already stumbled upon the Bean2ContentProcessor and the Bean2ContentTransformer interfaces in the Magnolia API, or have been looking for Bean2Content or Bean2Node, but an implementation has yet to be seen. So when we want to save object classes to the repository, we are usually stuck creating content nodes, and adding the node data manually. Over and over again.

While working on a new Magnolia tool, the need to persist object structures to the repository arose once again. This time 'round I finally decided that it was time for a simple, yet effective, Magnolia Object Mapping module. Interested??

Download OM Module

Read the rest of this entry »

Orange11 presents at Magnolia Conference

August 16th, 2012 by
(http://blog.trifork.com/2012/08/16/orange11-presents-at-magnolia-conference/)

Orange11 is proud to present at the Magnolia Conference in Basel on September 4 and 5, 2012. This conference for web developers, marketing / business users and CMS editors / authors is all about the Magnolia CMS. With over 20 sessions on different aspects of real-life usages of Magnolia CMS this conference is the go-to event if you're interested in using Magnolia or are already using it.

Orange11's Erik Alphenaar will present a session on using Magnolia Modules to integrate custom (Spring-based) software into a Magnolia website.
Check out the details of his talk: Bridging the Gap; Magnolia Modules and Spring Configured Custom Software.

If you are interested in going:
Register now! and we hope to see you there!

Resolve your NodeData automatically using a @NodeData parameter annotation in your Blossom powered Spring MVC controllers

June 19th, 2012 by
(http://blog.trifork.com/2012/06/19/nodedata-blossom-spring-mvc/)

Resolve all content nodeData values in the signature of your controller method

When we were working on a recent Magnolia project here at Orange11, I introduced Magnolia and Blossom to a colleague of mine. Since Blossom enables the use of  Spring MVC, this enables developers to work on Magnolia integration features, without having to know the entire CMS by heart.

One of the first things my colleague did, was addressing content node properties directly in the signature of the controller method.
When you are used to Spring MVC, you are also used to the fact that any relevant parameters in your method signature will automatically be resolved. But unfortunately I had to inform him that we only get the parameter types that come in through the BlossomWebArgumentResolver out-of-the-box.
Here you can read a bit more about Blossom's argument resolver, as described by Tobias Mattsson, the founder and lead developer of Blossom.

As the words left my mouth, we both realized that this would be a nice add-on for use in Blossom MVC controllers.

So this is why we introduced the method parameter annotation: @NodeData.
The annotation is quite useful in combination with Blossom. The argument resolver will try and resolve all annotated parameters from the current content node out of the aggregationState.

An example of the use of this annotation:

    @RequestMapping("/myParagraph")
    public String getStuffForMyBlossomParagraph(
        ModelMap modelMap,
        @NodeData String eventCode,
        @NodeData(name="startDate") Date date,
        @NodeData(defaultValue="true") boolean active) {
        ....

The method signature above would lead in the resolving of the following parameter values out of the current content node:

  • String nodeData with name eventCode
  • Date nodeData with name startDate
  • boolean nodeData with name active, that defaults to true when no value is found

This is a very standard thing to do with Spring, but the results can be really powerful and makes the controller in combination with your content very easy to use. Also the mocking of your controller will become that much easier, because you won't need to extract any data from a Content node anymore, but just pass the value directly as a method parameter.

A full tutorial and zip with sourcecode after the jump.
Read the rest of this entry »

Spring context configuration in Magnolia

May 31st, 2012 by
(http://blog.trifork.com/2012/05/31/spring-context-configuration-in-magnolia/)

Here at Orange11 we have quite a Magnolia portfolio. We do not only install, configure and host the actual CMS itself alone, we also design and implement pixel-perfect designs, and last but certainly not least: integrate new or existing business processes from external resources.

When we create any piece of software for such an integration, that software is 90% of the time a Spring configured application. For example, when  we need to load content from an external database into the Data module, or when we want to create a Blossom dialog that renders a select box based on results from an external web service. We create these services in a separate abstraction layer, like most of us would, so that we end up with a nice separate, reusable and testable module. The services we create are usually configured in a number of Spring contexts.

Loading your contexts in the Magnolia admin central.

Are you building your own Magnolia modules instead of Magnolia (1)? Are you letting your modules configure your Magnolia instance (2)?
If the answer to both of these questions is yes, and you do a fair bit of Spring in your modules, you might want to read on!

(1) Grégory Josephs': Don’t build Magnolia: build your projects.
(2) Grégory Josephs': Don’t configure Magnolia: let your projects configure it.

Read the rest of this entry »