Showing posts with label Jdeveloper. Show all posts
Showing posts with label Jdeveloper. Show all posts

Friday, September 6, 2013

Enabling ADF for Weblogic Clustering

To Enable ADF Application to be clusterable

1.  Any object that might be replicated to another instance of the server, should be Serializable.
  • The most common ones are the backing beans. 
  • ADF UI Components are not serializable, to over come this problem don't bind UI Components to Backing Beans.

2. ADF BC State Management should be enabled. Activation and Passivation should be done to a place where all the server instances can access the data. Preferably to a database.
 set jbo.dofailover = true in Application module to true.

3. in      Weblogic-application.xml
Change the Persistent store type to REPLICATED_IF_CLUSTERED

1.       adf-config.xml
Check the box “High Availability for ADF Scopes”

Wednesday, July 10, 2013

ADF disclosed property problems in showDetailItem after enabling MDS


After MDS is enabled in ADF, If you have logic to show or hide showDetailItem using  tab.setDisclosed(), it might not work.

To solve this issue.
import org.apache.myfaces.trinidad.change.AttributeComponentChange;
import org.apache.myfaces.trinidad.change.ChangeManager;
import org.apache.myfaces.trinidad.change.ComponentChange;
import org.apache.myfaces.trinidad.context.RequestContext;


ChangeManager changeManager = RequestContext.getCurrentInstance().getChangeManager(); ComponentChange disclosed = new AttributeComponentChange("disclosed",Boolean.TRUE); ComponentChange undisclosed = new AttributeComponentChange("disclosed",Boolean.FALSE); changeManager.addComponentChange(FacesContext.getCurrentInstance(), tabA,disclosed); changeManager.addComponentChange(FacesContext.getCurrentInstance(), tabB,undisclosed); AdfFacesContext.getCurrentInstance().addPartialTarget(tabA); AdfFacesContext.getCurrentInstance().addPartialTarget(tabB);


Tuesday, July 2, 2013

MDS ( metadata ) customizations written to the store but does not apply to components when the user comes back to the page in ADF.


Just noticed the below in ADF 11.1.1.*.
ADF MDS customizations are not applied to components but written to store when we have the below snippet in web.xml.
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>oracle.jsp.runtimev2.JspServlet</servlet-class>
</servlet>

Tuesday, December 18, 2012

ADF Mobile : Consuming a Restful service



Simple way to consume a restful service in ADF Mobile is to create a URL Service Data Control.

I have created two applications. The first one RestServices.rar is a simple restful service which does a begins with search of Employees. The second one RedStackMobileRestfulDemo.rar is a ADF mobile application to consume the restful service.

First I create an XSD locally in the project to represent the response. We can also refer this remotely. But this will cause the mobile application to make a call every time the application runs.


Employees.xsd
<?xml version="1.0" encoding="windows-1252" ?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="employees">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="employee" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:string" name="department"/>
              <xs:element type="xs:byte" name="employeeId"/>
              <xs:element type="xs:string" name="name"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>







We can now create a URL Service Data Control. Below are the steps to create a URL service data control

1

image

2 give the
URL Endpoint : get url without the query
Source: give the query with param values in ## ## as illustrated below

image

3 Here it mandates the query to have a defaultvalue

image

4 Select the Employees.xsd and finish

image

You can now see the data control in the data control pallet

image





You can now drag and drop  loaddata Action into the amx page as ADF Mobile Parameter Form . Drag and drop employee as ADF Mobile List View.

image

image















You can now preview and run the app. For reference you can also download the source code

Saturday, December 15, 2012

Disable count query in ADF table


This can be done by RowCountThreshold = –1 in the iterator on the page definition

Note: To have a proper scroll behavior. This query should execute.  Scroll behavior will change. It will only scroll the range size.

Weblogic Bridge for IBM MQ Series(Running on AS400 / iseries / Mainframe) Part 2



6. Create Local Queues


You need to create local queues in weblogic
refer my previous posts on how to create local queues



Configure MQ series Bridge in weblogic





7. Install jms-xa-adp.rar in weblogic.


This is an XA adapter for weblogic and is required for guaranteed delivery. This comes along with weblogic installation and is available in server/lib directory. Install this as a .rar file and dont unzip this.
to deploy this go to weblogic console. domain - > deployments - > install.
clip_image002
select the jms-xa-adp.rar and on the choose target style. select "Install this deployment as an application" as shown above and continue the rest of the installation.
 
7. Create JMS Bridge destinations
 
You need to create a source and target destination. In our case local queues are source and  MQ series is remote





8. Create Source Destination

 
a.  Select JMS Bridge Destinations and click New
image
b. fill in the following details and click OK
Name: Source Bridge
Adapter JNDI Name: eis.jms.WLSConnectionFactoryJNDIXA
Classpath:
Connection URL: t3://localhost:7004,localhost:7003  (ignore the image)
*Connection Factory JNDI Name: jms/MYJMSCF  (from  step 5 – > d  http://rohith-oracle.blogspot.com/2012/10/creating-file-based-jms-queue-on_9.html)
*Destination JNDI Name: jms/MYDISTQUEUE       (Local distributed Queue JNDI  given when creating a file based jndi as in step 6 – > d  http://rohith-oracle.blogspot.com/2012/10/creating-file-based-jms-queue-on_9.html )
Destination Type: QUEUE
 
image
 

9. Create a Target Destination

a.  Select JMS Bridge Destinations and click New
image


b.  Enter the following details and click OK
*Name:  TargetBridgeDestination
Adapter JNDI Name: eis.jms.WLSConnectionFactoryJNDIXA
Adapter Classpath:
Connection URL: file:/C:/jmsbindings/    (As given when creating initial context in Step 3 –> b)
Initial Context Factory: com.sun.jndi.fscontext.RefFSContextFactory
*Connection Factory JNDI Name: MQCF  (As given when creating initial context in Step 4 –> b)
*Destination JNDI Name: TestQ   (As given when creating initial context in Step 5 –> b)

image



c. Click on the currently generated destination

image

d. Change the initial context factory to com.sun.jndi.fscontext.RefFSContextFactory
click ok.
image


10. Create the Bridge

a. Select bridges and new
image
b. Give a name , Quality of service and Started Check box. Click next
image
c. Select  Source Bridge Destination and click next
image

d. Select source provider.  Since the source is a weblogic queue we selected Weblogic 7 or higher

image

e. Select the bridge destination.
image
f.  Since the remote queue is MQ Series . Select Other JMS
image

g. Select the target
image

h. click next and finish





























Wednesday, October 3, 2012

ADF Custom SQL Builders


ADF allows us to create and configure custom SQL builders. Since ADF’s  SQL builders don’t support all the SQL Flavors, there might be a need to create your own SQL Builder and configure it.

1. Create a SQL Builder Class.
You can create a custom builder class by extending one of the following classes

oracle.jbo.server.SQL92SQLBuilderImpl
oracle.jbo.server.BaseSQLBuilderImpl

or to extend current functionality of existing builders you can also extend

oracle.jbo.server.SQLServerSQLBuilderImpl
oracle.jbo.server.DB2SQLBuilderImpl
oracle.jbo.server.OracleSQLBuilderImpl


Below is a simple example to override query to get time from the database


package a.b.c.extn;
import oracle.jbo.server.SQLBuilder;
import oracle.jbo.server.SQL92SQLBuilderImpl
;
public class MySQLBuilder extends SQL92SQLBuilderImpl
{
    public MySQLBuilder () {
        super();
    }
   
  public static SQLBuilder getInterface()
  {
    return new MySQLBuilder ();
  }   
  /* (non-Javadoc)
   * @see oracle.jbo.server.BaseSQLBuilderImpl#getDbTimeQuery()
   */
  public String getDbTimeQuery()
  {
     return "select getdate()";
  }

}


2. Configuring the Custom SQL builder in the application
In the adf-config.xml,  go to Business Components Tab.
Change the SQL Flavor to Custom and in the SQL Builder Class, give the class name as shown below

  <adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
    <defaults/>
    <startup>
      <amconfig-overrides>
        <config:Database jbo.SQLBuilder="Custom"
                         jbo.SQLBuilderClass="a.b.c.extn.MySQLBuilder" jbo.locking.mode="optimistic"/>
      </amconfig-overrides>
    </startup>




image

ADF - How to submit/post values changes to database immediately in ADF UI components


When you want to persist changes to a database as soon as a user changes the value in any of the UI Components. you can use the below technique.

1. Add a value change listener to your UI Component and also make Auto Submit to true.

<af:selectOneChoice value="{row.bindings.reasonCode.inputValue}"
    
label="#{row.bindings.reasonCode.label}" id="soc1" autoSubmit="true"
     valueChangeListener="#{failures.reasoncodeChange}">
       
         <f:selectItems value="#{row.bindings.reasonCode.items}" id="si1"/>
</af:selectOneChoice>


2.  In the Backing bean value change listener method
valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
Calling the the above line will do all the model updates. refer the link
public void reasoncodeChange(ValueChangeEvent valueChangeEvent) {
valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
BindingContainer bindings = getBindings();
OperationBinding operationBinding =bindings.getOperationBinding("Commit");
operationBinding.execute();           
}