Tuesday, January 31, 2012

Upload Limits for Web Browsers

Thing I learned today... There are known upload size restriction for various browser. You can see details here http://www.motobit.com/help/scptutl/pa98.htm So, if you are using af:inputfile to upload huge files and configured all file upload parameters as described here, still not able to make upload to work with huge files, check out the browser support for the same.

Wednesday, January 18, 2012

In-Memory Filtering Without Affecting Default Row Set

Noticed the following requirement (multiple times) while working with ADF developers - Find out rows in the default row set that meets specific conditions - In other words, perform in-memory filtering without affecting the primary row set.
By default, when you apply in-memory filtering  using ViewCriteria or RowMatch, they are applied on default row set.The following code snippet may help you to perform in memory filtering without affecting your default row set-
 CountriesViewImpl countriesViewImpl = (CountriesViewImpl)getCountriesView1();  
 countriesViewImpl.executeQuery();  
 //Define VC for in-memroy filtering  
 ViewCriteria vc = countriesViewImpl.createViewCriteria();  
 vc.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE);  
 ViewCriteriaRow vcr1 = vc.createViewCriteriaRow();  
 vcr1.setAttribute("CountryName", "LIKE A%");  
 vc.add(vcr1);  
 //Override 'protected' findByViewCriteriaForViewRowSet in CountriesViewImpl  
 //and mark it as 'public' so that client can call this API  
 RowIterator rowIter =  
      countriesViewImpl.findByViewCriteriaForViewRowSet(getCountriesView1().getDefaultRowSet(), vc, 50,  
                                                                   ViewObject.QUERY_MODE_SCAN_VIEW_ROWS, null, null);  
 while(rowIter.hasNext()){  
   Row row=rowIter.next();  
      //Work with filterered rows  
 }  


Updated on August 2013

Note: JDeveloper 12C has new feature called Row Finder, which will help you to achieve the above mentioned functionality. It is recommended to us the same if you are on 12C release http://docs.oracle.com/middleware/1212/adf/ADFFD/bcquerying.htm#BCGFFEEI


Thursday, January 12, 2012

Displaying Transaction Log When User Commits a Transaction

I'm attaching a simple example that illustrates a possible solution to display number of rows(new, modified,  deleted) posted to database when user commits transaction.

This example overrides EntityImpl::doDML(int operation, TransactionEvent e) method to track the status of entities and save the log in UserData hash table object from the DBTransaction. The custom AppModuleImpl::commitTransactionWithStatusLog() does the commit and returns the transaction log as Map to the client which is displayed on the UI in the 'statusbar' facet for the table(wrapped by af:panelCollection). If you are interested, take a look at the custom variable binding in the page definition file in the attached sample. This basically does the wiring job  for the returned Map by commitTransactionWithStatusLog() method. May be useful for you later :)


Download

You can download the sample workspace from here. [Runs with Oracle JDeveloper 11.1.2.1.0 (11g R2PS1) + HR Schema]

How to run this sample?

1. Run test.jsf
2. Modify rows on the table and click on 'Commit Transaction With Status Log'. Application displays transaction status (rows modified, deleted, inserted) in the status bar.

Monday, January 9, 2012

Consuming ADF BC model project components from another project !

This year, let me start my posts with a simple topic. There are multiple ways to expose a project for use by other projects. One obvious approach is generate an ADF library artefact and consume it from other projects. This is documented in Fusion Middleware Fusion Developer's Guide -


 The above things are well and good. However if you you want to consume a ADF BC model project within same workspace, there is an easy way.

To consume business components defined in a model project from another model project within the same work space,

  1. Right click the model project which consumes business components from other model projects in the same workspace and select Project Properties.In the Project Properties dialogue window, select the Dependencies tab and add the 'supplier' Project by either selecting Build Output option or Jar archive option .
  2. The above steps is enough to consume Java classes from the dependent model project. To consume business components follow Step 3. 
  3. Once you define the dependencies for the consumer project, in the Project Properties window, select Imports option displayed below the ADF Business Component node. Click Import button, select the desired jpx file (jpx for the project whose business components needs to be imported to the consumer project) using file browser and then select the components that needs to be imported to the consumer project as shown in the following diagram.


You are done with the import task. Now IDE will start exposing business components in the consumer project.

Please note that, ADF development team is working on the 'dependency management' feature to make it more user friendly so that specifying dependency may be enough to consume business components from dependent project. Stay tuned, will keep you posted !