Custom Java Bind Variable in a Where Clause of an ADF View Object

You can make a JDeveloper model View Object (VO) use a data query that has a custom variable accessor in Java.  This is useful for cases where you want your where clause to select based on the current user name from the ADF Security context.

Go to the “Query” tab of your view object:


Add a new Bind Variable and make sure to specify “Expression” and give the value the Groovy expression “adf.object.viewObject.yourPropertyName”.  The “adf.object.viewObject” portion is essentially like saying “this object” and then it will call getYourPropertyName() to fetch the value:


Back in your query expression, refer to this new bind variable by its name but prepend “:” to indicate that it is a bind variable as shown above.

Select the “Java” tab of your view object and then click the pencil icon to edit the settings:


Select the “Generate View Object Class” and “Include bind variable accessors” options:


This will generate a new “.java” entry under your view object in the JDeveloper application navigator:


Finally, open that Java file and change the implementation of your get accessor as you wish.  In my case, I am simply returning the user name property from the ADF security context.  I also changed my set accessor to do nothing:

Últimas Noticias

Actualmente aumentar la  productividad y la competitividad empresarial es cada vez una tarea...
https://listacasas.com Uno de los portales inmobiliarios más conocidos de Guatemala...
Nuevo proyecto realizado por Infoacp, una web en prestashop : https://wiwi-pc.es En wiwi-pc...
More inNoticias  

Documentos Recientes

Categorías

Linkedin Twitter Facebook Youtube
Copyright (c) InfoAcp 2013. All rights reserved. Mantenimiento Informático
Infoacp Empresa de Informática, diseño gráfico, desarrollo de aplicaciones de gestión, Odoo, Contratos de mantenimiento informatico
Diseño y soluciones TIC Infoacp S.L.
Murcia Murcia 30007 España
Localización: 37.9956589, -1.1284899
868 70 76 94
informática, diseño gráfico, reparación de ordenadores, reparación de portatiles, reparación de móviles, programas de gestión para empresas, odoo, desarrollo odoo, programacion odoo, contratos de mantenimiento informatico