Monthly Archives: July 2010

Getting the value of Saved search – programatic way


QueryModel qm = (QueryModel)evaluateEL("#{bindings.SearchViewCriteriaQuery.queryModel}");
 for(int indexCount=0; indexCount
 {
 QueryDescriptor qd = qm.getUserQueries().get(indexCount);
 if(qd!=null){
 String queryDescriptorName = qd.getName();
 System.out.println(queryDesctiptorName);
 m = qd.getUIHints();
 isDefault = (Boolean) m.get(QueryDescriptor.UIHINT_DEFAULT);
 System.out.println(isDefault);
 isRunAutomatically = (Boolean) m.get(QueryDescriptor.UIHINT_AUTO_EXECUTE);
 System.out.println(isRunAutomatically);
 if (Boolean.TRUE.equals(isDefault) && Boolean.TRUE.equals(isRunAutomatically){
 break();
 }
 else{
 queryDescriptorName = null;
 }
 System.out.println(isDefault);
 }
Advertisements

Snippet to check if the transaction is dirty


We can use the following code snippet to check if the transaction is dirty or not

BindingContext bctx = oracle.adf.controller.binding.BindingUtils.getBindingContext();
if (bctx.findDataControlFrame(bctx.getCurrentDataControlFrame()).isTransactionDirty()) {
 //show the timestamp
 }
 else{
 //don't show
 }

Show dialog when a page is fully loaded


1. Add popup and outputText component at the end of your page (make sure popup is before outputText in the page structure)

2. Create bean binding for popup as well as outputText.

3. In the getter of outputText, launch popup programatically.

4. Set visible=false for outputText

Thoughts on Java that works


Disclaimer: This is just to get an idea of the implementation, please do not copy the source code

The problem reads like

SALES TAXES
Basic sales tax is applicable at a rate of 10% on all goods, except books,
food, and medical products that are exempt. Import duty is an additional
sales tax applicable on all imported goods at a rate of 5%, with no
exemptions.
When I purchase items I receive a receipt which lists the name of all the
items and their price (including tax), finishing with the total cost of the
items, and the total amounts of sales taxes paid.  The rounding rules for
sales tax are that for a tax rate of n%, a shelf price of p contains
(np/100 rounded up to the nearest 0.05) amount of sales tax.
Write an application that prints out the receipt details for these shopping
baskets…

Find the complete solved solution here

MARS ROVERS
A squad of robotic rovers are to be landed by NASA on a plateau on Mars.
This plateau, which is curiously rectangular, must be navigated by the
rovers so that their on-board cameras can get a complete view of the
surrounding terrain to send back to Earth.

A rover’s position and location is represented by a combination of x and y
co-ordinates and a letter representing one of the four cardinal compass
points. The plateau is divided up into a grid to simplify navigation. An
example position might be 0, 0, N, which means the rover is in the bottom
left corner and facing North.

In order to control a rover, NASA sends a simple string of letters. The
possible letters are ‘L’, ‘R’ and ‘M’. ‘L’ and ‘R’ makes the rover spin 90
degrees left or right respectively, without moving from its current spot.
‘M’ means move forward one grid point, and maintain the same heading.

Assume that the square directly North from (x, y) is (x, y+1).

Find the complete solved solution here

How to change the default text title of Detached table/treetable


have trindad-skins.xml in your web-inf folder and have the following tag

<skin>
 <id>dummy.desktop</id> // you are overriding the style
 <family>dummy</family>
 <extends>fusion.desktop</extends> // this should be from the trinidad-config.cml
 <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
 <style-sheet-name>skins/dummy/dummy.css</style-sheet-name>
 <bundle-name>oracle.view.resource.rich.SkinBundle</bundle-name> // your skin bundle to override the name
 </skin>

here dummy.css is used to override any visual property of the faces component defined in fusion theme
to override the label, use in the SkinBundle like (The java bundle file should be registered as a managed bean in adfc-config.xml)

package oracle.view.resource.rich;
 import java.util.ListResourceBundle;
public class SkinBundle
 extends ListResourceBundle
 {
 @Override
 public Object[] getContents()
 {
 return _CONTENTS;
 }

static private final Object[] _CONTENTS =
 {
 { "af_panelCollection.LABEL_DETACH_TABLE_DLG", "Any name for the Detachable Table" },
 { "af_panelCollection.LABEL_DETACH_TREE_TABLE_DLG", "Any name for the Detachable Tree Table" }
 };
 }

Decompiler for Jdeveloper


You can use JAD or any other decompiler with JDeveloper to show you the decompiled version of the source instead of the standard stub view with the following command line argument.

The property is ‘jcncmd’, and to use for instance ‘jad.exe’, you would use:

“-J-Djcncmd=D:\bin\jad.exe -b -ff -nl -p -pi99999 -space -t2”

There are two conditions: – the external decompiler must send its output to stdout – the external decompiler must accept as its last argument the full path to the Java class file to decompile. In the line above, -p forces the output to stdout.

Also you can invoke using control click by editing $JDEV_HOME\jdeveloper\jdev\bin\jdev.conf and add the following line

“AddVMOption -Djcncmd=D:\bin\jad.exe -b -ff -nl -p -pi99999 -space -t2”

Database answers


Found this useful link for all your db design related queries

http://www.databaseanswers.org/data_models/index.htm