Skip to main content

Posts

Showing posts from September, 2010

Auto Focus in ADF

still to fill in details but heres the idea -- bind query to backing bean -- get Id from bound query and inject some javascript with the id. public void focus(UIXComponent comp) { StringBuilder script = new StringBuilder(); FacesContext context = FacesContext.getCurrentInstance(); script.add("var elem = document.getElementById(").append(comp.getClientId(context)).append("); if (elem != null) {elem.focus();}"); Service.getRenderKitService(context, ExtendedRenderKitService.class).addScript(context, script.toString()); } -- viola ok after some pain here is the javascript function that works on ie and firefox function focusField(elementId) { var comp = document.getElementById(elementId); if (comp != null) { comp.focus(); comp.select(); } } NOTE: On some screens the auto focus does not work because the component does not have an id or children(has not been initialized etc) for this just run the method bound to the value attribute on component aft...

ADF Excel export

In adf if you export your tables that contain lov inside the index or id is exported and not the selected item value. If your table is read only change your existing table column from eg: <af:outputText value="#{row.bindings.Field.items[row.bindings.Field.inputValue].label}" id="ot3"/>

Me and my ADF

--Just a random set of opinions read no further if you are looking for technical info. Ok so I have been working with ADF for 8 months now (have worked with SOA suite before) and here are a couple of rants and findings: Development speed etc: The initial learning curve in VERY steep. Get help - we had an adf expert help us out - invaluable. Get the adf source code - it will help you. Like any framework you need to write a bit of framework extension code It is NOT just drag and drop dev if you want anything custom. Try to get things right from the start or you will end up redoing a lot and it is not very "refactoring" friendly. Forms devs will have to get a LOT of training to use this. (they will have to learn java and ADF unless you run a sweat shop dev process) Hire a very very compentant java dev before switching over from forms. Having a lot of logic in pl\sql with this framework may not be a bad thing. Try to do as little custom stuff as possible Once you h...

Almost foolproof ADF Oracle proxying

1) Create a common application model (this also sets up the oracle users in the context just for auditing) @Override protected void prepareSession(Session session){ super.prepareSession(session); try{ String userName = ADFContext.getCurrent().getSecurityContext().getUserName(); String host = ((HttpServletRequest)ADFContext.getCurrent().getEnvironment().getRequest()).getRemoteHost(); String ip = ((HttpServletRequest)ADFContext.getCurrent().getEnvironment().getRequest()).getRemoteAddr(); if (userName != null){ setupSessionInfo(getDBTransaction(), host, ip, userName); } proxyUser(getDBTransaction()); //this is done because of a crappy weblogic caching error clearPoolCache(getDBTransaction()); } catch (Exception e){ session = null; System.out.println("------> Error in user proxy"); e.printStackTrace(...

ant and ojdeploy

oracle.jdeveloper.ojdeploy.path=/Oracle/Middleware/jdeveloper/jdev/bin/ojdeploy application.name=Common <target name="buildJar"> <exec executable="${ojdeploy.path}" dir="${basedir}/${application.name}"> <arg line="-workspace ${basedir}/${application.name}/${application.name}.jws"/> <arg line="-project ${application.name}"/> <arg line="-profile ${application.name}"/> <arg line="-nodatasources"/&gt <arg line="-forcerewrite"/> <arg line="-basedir ${basedir}/${application.name}"/> </exec> </target>

UnsupportedCallbackException: Accessing the HttpServletRequest from a custom auth provider

There could be more than one cause of this problem but here is what cause it for me: My custom provider was the first provider in the list and was set to sufficient. I got an UnsupportedCallbackException when I tried to use the ContextHandlerCallback to retrieve the request in my provider. This was due to the fact that weblogic log in was using my provider and it uses the SimpleCallbackHandler (boo hiss). Here is my code: (I throw an login exception and fail the login if the callbacks are null for my login) private Callback[] getCallbacks() throws LoginException{ Callback[] callbacks = new Callback[3]; // need one for the user name callbacks[CALLBACK_USERNAME_POSITION] = new NameCallback("username: "); callbacks[CALLBACK_PASSWORD_POSITION] = new PasswordCallback("password: ", false); callbacks[CALLBACK_CONTEXT_POSITION] = new ContextHandlerCallback(); try{ callbackHandler.handle(callbacks); } catch (IOException e){ e....

Case Insensitive Filter

On the column just set the filterFeatures attribute to caseInsensitive CODE ALTERNATIVE 1) Map your querylistener and table binding to methods in your backing bean. 2) Implement the above mentioned methods and so what you need to the filter: public void queryListener(QueryEvent queryEvent){ FilterableQueryDescriptor des = (FilterableQueryDescriptor)getModuleTable().getFilterModel(); Map _criteriaMap = des.getFilterCriteria(); Set featureSet = new HashSet(); featureSet.add(FilterableQueryDescriptor.FilterFeature.CASE_INSENSITIVE); Iterator criteriaIter = _criteriaMap.keySet().iterator(); Map filterFeatures = new HashMap(); while (criteriaIter != null && criteriaIter.hasNext()){ String keyCr = (String)criteriaIter.next(); ((HashMap)filterFeatures).put(keyCr, featureSet); } des.setFilterFeatures(filterFeatures); JSFUtils.invokeMethodE...

Back button and connection leaks

If your back button behaves badly or connections are not closed when you close the browser and leaky. On your application module try checking "Disconnet Application Module Upon Release" this solved our problem. (Click on your AM, goto configurations, click on the Pooling and scalibility tab)