Pages

Monday, January 21, 2019

Groovy Series 2: Privileged Methods

“With great power comes great responsibility” is what Oracle wants to remind us by assigning certain methods in Groovy classes as privileged methods. Privileged methods restrict executing these methods in groovy rules unless user has administrator privileges.
Privileged Methods:
  • delete: Delete method in the Member Class. This method deletes the member and all its descendants from Planning outline
  • saveMember: saveMember method in the Dimension Class. This method returns the member that was created based on the properties map defined for the member
  • execute: execute method in DataMap Class. This method executes the already defined data map in the application
So what happens if a user with non admin privileges attempt to execute any groovy rule using any of these three functions? Here’s an example where a non admin user tries to execute a rule with data map and receives following error.

image

It’s obvious that these three functionalities should be controlled and handled with responsibility as an administrator, but some use cases where this functionality can be used to offer administrators a convenient way to manage things as well better user experience
  • Example 1: Consider a multi cube application and administrator is required to execute rules on BSO plan type, execute the data map to move data from BSO to ASO and then run a business rule on ASO. In a regular non-groovy environment would require an admin to juggle between multiple screens to perform all tasks, whereas with groovy being available, all the steps can be clubbed together into a ruleset and all admin needs to do is, trigger it from the rules card.
  • Example 2: Consider a scenario to implement a workflow to add a new project or a new asset. Users add their projects under “New Projects” parent and administrator is expected to approve the project and move it to new parent based on project type. Above that administrator is also expected to rename the project to follow the member name and alias name naming convention. Groovy can handle it all with ease and that too with click of a button. We need to define the member properties and use the saveMember method to perform the required functionality.
  • Example 3: Consider project dimension’s metadata gets refreshed daily and there are three attributes tagged to each level zero project member. Since business logic is driven by these attributes, admin needs to ensure all members of project dimension have correct attributes associated with them. Either admin evaluates it via smart view admin plug-in or a nice webform can be created which highlights which all members are missing attributes and set their properties.

Cheers !!!

Saturday, January 12, 2019

Groovy Series 1: Groovy + PBCS = New possibilities !!!

Groovy is the buzz word in Oracle EPM world and why shouldn’t it be. With the introduction of Groovy on EPBCS and PBCS+1 cloud options, it has made things so easy that everything seems to refreshed with Oracle EPM. On-premise version can also be enabled for Groovy, but it does not offer the groovy classes available on cloud.

EPBCS is the Enterprise Planning and Budgeting Cloud Service while PBCS + 1 is the base PBCS service with at least one Oracle module enabled. This module could be either one of Financials, Project Financials, Workforce or Capex.  Having either one of these opens up the system to have groovy capabilities.

Having capabilities to code in groovy programming language essentially makes PBCS a mini platform to play around with PBCS objects and anything with the data grid. Long back in the days of on-premise planning, we had the option to provide form validations using javascript which were replaced with data grid validation rules. Now imagine, having a similar javascript kind of capability with 10 times the power and ability to access all planning objects and data to play around. This is how groovy capabilities can be summarised.

What is Groovy?

18.11.1.1
        18.11.1.2
Groovy is a java syntax compatible object oriented language
  • Because of its optionally typed nature, it allows writing less code as compared to Java or any other traditional programming language
  • Runs on Java Platform (JVM)
  • Available with EPBCS, PBCS+, On-Prem Planning to give additional programming capabilities to Planning product
  • Can be accessed in Calc Manager under the “Edit Script” option on cloud environments
Opening up the system with options to code in a programming language as strong as Groovy,  makes life much easier and system robust. It gives numerous opportunities to think about any problem from all different perspectives or rather easy perspective !!!
If you have either EPBCS license or PBCS+1 license, the Groovy is accessible from Calc Manager. In Calc Manager, navigate to edit script mode, on right hand side, you have another drop down to choose script type.

18.11.1.3

Groovy is not there to replace Calc scripts or business rules, but complements each other. For example, using a IF within Calc scripts requires a member block within a FIX. What if we can write FIX based on certain conditions or want to execute a calc only when it fulfills certain condition? This is where groovy helps to generate the calc script on conditional basis. This not only reduces the length of the code, also the processing time.

Understanding Groovy structure:
Groovy follows the object oriented approach of programming and all methods and attributes are linked to an object. All objects are grouped under classes and creating an object of certain type gives access to all attributes and methods for that object.
Unlike Java, there is no main function to locate the start of a program. Scripting nature of groovy enables writing programs as any regular script, creating an object just by providing a name of the class.

Usage of Groovy with Oracle EPM cloud can be accessed from below URLs:
EPBCS Groovy Documentation: https://docs.oracle.com/cloud/latest/epm-common/GROOV/
Groovy Script Examples: https://docs.oracle.com/cloud/latest/epm-common/GROOV/groovy-examples.html

Apart from methods and classes available in the documentation, many other classes, objects and methods available in groovy can be used in EPM.
The root object of groovy scripts in PBCS is EPMScript. It is the base class for all EPM groovy scripts. Apart from this, the most important object is ‘Operation’. Operation represents the operation carried out on application. it is essentially used with operations performed on grid and thus the script can be triggered on any operation:
  • before load form
  • after load form
  • before save form
  • after save form
These are options similar to what we have for execution of business rules, but with groovy the options allow to run groovy rule before or after the form load or save. One common example is of validation check which can be run before form save to allow valid data goes into database and stop data save if its not. 

None the less, groovy opens up new avenues to control and configure the business rules and User Interface functionality. I will continue to add more examples of how groovy is evolving the PBCS into an overall new platform.