Posts Tagged ‘adf’

JDev & ADF Goodies

Recently a question on the OTN JDeveloper & ADF Space caught my interest. The question was how to initialize an af:quickQuery component with a parameter passed to a task flow on load of a page.
At first I thought that this would be a simple case of setting a property (InitialQueryOverwritten=true) as mentioned by Frank Nimphius in his article How-to query af:quickQuery on page load ?, but after a short test it turned out, that this setting only executes the query but can’t be used to initialize the criteria.

This blog is about a solution to this problem. The question can be divided into two smaller problems to solve. The first is to pass a parameter to a bounded task flow and use the passed parameter in the bounded task flow. The second problem is to initialize a default query attribute of a af:quickQuery component and execute the query.

View original post 833 more words

JDev & ADF Goodies

A question on the JDeveloper and ADF OTN forum asked about how to navigate to a specific page of an af:table in pagination mode. As of JDeveloper 11.1.1.7.0 adf tables can be rendered in scroll mode or in pagination mode where only a specific number of rows are visible in the table.

af:table in pagination mode

To navigate the pages there is a small navigation toolbar below the table which allows to enter a page number or to navigate to the previous, next, first or last page.

The problem to solve is how to navigate the paginated table from within a java bean?

The table doesn’t offer any navigation listeners or methods you can bind bean methods to. Luckily there is the RangeChangeEvent one of the FacesEvents which can e used to notify a component that change in the range has taken place.

All we have to do to navigate the table in pagination…

View original post 440 more words

Oralublog - Oralution's Blog

Groovy, a useful dynamic language for the JVM based on Java but adding powerful features you would often see in others scripting languages like Phyton and Ruby. Groovy is part of the ADF Framework, particullary inside the Business Components world. This post will resume some of the most useful line of code when working with ADF BC and a little bit of Groovy.

View original post 323 more words

Environment (JDeveloper 11.1.2.0.0, ADF Faces)
ADF Faces uses the standard JSF messaging API. JSF supports a built-in framework for messaging by allowing FacesMessage instances to be added to theFacesContext object using theaddMessage(java.lang.String clientId, FacesMessage message) method. In general there are two types of messages that can be created:component-level messages, which are associated with a specific component based on any client ID that was passed to the addMessage method, and global-level messages, which are not associated with a component because no client ID was passed to the addMessage method.

in this post, I will show how to show af:message programatically.

  • global level message:

To show a global level message, use this method:

public String showMessage() {
        String messageText=”A prgramatic af:message”;
        FacesMessage fm = new FacesMessage(messageText);
        /**
         * set the type of the message.
         * Valid types: error, fatal,info,warning
         */
        fm.setSeverity(FacesMessage.SEVERITY_INFO);
       …

View original post 260 more words

Environment (JDeveloper, ADF BC, ADF Faces)

When you work with large application which contains more than one Model/one ViewController projects, you need to set the project dependency between the model and the view controller project., failing to do this you may face this exception.

oracle.jbo.ConfigException: JBO-33001: Configuration file /model/common/bc4j.xcfg is not found in the classpath.

To solve the problem, double click the viewController project to open project properties dialog, and select the the Dependencies node  and click the Edit Dependecies icon to add a dependency on the build output path or on one or more deployment archives.

Hope this will help someone faced the same problem.

View original post

JDev & ADF Goodies

This post is a continuation of an earlier blog about how to reset a filter on an af:table.
A question on OTN JDev and ADF spaces brought a change to my attention which I like to share here.
Using the code from the former post now results in a depreated warning in 12c:

Warning(7,28): getFilterCriteria() in oracle.adf.view.rich.model.FilterableQueryDescriptor has been deprecated

and a look into the javadoc for the getFilterCriteria() method showed

Deprecated. Please use #getFilterConjunctionCriterion

AFAIK you only get the javadoc if you have access to the source code of ADF which you can get via support.oracle.com.

Knowing what to use instead of the deprecated method is half the solution. It turned out that it’s not enough to to use the new method to get the FilterConjunctionCriterion but that you have to iterate over the ConjunctionCriterion and reset them one by one. Here you have to check which type of…

View original post 71 more words

Environment (JDeveloper 11.1.2.3.0,ADF Faces)

The inputDate component creates a text field for entering dates and (optionally) a glyph which opens a popup for picking dates from a calendar. However  in some cases we need to prevent the user from picking a specific days from the calender. In this post I will explain how to do this use case.

1- Create a simple JSF page and drag and drop af:inputDate component from the component palette into the newly created page.

2- Create a java class which implements org.apache.myfaces.trinidad.model.DateListProvider interface. This interface is used for providing a list of  individual dates within a given range.

3- Override the getDateList method, This method will generate a List of individual Date objects which will be rendered as disabled in a datePicker component.  An example is shown below.

import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.List; import javax.faces.context.FacesContext; import org.apache.myfaces.trinidad.model.DateListProvider; public class DaysBean implements…

View original post 172 more words

Entity Objects

Entity objects map to single objects in the datasource. In the vast majority of cases, these are tables, views, synonyms, or snapshots in a database. Entity objects handle the posting of changes to the datasource. 

Entity objects provide a hook for implementing your application’s business rules, including:

 

  • Validation logic, which keeps corrupt data from being entered in the database
  • Security logic, which tracks data changes and ensures that only authorized users can see or change data
  • Creation logic, which performs actions (such as prepopulating attributes) for newly created rows
  • Deletion logic, which performs actions when rows are deleted
  • Other logic, such as dynamic calculations and events that trigger when data is modified

View Objects

Oracle ADF view objects are business components that collect data from the datasource, shape that data for use by clients, and allow clients to change that data in the Oracle ADF Business Components cache. For example, a view object can gather all the information needed to:

  • Populate a single table element in a form
  • Create and process an insert or edit form
  • Create an LOV for populating a dropdown list

ViewObject decribes how the application will view and update data. A view object may be entity based or non-entity based. In the former case, the view object consists of one or more entity bases. The first one of these is referred to as the primary entity base. The rest are called secondary entity bases. An entity based view object maps its attribute (view attributes) to attributes in the entities (entity attributes). An entity based view object may map all its entity attributes or only some of them.

A non-entity based view object is one where it does not have any entity base. All its attributes are view level attributes. In this case only READ operation is allowed from the VO.

http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/ViewObject.html

http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/bc4j/intro/bc_avo.html

It is possible to disable each component one by one but the easiest method is getting the list of all the components within the af:panelGroupLayout on page load and setting the properties to the desired status for each one. The same solution can be performed also for other surrounding element.

First bind your component (af:panelGroupLayout in this case) in your managed bean:


RichPanelGroupLayout yourPanelGroupBind;
public void setYourPanelGroupBind(RichPanelGroupLayout yourPanelGroupBind) {
this.yourPanelGroupBind = yourPanelGroupBind;
}
public RichPanelGroupLayout getYourPanelGroupBind() {
return yourPanelGroupBind;
}

Then within a method do this:


List outer = yourPanelGroupBind.getChildren();
for (UIComponent outerComponent : outer) {
if (outerComponent instanceof RichPanelFormLayout) {
List uiComponentList = outerComponent.getChildren();
for (UIComponent uiComponent : uiComponentList) {
if (uiComponent instanceof RichPanelLabelAndMessage) {
List uiComponentList2 = uiComponent.getChildren();
for (UIComponent uiComponent2 : uiComponentList2) {
if (uiComponent2 instanceof RichInputText) {
((RichInputText)uiComponent2).setDisabled(true);
} else if (uiComponent2 instanceof RichSelectBooleanCheckbox) {
((RichSelectBooleanCheckbox)uiComponent2).setDisabled(true);
} else if (uiComponent2 instanceof RichInputDate) {
((RichInputDate)uiComponent2).setDisabled(true);
} else if (uiComponent2 instanceof RichSelectOneChoice) {
((RichSelectOneChoice)uiComponent2).setDisabled(true);
} else if (uiComponent2 instanceof RichPanelGroupLayout) {
List uiComponentList3 = uiComponent2.getChildren();
for (UIComponent uiComponent3 : uiComponentList3) {
if (uiComponent3 instanceof RichInputText) {
((RichInputText)uiComponent3).setDisabled(true);
} else if (uiComponent3 instanceof RichSelectBooleanCheckbox) {
((RichSelectBooleanCheckbox)uiComponent3).setDisabled(true);
} else if (uiComponent3 instanceof RichInputDate) {
((RichInputDate)uiComponent3).setDisabled(true);
} else if (uiComponent3 instanceof RichSelectOneChoice) {
((RichSelectOneChoice)uiComponent3).setDisabled(true);
}}}}}}}

The code above checks for a wide variety of components that might be located within the af:panelGroupLayout.

There are very few references about this so I thought to post it here.

To get the query you have to override the executeQueryForCollection() in your ViewObjectImpl. Before calling super(), you can get/print out the result of getQuery() method.

protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {
getQueryParameters();
q = getQuery();
System.out.println(“SQL = ” + q);
if (params != null) {
for (int i = 0; i < params.length; i++) {
Class cls = params[i].getClass();
System.out.println(“Class is ” + cls.getName());
System.out.println(“Query param ” + i + ” ” + String.valueOf(params[i]));
}
}
super.executeQueryForCollection(qc, params, noUserParams);
}