Thursday, December 9, 2010

Alfresco @MVC part 2 - views

As explained in my previous post, the idea behind Alfresco @MVC is to provide spring annotations through an Alfresco webscript. Why a webscript? Well, simply because it avoids changing the web.xml file and to use AMPs (alfresco module packages).

A part from that, all this would allow to use spring views and all the features spring @MVC has to offer, like annotated parameters, return methods types and so on. I do not have to preach for spring @MVC but I like using it on my projects and know I can use it with Alfresco ... cool.

Many of you know about the framework I developed for Alfresco (Jibe) but what Jibe does is imitating Spring in a lot of features and one thing that is helpful is having conditions to evaluate a role or group for instance. Meaning that a specific view is shown to that group of people.

What about JSPs? At the end that is the solution I appreciate as it is standard and many developers know it, opposed to learning a new framework. Using a tag library is the solution. I have many tag libraries defining different needs like roles, groups, permissions and it is easily extendable in a standard way.

One more thing to note is the usage of JSON. Again a simple spring annotation @ResponseBody allows to return a JSON representation of your model.

Soon I will show some examples but for now Alfresco @MVC has some previews and a starting documentation, what is good is that there is no need for a lot of documentation as Spring has it:)

More info can be found here.

Cheers.

Thursday, November 18, 2010

Alfresco @MVC

I was never happy with webscripts and I always preferred using Java to Javascript server-side programming ... but that is just a personal opinion and preferences.

Alfresco 3.4 came with Springframework 3, I have to say that Alfresco has been really slow in adapting newer versions of different technologies and probably they will remain, but this move is a good one and I was waiting for that for a long time. A lot of people are using Springframewok and especially the @MVC annotations and now we can do the same with Alfresco, of course not out of the box.

To achieve that I wrote a webscript which enables the usage of Spring @MVC inside of any Alfresco modules (AMP). Sure, I must admit that Alfresco Share is using it but I am a partisan of using Alfresco as a platform and not only as a repository, therefore I prefer writing java code integrated with the Alfresco Java API. This way of working opens huge possibilities and you can be much faster in developing new controllers than new webscripts. This approach is a standalone webscript design and let Spring @MVC do the rest for you.

I did not yet published the code but will be done soon at Google code. However here is a preview of what you can do ...

Firstly you need to initialize the webscript as you would do with any other webscript

<bean id="webscript.com.gradecak.spring.dispatch.post" class="com.gradecak.spring.webscript.DispatcherWebScript" parent="webscript" scope="prototype">

<property name="contextConfigLocation" value="/WEB-INF/classes/alfresco/module/com.gradecak.spring/context/dispatcher/servlet-context.xml">

</property>

</bean>


than in the servlet-context.xml you simply enable Spring annotations and use all the Spring config you want ...

...
<context:annotation-config />

<context:component-scan base-package="com.gradecak.spring.controller" />

...


and than in the controller you are free to use Alfresco's Java API or any library that you want

@Controller
@RequestMapping("/user/*")
public class UserController {

@RequestMapping(value = "get", method = RequestMethod.GET)

public String getUser(@RequestParam String userId) {
....

}

}


Sure, some minor problems appear if you want to use Freemarker as the view but that is just a matter of having Alfresco include a newer Freemarker JAR file and if you want to use a JSON view, Spring is coming with Jackson, but for a higher integration we need a later version of Spring than 3.0.0 provided by Alfresco ... so let's the show go on ;)

Wednesday, September 1, 2010

Content repositories and their user interface

After a long time I decided to write my thoughts about enterprise content management systems (CMS) like Alfresco and the user interface that is distributed with it.

In an effort to simplify their IT architectures and optimize systems company-wide, many businesses are standardizing on a single content- management platform for document management, Web-content management, imaging and intranet publishing. To do so there are plenty of solutions and technologies on the market allowing users to save, update and find their content but many of them lack of a suitable user interface nor a fluid accessibility.

Traditional solutions offer a strong central content repository and an enterprise database without satisfying user's actual needs like effectiveness or simple usability. On the other hand, the user interface is rarely given such attention and I do think there is a huge gap between repositories and the way they interact with the user.

As I am in that business I might sound subjective and probably that I am, but for a couple of years my company (Jibe Source also used to be named iCodix) is targeting especially that market.