Openbravo meets Groovy

The goal of this post is to show how it is easy to integrate Openbravo ERP and Groovy. Openbravo ERP is the world leader of open source ERPs. It is Java based and it is built on several standards such as Java Servlet, XML, JSON and Hibernate. Groovy is a programming languge belonging to the world of JVM languages. It can be compiled in order to share its byte code with other JVM languages but it can be also used such as a scripting language; in other words you can use it with no compilation steps, just loading a piece of code into a Java class and execute it. If you are a Java developer you can begin using Java code and almost in the 100% of cases your Groovy code will work. Now it’s time to begin, let’s go to use this Openbravo module.

Installing Groovy Adapter module

There are two ways in order to install the Groovy Adapter module: downloading the obx file from the Openbravo Forge site or installing it using the Module Management menu of Openbravo ERP with System administrator role. In the first case you have to point your browser to Groovy Adapter module and download the last version of the module (now at 0.0.3).

forge_1

Once you have downloaded the obx file, you can access to Openbravo with System Administrator role and choose the Module Management menu item.

addmod_3

Select the the Add Module tab and through the Browse File System button load the obx file you had downloaded from the openbravo forge site.
The second way is more easy you need just to search the module on the Add Module tab of Module Management Window, select the Groovy Adapter module and finish the installation process.

addmod_2

Groovy Console

If you have installed the module, after restarting the Openbravo ERP you can access to the ERP with System Administrator role then you can begin to play with Groovy. Choose the Groovy console window and it will show this UI

GroovyConsole_1

How you can see there is the Source text area where you can write and store the Groovy code, on the top right side there is an Excute Groovy button. If you push on it the Groovy code will be executed and the output will be shown on the Output text area. If something goes wrong an error will apeear in the status bar message box, instead if all things work fine the computation time will be shown. The name field is mandatory and must be unique, at the moment we don’t talk about how we can use this field but we’ll do for sure in the next post.

First conclusions and next steps

Ok, I hope this post is enough for the moment, through this reading you are able to load the module and to begin to play with simple Groovy scripts. Pay attention to its usage, this module can be used ONLY with System Administrator role because it may be very dangerous, if you delete something through a script, that data will be losed forever. I’ve in mind to write other posts and to improve the module allowing its usage to cover several Openbravo development patterns (Java Process, callouts and so on …).

Advertisements

About amicidiroberto

Curioso, onesto, polemico ed innamorato della programmazione, del mondo IT, ma soprattutto di mia moglie e delle mie figlie
This entry was posted in Groovy, Openbravo and tagged , , , . Bookmark the permalink.

3 Responses to Openbravo meets Groovy

  1. alostale says:

    Really cool!

    Thanks Roberto

  2. Eduardo says:

    Have you thought about the PLAY framework ??

  3. @alostale, I know who you are, then I’m very proud of your comment, thank you; @Eduardo, as you know Play! is a wonderfull Scala/Java Web Framework, but it has its own structure and its “modus operandi” such as RoR, Grails and so on. Also Openbravo is a web framework, I know sounds strange but it is true it is a nice and powerful MDD Framework and it is no easy to integrate with RoR, Grails or Play!. On the other side it’s feasible that you can integrate Openbravo with other JVM languages such as Groovy (reference language of Grails), Scala (reference language of Play! framework) or JRuby (Java porting of Ruby that is the reference language of RoR framewoek)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s