Thursday, October 10, 2013

That's Groovy!

I think a little known feature of ADF is the ability to use Groovy expressions in the ADF Business Components layer. You can use Groovy expressions for the following:
• Values for view and entity objects attributes
• Validation rules on entity object attributes
• Expressions for error messages
• Values for view object bind variables
• View object transient attribute validation

If you haven't already I highly recommend reading the Introduction to Groovy Support in JDeveloper
and Oracle ADF 11g whitepaper at the following link: http://www.oracle.com/technetwork/developer-tools/jdev/introduction-to-groovy-128837.pdf

Since the Groovy expressions are run inside of the JVM you can make use of any Java libraries and classes that exist there. Groovy expressions can be simple or complex and there are also a variety of expressions built into ADF such as adf.currentDate and adf.context.securityContext.userName. These would allow you to set the date and user on attributes at the VO level when not using history columns.

Useful JDeveloper Keyboard Shortcuts

Just a few useful JDeveloper 11g keyboard shortcuts


FUNCTION SHORTCUT
Go To File Ctrl + Alt + Minus
Select File In Navigator Alt + Home
Code Template Ctrl + Enter
Go To Declaration Ctrl + Mouse Click
Go To Java Class Ctrl + Minus
Application navigator start typing to search
Quick Class Outline Ctrl + Shift + `
Open Recent Files Ctrl + Plus
Reformat Code Ctrl + Alt + L
Go To Line Number In Source Ctrl + G
Go To Last Edit Location Ctrl + Shift + Backspace
Go To Open Editors Ctrl + Tab

oracle.jbo.expr.JIEvalException: JBO-25077: Name MyLOVType not found in the given object - Error When Trying To Implement LOV Attribute

If you have ever received the oracle.jbo.expr.JIEvalException: JBO-25077: Name MyLOVType not found in the given object error when trying to implement a LOV for an attribute you mots likely spent more time than you should have trying to figure out what the issue was. According to the error message everything is configured as it should be and it is even telling you that it can't find the MyLOVType in the given object which is the LOV type that you are looking for. Upon closer examination of the view accessor used to generate the LOV you will find that you didn't enclose the string value in quotes for the bind parameter value. MyLOVType should be "MyLOVType" just as the value for p_active is "Y".

Wednesday, July 17, 2013

ADF Architecture TV

A very exciting initiative was just announced on the ADF Enterprise Methodology Group (
http://groups.google.com/group/adf-methodology). Essentially, Oracle is making their ADF Architecture Training course available free of charge in approximately 1/2 hour installments on YouTube.

When developing with a new technology, one of the challenges for technical staff is to both learn the features of the technology and how to implement them, and also consider the broader concepts of design, engineering and architecture. Many an IT project has come undone because IT staff have been focused on the nitty gritty details of writing software, rather than looking at the "bigger picture" of how it will all go together.
Oracle's "ADF Architecture TV" plans to address this issue by focusing on architectural issues and developer guidelines for writing ADF software solutions. The goal, to give ADF developers an understanding of the decisions you need to build a successful ADF application, potential architectural blueprints to choose from when putting the ADF application together, and potential best practices to take back to your development team.

ADF Architecture TV can be found on YouTube at the following link: https://www.youtube.com/user/adfarchtv

Tuesday, May 14, 2013

JDeveloper Configuration Essentials

Before starting your development work in JDeveloper I highly recommend taking some time to familiarize yourself with the various preferences that are available to configure in JDeveloper (Tools --> Preferences). Below are some of the essential preferences that I configure after first installing JDeveloper.

1. Tools --> Preferences --> Business Components --> Packages
    Tools --> Preferences --> Business Components --> Object Naming
When creating ADF Business Components I highly recommend setting your default object suffixes and package names in the JDeveloper preferences as is detailed below. This will ensure that when the wizard auto generates these business components they are named correctly and are created in the correct package locations. Depending on the approach you decide to take you can also setup your default base classes and view object tuning parameters. 



2. Tools --> Preferences --> Code Editor --> Line Gutter --> Show Line Numbers
Not much to say other than I like seeing the line numbers in my Java code.


3. Tools --> Preferences --> Code Editor --> Code Style
Your team should decide on which Java coding style you want to follow. This could be a predefined code style or one that you create yourself, just pick one and stick with it. I prefer the Java Code Conventions code style with a few minor modifications. Once you have your code style set you can easily reformat your code by pressing Ctrl + Alt + L in the source. In addition you may want to set the option to reformat your code when pasting which is on the main Code Editor setting.



4. Tools --> Preferences --> Compiler
 When doing a rebuild of your project it's always best to clean out what is currently there to help reduce the risk of any caching issues that you might run into.



5. Tools --> Preferences --> File Types
After coming to the realization that you have wasted a better part of your day waiting for files to open in design mode you will want to change the default editor for the majority of the file types that you use on a consistent basis. I prefer to change the default editor from 'Design' to 'Source' as the files will open up much quicker.


6. Tools --> Preferences --> Shortcut Keys
While I have yet to make any modifications to this section I really recommend taking some time to familiarize yourself with the shortcut keys available in the IDE as this will only make you a much more efficient developer.


7. Tools --> Preferences --> Environment
In order to help alleviate any issues you might run into when switching between a Windows and UNIX type environment I recommend setting your 'Line Terminator' to 'Line Feed (Unix/Mac)' and the default Encoding to UTF-8.






8. Tools --> Preferences --> Code Editor --> Save Actions
JDeveloper allows you to set some predefined actions that will occur when you save a file. I like to use Organize Imports, Trim Trailing Whitespace, and Reformat.


9. Tools --> Preferences --> CSS Editor
I like to change the default CSS level to CSS Level 3






Friday, May 10, 2013

oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.adf.share.security.ADFSecurityAuthenticationException, msg=EXC_NO_AUTHENTICATION_SERVICE

After enabling ADF Security in my ADF 11.1.1.6 application I ran across a strange occurrence where I was no longer able to run the application module tester. The JAAS prompt would successfully display but no matter what credentials I used I always received an ADFSecurityAuthenticationException.




One workaround for this issue is to temporarily disable ADFSecurity by going into the adf-config.xml file for your application and setting the 'authorizationEnforce' and 'authenticationRequire' fields to false in the 'sec:JaasSecurityContext' parameter as seen below.
 
<sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
    <CredentialStoreContext credentialStoreClass="oracle.adf.share.security.providers.jps.CSFCredentialStore"
                            credentialStoreLocation="../../src/META-INF/jps-config.xml"/>
    <sec:JaasSecurityContext initialContextFactoryClass="oracle.adf.share.security.JAASInitialContextFactory"
                             jaasProviderClass="oracle.adf.share.security.providers.jps.JpsSecurityContext"
                             authorizationEnforce="false"
                             authenticationRequire="false"/>
  </sec:adf-security-child>

The main drawback to this is that often times you will want to test the application module with security enabled so this is not an ideal workaround. After some investigation I determined that the dreaded 'ADF Model Generic Runtime' was the root of this issue. If the model project that you are running the application module has any indirect or direct references to the 'ADF Model Generic Runtime' you will not be able to run the application module tester with ADF Security enabled. Removing the reference to this library from the project's properties will once again allow you to run the application module tester with ADF Security enabled.


Error During Web Service Proxy Creation - oracle.jdeveloper.webservices.model.WebServiceException: Error creating model from wsdl

When attempting to create a web service proxy in a JDeveloper 11.1.1.6 ADF application you may come across the following error which prevents the creation of the proxy service.

oracle.jdeveloper.webservices.model.WebServiceException: Error creating model from wsdl "http://host.domain.com:port/webservices/SOAProvider/?wsdl" :org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammer(Lorg/apache/xerces/xni/parser/XMLInputSource;)V


 I have found that this is a result of the project that you are creating the web service proxy in having a reference to the 'ADF Model Generic Runtime' library. This reference can either be in the 'Libraries and Classpath' for the project or it can be in the 'Libraries and Classpath' of another project that your project is referencing through the project's dependencies.






You can just remove the reference to the 'ADF Model Generic Runtime' library, save the project's properties, and then try to create the web service proxy again. If you still get the same error make sure you don't have any indirect references to the 'ADF Model Generic Runtime' and restart JDeveloper before trying again. Once the web service proxy is created you can safely add the 'ADF Model Generic Runtime' library back to the project or if you don't feel it is needed leave it out. 

Thursday, May 9, 2013

JDeveloper Studio 11g Installation Tip - Append The Middleware Version To The Directory Name

The installation of JDeveloper Studio 11g is very straight forward. However, appending the middleware version to the default middleware home directory location will allow you to easily install multiple middleware versions on the same machine. This can be helpful when evaluating the most recent middleware version while still continuing development in the old middleware version.