Pages

Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

The Struggles of Personalization in ADF

A Mike Heeren & Richard Olrichs co-production

ADF comes with the out-of-the-box features of personalization. This means that whenever you configure personalisation, users can persist changes they make to the application across sessions and personalize their experience with the application. We have seen that this feature can also confuse some of our users, so it is not always wise to use this. It depends on the use case you have. However, when recently implementing personalization on an ADF 12.2.1.2 application, we had a couple of issues regarding persisting these personalizations to the MDS.

We felt that most of the blogs we came across while implementing these features, share the joyful out-of-the-box configuration. Just select some of the checkboxes in the properties and you are done, ready to enjoy your beer and have your designers and product owners cheer for you.
Sometimes however, real life applications at customers do not match the out-of-the-box configuration and things can become a little bit more tricky than you might expect.

Let's start at the top, and go through some of the steps you will always need within your application for personalization to work. You need to have authentication and authorization set up. If you also want to follow our struggles, we have posted a sample application at the end of this blog to show both the problems as well as the solutions.

Getting started with customizations

The basic configuration of customization in ADF is pretty simple. We start with a simple ADF application (with authentication already configured), and select the Project Properties > ADF View. Here we check Enable user customization and Across sessions using MDS, as seen below:



When enabling user customizations, the following files are edited:
In the adf-config.xml file the following lines are added:

 
  oracle.adf.view.rich.change.MDSDocumentChangeManager
 


In the web.xml file the javax.faces.FACELETS_RESOURCE_RESOLVER context-param is changed from oracle.adfinternal.view.faces.facelets.rich.AdfFaceletsResourceResolver to oracle.adfinternal.view.faces.facelets.rich.MDSFaceletsResourceResolver, and the following blocks are added:

 adflibResources
 oracle.adf.library.webapp.ResourceServlet

...

 adflibResources
 /adflib/*

...

 ADFLibraryFilter
 oracle.adf.library.webapp.LibraryFilter

...

 ADFLibraryFilter
 /*
 FORWARD
 REQUEST

...

 oracle.adf.jsp.provider.0
 oracle.mds.jsp.MDSJSPProviderHelper


 org.apache.myfaces.trinidad.CHANGE_PERSISTENCE
 oracle.adf.view.rich.change.FilteredPersistenceChangeManager


Finally, the following block will be added to the project .jpr file:

 
 


After this we need to configure the adf-config.xml file and add the oracle.adf.share.config.UserCC Customization Class on the MDS tab. This is a default customization class that is shipped with ADF. You can also write your own, but that is more of a use case for customization than it is for personalization. In our case we’ll just configure the application using the UserCC:



Now you need to configure the components that you want the end user to be able to personalize. This can be done in the View tab. Select the ADF Faces Components Tag Library, because we want to personalize the table and column components, these are default component from ADF Faces. By default all attributes will be persisted, you can uncheck them if you do not wish to persist these:



After the above steps are configured, you can give a fancy demo on your demo application, and everybody is happy. However, in our production application, there were still a few issues to tackle, we struggled with some of these.

Struggle 1: Task flows from libraries combined with a file based MDS on a Windows machine.


Our application was not a simple MVC application, but like many application out there, we used ADF libraries to include taskflows from library projects and included them in a bigger main application. When we turned on personalisation on components from task flows which come from libraries instead of directly from the application, they were not correctly persisted to the file based MDS on Windows machines.

When running the application via JDeveloper (in our example application by right clicking default.jsf in the ViewController project, and selecting Run), we see that the task flow that comes directly from the ViewController project (the table on the left of the screen), behaves as expected. However, when personalizing the table from the task flow that comes from the imported library (so from the ViewControllerLibrary project), we see the following warning in the log files.

    

We can verify that the preferences were persisted to the MDS for the left table, but not for the right table, by opening the application (with the same user) in another browser:



Unfortunately, this issue occurs when using task flows from libraries in combination with using a file based MDS on a Windows machine. Weblogic is not able to create a file path, which contains !/ (which is used to indicate that the resource is part of a library).

Luckily, in our case all other DTAP environments don’t use a file based MDS, but a database MDS. In the database MDS, we don’t have the file path issues, so there we won’t see this issue. So on all environments except the (local) Integrated WLS, we don’t see these warning logs, and we will see both table personalizations being persisted. It might take you some time to realise this, if you do not want to deploy to Dev or Test without having the Personalization working on your local machine.

Struggle 2: Deploying the application as EAR instead of via JDeveloper


Deploying both from JDeveloper as well as creating an EAR file seems to work. However, there was still some struggle there as well. The personalisation was working when deploying via JDeveloper, but when we would build in EAR from the application via JDeveloper, and deploy it manually to the Integrated WLS via the console, none of the settings were persisted to the MDS, and we saw the following warning in the log files:

     

By opening the application in different browsers again, we can also confirm that neither of customizations the tables is persisted in the MDS now:



When Personalization across sessions with the MDS is configured, JDeveloper always creates a metadata store usages in the adf-config file at deployment time. This configuration is named MAR_TargetRepos.

It does not matter that we have configured a different metadata store usages within the adf-config. If the MAR_TargetRepos is not present while creating the EAR file, it will be added to the adf-config file. The only solution that we found to this, is by naming our metadata store usages to match the expected default, then it will not override or add anything.


      
            
      
 
  
   
    
    
   
  
 


Note that we did not set deploy-target to true, because if we do this, our custom MAR_TargetRepos will be overridden with the default implementation again, when building the EAR file. This default implementation does not contain the FileMetadataStore implementation:



Because we want to override the default MAR_TargetRepos, so the personalization will also work when deploying the EAR instead of deploying via JDeveloper, we do not set the deploy-target to true so the default (false) will be used. In this case the FileMetadataStore configuration will be preserved in the EAR file.

If we deploy the new EAR file, we see the same behaviour as we did when deploying it via JDeveloper. Also, when we use the personalization functions on the screen, we will see files being created within the PersDef folder within the %TEMP% environment variable.

This FileMetadataStore configuration is changed (back) to a DBMetaDataStore configuration by an ANT build script, before deploying on the different DTAP environments instead of the Integrated WLS environment. An example of such ANT script can be found below.


  
  
  
  
 
  
  
  
  
  
 
 
   
   
 
 
  


Be sure that the WLS_HOME environment variable is set in the system environment variables, and the ear.location property is replaced in the ANT file when you want to use the above example.

Struggle 3: Suddenly our application does persisting during the session.


We have configured the adf-config to persist only certain components and attributes across the session. This works very nice and clear, however, suddenly all the other components also persist their state, just not across the session, but during the session.

It is possible that this is not what you want, it certainly was not what we expected or had in mind for our application, but there is nothing much we can do about it. It would have made more sense to turn this off for all the components and only persist those that were configured to be persisted.

Luckily the ADF components have an attribute persist and dontPersist on them. When reading the documentation on these attributes, it sounds exactly like what we need for our application! Before adding the dontPersist attribute to the hundreds of components we have in the application, we decide to test it on a couple. What we found out was very unpleasing, basically these attributes could be used for documentation purpose or for fun, but it certainly did nothing concerning persistence.

We decided to create our own custom class to adjust the framework and get this working. To achieve this, the context-param org.apache.myfaces.trinidad.CHANGE_PERSISTENCE can be adjusted to a custom class.

At first we tried to extend the oracle.adf.view.rich.change.FilteredPersistenceChangeManager class, which is the class ADF uses by default. However, unfortunately this class is declared final. We decided to create a class that extends the org.apache.myfaces.trinidad.change.SessionChangeManager class, and use the FilteredPersistenceChangeManager as an instance variable. This may not be the prettiest solution, but it serves our purpose:
package nl.whitehorses.personalization.changemanager;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import oracle.adf.view.rich.change.FilteredPersistenceChangeManager;

import org.apache.myfaces.trinidad.change.AttributeComponentChange;
import org.apache.myfaces.trinidad.change.ChangeManager;
import org.apache.myfaces.trinidad.change.ComponentChange;
import org.apache.myfaces.trinidad.change.DocumentChange;
import org.apache.myfaces.trinidad.change.SessionChangeManager;

public class CustomChangeManager extends SessionChangeManager {
 private final FilteredPersistenceChangeManager fpcmInstance = new FilteredPersistenceChangeManager();

 @Override
 public void addComponentChange(final FacesContext context, final UIComponent component, final ComponentChange change) {
     if (component == null || component.getAttributes() == null) {
         return;
     }
     final String[] persistArray = (String[]) component.getAttributes().get("persist");
     if (persistArray == null) {
         return;
     }
     for (final String persistVal : persistArray) {
         if (persistVal != null && change instanceof AttributeComponentChange && ("ALL".equals(persistVal) || ((AttributeComponentChange) change).getAttributeName().equals(persistVal))) {
             fpcmInstance.addComponentChange(context, component, change);
         }
     }     
 }

 @Override
 public void addDocumentChange(final FacesContext context, final UIComponent component, final DocumentChange change) {
     fpcmInstance.addDocumentChange(context, component, change);
 }

 @Override
 public boolean supportsDocumentPersistence(final FacesContext context) {
     return fpcmInstance.supportsDocumentPersistence(context);
 }

 @Override
 public ChangeManager.ChangeOutcome addDocumentChangeWithOutcome(final FacesContext context, final UIComponent component, final DocumentChange change) {
     return fpcmInstance.addDocumentChangeWithOutcome(context, component, change);
 }
}

As you can see, the logic for the persist attribute has been implemented in the addComponentChange method. The addComponentChange method from the FilteredPersistenceChangeManager instance, will only be called when the component contains the persist attribute which is set to ALL. Besides the addComponentChange method, all other (public) methods from the FilteredPersistenceChangeManager have been implemented to use the instance variable as well.
Conclusion

After some struggles and adjustments to the implementation and configuration of the application, we got personalization to work in our real world application used by customers. We overcame the struggles, but this was not as easy as the blogs on the internet made us believe beforehand. We hope that sharing this experience, might save you for some of the troubles we had.

To give you some more insight in the code and the struggles, we have created a (simple) demo application AdfPersonalization, to reproduce the issues we had, and which we used to solve them.

This application consists of the default Model and ViewController projects. Also, we added a ViewControllerLibrary project. This ViewControllerLibrary project is imported as a library by the ViewController project.

The AdfPersonalization application can be deployed to Weblogic in multiple ways:

  • Using the ‘Run’ button in JDeveloper.
  • Using Application > Deploy > … to IntegratedWebLogicServer in JDeveloper. This can be done to verify that struggle 2 is no longer an issue.
  • Using Application > Deploy > … to EAR, followed by running the replace-persdef-repo ANT target from the build.xml file. Afterwards the EAR can be deployed to a Weblogic servers, which is capable using a database based MDS. This can be done to verify struggle 1 is no longer an issue.
  • The source of this project can be downloaded via AdfPersonalization.zip.

Resources




New Release ADF EMG Selenium Tools v3.0.0

First of all, the github repository is now under the ADF EMG repository and not anymore under Wilfred his personal account. On the release page there is a new release of the Selenium Tools, version 3.0.0.

This new version is based on Java 8 (version 52+) and compatible with JDeveloper (and thus ADF) 12.2.1.x. The selenium tools work the same as they always did and the components are still in the com.redheap.selenium.component package, I did not rebrand it all to an org.adfemg package structure because of backwards compatibility.

Resources:



Put Component References in the correct memory scope

Memory scopes itself can be confusing enough, therefor I always advise my fellow developers to use the ADF scopes as much as possible and avoid the JSF scopes if they can.

When using taskflows, a lot of times, we want to store values in a pageFlowScope bean, for example to use during the lifecycle of the taskflow on several pages. Now a common mistakes is to have the UI components bind to the same bean as the values.
Usually this happens, because there is an actionListener that refreshes the component in the pageFlowScope bean, that also sets values in that same bean.

I am always a fan of splitting up beans in smaller logical blocks of code, but in this case it is necessary as well. There is a good blog by the a-team on the best practises for bindings in ADF. Next to that, there is also a Code Guideline on the ADF Architecture Square:

• [ADFcg1-03009] – Store UI components in requestScope and backingBeanScope beans - only store references to UI components in requestScope and backingBeanScope beans. Never store references to UI components in applicationScope, sessionScope, viewScope or pageFlowScope beans.

Not doing this, can cause problems on a HA clustered environment, but the main and best reason in my eyes for this is because the UI component tree might not be released correctly. This has two side effects, mostly a significantly increasing of memory load of your application, but I have also seen some strange behaviour of the UI component, leading to inconsistent state of the component in the browser.

The tricks is to split the beans in separated concerns, one that manages the UI components, holding the component references, as well as the actionlisteners. In the taskflow we inject the pageFlowScope bean holding the values in this backingBeanScoped bean that manages the UI state.
Because we have access to the values through the injected bean, we can use the getters and setters to read or modify the value in the pageFlowScope bean, while making sure our UI component references never exceed the backingBeanScope.

My next blogpost will show an example of how to set up this beans including code examples.

Resources:


OOW16: What is new in ADF

It was not hard to find the ADF sessions this year at Open World, mainly because there was really only one session. Shay his session about new features in JDeveloper & ADF. It was worth seeing who would show up in the room and to be honest, it was quite crowded for an ADF session. 

JDeveloper 12.2.1.1.0 came out in June 2016, however, this new JDeveloper is only a Patch Set, so mainly bug fixes and not much news compared to last year. Last year I already wrote a blog entry about the JDeveloper 12.2.1.0.0.

ADF Business Components Triggers
These are simple hook points, in both the Entity Object level as wel as the View Object level, just like we know from the database. You can for example create a BeforeDelete trigger or an AfterInsert. 

You can write this in groovy, JDeveloper even has syntax support for that now and will also do a type check on the groovy code.

ADF Remote Regions
The ADF Remote Regions were already in JDeveloper 12.2.1.0.0 as well, however, you might have done a small Proof of Concept and came to the conclusion not to use this. Well, the latest patch set included a lot of bug fixes on the remote regions, so if you ever had a good usecase for this it might be worth reconsidering. 

New DVTs
There are again some new Data Visualisation Tools as well:

Next Release
There was a little bird saying something about 12.2.1.2.0, however, I could not find anything official on this, so we have to sit tight wether we will get an other PatchSet or a release. 

Resources


JDeveloper Shortcut Keys: Go To File

I have been noticing that a lot of developers are either struggling with finding files in JDeveloper or taking a long time to open all the packages and browsing to the files. However, JDeveloper has a lot of shortcut keys that come in handy.

First of, a shortcut key to 'Go To Java Type', I think most developers know this one. It is the 'ctrl' + '-' on windows or '⌘' + 'J' on mac, you will get this window:

However, did you also know the search is CamelCaseSensitive? It is a very neat trick, imagine you have connected your ADF sources and want to look up the PageFlowScopeMap in the 'org.apache.myfaces.trinidadinternal.context' package.
You can open the 'Go to Java Type' screen and start typing page, but a lot of java classes will come up:

As said the search box understands CamelCase, so if you instead start typing the fist capital of each CamelCase word, in this case 'PFSM' (PageFlowScopeMap) JDeveloper will understand:

How cool is that?

Now this is not where it ends, instead of only searching for Java Types, you can search over all your files in JDeveloper, using the shortcut key: 'ctrl' + 'alt' + '-' on windows or '⌥' + '⌘' + '-' on mac. The following window will popup:

In here you can search for any file, but again you can also search CamelCase, for example, in case I want to search my ViewControllerBundle.properties file:

Now, in both windows you can also use wildcards (*), however the CamelCase will not work in combination with a wild card anymore.


OOW15: New features in ADF 12.2.1

The whole stack of Fusion Middleware 12c  was launched just before open world. This means there is also a new, cooler and better version of Oracle Application Development Framework (ADF) out! It was not too hard to follow all the session about ADF on open world this year, there were not that many to begin with. 

So what is new? To start with, the infrastructure, we can now use JDK 8 in ADF and WebLogic Server version 12.2.1, which is also Java EE7 complaint. It also fully integrates with the Java Cloud Service (JCS) and the Developer Cloud Service (DevCS). JCS supports ADF version 12.1.3 & 11.1.1.7.1 and you can deploy to JCS directly from JDeveloper. The JDeveloper IDE also fully integrates with the GIT repository on the DevCS. You can track and update tasks and issues:

In ADF Business Components (ADF BC) there is now REST support. You can expose your Application Module as a REST service by simply following a wizard. You can also consume REST services by using the REST Data Control in JDeveloper, it can consume both REST JSON or REST XML. It has a declarative approach, as you would expect from ADF and security supports for OWSM policies.

On the view side, the Alta UI is now enabled by default, there is also a browser based theme editor application. You have a visually modification of the look and feel, create ADF skins and import the jar this application create in your application to use the skin in your ADF application. Next to the skinning, there are more, better and newer Data Visualization Components (DVTs) as well!

There is a cool new feature that allows you to call Remote Regions, this means that you can call a taskflow that is deployed in another application, possible even on a totally different server. Both the consuming as well as the publishing application need to be made aware of these feature. This means that you can reuse taskflows, without the need of consuming a library in the consuming application. The remote region will be loaded parallel (in the other application). You can pass parameters to the region, just like you are used to.

Last but not least, ADF Faces got a lot better at being responsive! They added the so called ‘Masonry Layout’, this is not a new component, but you create responsiveness by adding predefined style classes to your components. ADF now also supports the media tag, with this you can now change properties on your ADF Faces components based on the media query results.

OOW15: Announcing Oracle JET

This is the first blog in a series about Oracle Open World 2015 (OOW15), it focuses on the release of the Oracle JavaScript Extension Toolkit (Oracle JET). This was one of the big announcements this week in San Francisco. Oracle now has a JavaScript toolkit to create and build responsive websites.

One of the most heard questions is what is the different from Oracle JET with Oracle ADF? Will the one replace the other? Or will they coexist next to each other? All very valid questions, for now they will coexist next to each other. Oracle supports and invests in both products, focusing on a different kind of developer and a different kind of tool. You can see this in their own product as well, as a rule of thumb Oracle builds their SaaS application with the ADF and their PaaS applications with JET.

The biggest difference between the two is that ADF protects you from the underlying technology, works in a declarative way and is a server side framework. Oracle JET is more on the edge, as you would expect, from a JavaScript toolkit, more code centric and a pure client-side toolkit.

They share a lot of the same components and the Oracle DVT components work also in JET, this means the same DVT components work in Oracle ADF, MAF & JET. JET is based on libraries such as JQuery, JQuery UI & KnockOut, therefore you can use the key features (like 2 way binding) out of these libraries in JET as well. Behind the scenes Oracle has worked on this project for over 2 years, with the same development teams as the teams that work on ADF Faces & DVT’s.
JET is a modular toolkit in which you can pick ‘n mix your own JS libraries to extend more capabilities. Oracle has also build in support for internationalization & accessibility.

For now the use of Oracle JET is only for “the lucky few”, it comes with a Restrictive Use License (RUL) if you are using one of the few Cloud products (MCS, JCS, DevCS, ABCS: more on these in later blogs) Oracle offers today. However, they are looking for open source possibilities under the Apache 2.0 license. That they are working on open sourcing, but they did not give a timeframe on this yet. The release cycle of JET will be aimed at a minor release every two months and a major release every six.

So where do you start? First of all, make sure you check out the Oracle JET page for more cool stuff. Here you can find explanations, tutorials and code samples, there are cookbooks where you can check out the JET components and see the JavaScript and HTML code for these components. This tool works both ways, so you can copy and paste your JET component code in there as well to see the component it would generate!
You can use any code editor you prefer, whether this is Agnostic, NetBeans or some other IDE. They do however have build in support in the latest release of NetBeans, so it might be wise to let that be your weapon of choice.

Last but not least, Oracle Application Builder Cloud Services (ABCS) is fully build in Oracle JET, but it also produces Oracle JET code. So when you use the ABCS to create user interfaces, you can get the underlying JET code and continue working on that as a developer.


Run ADF & SOA on the IntegratedWLS in separated domains

In JDeveloper 12c, it is possible to run SOA Suite on the InternalWLS, which is a great feature. However, once you have done this, your domain will be filled with SOA extensions. Meaning the server start up time will increase drastically.
When you do both ADF & SOA development, this can be annoying when you just want to run your ADF application and the IntegratedWLS is busy starting up the SOA domain. One way to avoid this is to run two different JDeveloper instances with two different Jdev Homes configure.
In this blog I will describe you how to set this up.

First of all, I got my ‘normal’ JDeveloper for ADF development, this is installed on my C drive, under: C:\oracle\JDev1213, if you navigating to the Oracle_Home\jdeveloper\jdev\bin folder and open the jdev.boot file, you will see the variable ‘ide.user.dir.var’:


Now I recently installed a second JDeveloper 12c in a different directory, this JDeveloper is installed with the SOA extensions, I installed this on the C drive as well, but in the folder C:\oracle\JDevHomeSOA. Within this JDeveloper folder, there is also a jdev.boot file under the folder ‘\jdeveloper\jdev\bin’, however, I changed the ‘ide.user.dir.var’ to a specific _SOA variable:


Now all that is left to do is to create two new Environment Variables, pointing to different JDevHome directories:


This will create two different domains for each JDeveloper, keeping your environment clean and tidy!

Stretch your table to full page

In a previous blog I mentioned dynamic stretching table height with the autoHeightRows property. However, I have noticed people are having more troubles with stretching the height of the table.

This time I will focus on stretching your table to fill the total page height. We start with a simple ADF table on the employee table, showing all employees. Although I have seen more complex questions, including regions and more components in the structure, it all comes down to the same principle. I created a pretty straight forward jsf file with the following structure:



On the panelCollection I have set the styleClass AFStretchWidth to stretch the table to the full width of the page, however, by default it will not stretch the full height, but it will look like this:

Especially when you have a more complex structure, with more layout components in your page, it is easy to think you configured something wrong, however, this is the default behavior even when you use the panelStretchLayout.
In the documentation of the panelStretchLayout you can read up on the Geometry Management, it is important to focus on the section about the ‘dimensionsFrom’ property. The default value is read from the web.xml context-param ‘oracle.adf.view.rich.geometry.DEFAULT_DIMENSIONS’ which results in ‘auto’.
However, for our page we want the table to take the dimensions from parent. You can set the dimensionsFrom="parent" on the panelStretchLayout on your page, or you can override the default in the web.xml parameter.
The result will be the same, a table shown over the full page:





XML Data Control Article

Today Oracle published our article about the ADF EMG XML Data Control. With the article, also comes an extensive two part tutorial, go check them out at OTN:

Powerful and Easy ADF Data Control for XML Data
Article
Tutorial
Enjoy reading and if you have any comments or remarks, let me know!

Other Resources:
ADF EMG Community
XML Data Control wiki


Clear ADF 12c deployment on Integrated WLS

Sometimes you want to cancel your Integrated WebLogic Server, however, if you do this while a deployment is currently going on, you might run into trouble. The log window will not tell you anymore than a remote deployment failed and that the Application can not be run:



You need to clear some directories in your JDevHome before the application deployment works again. Before clearing the directories, make sure you close JDeveloper.

Go to the folder: JDevHome\system<versionnumber>\o.j2ee\drs
In here you should see your application that you try to deploy you can delete that folder or you can delete all the folders in this directory. They will be recreated for you when you run the specific application.

Next, go to the folder: JDevHome\system<versionnumber>\DefaultDomain\servers\DefaultServer
In here you should delete the ‘tmp’ folder.

After you deleted the folders, restart JDeveloper and run the application again.
You should now be able to deploy your application again to the Integrated WebLogic Server.


Create a Custom ADF Component

During UKOUG Tech14 in Liverpool, Wilfred and I had a presentation about how to create your own Custom ADF Component. Since we were busy on preparing the presentation there were no blogs about these beforehand.
I thought it would be nice to give a small recap, for anyone interested in going into creating Custom ADF Components.

In our sample application we created an ADF Component called ‘multi select’ which offers the user the ability to show a list of items and the ability to add items, delete items and select an item. The result is the component within the red line:

During our presentation, we had an overview of the components involved in creating a custom ADF component. The overview looked as followed:

The slide deck on slideshare will take you through these components, the responsibilities and the code involved in creating this component. We have added comments to the code in the slides, so you are able to follow this without our voice over. The server side classes are all Java classes as where the client side is all JavaScript. The Skin is created in a css file using the ADF skin style.

At the end of the slide deck there is a slide with links to several documentation, we advise you to keep links to these documents close by you while starting to code your component. As you will see, we link to documentation from the ADF release 11.1.2.4 while we have build our component in ADF 12.1.3. This is because Chapter 31 ‘Creating Custom ADF Faces Components’ is not available in the 12c Documentation.
Last but not least, all our effort is available on a github repository, both the Custom ADF Component we have created as well as an example of a consuming ViewController project using this multiSelect component.

Resources:
- Presentation: http://www.slideshare.net/ROlrichs/adf-component-tech14
- GitHub Repository: https://github.com/wvanderdeijl/adfcomponent

JDeveloper Debugging Tips (Watchpoints & Beep)

In a previous blog post I talked about scoping breakpoints for debugging purposes, next to scoping breakpoints JDeveloper has more interesting debugging features to offer.

I created a simple example to show both the watchpoint as well as the beep functionality. To illustrate this, I created a page with an inputText and a button, both bound to a backingBean. 

This  is the jsf code:
 
      
      
 
The code from the bean is also pretty straight forward:
   private String value = "value";

    public void setValue(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void changeValue(ActionEvent actionEvent) {
        value += "!";
    }

Now imagine that I want to halt execution everytime the bean field value changes. I can simply right-click the field and choose ‘Toggle Watchpoint’:

This will show a nice sunglass instead of a breakpoint in the line gutter:


I also want to be informed when the getter of the value is called, however, I do not have the need to be redirected to JDeveloper and press F9 again to continue. I just want a signal that we have been inside the getValue() method, in this case a beeping sound.
To do this, you place a breakpoint in the getter, right-click on it and go to ‘Edit Breakpoint’.

Go to the Actions tab, in here unselect the ‘Halt Execution’ option and select the ‘Beep’ option. You will hear a beep when the breakpoint is reached, but it will not force you into JDeveloper.


If you run the page, you will hear a Beep whenever the getter is called, so you recieve a signal of this action. Whenever the field value is changed, it will take me into JDeveloper and halt the execution, this means it will halt execution in the method when I press the button on the screen, while there is no explicit breakpoint at this point in the code:

You can also see the old and new value in the log window:


OOW14 summary: Oracle ADF

Being an ADF developer, off course a lot of my focus and attention went to the ADF related sessions. I left OOW with a mixed feeling about the ADF sessions. On the downside I felt there was not a lot of attention for ADF during the OOW conference. You see ADF or ADF related features during almost all the presentations, whether it is the Cloud, SOA Suite and Service Bus or MAF, but not a lot on ADF itself. Then again this might be a good thing, meaning the framework being more stable and reliable.
However, the upside of the conference for me personally still is the User Group session on the Sunday, thanks to the ODTUG user group and the ADF EMG community there was a whole Sunday full of nice ADF presentation, I enjoyed all of them, a great day!

ALTA UI
One of the key ADF features at Open World was the release of the new ALTA UI, which can be viewed upon as a Simplified UI 2.0, if you want (also see my blog about the UX event). It is not just a skin, but a way of creating ADF applications. Follow the patterns, use the building blocks and create not only a functional, but also a good looking application with a good user experience.

Diagrams for ADF
A presentation done by Duncan Mill and Jairam Ramanathan about the new DVT component to create diagrams in ADF. This is not just a ready to use DVT, that can work for you in some situations. This is actually a framework you can use to create the exact diagram you need for your use case at that time. This will result in a SVG in the HTML output, which means there is native browser support and the user can actually use default functionality like zooming & panning.
Duncan wrote a series containing over 10 articles, which included the necessary steps on how to get yourself familiar with the diagrams and how to use this. A leap forward in the visualization tools within ADF, maybe we will get to see more of this in the framework?
 
High Availability and ADF
Jobinesh had a great session on High Availability (HA) support within ADF. If you want to run ADF on HA, the framework does not do all the work for you, you have to help it a little bit.
Look up his presentation to read up on how to ensure the correct working of failover and data replication, but also for some great code guidelines on how to program MBeans, TaskFlows and more within a HA environment. There is no need for me to repeat all these steps he worked out for you so well.

DVT within ADF
In this session the Data Visualization Tools (DVT) team showed some cool new features from the current (12.1.3) as well as the upcoming release. They are not ADF only, because almost all of them are also available within the MAF framework. The layout and animation of all the DVTs are now responsive and there has been a great performance improvement in all of them. Within the thematic map it is now possible to provide your custom map.
In the upcoming release the there will be a nice cool feature to mashup DVTs. Meaning you can switch between different DVTs without losing the state/context of the data.

Maven support
Since the release of ADF 12c, there is now support in JDeveloper for Maven. Which can be of great use in your Continuous Integration and/or Continuous Deployment process. JDeveloper understands how to work with the pom file and everything you need to do to get started with maven and your project you can do from within JDeveloper.

ADF EMG XML Data Control
Last but not least some shameless self plug. If you do anything with XML within ADF, whether it is just to show data on an UI or to manipulate it. Make sure you have a look at the XML Data Control. The 1.0 version is out and it can saves you lots of time , headaches and lines of code in Java.

Available online resources



What I learned at Oracle Open World 2014

Oracle Open World was once again very inspiring, last week I’ve been summarizing my own notes. I decided to share them with the world, if not only for me to find them back in my own blog archive in the (near) future.

As you might have guessed, there was a lot going on about the cloud. So much, it was almost confusing. The most interesting clouds that stayed with me after OOW14 where:
  • The Integration Cloud Service (ICS).
  • The Java Cloud Services (JCS) in combination with the Developer Cloud Service (DCS).
  • Mobile Cloud Service (MAX).

However, since I am not really working with any cloud related product, my main focus was on the on-premise Oracle FMW stack. So if you want to know more about the cloud, there are plenty of other, better blogs to tell you more about these details.

SOA Suite Upgrade to 12c
First of all, very impressive, you can smoothly upgrade from 11g to 12c. There is an extensive upgrade manual that you can follow, to upgrade from your 11g to the new 12.1.3. release. If you follow the step by step guide, the upgrade will even work if you have running instances on your production environment.
This upgrade has been proven to work on multiple customer cases.

API Management
Oracle will be announcing two new product which will help you with your API management, this features will be on top of the Oracle Service Bus. There are two sides of this product, which are actually separated products. One is to help out with your catalog of services, which are you running on the service bus. This information can be harvested from the bus and will be available in a catalog.
The second product is to help you with managing the consumers of your services. Your consumers must explicitly subscribe to your service in order to get an API key. They must use this API key in the http header when they call the service in order to get a result. Using this feature you get a complete overview of the consumers calling your service.

Oracle Stream Explorer
Oracle Stream Explorer (OSX) is a tool that can help you with getting information out of Oracle Event Processing (OEP). OSX can help you transforming lots of data into information. Stream Explorer can not only listen to edn, but also get input from csv files, database tables and other sources. It is a standalone product that helps you manipulate streams of data (events). Once the data is transformed into information, Stream Explorer can publish this again, for example to a JMS queue.
You can build a custom ADF UI to present this information or you can use Oracle Business Activity Monitoring (BAM).

Mobile Application Framework
The Oracle Mobile Application Framework (MAF) 2.0 is out and it starts to become a really mature product, one of the key things is the new release cycle for MAF. They intend to release every 2 months from now on.
One of the most named down sides of MAF is that it still runs on Java 4. However, not in the upcoming, but the release after that (meaning early next year), MAF will be upgraded to use Java 8. If you ever doubted on starting to investigate on MAF, now might be a good time.
The skills for a ADF developer are pretty transferable, MAF does not use JSF and does not have the ADF lifecycle as we know it from his big brother, but we do have java, taskflows, data controls and the binding layer.

Mobile Cloud Service 
In the session ‘Next-Generation Application Development’, Chris Tonas said “The cloud is not just a deployment platform anymore”. Chris announced the coming of the Mobile Cloud Service (MCS), which is coming soon.
In a fifteen minute demonstration Chris showed how you can create an online mobile application, using the  Mobile Application Accelerator (MAX) for Mobile Cloud Service. An application based on reusable MAF components you can deploy to either Android or iOS devices.

Service Bus & ADF
For both Service Bus & ADF I gathered so much info that I decided to create two separated blogs for these subject.

Online available resources


ADF EMG XML Data Control version 1.0.0

Today at Oracle Open World, we (Wilfred and myself) officially announced the 1.0.0 version of the ADF EMG XML Data Control. Check out the presentation on slideshare if you missed it.

You can get this extension through the JDeveloper Help -> Check for Updates menu. Make sure you select the 'Open Source and Partner Extensions' checkbox:


There you should see the 'ADF EMG Data Control' extension:


A brief description for those who were not at our OOW Sunday Session:
The XML Data Control is an ADF Data Control that is used by developers to create data bindings in ADF Faces pages, just like the ADF BC Data Control and the POJO Data Control. The data exposed through this data control can be any XML source – from a BPM Human Task, from a SOAP or REST WebService, from a static XML document or a custom Java Class that produces an XML document from anywhere.

Read more on this project on our public wiki.

If you’re interested in following or contributing to this open source project, make sure you bookmark the following links:


The ADF EMG XML Data Control Extension is available for both JDeveloper 11gR1 and JDeverloper 12c.


ADF EMG Audit Rules available on JDeveloper 12.1.3

I got a few questions from people why the ADF EMG Audit Rules are not available in JDeveloper 12.1.3. So there has been a new release of the ADF EMG Audit Rules. No new functionality is implemented this time, but the extension is now available for JDeveloper 12.1.3.

If you go to Help -> Check for Updates, tick the Open source and Partner Extensions checkbox and press Next: 

Select the ADF EMG Audit Rules and click Next:

The extension ADF EMG Audit Rules should be installed correctly, click finish and restart JDeveloper 12.1.3:

Now if you go to your Tools -> Preferences, there is a button ‘Manage Profles’ on top of the Audit tab, you will find your profiles under that submenu. Press the button to open the Profiles menu:

Within the Audit Profile, you should see the ADF EMG Audit Rules appear:

Presentations at Oracle Open World 2014

I am proud to announce that I will be giving two presentation at Oracle Open World this year in San Francisco. So some shameless self-plug on my blog to put them both under a little extra attention.

The first one will be on the ODTUG's and ADF EMG ADF Sunday, together with Wilfred. We will explain and demonstrate our new open source project/product the ADF EMG XML DataControl.
If you’re working with Oracle ADF and WebServices, this one should be very interesting for you.


The second one is on Tuesday, together with Frank Houweling from AMIS and Frédéric Desbiens from Oracle. We will be talking about build environments, performance within ADF and quality assurance. I am confident I will be able to mention my other open source initiative the ADF EMG Audit Rules.


Hope to see you there!

Use tree binding accessors to show detail rows

Tree bindings can be very handy, for example to combine details in the same row as the master. Let’s assume we have the following starting point based on the HR schema:


We see the department in a form layout with navigation buttons, with a table under the form showing information about the employees. As you can see in the screenshot below in the ApplicationModule, there is also a Jobs detail under the EmployeeView.


If you go to the bindings on the page, you see the Tree Binding ‘EmployeesView’. You can edit the Tree binding very easily through the overview of the binding page. If we add the JobsView as detail this will be available in the page as well.


Don’t forget to shuffle the attributes that you need to the right:


After pressing ok, the source of the PageDef should now look something like this:


You see that the first nodeDefinition in the tree has gained an Accessors element, in this Accessors element there is an item with the name JobsView. We can now use this accessor in our table in the page as well. To illustrate I add two new columns to the table.


The editor does not really understand this, so you do not get any help from the IDE. You can see that the EL expression to the hints of the EmployeeView is the same, but after that we use the accessor value to navigate to that nodeDefinition in the Tree, after which we enter the value from the AttrName inside this nodeDefinition.
The value itself however, we need to access through the row. You can see the EL expression in the value of the outputText. After the row we again first use the accessor value but then go to the bindings, after the bindings we enter the AttrName value and we end the EL expression with the inputValue.

On run time this results in the two extra added columns: