Experiencias Usando la Tecnología ADF
Upcoming SlideShare
Loading in...5
×
 

Experiencias Usando la Tecnología ADF

on

  • 3,306 views

Presentación de Plinio Arbizu (@oramexico) en #OTNLADTour

Presentación de Plinio Arbizu (@oramexico) en #OTNLADTour

Statistics

Views

Total Views
3,306
Views on SlideShare
3,306
Embed Views
0

Actions

Likes
1
Downloads
71
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Oracle JDeveloper 10 g : Application Development Framework (ADF) The Oracle ADF architecture follows the MVC design pattern, enabling developers to cleanly separate: Business logic and data access User interface Application flow
  • Oracle JDeveloper 10 g : Application Development Framework (ADF) The Oracle ADF architecture follows the MVC design pattern, enabling developers to cleanly separate: Business logic and data access User interface Application flow
  • Oracle JDeveloper 10 g : Application Development Framework (ADF) The Oracle ADF architecture follows the MVC design pattern, enabling developers to cleanly separate: Business logic and data access User interface Application flow
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 1 - Technology Choices for ADF BC Applications In this course, you employ the MVC architecture through the use of Oracle ADF and JavaServer Faces: Business Services: ADF Business Components (ADF BC) provides the business services that are responsible for representing database tables and persisting user input values to the database. Model: ADF data binding is accomplished in compliance with JSR-227, a standard data binding and data access facility for Java EE that provides a standard for interactions between UI components and methods available on the business services. With this standard data binding, any Java UI rendering technology can declaratively bind to any business service. Controller: ADF Controller View: Java ServerFaces and ADF Faces; render kits enable the UI components defined by Java ServerFaces or ADF Faces to be rendered differently on different devices. For example, the UI can be rendered on a computer’s browser or on a mobile device such as a cell phone or PDA. Metadata Service: ADF BC applications can also use Metadata Service (MDS) for customization and personalization. This is outside the scope of this course.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 3 - ADF Business Components Oracle ADF Business Components (ADF BC) provides building blocks that help you to create the business services part of your application. That is, it governs interaction between the rest of the application and the data stored in the data source, providing validation, specific services, and other business logic. With ADF BC you can: Write and enforce business application logic in a central way Author and test business logic in components that automatically integrate with databases Reuse business logic in multiple applications and application tasks Access updatable views of business data that are tailored to specific tasks Access and update the views from browser, desktop, mobile, and Web service clients Maintain and modify the business functionality in layers, without requiring modification of the delivered application ADF Business Components are implemented in metadata that you write by using wizards and that you edit declaratively. You can optionally expose framework code to add functionality if needed.
  • 1,2. De manera mensual, es necesario conocer el estado de la ventas y los pronósticos para el año de trabajo, por ello es necesario todo un proceso de análisis de la información la cual se realiza utilizando hojas de cálculo. Este proceso produce que la manipulación de dichos archivos produzca que la información sea vulnerable de ser modificable. 3. Al usar hojas de cálculo para consolidar sus ventas, provoca la necesidad de realizar la carga manual de datos, lo que involucra un tiempo adicional de trabajo. 4. Para elaborar las hojas de cálculo, muchas veces se recurre a muchas versiones de las hojas de cálculo, lo que provoca un mayor riesgo en mantener segura la información 5. Dado que es necesario analizar la información obtenida considerando diversos indicadores, se hace necesaria el procesamiento de la información capturada para poder visualizarla en diferentes formatos
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 1 - Technology Choices for ADF BC Applications In this course, you employ the MVC architecture through the use of Oracle ADF and JavaServer Faces: Business Services: ADF Business Components (ADF BC) provides the business services that are responsible for representing database tables and persisting user input values to the database. Model: ADF data binding is accomplished in compliance with JSR-227, a standard data binding and data access facility for Java EE that provides a standard for interactions between UI components and methods available on the business services. With this standard data binding, any Java UI rendering technology can declaratively bind to any business service. Controller: ADF Controller View: Java ServerFaces and ADF Faces; render kits enable the UI components defined by Java ServerFaces or ADF Faces to be rendered differently on different devices. For example, the UI can be rendered on a computer’s browser or on a mobile device such as a cell phone or PDA. Metadata Service: ADF BC applications can also use Metadata Service (MDS) for customization and personalization. This is outside the scope of this course.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 11 - Tracing Data Binding: From Database to Databound Components It is easy for you as a developer to create databound components, but it is helpful for you to also understand what goes on behind the scenes to enable this simplicity. This slide illustrates the source of data that appears on the page. Its ultimate source in an ADF BC application is a table in the database. An ADF BC entity object represents that table, and a developer creates an ADF BC view object to present a specific view of the EO data that is required by an application. The developer exposes the VO to an application in an ADF BC application module. When you create an AM, JDeveloper automatically creates a data control for it. You then bind data on a page to elements in the data control, thus enabling access to the back-end ADF BC entity object, and through that to the database table. The next several slides examine the concept of data binding in more detail, expounding upon the bottom portion of the above slide.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 11 - Using the Data Controls Panel The Data Controls panel shows all the data controls that have been created for the application’s business services and exposes all the data objects, data collections, methods, and operations that are available for binding to UI components. A different icon is used for each type of data control object. Each root node in the Data Controls panel represents a specific data control. Under each data control is a hierarchical list of objects, collections, methods, and operations. How this hierarchy appears on the Data Controls panel depends on the type of business service represented by the data control and how it was defined. When you use technologies other than ADF Business Components (ADF BC) for the business model, then you must explicitly create data controls for the business service. However, ADF BC automatically creates a data control for each application module in an application. The Data Controls panel enables you to easily create databound components on a page. When you drag a data element to a page, you are given a choice of the type of component to use to contain the data element, based on whatever is appropriate for that particular element. Dragging a collection, such as a view object, to the page gives you the choice of creating the component as an ADF form, table, graph, single selection, tree, navigation component, or geographic map. When you select a category, you are presented with additional choices. After you select a component, JDeveloper automatically creates the various code and objects needed to bind the component to the data control that you selected.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 11 - Expression Language and Bindings When you use the Data Controls panel to create a component, the ADF data binding expressions are created for you. The expressions are added to every component attribute that displays data from or references properties of a binding object. Each expression references the appropriate binding objects defined in the page definition file, the file that contains data bindings for a page. You can edit these binding expressions or create your own, as long as you adhere to the basic ADF binding expression syntax. ADF data binding expressions can be added to any component attribute that you want to populate with data from a binding object. In JSF pages, a typical ADF data binding EL expression uses the following syntax to reference any of the different types of binding objects in the binding container: #{bindings. BindingObject . propertyName } where: bindings is a variable that identifies that the binding object being referenced by the expression is located in the binding container of the current page. All ADF data binding EL expressions must start with the bindings variable.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 11 - Data Binding Objects and Metadata Files All of the bindings used by a particular page or form are grouped in a binding container. In general there is one binding container per page or form. The binding context is the handle through which the client accesses the data binding layer. The DataBindings.cpx file maps each page to its page definition file and the data controls it uses. It lists all of the data controls that are in use. The page definition file is created automatically the first time you create a binding in a page. Alternatively, if you select “Go to Page Definition” for a page that does not currently have a page definition, you are prompted to create the page definition file. Page definition files are named pagename PageDef.xml . If you rename a page definition file you must also change the name of the file in DataBindings.cpx . Use the Refactor  Rename  operation to perform a consistent rename. Each binding context, binding container, and data control has its own metadata file. A metadata file is a .xml file that contains all the application-specific information that the ADF model run time needs. Note that ADF BC is different from other data controls in that it does not have a Data Controls definition file, because each application module automatically becomes a data control.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 12 - Bounded and Unbounded ADF Task Flows: Example The example in the slide shows: An unbounded task flow that consists of two pages; there is no entry or exit point in this task flow. It defines the “top level” flow. The CheckoutFlow bounded task flow, which is a train with a single entry and two exit points. It also includes a global control flow rule. A typical application is a combination of an unbounded and one or more bounded task flows. The application can then call bounded task flows from activities within the unbounded task flow. You can include bounded task flows in a top-level (unbounded) task flow diagram. This has various advantages over putting everything in one diagram: It breaks the diagram into modules and makes it more readable. The individual modules (bounded task flows) make it easier for multiple developers to work on pieces of the application. Bounded task flows can be reused by other application developers.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 1 - Technology Choices for ADF BC Applications In this course, you employ the MVC architecture through the use of Oracle ADF and JavaServer Faces: Business Services: ADF Business Components (ADF BC) provides the business services that are responsible for representing database tables and persisting user input values to the database. Model: ADF data binding is accomplished in compliance with JSR-227, a standard data binding and data access facility for Java EE that provides a standard for interactions between UI components and methods available on the business services. With this standard data binding, any Java UI rendering technology can declaratively bind to any business service. Controller: ADF Controller View: Java ServerFaces and ADF Faces; render kits enable the UI components defined by Java ServerFaces or ADF Faces to be rendered differently on different devices. For example, the UI can be rendered on a computer’s browser or on a mobile device such as a cell phone or PDA. Metadata Service: ADF BC applications can also use Metadata Service (MDS) for customization and personalization. This is outside the scope of this course.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 16 - Reusing Components In the course of application development, certain components are often used more than once. Whether the reuse happens within the same application, or across different applications, it is often advantageous to package these reusable components into a library that can be shared between different developers, across different teams, and even across departments within an organization. ADF Library provides a convenient and practical way to create, deploy, and reuse high-level components. You should design your application with component reusability in mind. If you created components that can be reused, you can package them into JAR files and add them to a resource catalog. If you need a component, you may look into the resource catalog for that component and then add the library into your project or application. For example, you can create an application module for a domain and package it up to be used as the model project in several different applications. Or, if your application consumes components, you may be able to load a page template component from a repository of ADF Library JARs to create common look-and-feel pages. Then you can put your page flow together by stringing several task flows components pulled from the library.
  • Oracle Fusion Middleware 11 g : Build Applications with ADF I 16 - Creating an ADF Library A project corresponds to one ADF Library JAR. If you create multiple projects and want to reuse components from each of the projects, you may need to create an ADF Library JAR for each project. In other situations, you may be able to involve multiple components under one project to create a single ADF Library JAR. For example, you may be able to create business components, application module, task flow, and page template all under one project and create one ADF Library JAR. To package and deploy a project into the ADF Library JAR, perform the following steps: 1. In the left pane of the Project Properties window for the project that contains the component you want to make reusable, select Deployment and then click New. 2. In the Create Deployment Profile dialog box, select ADF Library JAR file for Archive Type drop-down list and enter a name for the deployment profile. Click OK. 3. Edit the profile you just created. In the ADF Library JAR Deployment Profile Properties dialog box, verify the default directory path or enter a new path to store your ADF Library JAR file. Click OK, and then click OK again. 4. In the Application Navigator, right-click the project and select the followng: from the context menu Deploy > deployment > to ADF Library, where deployment is the name of the deployment profile

Experiencias Usando la Tecnología ADF Experiencias Usando la Tecnología ADF Presentation Transcript

  • Plinio Arbizu – Oracle Ace Director
  • ◦ Definición de la Arquitectura ADF.◦ Metodología de Desarrollo◦ Recomendaciones Equipos de Trabajo◦ Recomendación en el modelado de BD◦ Recomendaciones en la capa de modelo◦ Recomendaciones en la capa de control◦ Recomendaciones en la capa de Vista◦ Recomendaciones en el manejo de Versiones◦ Recomendaciones Generales
  • Plinio Arbizu Oracle ACE Director Coautor del libro Web 2.0 solutions with Oracle WebCenter Certificado : ◦ Oracle ADF Certified Implementation Specialist ◦ Oracle WebCenter Portal 11g Certified Implementation Specialist Líder del Grupo de Usuarios Oracle en México (ORAMEX) Consultor de S&P Solutions de México Instructor de Oracle University en Perú
  • ◦ Es un meta-framework que integra diversos frameworks para el desarrollo de soluciones◦ Reduce la complejidad de los desarrollos J2EE brindando un desarrollo visual y declarativo◦ Basado en Java y XML◦ Incrementa el desarrollo productivo  Menos codificación y mayor rehúso  Enfocado en la aplicación y no en lo “Accesorios”◦ Promueve el uso de buenas practicas J2EE implementando Patrones de Diseño J2EE (MVC)
  • Desktop Browser-basedADF Swing Office JSP JSF ADF Faces / DVT View Controller Struts JSF/ADF Task Flow ADF Bindings (JSR 227) ModelJava EJB BAM BPEL Web ADF BC BI Essbase Portlets Services Business TopLink Services Data Relational XML Data Legacy Data Packaged Services Data Apps
  • Metodología de DesarrolloDesarrollar 1 Application 2 Capa de Modelo (Business Components) • Persistent Business Object • View Object • Application Module 3. Capa Controller • Crear el Flujo de páginas 4. Capa de Vista • 7- Crear la página JSF5. Correr la aplicación Desarrollo Gradual
  •  Conocimientos básicos: Java, PL-SQL, JSF. Conocimiento del manejo de versiones Sí va a cambiar el diseño, Diseñador WEB. Incluir un Administrador de Weblogic. Puede incluir recien egresados para labores sencillas. Alineados a usar ADF (Decl + Progr)
  •  Normalizar Usar Sequence y Triggers para los Primary Keys. Un diseño generico impacta en los desarrollos. Se puede usar Store Procedures, pero no priorizarlo. No es necesario crear vistas de BD. Nombrado afecta el mapeo de componentes.
  •  Enterprise Java Beans (EJB)  Estándar JavaEE  Orientado a Objetos TopLink  Maduro  Orientado a Objeto Java Beans  Flexible ADF Business Components  Default  Soporta características OO, Perspectiva Relacional
  • ◦ Brinda interacción de datos y implementación de reglas de negocio.◦ Mapea las fuentes de datos, ejem : Oracle DB, MySql, etc,(JDBC Driver).◦ Permite un desarrollo 4GL  Asistente y un desarrollo Visual  Implementado en metada, no código◦ Permite la codificación de lógica de negocio.
  • Contenedores de Presentación Lógica deHTML, Java, and Aplicaciones y y Manipulación NegocioXML Interfaces Servicios de Datos L XM Application View Entity Sistema de Alumnos Cursos MATH Alumnos Matriculas - matricular() Cursos Profesores Activos Profesores
  • Empieza con sus tablas
  • Desarrolle sus Entidades que encapsulen su lógica denegocio
  • Elabore sus ViewObjects queprepara la data para lainteracción con clientes Externos
  • Desarrolle su Aplication Moduleque incluya las VO’S necesariasen su Aplicación
  • Finalmente desarrolle su capa dePresentación en la tecnología desu preferencia JSF,ADF Faces
  •  Validaciones Declarativas
  •  Validaciones Declarativas
  •  Lista de Valores 1 3 2 4
  •  Ideal para colocar lógica Maneja Transacciones por Default Maneja su propio pool de conexión datos Cuenta con su propio cache de entidad.
  •  Crear un sólo application module para la aplicación Crear varios application module aislados  Se utiliza más conexiones a la base de datos  No se preserva el mismo cache de entidad
  •  Se maneja un application module root Se cuenta con varios modulos de aplicación “Hijos” asociados a un caso de uso. Todos comparte el pool de conexiones y el cache de entidades
  • public void incrementarPrecio(int porcentaje){Row fila = this.getProductoVO1().first(); while (fila !=null) { float precio = ((Number)fila.getAttribute("Precio")).floatValue(); float nuevoPrecio = precio * (100+ porcentaje)/100 ; fila.setAttribute("Precio", new Number(nuevoPrecio)); fila = this.getProductoVO1().next(); }this.getDBTransaction().commit();}
  •  Mantenga los tipos de datos que sugiere el asistente Aproveche las validaciones declarativas y las asociaciones Los View Object puede ser basados en SQL, aproveche los view criterias y las listas de valores Modularizar sí tiene una aplicación grande Usar Nested Aplication Module (Nested) Usar un App module por conexion a DB
  • Desktop Browser-basedADF Swing Office JSP JSF ADF Faces / DVT View Controller Struts JSF/ADF Task Flow ADF Bindings (JSR 227) ModelJava EJB BAM BPEL Web ADF BC BI Essbase Portlets Services Business TopLink Services Data Relational XML Data Legacy Data Packaged Services Data Apps
  • Database table ADF BC ADF BC ADF BC Entity Object View Object Application Module ADF Model Databound components on a JSP Binding Container Data Control
  •  Data Controls panel: ◦ Es una representación de la capa de business service que contiene  Métodos  Parametros y valores de retorno  Atributos  Colecciones ◦ Se genera automáticamente basado en cada módulo de aplicaciones.
  • Executables- IteradoresBindings- Value Bindigs- Action Bindings- Tree Bindings- Etc
  • ◦ Las expressiones asociadas a los bindings son escritas usando EL.◦ Estas son evaluadas en tiempo de ejecución para determinar que mostrar◦ ADF EL expressions tipicamente tienene esta forma: #{bindingVariable.BindingObject.propertyName}  Ejemplo de un inputText component en una página JSF <af:inputText value="#{bindings.Ename.inputValue}” label="#{bindings.Ename.label}” required="#{bindings.Ename.mandatory}">
  • Structure Page definition file Binding Data definition Container Control file *.xml*PageDef.xml Binding Context Data Controls definition file Binding context definition file DataControls.dcx DataBindings.cpx
  • public String calcular() { // Add event code here... BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry(); AttributeBinding dato= (AttributeBinding)bindings.getControlBinding("empleadoParametro"); AttributeBinding resultado = (AttributeBinding)bindings.getControlBinding("totalResultado"); OperationBinding operationBinding = bindings.getOperationBinding("obtenerTotal"); Map parametros = operationBinding.getParamsMap(); parametros.put("cod", dato.getInputValue()); Double retorno= (Double)operationBinding.execute(); resultado.setInputValue(retorno); if (!operationBinding.getErrors().isEmpty()) { } return null; }
  •  Controle los descriptores en las integraciones. Los Bindigs también se programan. ( Ver más adelante) Inicialmente use siempre bindings para acceder a los business Manipule los bindigs según sus necesidades. Inicialmente use esta formade integración
  •  ADF task flows son unidades lógicas de flujos de paginas ◦ Ofrece ventajas sobre los flujos JSF :  La aplicación puede ser dividida en tareas (Task)  Puede contener otros tipos de elementos además de páginas  Reusables  Comparte el mismo scope de memoria. ◦ Pueden ser del tipo unbounded o bounded
  • UnBounded Task Flow Registro Confirma login Venta VentaPrincipal Clientes
  • UnBounded Task Flow Bounded Task Flow Registro Confirma Venta Venta login Principal Clientes
  • Bounded Task FlowUnBounded Task Flow Confirma Venta Valid ar Registro tarjet a? Venta Rechaza login Venta Principal Clientes
  • Usando Páginas UnBounded Task Flow ( adfc – config) Registro Confirma login Venta Venta Principal Registro Confirma Compra Compra
  • Usando Fragmentos UnBounded Task Flow ( adfc – config) Principal.jspx login Flujo de Venta, Compra.. (bounded - fragmentos)
  •  Usar un sólo flujo unbounded (adfc-config.xml) Modularizar las páginas en flujos del tipo bounded Los elementos de los flujos son reusables (doble reuso) Recuede que no son sólo pagínas sino pueden ser decisiones ó invocación a metodos. Puede usar páginas ó fragmentos Fragmentos son altamente reusables y pueden ser exportados a componentes personalizables ó portlets
  • Desktop Browser-basedADF Swing Office JSP JSF ADF Faces / DVT View Controller Struts JSF/ADF Task Flow ADF Bindings (JSR 227) ModelJava EJB BAM BPEL Web ADF BC BI Essbase Portlets Services Business TopLink Services Data Relational XML Data Legacy Data Packaged Services Data Apps
  •  Deberá crear su template El trabajo se realiza basado en Layout (Contenedores) ◦ Panel Group Layout (Horizontal, Vertical) ◦ Panel Form Layout (Almacenar componentes en formato formulario) Existe una gran variedad de componentes “out of the box” (Combos, Input Text, Grillas) ◦ Generalmente sugeridos por el asistente. Generalmente se utiliza un managed bean para soportar los eventos de la página. ◦ Los eventos ó Listeners dependen del componente
  •  ADF Library permite que reuse componentes: ◦ Se empaqueta en un ADF Library JAR files. ◦ Incluya estos en un catalogo de recursos. ◦ Incluya la libreria en el proyecto que usted este trabajando
  • 1 32 4
  •  Todo es Java y XML Utilice SVN, se integra a Jdeveloper Puede hacer commit, update, revert Puede comparar su versión contra la que esta desplegada en el server..
  •  Defina un integrador que sea el encargado de los despliegues y archivos sensibles Cuide archivos “Sensibles” ◦ adfc_config.xml ◦ Databindings.cpx ◦ Proyectos (*.jpr) ◦ Faces_config.xml Si esta empezando, cree el esqueleto del proyecto y que los desarrolladores sólo hagan actualizaciones
  •  ADF es un framework integral para realizar aplicaciones de negocio ADF no es un framework para hacer sólo mantenimientos ADF trabaja declarativamente y programaticamente ADF permite personalizar. No es rigido. ADF soporte el trabajo de aplicaciones “Grandes”. ADF permite el trabajo de equipos. ADF es la base de Fusion y puede ser el inicio para escalar a otras tecnologías (WebCenter, BPM, Applications)
  • www.oracle.com/technetwork/jdev• Tutorials• Demos• Software• Discussions• Blogs• And moreplinioa.blogspot.com• Curso en Español• Artículos (avanzado)• Eventos
  • Preguntas y Respuestas