Translate

Sunday, September 6, 2015

Using Groovy elements in WCS

One of the new features which were introduced with Oracle WebCenter Sites version 11.1.1.8.0 was use of Groovy within WCS. You can now write code in Groovy elements to perform business logic separately and hence, with proper plan and design, one can develop a site with MVC pattern.

Although there is not much documentation or explanation on how to use it. There are few interesting articles by Oracle expert team which should be helpful:

1. Why to use groovy with WCS?
This article explains not only how WCS product uses groovy element but possible use of it to design MVC pattern within WCS sites.

2. Wrapper-CSElement example using Groovy
Although it's not a simple example as one would like but you get the point once you go through it.

3. Using RUNTAG api
This is far most best example explaining use of groovy to render sites tags. Best part of using groovy is that it can invoke both JSP and XML tags.

4. An useful use case
Setting http-status codes, content-type at runtime and redirect implementation; which may be desirable for many clients.

5. Get Translated asset
Describes the method to get a translation of an asset using Groovy.

6. Groovy CSELement Dispatcher
A good example on how to leverage groovy to generate output in different formats by setting content-type at runtime. This use case is very simple yet very useful and powerful considering that if your clients wants to have WCS site based content output in different formats for e.g. generating different web feed formats (like atom or rss), json object to be consumed by other sites or internally, XML/HTML output of certain webpage, etc.

All of the above examples mentioned are really good in terms of providing knowledge and implementation of groovy element.

Groovy was already used before it was officially being introduced to Sites with GSF framework. Currently, WCS product itself doesn't use many groovy elements but a few. It seems after the introduction of groovy, in future, more of development should occur within product (or sample sites) which shall make full use of groovy language to develop a site or product itself. Henceforth, it is better for any Sites developer to learn groovy and be prepared to use it.

----------------------------------------------------
SUGGESTIONS/COMMENTS ARE INVITED
----------------------------------------------------