Friday, October 28, 2011

ADF Controller Architecture

The ADF Controller engine is defined int the internal NavagationHandlerImpl class that extends the javax.faces.application.NavigationaHandler of the JavaServer Faces framework. A faces-config.xml configuration file that is added to the META-INF directory of the ADF Controller Library registers the Oracle controller with the JavaServer Faces framework at run time. No extra configuration is needed..

From: Oracle Fusion Developers Guide

Thursday, October 27, 2011

How to Get Trigger-Assigned Primary Key Values from a Database Sequence

4.10.10 How to Get Trigger-Assigned Primary Key Values from a Database Sequence

One common case for refreshing an attribute after insert occurs when a primary key attribute value is assigned by a BEFORE INSERT FOR EACH ROW trigger. Often the trigger assigns the primary key from a database sequence using PL/SQL logic. Example 4-9 shows an example of this.

Example 4-9 PL/SQL Code Assigning a Primary Key from a Database Sequence
CREATE OR REPLACE TRIGGER ASSIGN_SVR_ID
BEFORE INSERT ON SERVICE_REQUESTS FOR EACH ROW
BEGIN
 IF :NEW.SVR_ID IS NULL OR :NEW.SVR_ID < 0 THEN
   SELECT SERVICE_REQUESTS_SEQ.NEXTVAL
     INTO :NEW.SVR_ID
     FROM DUAL;
   END IF;
END;
On the Details tab (on the Attributes page of the overview editor), you can set the value of the Type field to the built-in data type named DBSequence, and the primary key will be assigned automatically by the database sequence. Setting this data type automatically selects the Refresh on Insert checkbox.
Note:
The sequence name shown on the Sequence tab is used only at design time when you use the Create Database Tables feature described in Section 4.2.6, "How to Create Database Tables from Entity Objects." The sequence indicated here will be created along with the table on which the entity object is based.
When you create a new entity row whose primary key is a DBSequence, a unique negative number is assigned as its temporary value. This value acts as the primary key for the duration of the transaction in which it is created. If you are creating a set of interrelated entities in the same transaction, you can assign this temporary value as a foreign key value on other new, related entity rows. At transaction commit time, the entity object issues its INSERT operation using the RETURNING INTO clause to retrieve the actual database trigger-assigned primary key value. In a composition relationship, any related new entities that previously used the temporary negative value as a foreign key will get that value updated to reflect the actual new primary key of the master.
You will typically also set the Updatable property of a DBSequence-valued primary key to Never. The entity object assigns the temporary ID, and then refreshes it with the actual ID value after the INSERT operation. The end user never needs to update this value.

For information on how to implement this functionality for an association that is not a composition, see Section 4.14.7.3.3, "Associations Based on DBSequence-Valued Primary Keys."

Assigning the Primary Key Value Using an Oracle Sequence

4.12.5 Assigning the Primary Key Value Using an Oracle Sequence

As an alternative to using a trigger-assigned value (as described in Section 4.10.10, "How to Get Trigger-Assigned Primary Key Values from a Database Sequence"), you can assign the value to a primary key when creating a new row using an Oracle sequence. This metadata-driven approach allows you to centralize the code to retrieve the primary key into a single Java file that can be reused by multiple entity objects.
Example 4-16 shows a simple CustomEntityImpl framework extension class on which the entity objects are based. Its overridden create() method tests for the presence of a custom attribute-level metadata property named SequenceName and if detected, populates the attribute's default value from the next number in that sequence.

Example 4-16 CustomEntityImpl Framework Extension Class
package sample;
 
import oracle.jbo.AttributeDef;
import oracle.jbo.AttributeList;
import oracle.jbo.server.EntityImpl;
import oracle.jbo.server.SequenceImpl;
 
public class CustomEntityImpl extends EntityImpl {
    protected void create(AttributeList attributeList) {
        super.create(attributeList);
        for (AttributeDef def : getEntityDef().getAttributeDefs()) {
            String sequenceName = (String)def.getProperty("SequenceName");
            if (sequenceName != null) {
               SequenceImpl s = new SequenceImpl(sequenceName,getDBTransaction());
               setAttribute(def.getIndex(),s.getSequenceNumber());
            }
        }
    }
}

To assign the primary key value using an Oracle sequence:
  1. Create the CustomEntityImpl.java file in your project, and insert the code shown in Example 4-16.
  2. In the Application Navigator, double-click the entity you want to edit to open the overview editor.
  3. In the overview editor, click the Attributes tab, and double-click the attribute you want to edit.
  4. In the Edit Attribute dialog, set the attribute Type to Number, and then click the Custom Properties node.
  5. Enter SequenceName for the name.
  6. Enter the name of the database sequence for the value, click Add, then click OK to create the custom property.
    For example, a Dept entity could define the custom property SequenceName on its Deptno attribute with the value DEPT_TABLE_SEQ.

Lost the Application Manager Data Controls Window????

OK so it seems that I lost the Data Controls Window in the Application Manager...

My previous application Role was set to database developer and I then I switched to Studio Role and lost the Data Controls. Hmmmm. I tried to reset to Studio and still the Data Control Window was unavailable.  So closed out all the applications and started a new application and behold there was the Data Control window!!!

Creating list object to ADF bindings

The most direct way of binding to values from the model layer is via dynamic list. This is the most useful for master-detail lookup senarios where the value of the detail view's attribure must exist as a corresponding value in the master view

Switch JDeveloper Role

Wednesday, October 26, 2011

Setting Up a JSF web page -- Java EE 6 Tutorial

From the Java EE 6 Tutorial here.


A typical JavaServer Faces web page includes the following elements:

  • A set of namespace declarations that declare the JavaServer Faces tag libraries

  • Optionally, the new HTML head (h:head) and body (h:body) tags

  • A form tag (h:form) that represents the user input components


To add the JavaServer Faces components to your web page, you need to provide the page access to the two standard tag libraries: the JavaServer Faces HTML tag library and the JavaServer Faces core tag library. The JavaServer Faces standard HTML tag library defines tags that represent common HTML user interface components. This library is linked to the HTML render kit at http://download.oracle.com/javaee/6/javaserverfaces/2.1/docs/renderkitdocs/. The JavaServer Faces core tag library defines tags that perform core actions.

For a complete list of JavaServer Faces Facelets tags and their attributes, refer to the documentation at http://download.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/.

To use any of the JavaServer Faces tags, you need to include appropriate directives at the top of each page specifying the tag libraries.

For Facelets applications, the XML namespace directives uniquely identify the tag library URI and the tag prefix.

For example, when creating a Facelets XHTML page, include namespace directives as follows:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">

The XML namespace URI identifies the tag library location, and the prefix value is used to distinguish the tags belonging to that specific tag library. You can also use other prefixes instead of the standard h or f. However, when including the tag in the page, you must use the prefix that you have chosen for the tag library. For example, in the following web page, the form tag must be referenced using the h prefix because the preceding tag library directive uses the h prefix to distinguish the tags defined in HTML tag library:
<h:form ...>

The sections Adding Components to a Page Using HTML Tags and Using Core Tags describe how to use the component tags from the JavaServer Faces standard HTML tag library and the core tags from the JavaServer Faces core tag library.

Composite Components -- The Java EE 6 Tutorial -- JSF 2.0

From Java EE 6 Tutorial here.


JavaServer Faces technology offers the concept of composite components with Facelets. A composite component is a special type of template that acts as a component.

Any component is essentially a piece of reusable code that behaves in a particular way. For example, an inputText component accepts user input. A component can also have validators, converters, and listeners attached to it to perform certain defined actions.

A composite component consists of a collection of markup tags and other existing components. This reusable, user-created component has a customized, defined functionality and can have validators, converters, and listeners attached to it like any other component.

With Facelets, any XHTML page that contains markup tags and other components can be converted into a composite component. Using the resources facility, the composite component can be stored in a library that is available to the application from the defined resources location.

Table 5-3 lists the most commonly used composite tags and their functions.



Table 5-3 Composite Component Tags



































TagFunction
composite:interfaceDeclares the usage contract for a composite component. The composite component can be used as a single component whose feature set is the union of the features declared in the usage contract.
composite:implementationDefines the implementation of the composite component. If a composite:interface element appears, there must be a corresponding composite:implementation.
composite:attributeDeclares an attribute that may be given to an instance of the composite component in which this tag is declared.
composite:insertChildrenAny child components or template text within the composite component tag in the using page will be reparented into the composite component at the point indicated by this tag’s placement within the composite:implementation section.
composite:valueHolderDeclares that the composite component whose contract is declared by the composite:interface in which this element is nested exposes an implementation of ValueHolder suitable for use as the target of attached objects in the using page.
composite:editableValueHolderDeclares that the composite component whose contract is declared by the composite:interface in which this element is nested exposes an implementation of EditableValueHolder suitable for use as the target of attached objects in the using page.
composite:actionSourceDeclares that the composite component whose contract is declared by the composite:interface in which this element is nested exposes an implementation of ActionSource2 suitable for use as the target of attached objects in the using page.

For more information and a complete list of Facelets composite tags, see the documentation at http://download.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/.

Java Tutorial Highlights - JSF Templating

From the Java Tutorial here.

JavaServer Faces technology provides the tools to implement user interfaces that are easy to extend and reuse. Templating is a useful Facelets feature that allows you to create a page that will act as the base, or template, for the other pages in an application. By using templates, you can reuse code and avoid recreating similarly constructed pages. Templating also helps in maintaining a standard look and feel in an application with a large number of pages.

Table 5-2 lists Facelets tags that are used for templating and their respective functionality.



Table 5-2 Facelets Templating Tags



















































TagFunction
ui:componentDefines a component that is created and added to the component tree.
ui:compositionDefines a page composition that optionally uses a template. Content outside of this tag is ignored.
ui:debugDefines a debug component that is created and added to the component tree.
ui:decorateSimilar to the composition tag but does not disregard content outside this tag.
ui:defineDefines content that is inserted into a page by a template.
ui:fragmentSimilar to the component tag but does not disregard content outside this tag.
ui:includeEncapsulate and reuse content for multiple pages.
ui:insertInserts content into a template.
ui:paramUsed to pass parameters to an included file.
ui:repeatUsed as an alternative for loop tags, such as c:forEach or h:dataTable.
ui:removeRemoves content from a page.

For more information on Facelets templating tags, see the documentation at http://download.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/.

The Facelets tag library includes the main templating tag ui:insert. A template page that is created with this tag allows you to define a default structure for a page. A template page is used as a template for other pages, usually referred to as client pages.

Facelets Tutorial Highlights

Facelets Tutorial Highlights from here.

The term Facelets refers to the view declaration language for JavaServer Faces technology. JavaServer Pages (JSP) technology, previously used as the presentation technology for JavaServer Faces, does not support all the new features available in JavaServer Faces 2.0. JSP technology is considered to be a deprecated presentation technology for JavaServer Faces 2.0. Facelets is a part of the JavaServer Faces specification and also the preferred presentation technology for building JavaServer Faces technology-based applications.

What Is Facelets?




Facelets is a powerful but lightweight page declaration language that is used to build JavaServer Faces views using HTML style templates and to build component trees. Facelets features include the following:

  • Use of XHTML for creating web pages

  • Support for Facelets tag libraries in addition to JavaServer Faces and JSTL tag libraries

  • Support for the Expression Language (EL)

  • Templating for components and pages


JavaServer Faces technology supports various tag libraries to add components to a web page. To support the JavaServer Faces tag library mechanism, Facelets uses XML namespace declarations. Table 5-1 lists the tag libraries supported by Facelets.



Table 5-1 Tag Libraries Supported by Facelets













































Tag LibraryURIPrefixExampleContents
JavaServer Faces Facelets Tag Libraryhttp://java.sun.com/jsf/faceletsui:ui:component

ui:insert
Tags for templating
JavaServer Faces HTML Tag Libraryhttp://java.sun.com/jsf/htmlh:h:head

h:body

h:outputText

h:inputText
JavaServer Faces component tags for all UIComponents
JavaServer Faces Core Tag Libraryhttp://java.sun.com/jsf/coref:f:actionListener

f:attribute
Tags for JavaServer Faces custom actions that are independent of any particular RenderKit
JSTL Core Tag Libraryhttp://java.sun.com/jsp/jstl/corec:c:forEach

c:catch
JSTL 1.1 Core Tags
JSTL Functions Tag Libraryhttp://java.sun.com/jsp/jstl/functionsfn:fn:toUpperCase

fn:toLowerCase
JSTL 1.1 Functions Tags

In addition, Facelets supports tags for composite components for which you can declare custom prefixes. For more information on composite components, see Composite Components.

Further Information about JavaServer Faces Technology

For more information on JavaServer Faces technology, see

Java EE 6 - JavaServer Faces Technology 2.0 - Tutorial Highlights

These are my notes from the Java Tutorial located here.

What Is a JavaServer Faces Application?


The functionality provided by a JavaServer Faces application is similar to that of any other Java web application. A typical JavaServer Faces application includes the following parts:

  • A set of web pages in which components are laid out

  • A set of tags to add components to the web page

  • A set of managed beans, which are lightweight container-managed objects (POJOs) with minimal requirements. They support a small set of basic services, such as resource injection, lifecycle callbacks and interceptors.

  • A web deployment descriptor (web.xml file)

  • Optionally, one or more application configuration resource files, such as a faces-config.xml file, which can be used to define page navigation rules and configure beans and other custom objects, such as custom components

  • Optionally, a set of custom objects, which can include custom components, validators, converters, or listeners, created by the application developer

  • A set of custom tags for representing custom objects on the page


Figure 4-1 shows the interaction between client and server in a typical JavaServer Faces application. In response to a client request, a web page is rendered by the web container that implements JavaServer Faces technology.

The web page, myfacelet.xhtml, is built using JavaServer Faces component tags. Component tags are used to add components to the view (represented by myUI in the diagram), which is the server-side representation of the page. In addition to components, the web page can also reference objects, such as the following:

  • Any event listeners, validators, and converters that are registered on the components

  • The JavaBeans components that capture the data and process the application-specific functionality of the components


On request from the client, the view is rendered as a response. Rendering is the process whereby, based on the server-side view, the web container generates output, such as HTML or XHTML, that can be read by the client, such as a browser.



---------------------------------------------------------------------------------------

Creating a JavaServer Faces Application




Developing a simple JavaServer Faces application typically requires the following tasks:

  • Developing managed beans --
    Components in a page are associated with managed beans that provide application logic.

  • Creating web pages using component tags --
    In a typical Facelets application, web pages are created in XHTML. The example web page, beanhello.xhtml

  • Mapping the FacesServlet instance --
    The final task requires mapping the FacesServlet, which is done through the web deployment descriptor (web.xml). A typical mapping of FacesServlet is as follows:
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

    The preceding file segment represents part of a typical JavaServer Faces web deployment descriptor. The web deployment descriptor can also contain other content relevant to a JavaServer Faces application configuration, but that information is not covered here.
    Mapping the FacesServlet is automatically done for you if you are using an IDE such as NetBeans IDE.

Java EE 6 Tutorial Highlights

These are highlights from the Java EE 6 Tutorial located here.

Web components and static web content files, such as images, are called web resources. A web module is the smallest deployable and usable unit of web resources. A Java EE web module corresponds to a web application as defined in the Java Servlet specification.

In addition to web components and web resources, a web module can contain other files:

  • Server-side utility classes, such as shopping carts

  • Client-side classes, such as applets and utility classes


A web module has a specific structure. The top-level directory of a web module is the document root of the application. The document root is where XHTML pages, client-side classes and archives, and static web resources, such as images, are stored.

The document root contains a subdirectory named WEB-INF, which can contain the following files and directories:

  • classes: A directory that contains server-side classes: servlets, enterprise bean class files, utility classes, and JavaBeans components

  • tags: A directory that contains tag files, which are implementations of tag libraries

  • lib: A directory that contains JAR files that contain enterprise beans, and JAR archives of libraries called by server-side classes

  • Deployment descriptors, such as web.xml (the web application deployment descriptor) and ejb-jar.xml (an EJB deployment descriptor)


A web module needs a web.xml file if it uses JavaServer Faces technology, if it must specify certain kinds of security information, or if you want to override information specified by web component annotations.

You can also create application-specific subdirectories (that is, package directories) in either the document root or the WEB-INF/classes/ directory.

A web module can be deployed as an unpacked file structure or can be packaged in a JAR file known as a Web Archive (WAR) file. Because the contents and use of WAR files differ from those of JAR files, WAR file names use a .war extension. The web module just described is portable; you can deploy it into any web container that conforms to the Java Servlet specification.

Java EE 6 - Tutorial on Faces 2.0

http://download.oracle.com/javaee/6/tutorial/doc/bnadp.html

Oracle JDeveloper and Oracle ADF 11g Release 2 (11.1.2.x): New Features

Oracle Link --- September 22, 2011

http://www.oracle.com/technetwork/developer-tools/jdev/jdev-11gr2-nf-404365.html

Auto Draft

Friday, October 21, 2011

ADF View Links ---

Oracle ADF view links are business components that define a relationship between two Oracle ADF view object definitions (the "source" and "destination" view objects) based on sets of view attributes (the "source" and "destination" attributes) from each. These can range from simple one-to-many relationships to complex many-to-many relationships. This allows you to easily create master/detail relationships between data controls in the client. For example, creating a view link between view objects will allow you to create relationships between:

  • A dropdown list for selecting a customer and a table displaying that customer's orders

  • The nodes in a tree control and their respective children

  • An HTML page containing two frames: one that allows the user to browse for items and the other that lists the wherehouses in which the selected item is stored


http://www.adftips.com/2010/10/adf-model-creating-view-link.html

Auto Draft

Auto Draft

Thursday, October 20, 2011

Installing JDeveloper Extensions Locally

Shay Shmeltzer: http://blogs.oracle.com/jdeveloperpm/entry/installing_jdeveloper_extensions_locally


To install an extension follow these simple steps:

  • Locate the extension that you are after in the above mentioned URLs

  • Download the extension to your machine (the extension will be packaged as a zip file - don't unzip the extension).

  • In JDeveloper use the help->check for updates and instead of choosing from the existing update centers choose the "Install From Local File" option, and point to the zip file you have downloaded.

  • Restart JDeveloper to complete the extension installation.

Wednesday, October 19, 2011

cant get into “My Documents and Settings" - Windows 7

Microsoft says:

the “My Documents and Settings“, has been replaced by "Users".  Each user account will then have Documents, Pictures, videos etc.  Note the "My" designation is no longer used.  These junction points exist to provide backwards compatibility for older programs that are unaware of the new folder structure.  A program that is hardcoded to install files in the old Documents and Settings will be silently redirected to the new location.

AND---

..\Documents and Settings\<username>\Local Settings\ is redirected to
..\Users\<username>\AppData\Local as per Application Compatibility: Junction Points and Backup Applications

Tuesday, October 18, 2011

Installing JDeveloper under windows

Good outline by Chris Muir - albeit older / JDeveloper 11g v11.1.1.2.0

http://java.sys-con.com/node/1499794

Note Chris suggest priming the Web Logic server.

Remove older version of Java - Yea

From Here: http://www.java.com/en/download/faq/remove_olderversions.xml

Windows 7 and Vista - Uninstall Programs
1.Click Start
2.Select Control Panel
3.Select Programs
4.Click Programs and Features
5.Select the program you want to uninstall by clicking on it, and then click the Uninstall button.
You may need administrator privileges to remove programs.

Windows XP - Uninstall Programs
1.Click Start
2.Select Control Panel
3.Click the Add/Remove Programs control panel icon
4.The Add/Remove control panel displays a list of software on your system, including any Java software products that are on your computer. Select any that you want to uninstall by clicking on it, and then click the Remove button.

What version of Java am I using??? — Windows

in the command promp type:

java -version

Saturday, October 15, 2011

Installing Java - what is the ml in / java_ee_sdk-6u3-jdk-XXXXXX-x64-ml.exe

The ml indicates this release provides multilingual support.

enable and view the Java Console

From: http://www.java.com/en/download/help/javaconsole.xml

Enabling the Java Console:

  1. Click Start

  2. Select Settings

  3. Select Control Panel.

  4. Double click the Java icon.

  5. Click the Advance tab.

  6. Click on the sign

  7. Select Show Console and click Apply.

Auto Draft