Showing posts with label Groovy. Show all posts
Showing posts with label Groovy. Show all posts

Monday, April 24, 2017

JDev/ADF sample - ADF BC Groovy Expression Security Policy Configuration

  • ADF BC Groovy Expression Security Policy Configuration. Today I'm going to explain how to configure Groovy expression security policy. This could be helpful, if you dont want to change trustMode property to trusted everywhere across the app, but looking for single configuration point.
    Download - GroovyPermissionApp.zip

Tuesday, February 7, 2017

JDev/ADF sample - Setting Invalid Fields for the UI in ADF BC Groovy

  • Setting Invalid Fields for the UI in ADF BC Groovy. What if you have entity level validation rule and want to attach validation error message to specific field. By default this is not possible - all entity level validation error messages are displayed in the popup and are not attached to the fields (differently than attribute level validation rule messages).
    Download - GroovyADFApp.zip

Friday, February 3, 2017

JDev/ADF sample - ADF 12c New Groovy API to Work with View Object Methods

  • ADF 12c New Groovy API to Work with View Object Methods. I have interesting topic to share - new Groovy API in ADF to work with View Object, apply View Criteria, execute it. I have discovered it while experimenting with new features and functionality in ADF 12c. Starting from ADF 12.2.1, we have an option to code Groovy in separate file with extension .bcs - ADF BC Groovy Improvements in ADF 12.2.1. This makes sense especially with this new Groovy API - it is more convenient to code/maintain more complex Groovy logic in separate file. As Oracle docs say - Groovy runs faster when it is coded in separate .bcs file, probably there is no need to parse XML to extract and execute expression.
    Download - GroovyADFApp.zip

Sunday, April 17, 2016

JDev/ADF sample - ADF 12c Custom Property Groovy and AllowUntrustedScriptAccess Annotation

  • ADF 12c Custom Property Groovy and AllowUntrustedScriptAccess Annotation. To execute Groovy expression in ADF 12c (to call Java method from Groovy), you must specify trusted mode. Read more about it in my previous post - ADF BC 12c New Feature - Entity-Level Triggers. Setting mode to trusted, works in most of the cases. It doesn't work if we want to execute Groovy expression (calling Java method in ViewRow or Entity class) for custom property. In a case of custom property and Groovy calling custom method, we need to annotate Java class with AllowUntrustedScriptAccess. This makes a trick and Groovy expression can call custom method.
    Download - ADF12cGroovyCustomPropertyApp.zip

Monday, December 28, 2015

JDev/ADF sample - ADF BC Groovy Improvements in ADF 12.2.1

  • ADF BC Groovy Improvements in ADF 12.2.1. Groovy scripting is improved in ADF 12.2.1. There are no inline Groovy expressions anymore. Expressions are saved in separate Groovy language file, external codesource. Each EO/VO will be assigned with separate file to keep Groovy expressions. This improves Groovy script maintenance (easier to check all Groovy expressions from EO/VO located in one file), also it improves runtime performance (as JDeveloper ADF code audit rule suggests).
    Download - ADFGroovyApp.zip

Friday, March 1, 2013

JDev/ADF sample - Default Dynamic Value for ADF Query Search Field

  • Default Dynamic Value for ADF Query Search Field. What if you face requirement, which tells to give default value for ADF query field in the search box. This is not just for some static value, but default search parameter must come from another LOV view object. As example in this post, I will implement use case where first value from LOV view object will be set as default value for the search field.
    Download - ADFQueryDefaultValueApp.zip

Thursday, February 7, 2013

JDev/ADF sample - ADF BC Groovy with Java Imports

  • ADF BC Groovy with Java Imports. ADF BC Groovy expressions support is really great and often saves a lot of time in development of complex functionalities. It comes very handy when retrieving referenced data or calling custom ADF BC methods. There is one more hidden gem offered by ADF BC Groovy - option to import Java packages directly into Groovy and use Java functionality.
    Download - AdvancedGroovyApp.zip

Sunday, August 26, 2012

JDev/ADF sample - New Record Master-Detail Validation and ADF BC Groovy Use Case

  • New Record Master-Detail Validation and ADF BC Groovy Use Case. I will explain today implementation for Master-Detail validation rule - new Master record insert is not allowed, if there are no Detail records added.  ADF is powerful framework and there are different ways to implement same requirement - complexity is to choose the most suitable and optimal approach. Such validation rule can be implemented in Java, by overriding doDML() method on Entity Implementation class. While this works, also same rule can be implemented in Groovy script and declared as ADF BC business rule on Entity. Obviously its better to declare validation in standard way as Entity business rule, instead of coding it in Java logic (at least for current requirement) - it will make code maintenance and changes simpler.
    Download - MasterDetailGroovyValidationApp.zip

Tuesday, August 7, 2012

JDev/ADF sample - Difference Between ADF BC Groovy Old Value and Posted Attribute

  • Difference Between ADF BC Groovy Old Value and Posted Attribute. To keep it short - ADF BC Groovy keyword "oldValue" and ADF BC API method getPostedAttribute(index) are not the same thing. I spoke with ADF developer today, who have spent around 5 days debugging and hitting validation bug related to incorrect usage of "oldValue" by Groovy. Both approached - "oldValue" and getPostedAttribute(index) are valid for its own use cases. But you should clearly understand the difference, otherwise may hit some painful bugs in validation rules.
    Download - OldNewValueValidationApp.zip

Thursday, June 10, 2010

JDev/ADF sample - Groovy String Operations in Oracle ADF 11g

  • Groovy String Operations in Oracle ADF 11g. Groovy Script support by Oracle ADF 11g gives us good flexibility to operate attribute values and implement business logic. Often you need to parse String type attribute values - it can be easily done using Groovy script directly in ADF BC.
    Download - GroovyStringMethods.zip

Monday, January 18, 2010

JDev/ADF sample - Storing/Accessing Objects in ADF BC UserData Map

  • Storing/Accessing Objects in ADF BC UserData Map. While implementing one of the requirements for View Criteria, I faced an issue when there was a request to filter View Criteria Item based on user language. Well, its trivial when you want to filter choice list defined for attribute - just specify bind variable value in View Accessor. Its a bit more tricky for View Criteria Item choice list, mainly because View Criteria can't access value from VO row. This means, if we want to filter View Criteria Item choice list, we need to use Groovy language script in order to retrieve value for View Accessor bind variable. In my case it was user language. What I did - I have read Example #154 from Steve Muench blog - Not Yet Documented ADF Sample Applications, and decided to store user language in UserData map, in order to access it from View Accessor Groovy.
    Download - UserDataGroovy.zip

Wednesday, November 4, 2009

JDev/ADF sample - Groovy Validation Hint in Oracle ADF 11g

  • Groovy Validation Hint in Oracle ADF 11g. There is one very powerful option for Groovy validation in Oracle ADF 11g. This option is somehow hidden from developers and quite often not used. I decided to blog about it, in order to put some light on it. This option is about how to get old and new values for edited attribute. Groovy provides two reserved keywords - oldValue and newValue, you can use those keywords while writing Groovy validation script.
    Download - GroovyValidation.zip

Sunday, December 7, 2008

JDev/ADF sample - Groovy - Multiple LOV's per Attribute in JDeveloper 11g

  • Multiple LOV's per Attribute in JDeveloper 11g. I was blogging previously about multiple LOV's per attribute functionality. I was using RowImpl class for View object in order to calculate value for LOV switcher attribute. However, this approach is not perfect, since it requires to create Java implementation class with getter method. Even more, getter method in RowImpl class is not invoked, when LOV component is triggered in ADF Query Criteria component. I have described this cool component in my previous post - ADF Query Component and View Criteria Functionality with Custom Query Listener in 11g. So, as you probably already understood, I will show better approach for LOV switcher attribute implementation with Groovy language expression, defined as a Value for transient LOV switcher attribute.
    Download - ADFSearchApp2.zip

Spanish Summary:

Titulo: Uso del lenguaje Groovy para la creación de Lista de Valores en JDeveloper 11g.

Resumen: Andrejus muestra como crear listas de valores en JDeveloper 11g haciendo uso del lenguaje Groovy.