Skip to main content

Posts

Showing posts from August, 2011

ADF : lazy checking if a row in a table is new programmatically/el

Lazy arb piece of code but hey well maybe it will help someone: Put this in the component in your table you want to make non readonly when it is a new row: readOnly="#{not yourBean.newRow}" public boolean isNewRow() {   ViewRowImpl row = (ViewRowImpl) JSFUtils.resolveExpression("#{row.row}");   return row.getNewRowState() == Row.STATUS_INITIALIZED || row.getNewRowState() == Row.STATUS_NEW; } could also just use el : readOnly="#{not (row.row.newRowState < 1}"

Random blog stat : Top 10 countries

Maybe this says something about who uses adf and in which countries - and maybe not. United States - by FAR 3 * the number of post hits than India India Germany United Kingdom Canada Spain Netherlands Brazil South Africa Poland Welcome Poland to my top 10.  Top 20 Countries by GDP: United States People's Republic of China Japan Germany France United Kingdom Brazil Italy Canada India Russia Spain Australia Mexico South Korea Netherlands Turkey Indonesia Switzerland Poland I think I may need to brush up on my japanese/ chinese and russian to get some more hits from the top 20 countries. Hits per browser: Firefox 43% Internet Explorer 28% Chrome 23% Hits per os: (Linux version of jdev buggy perhaps?) Windows 88% Linux 4% Macintosh 3% Other Unix 2%

ADF : Ridiculous java.lang.ClassNotFoundException oracle.jbo.server.nullImpl

I added a EO that had a fk assoc to another entity I wasnt working with and suddenly (after a bit of refactoring) when I ran my app I kept getting: java.lang.ClassNotFoundException: oracle.jbo.server.nullImpl. So I searched through my entities for nullImpl and found <AccessorAttribute     Name="AccountToDivisionFkAssoc"     Association="AccountToDivisionFkAssoc"     AssociationEnd="AccountToDivisionFkAssoc.sourceEnd"     AssociationOtherEnd="AccountToDivisionFkAssoc.destEnd"     Type="nullImpl"     IsUpdateable="true"/> I changed this back to oracle.jbo.server.EntityImpl and all was well <AccessorAttribute     Name="AccountToDivisionFkAssoc"     Association="AccountToDivisionFkAssoc"     AssociationEnd="AccountToDivisionFkAssoc.sourceEnd"     AssociationOtherEnd="AccountToDivisionFkAssoc.destEnd"     Type="oracle.jbo.server.EntityImpl "     IsUpdat

ADF service based lov and query

I want to have a LOV/ query backed by a webservice in adf. Looks like I am going to have to implement some code for this () XCode - Bound to a returned service value for now. <af:inputListOfValues id="XCode"   popupTitle="Search and Select: #{bindings.XCode.hints.label}" value="#{bindings.XCode.inputValue}" label="#{bindings.XCode.hints.label}" model="#{viewScope.backingBean.listOfValuesDataModel}" required="#{bindings.XCode.hints.mandatory}" shortDesc="#{bindings.XCode.hints.tooltip}" styleClass="colspec_fshort"/> Map your service and execute. In the listOfValuesDataModel method.       Object ob = ADFUtils.executeOperationBinding("findCodeTypesVO", new HashMap()); Map that to a custom implementation of oracle.adf.view.rich.model.ListOfValuesModel and return it. There is a nice example of how to do this in the ADF demo application code. oracle.adfdemo.view.lov.Demo

ADF Error handling new lessons

1) When using a custom error handler (in DataBindings.cpx ErrorHandlerClass="blah") in a main project that contains in a shared libs the main projects error handler will be used not the shared libs. So it is best not to override the error handler in the main project. 2) ErrorHandler for unexpected errors: http://blogs.oracle.com/jdevotnharvest/entry/extending_the_adf_controller_exception_handler 3) action-listener in faces-config.xml can be overriden. http://www.techbrainwave.com/?p=3 4) JSF 2 error handler: http://jugojava.blogspot.com/2010/09/jsf-2-exception-handling.html

ADF Custom declarative component error 11.1.2

OK so I though the components where broken in 11.1.2 but it turns out it was just me who was broken. Here a a couple of things I struggled with: Naming yes I got the name of my custom component in declarativecomp-metadata.xml component file I had an extra l in my taglib-name. (if you get a blank page like me check the spelling then check it again) I also put the folloing in my consuming project - dont know if it is necessary but it made me feel good: <context-param>   <param-name>javax.faces.FACELETS_VIEW_MAPPINGS   <param-value>*.jsf;*.xhtml <context-param> <context-param>   <param-name>javax.faces.FACELETS_SKIP_XML_INSTRUCTIONS   <param-value>true <context-param> <context-param>   <param-name>javax.faces.FACELETS_SKIP_COMMENTS   <param-value>true <context-param> <context-param>   <param-name>javax.faces.FACELETS_DECORATORS   <param-value>oracle.adfinternal.view.face

ADF Mapping a service based Select One choice

1) Select the field you would like and drag it onto the jspx. 2) Select Single Selection then ADF select one choice 3) Click the add button next to List Data Source 4) Find you web service data control and expand it. 5) Find your "find" service method ie. findGenderLOV --> Return --> result (the one with the white icon not the red) 6) Press ok , Press ok Follow these simple steps and everything should work in a serviceable manner.

ADF Making the results of a service backed find editable

Get the current row or the row you want editable and run it through this method: import oracle.jbo.server.ViewAttributeDefImpl;   public static void setRowEditable(Row row) {     int attribCount = row.getAttributeCount();     for(int i = 0; i < attribCount; i++) {       ViewAttributeDefImpl attrDef = (ViewAttributeDefImpl) row.getStructureDef().getAttributeDef(i);       attrDef.setEditable(true);       attrDef.setUpdateableFlag(ViewAttributeDefImpl.UPDATEABLE);     }   }

ADF Webservice data control HACK: DONT TRY THIS AT HOME

I really wanted to be able to do things with my ADF service implementation based web service data control: 1) Change configuration of the wsdl location dynamically for each environment. 2) Make sure that I could add to the results of the web service with ADF. (createNewRow) The first point: This is hard to do because the url is looked up from the bindings and wsdl. You could do this at build time and build an artifact for each environment but I didnt want to. The second point: The result created by the ws data control was an XMLHandler$DataCollection wich did not implement the add method - I got a Not supported exception. So here is the solution very ugly but hey well (this is a work in progress so shout if you want more code/ explanation): 1) Override the SOAPProvider in the DataControls.dcx <DataControlConfigs xmlns="http://xmlns.oracle.com/adfm/configuration"   version="11.1.2.60.17" id="DataControls"   Package="za.co.transcode.

ADF : Refreshing a service backed table and keeping the correct item highlighted

Make sure your table has  displayRow="selected" set. <af:table value="#{bindings.CustomerVO.collectionModel}" var="row"   rows="#{bindings.CustomerVO.rangeSize}"   emptyText="#{bindings.CustomerVO.viewable ? 'No data to display.' : 'Access Denied.'}"   fetchSize="#{bindings.CustomerVO.rangeSize}" rowBandingInterval="0"   selectedRowKeys="#{bindings.CustomerVO.collectionModel.selectedRow}"   rowSelection="single" id="table" columnStretching="last" immediate="true"   displayRow="selected" binding="#{viewScope.customerTypesBean.table}"   selectionListener="#{viewScope.customerBean.handleTableRowSelection}"> Invoke the following code when your table needs a refresh //use the name of your tables result iterator here     DCIteratorBinding iterator = BackingBeanUtils.getIteratorBinding(getResultsIteratorName())

Faith based development

We cam up with yet another development term while converting our existing adf page to work off web services. So if you use any of the following statements you know you are engaged in "faith" based development, Have faith in the framework it will work. It all happens automagically. Trust the tool. Just click a button and it works. They will fix it in the next release. I have no control over how that works. The MDS will take care of that. I have seen a blog post about that.   Very uncomfortable but apt.