Skip to main content

Posts

Showing posts with the label OracleADF

RIDC API to access WebCenter Content

Fix: Missing RIDC libs issue for 12c Earlier (prior to 12c) all the Webcenter Extensions use to be shipped and installed to JDeveloper by just installing Webcenter Extensions to that specific version of JDeveloper but with the latest 12c (12.2.1.3) release there are lot of missing parts in the extensions. After installing extension you pretty much get features to skin the applications and to add, manage custom task-flows. Few of my current applications which are in the process of migration heavily use Webcenter Content I must say all of our content pretty much sits there so upon working my way through documents i found a fix which I got confirmed from the official support team as well to use it. FIX:  Get the extension with name "oracle.ucm.ridc-jdev.zip" from the below location in WebCenter Content Server: $MW_HOME/oracle_common/ucm/Distribution/RIDC/jdev Install the extension to Jdeveloper as below: Help -> Updates Once the extension is installed ...

ADF Best Practices: Let's do it better

We may happen to implement things in the wrong way and see an expected output, which may break or degrade the performance of the application later. I planned to blog the best practices i come across everyday and from resources  i follow. Also i'll be more than happy if you can contribute to this project or correct me through comments: 1. Do not prefix managed bean EL expression every-time with a specific scope: Sometimes it's good to not specify scope when referencing managed beans in expression language. Never prefix for default servlet scope (requestScope, sessionScope and applicationScope). By prefixing the scope you bypass the JavaServer Faces managed bean facility(handles creation and initializing of managed beans). When scope is prefixed it will only look for in-memory objects and does not instantiate managed beans possibly throwing an NPE. ADF specific scopes (backingBeanScope, viewScope and pageFlowScope) should've a prefix. These scopes are handled by the ADF c...

Part I: Migrating to 12c not so easy - Oracle ADF Jdeveloper 12c Findings

This post is part of 12c Migration project which lists all updates and deprecated stuff in 12c from its predecessors. These are all known findings so far I'll try to update this as I come across new stuff, bugs or fixes: Java8 👏👏👏👏 - you know what it means 👼 No Groovy Expression to Generate Sequence: Common requirement is to use a database sequence to populate key attribute and you can achieve this by adding a groovy expression to the expression tab of attribute in entity object. (new oracle.jbo.server.SequenceImpl("YOUR_SEQUENCE_NAME", adf.object.getDBTransaction())).getSequenceNumber() Trying to use the same logic in 12C will result in following runtime exception: JBO-25152: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted. Here's a quick fix for this issue: Open EO in the source view. Search for trustMode. Change trustMode="untrusted" to trustMode="trusted". R.I.P  InvokeAction, comman...

Set BIND VARIABLE and EXECUTE QUERY programmatically in ADF

A very common scenario in ADF is to set a bind variable and execute query programmatically within AMImpl/ VOImpl classes. Here's a simple way to do this: To set bind variable for all rowsets:       ViewObjectImpl someVO = this.getSomeViewObject();       VariableValueManager vMngr = someVO.ensureVariableManager();        vMngr.setVariableValue("DefinedBindVariable",value);        someVO,executeQuery(); To set bind variable for default rowset:          ViewObjectImpl someVO = this.getSomeViewObject();          someVO.setNamedWhereClauseParam("DefinedBindVariable",value);          someVO,executeQuery();

Stored Procedures in ADF

One of the common requirements for ADF programmers is to invoke Stored Procedures and Functions. Implementing this is so simple with few lines of code in Java classes used under business components. Following code snippets from fusion guide  will help execute different procedures with and without arguments. Execute stored procedure with No Arguments: public void callProcWithNoArgs() { getDBTransaction().executeCommand( "begin devguidepkg.proc_with_no_args; end;"); } Execute stored procedure with only IN arguments: Procedures often take arguments in order to process some business logic. Arguments are limited from none to many. In order to use stored procedures with argument mode we need to use JDBC PreparedStatement object. How To: Create connection Create a JDBC PreparedStatement with procedure details wrapped in a PL/SQL begin..end block. Assign the values to arguments if any. Execute the statement. Close the statement. protected void callStoredPr...

Handy code snippets: Oracle ADF

Get Binding Container: BindingContainer bind = BindingContext.getCurrent().getCurrentBindingsEntry(); Call and refresh Iterator from UI (Managed Bean): DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding iterBinding = bindings.findInteratorBinding("IteratorName"); iterBinding.executeQuery(); Get all rows from iterator: Row[] rows = iterBinding.getAllRowsInRange(); Call MethodAction:  BindingContainer binding = BindingContext.getCurrent().getCurrentBindingsEntry(); OperationBinding opBinding = binding.getOperationBinding("methodName"); opBinding.getParamsMap().put("params", "values"); opBinding.execute(); User details: // username ADFContext.getCurrent().getSecurityContext().getUserName(); //user role ADFContext.getCurrent().getSecurityContext().getUserRoles(); //check user in security group SecurityContext secContext = ADFContext.getCurrent().get...

Validation rules in ADF

Purpose:              Validation rules are used in almost all the applications which includes a database to make sure only valid data is committed to the database. You can define validations on your business service layer or directly on user interface.   As per fusion guide  there are three types of validation rules that can be used on entity objects: Attribute-level validation. Entity-level validation. Transaction-level validation. Attribute-level validation:          These validations are applied on attributes. Few examples might be upper and lower limit for salary, OrderDate should not be a date in the past and Length of attribute values.  How to: Select the attribute on EO. Edit Attribute. Validation. Define the check you want to perform under Rule Definition. Use Failure Handling to provide info to user. *Any conditions needed to perform/skip validation can be added in Validati...

ADF Create Vs CreateInsert

Three ways in ADF to create a new row: Create, CreateInsert and CreateWithParams As per fusion guide: What happens when you use Create ? // create a new row for the view object Row newRow = yourViewObject.createRow(); // mark the row as being "initialized", but not yet new newRow.setNewRowState(Row.STATUS_INITIALIZED); When CreateInsert is used? It performs this additional line of code to inert the row into the row set and make it available on the iterator. // insert the new row into the view object's default rowset yourViewObject.insertRow(newRow); When CreateWithParams is used? CreateWithParams does similar tasks as CreateInsert except that it gives the feasibility to define default values declaratively for the row attributes. Suggested usages:       - With ADF forms you can use Create or CreateInsert.       -  It is always safe to use CreateInsert when you have af:table as it will create a empty record and also puts it in recordse...