Share

Have you ever wondered what Groovy is and what makes it so crucial to enhancing the depth and breadth of Oracle EPM Cloud capabilities?  This blog explains what Groovy is, why it matters, and what problems it can solve for your business.

So what is Groovy?      

Let’s do the introductions first. Groovy - or Apache Groovy - is an object-oriented programming language for the Java platform with features similar to those of Python, Ruby, and Smalltalk. It is aimed at improving developer productivity thanks to a concise, familiar and easy to learn syntax. 

Version 1.0 was originally released in 2007 when Java was a dominant programming language with a wealth of useful libraries. Nevertheless, some perceived it to be evolving too slowly and to have shortcomings for scripting, rapid prototyping, and when trying to write minimalistic code.

Other languages seemed to be breaking new ground faster than Java but used a less familiar syntax to Java developers while overcoming Java’s shortcomings. Groovy was created as a complementary language to Java - its dynamic Doppelgänger. It looks and feels like Java but focuses on extensibility and rapid innovation.

 You can think of Groovy as Java on steroids; dozens of lines of code in Java can be shortened to a few lines of code in Groovy with negligible or no loss of readability, maintainability, or efficiency. Groovy is a Java enhancer, providing greater flexibility and even introducing special features to applications.

Groovy features

There are several reasons why Groovy has gained popularity over the years:

  • Support for static and dynamic typing. Java is a statically typed language, and type checking is done at the compiling stage, not during execution, as with dynamic typing syntaxes, where the check is performed during execution. Groovy enables developers to include this kind of typing within Java.
  • Lean, brief and direct syntax. Developers can develop projects faster and easier since not all the elements other coding languages use are required.
  • Short learning curve. Groovy is a relatively simple language like Python or Ruby and, for developers with a Java background and fair coding experience, easy to learn.
  • Support for unit testing. Being a testing-oriented development language, it is a syntax that provides support for running tests in integrated development environments (IDEs), Ant or Maven, which are all application programming tools in Java.
  • Native support for regular expressions. The Groovy syntax for creating regular expressions is quite simple. The programming language has three operators for regular expressions:
    • The operator regex =~
    • The operator match ==~
    • the pattern operator ~String
  • Native syntax for lists and associative arrays. In programming, arrays are usually assigned to variables, which are often associated with data. Developers sometimes associate that information through various elements of the array through a common thread called index. That way of structuring information with programming is called an associative array.
  • Native support for markup languages like XML and HTML.
  • Support for domain-specific languages. A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language such as Java, which is broadly applicable across domains.

Groovy has been adopted by many companies, including Oracle, for its cloud environment security and its advanced features. 

Groovy in the Oracle EPM Cloud

The relationship between Groovy and Oracle EPM Cloud began in June 2017, when Groovy was supported, in Oracle EPM Planning Cloud (formerly known as Oracle Enterprise Planning and Budgeting Cloud Service or EPBCS). Groovy was integrated into Oracle EPM Calculation Manager, which handles the creation, validation, deployment, and launch of calculations that solve business problems.

Groovy comes with the Enterprise EPM Cloud licensing (not Standard). Legacy licensing would have come with Planning Cloud on the PBCS +1 licensing or higher, most notably in EPBCS.

Groovy is written through the Calculation Manager Business Rules module without any additional graphic interface. If you have an EPBCS or PBCS+1 module, you will see the Groovy rules option in the Calculation Manager. You create Groovy rules in the Calculation Manager, and you can execute them from any place in the application that a business rule can be executed. Complex Groovy rules are used to tackle business requirements that available Calculation Manager script-based business rules cannot resolve. 

Is the EPM Cloud better with Groovy?

Here are some examples of limitations of the existing Calculation Manager business rules:

  • They're unable to dynamically generate scripts at runtime based on contexts other than user-entered run time prompts. For example, if you change a few cells in a form, a calculation script business rule cannot identify what data has been changed and then calculate based only on that data.
  • They're unable to dynamically specify the parent for a current member (for example, by project type or region).
  • You can't validate user-entered data or runtime prompt values before the calculation is run.
  • You can't combine multiple EPM functions into a single rule or rule set (for example, automatically running a Smart Push operation after calculating).
  • They may experience performance issues due to their static nature (for example, requiring a large portion of the database calculation even when only a few cells have been updated).
  • Although limited context-specific calculations are available in forms by right-clicking and calculating only a specific row, this option is less useful for large forms or where you update cells in multiple rows.
  • For ASO applications, they provide only simple calculations.

With support for Groovy rules in Oracle EPM Enterprise Cloud, you can address all of these issues. Groovy rules enable you to:

  • Dynamically generate calculation scripts at runtime based on contexts defined in the Groovy script.
  • Add validation checks for run time prompt values before running calculations, add validation checks before submitting data, and add error handling.
  • Launch multiple EPM functions with a single rule (for example, run a calculation and then run a Smart Push operation to move calculated data to a reporting cube)
  • Improve performance by creating focused calculations (for example, dynamically creating custom targeted calculation scripts based on what data was modified in the current form)
  • Perform complex procedural calculations in memory before submitting the results to the database

Furthermore, you can use Groovy rules to prevent users from saving data on forms if the value is above a predefined threshold. You can also use Groovy for business logic that can be isolated to the changes in a webform.  Finally, you can use Groovy combined with Data Maps and Smart Push to provide a real-time consolidated report.

Types of Groovy rules

Oracle supports two types of Groovy rules:

  • Rules that can dynamically generate calculation scripts at runtime based on contexts such as runtime prompts, the POV, the current grid, and so on. The generated calculation scripts are then executed against Essbase cubes. An example of this type of rule calculates expenses for projects only for the project’s duration, based on start and end dates. Another example is the trend-based calculation in Financial Consolidation and Close Cloud, which restricts the calculation to the accounts available in the current form. This approach allows you to use the same rule for calculating various forms in revenue, expense, balance sheet, and cash flow, optimising the rule’s calculation and reuse.
  • Pure Groovy rules that don't generate calculation scripts. Examples of this type are rules that perform data validations and cancel the operation if the data entered violates company policies, rules that change the background colours of cells based on numeric thresholds, or rules that modify dimensions and members in the outline.

Should we bother with Groovy?

Groovy is, of course, not required to run Oracle EPM Cloud. However, for customers with particular business requirements that are unable to be met by the standard application constructs, Groovy may be vital.

We should also pay attention to Oracle’s point of view is - and they are saying that Groovy is strategic and can be used to extend Cloud applications. When in the Cloud, security is paramount, and that’s the reason why you can’t do all the same things with scripting that you can do on-premises. And that’s where Groovy is extremely useful since it enables you to bypass some of these limitations in a safe and non-hackable way.    

Want to learn more about Groovy in EPM Cloud?

Here are some great free resources from Oracle to get you started:

Become a member

Newsletter

Receive our newsletter to stay on top of the latest posts.