tag:blogger.com,1999:blog-38739061221603663102024-03-18T03:59:35.961-07:00Unwinding ADFOracle ADF is an end-to-end Java EE framework that simplifies and speed up application development.This blog discusses technical discovery on Oracle Application Development Framework using Jdeveloper.
<br><br>
The views expressed on this blog are my own and do not necessarily reflect the views of my employer.Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.comBlogger67125tag:blogger.com,1999:blog-3873906122160366310.post-47776705161147770242015-09-18T01:04:00.000-07:002015-09-18T01:04:04.484-07:00Oracle Taleo WebService Sample Client Code to Create New Candidate and apply to a Taleo job offer (requisition)<div dir="ltr" style="text-align: left;" trbidi="on">
Let's assume you are a Taleo Partner (EBS/Peoplesoft) and want to export a candidate from your application and import it into Taleo systems by attaching candidate to a existing Taleo job offer (requisition) .<br />
<br />
<!-- Candidate Import Request with attaching Taleo job offer (requisition) --><span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<pre style="background: none 0% 0% repeat scroll rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); height: 600px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><span style="font-size: 12px; line-height: 20px;"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:e="http://www.taleo.com/ws/tee800/2009/01/candidate">
<soapenv:Header>
<itk:Debug xmlns:itk="http://www.taleo.com/ws/itk21/2005/07">
<itk:StackTrace>true</itk:StackTrace>
</itk:Debug>
</soapenv:Header>
<soapenv:Body>
<e:merge>
<e:candidate>
<e:Address>123 Main Street</e:Address>
<e:Address2>Apartment 1</e:Address2>
<e:City>Seattle</e:City>
<e:EmailAddress>xxx@invalid.address.com</e:EmailAddress>
<e:FirstName>XYZ</e:FirstName>
<e:LastName>XYZ</e:LastName>
<e:ZipCode>74554-234</e:ZipCode>
<e:Applications>
<e:Application>
<e:Requisition>
<e:Requisition>
<b> <span style="color: red;"><e:ContestNumber searchType="search" searchValue="XXXXX"/></span></b>
</e:Requisition>
</e:Requisition>
</e:Application>
</e:Applications>
</e:candidate>
</e:merge>
</soapenv:Body>
</soapenv:Envelope></span></pre>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com382tag:blogger.com,1999:blog-3873906122160366310.post-57208268509452022912015-09-18T00:16:00.000-07:002015-09-18T00:53:56.636-07:00Oracle Taleo WebService Sample Client Code to Create New Candidate<div dir="ltr" style="text-align: left;" trbidi="on">
Let's assume you wants to import the candidates into Taleo systems. Using Taleo BulkAPI, CandidateService allows your application to create and update a candidate in Taleo systems.<br />
<br />
We can implement the above usecase with following options:<br />
<br />
<ul style="text-align: left;">
<li><b>Java Code using SAAJ: </b>SAAJ stands for "SOAP with Attachments API for Java." With it, you can make Java API calls that generate XML messages which comply with the SOAP 1.1 or 1.2 specifications, as well as the WS-I Basic Profile 1.1 specification. It allows developers to read and write SOAP-based XML messages, and in some cases, to send and receive those messages over the Internet. SAAJ offers an alternative to JAX-RPC or JAX-WS</li>
</ul>
<pre style="background: none 0% 0% repeat scroll rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); height: 400px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><span style="font-family: arial;"><span style="font-size: 12px; line-height: 20px;">public class SOAPClientSAAJ {
/**
* This method process the new candidate creation
* @return employeeNumber
* @throws SOAPException
* @throws Exception
*/
public static String processCandidateCreationSOAPRequest() throws SOAPException, Exception {
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
// Trust to certificates
doTrustToCertificates();
// Send SOAP Message to SOAP Server
String url = "https://xxx.taleo.net/enterprise/soap?ServiceName=CandidateService";
SOAPMessage soapResponse = soapConnection.call(callCandidateCreationSOAPRequest(), url);
String employeeNumber = processCandidateCreationSOAPResponse(soapResponse);
return employeeNumber;
}
public SOAPClientSAAJ() {
super();
}
/**
* This method parse the soapResponse and gets the employeeNumber
* @param soapResponse
* @return employeeNumber
* @throws TransformerConfigurationException
* @throws SOAPException
* @throws ParserConfigurationException
* @throws TransformerException
* @throws SAXException
* @throws IOException
*/
private static String processCandidateCreationSOAPResponse(SOAPMessage soapResponse) throws TransformerConfigurationException,
SOAPException,
ParserConfigurationException,
TransformerException, SAXException,
IOException {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = soapResponse.getSOAPPart().getContent();
StringWriter writer = new StringWriter();
transformer.transform(sourceContent, new StreamResult(writer));
String output = writer.toString();
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(output));
Document doc = db.parse(is);
NodeList nodes = doc.getElementsByTagName("createResponse");
Element element = (Element)nodes.item(0);
NodeList name = element.getElementsByTagName("Number");
Element line = (Element)name.item(0);
return getCharacterDataFromElement(line).toString();
}
/**
* This method creates the soapMessage and calls the webservice
* @return
* @throws Exception
*/
private static SOAPMessage callCandidateCreationSOAPRequest() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
// SOAP Envelope
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("can", "http://www.taleo.com/ws/tee800/2009/01/candidate");
envelope.addNamespaceDeclaration("ns1",
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
SOAPHeader soapHeader = envelope.getHeader();
SOAPElement SecuritySoapElement = soapHeader.addChildElement("Security", "ns1");
SOAPElement usernameTokenSoapElement = SecuritySoapElement.addChildElement("UsernameToken", "ns1");
SOAPElement usernameSoapElement = usernameTokenSoapElement.addChildElement("Username", "ns1");
usernameSoapElement.addTextNode("username");
SOAPElement passwordSoapElement = usernameTokenSoapElement.addChildElement("Password", "ns1");
passwordSoapElement.addTextNode("password");
// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement createSoapBodyElem = soapBody.addChildElement("create", "can");
SOAPElement candidateSoapBodyElem = createSoapBodyElem.addChildElement("candidate", "can");
SOAPElement emailAddressSoapBodyElem = candidateSoapBodyElem.addChildElement("EmailAddress", "can");
emailAddressSoapBodyElem.addTextNode("xxx@invalid.address.com");
SOAPElement addressSoapBodyElem = candidateSoapBodyElem.addChildElement("Address", "can");
addressSoapBodyElem.addTextNode("123 Main Street");
SOAPElement address2SoapBodyElem = candidateSoapBodyElem.addChildElement("Address2", "can");
address2SoapBodyElem.addTextNode("Apartment 1");
SOAPElement firstNameSoapBodyElem = candidateSoapBodyElem.addChildElement("FirstName", "can");
firstNameSoapBodyElem.addTextNode("XYZ");
SOAPElement lastNameSoapBodyElem = candidateSoapBodyElem.addChildElement("LastName", "can");
lastNameSoapBodyElem.addTextNode("XYZ");
// Save message
soapMessage.saveChanges();
return soapMessage;
}
/**
* This method trust the https certificates
* @throws Exception
*/
private static void doTrustToCertificates() throws Exception {
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
return;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
return;
}
} };
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
if (!urlHostName.equalsIgnoreCase(session.getPeerHost())) {
System.out.println("Warning: URL host '" + urlHostName + "' is different to SSLSession host '" +
session.getPeerHost() + "'.");
}
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
}
private static String getCharacterDataFromElement(Element e) {
Node child = e.getFirstChild();
if (child instanceof CharacterData) {
CharacterData cd = (CharacterData)child;
return cd.getData();
}
return "";
}
}</span></span></pre>
<br />
<ul style="text-align: left;">
<li><b>Java Code using Apache Axis2: - </b>First you should Import the WSDL Files into Your Development Platform using below command.</li>
</ul>
<br />
<b>“wsdl2java.bat -uri pathToWsdl/WsdlFilename -d xmlbeans -ns2p namespaceURL=javaPackageName”</b><br />
<br />
<pre style="background: none 0% 0% repeat scroll rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); height: 400px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><span style="font-family: arial;"><span style="font-size: 12px; line-height: 20px;">public class CandidateDC {
/**
* Main method call the importCandidate method
* @param args
*/
public static void main(String[] args) {
try {
long employeeNumber = importCandidate();
System.out.println("Candidate Num: " + employeeNumber);
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (WebServiceFault e) {
e.printStackTrace();
}
}
/**
* This method process the new candidate creation
* @return employeeNumber
* @throws AxisFault
* @throws RemoteException
* @throws WebServiceFault
*/
public static long importCandidate() throws AxisFault, RemoteException, WebServiceFault {
CandidateServiceStub stub =
new CandidateServiceStub("https://hostname/enterprise/soap?ServiceName=CandidateService");
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername("Username");
auth.setPassword("Password");
auth.setPreemptiveAuthentication(true); // activate preemptive authentication
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);
CreateDocument createDoc = CreateDocument.Factory.newInstance();
CreateDocument.Create create = createDoc.addNewCreate();
Candidate candidate = create.addNewCandidate();
SearchableStringField address = candidate.addNewAddress();
address.setStringValue("123 Main Street");
SearchableStringField address2 = candidate.addNewAddress2();
address2.setStringValue("Apartment 1");
SearchableStringField lastName = candidate.addNewLastName();
lastName.setStringValue("XYZ");
SearchableStringField firstName = candidate.addNewFirstName();
firstName.setStringValue("XYZ");
SearchableStringField emailAddress = candidate.addNewEmailAddress();
emailAddress.setStringValue("xxx@invalid.address.com");
CreateResponseDocument createResponse = stub.create(createDoc);
long val = createResponse.getCreateResponse().getNumber();
return val;
}
public CandidateDC() {
super();
}
}<code style="color: black; word-wrap: normal;"></code></span></span></pre>
<br />
If you get the "java.net.SocketException: Software caused connection abort: recv failed" issue - <a href="http://deepakcs.blogspot.in/2015/01/oracle-taleo-webservice-integration.html">More Details</a></div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com4tag:blogger.com,1999:blog-3873906122160366310.post-75458327613172053602015-01-15T01:59:00.000-08:002015-09-18T01:53:22.519-07:00Oracle Taleo WebService Integration - "java.net.SocketException: Software caused connection abort: recv failed"<div dir="ltr" style="text-align: left;" trbidi="on">
Recently I was trying to integrate Oracle Taleo WebService with one of the 3rd party system. I tried with WSDL2Java from the Apache Axis2 and SAAJ (SOAP with Attachments API for Java) types for the integration.<br />
<br />
But on both the types I was getting "java.net.SocketException: Software caused connection abort: recv failed" issue. Below is the error detail.<br />
<br />
<i>org.apache.axis2.AxisFault: Software caused connection abort: recv failed </i><br />
<i>at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) </i><br />
<i>at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197) </i><br />
<i>at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) </i><br />
<i>at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404) </i><br />
<i>at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231) </i><br />
<i>at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443) </i><br />
<i>at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406) </i><br />
<i>at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) </i><br />
<i>at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) </i><br />
<i>at com.taleo.www.ws.tee800._2009._01.candidate.CandidateServiceStub.create(CandidateServiceStub.java:1284) </i><br />
<i>at com.taleo.Generic.main(Generic.java:54) </i><br />
<i>Caused by: java.net.SocketException: Software caused connection abort: recv failed </i><br />
<i>at java.net.SocketInputStream.socketRead0(Native Method) </i><br />
<i>at java.net.SocketInputStream.read(SocketInputStream.java:152) </i><br />
<i>at java.net.SocketInputStream.read(SocketInputStream.java:122) </i><br />
<i>at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) </i><br />
<i>at java.io.BufferedInputStream.read(BufferedInputStream.java:254) </i><br />
<i>at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) </i><br />
<i>at org.apache.commons.httpclient.HttpPars </i><br />
<br />
Solution:- <br />
<br />
The error message that we are getting is not because of the java code, it's related to a HTTPS/SSL setup/configuration problem.<br />
<br />
Connection to the Taleo zone requires use of the "HTTPS" protocol which uses "SSL". You need to <b>Import the HTTPS Certificate into Java HTTPS certificates</b>, this should solve the above issue.<br />
<br />
Note:- If you are deploying your application to any web server, please check if the certificate is trusted by the 3rd party web server.<br />
<br />
Steps to Import Certificate :-<br />
<br />
<ul style="text-align: left;">
<li>Export the HTTPS Certificate into a file</li>
<ul>
<li><span style="color: #333333; font-family: Arial, sans-serif;"><span style="font-size: 14px; line-height: 16.1px;">Open your web browser</span></span></li>
<li> Enter your web browser's "Options" utility. Internet Explorer users will need to click "Tools" and then "Internet Options," for example. Mozilla Firefox users will need to click "Tools" and then "Options..." Google Chrome users will need to click "Customize" and then "Options"</li>
<li>Click "Content" and then "Certificates" in Internet Explorer. Click on the certificate you'd like to export and then click on the "Export" button to export it for use on other servers</li>
<li>Click "Advanced" and then "View Certificates" in Mozilla Firefox. Click on the certificate you'd like to export and then click on the "Export" button to export it for use on other servers</li>
<li>Click "Under the Hood" and then "Manage Certificates" in Google Chrome. Click on the certificate you'd like to export and then click on the "Export" button to export it for use on other servers</li>
</ul>
<li>Import the HTTPS Certificate into Java HTTPS certificates</li>
<ul>
<li>Java HTTPS certificates stored in - $JAVA_HOME/jre/lib/security/cacerts</li>
<li>To import your new certificate into “cacerts” run below command:</li>
</ul>
</ul>
<b style="line-height: 13.15pt; text-align: justify;"><i><span style="color: #333333; font-family: "Arial",sans-serif; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">“keytool -import -file amirssw.cer -keystore cacerts”</span></i></b><br />
<div>
<div style="text-align: justify;">
<span style="color: #333333; font-family: Arial, sans-serif; font-size: 10.5pt; line-height: 13.15pt;">The Password is </span><b style="color: #333333; font-family: Arial, sans-serif; font-size: 10.5pt; line-height: 13.15pt;"><i>“changeit”</i></b></div>
</div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com82tag:blogger.com,1999:blog-3873906122160366310.post-19357815224795682712014-06-28T06:19:00.000-07:002014-06-28T06:19:20.594-07:00How to check AMX page is fully loaded or not <div dir="ltr" style="text-align: left;" trbidi="on">
Sometimes you might requires to manipulate the HTML elements after the page is fully loaded. In HTML file it an be checked using <b>window.onload or deviceready </b>but same doesn't guarantees the appropriate ADF Mobile state.<br />
<br />
In ADF mobile using showpagecomplete event on the handlePageShown callback function it can be checked.<br />
<pre style="background: none 0% 0% repeat scroll rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); height: 125px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><span style="font-family: arial;"><span style="font-size: 12px; line-height: 20px;"><script>
function handlePageShown() {
console.log("Page is shown!");
}
document.addEventListener("showpagecomplete", handlePageShown, false);
</script><code style="color: black; word-wrap: normal;"></code></span></span></pre>
The showpagecomplete event guarantees the appropriate ADF Mobile state; other browser and third-party events, such as load and Cordova's deviceready, may not.
<br />
<br />
In my next article I will show the usage of showpagecomplete event with example.</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com7tag:blogger.com,1999:blog-3873906122160366310.post-54718151872113539022014-06-27T10:48:00.001-07:002014-06-27T10:59:56.520-07:00ADF Mobile - Get network status dynamically<div dir="ltr" style="text-align: left;" trbidi="on">
While working on ADF mobile application with offline/online capabilities, before calling webservices network has to be checked whether it is "connected" or "disconnected".<br />
<br />
In my previous article <a href="http://deepakcs.blogspot.in/2013/06/offline-data-synchronization-for-adf.html">Offline Data Synchronization for ADF Mobile</a>, I was using the javascript to evaluate the network connectivity and store the connection status in pageFlowScope variable. But after subsequent checks pageFlowScope variable was not refreshing properly. Please see the oracle forum for more info, <a href="https://community.oracle.com/thread/2589879?start=0&tstart=0">ADF Mobile - Get network status</a>.<br />
<br />
<u><b>Steps to check network status dynamically:-
</b></u><br />
<u><b><br /></b></u>
1. Java Script to check the network status<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 480px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> /**
* Method to check the network status
*/
application.checkConnection = function () {
var isConnected;
var connectionType = navigator.network.connection.type;
var states = {
};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.NONE] = 'No network connection';
if (connectionType == Connection.NONE || connectionType == Connection.UNKNOWN) {
isConnected = false;
}else {
isConnected = true;
}
var obj = {connectionType : connectionType, isConnected : isConnected};
return obj;
}
</code></pre>
2. In managed bean call the application.checkConnection method<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 260px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public void checkNetworkStatusAction(ActionEvent actionEvent) {
String networkDetails = (String)AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureName(),"application.checkConnection",new Object[] { });
try {
JSONObject obj = new JSONObject(networkDetails);
String connectionType = (String)obj.getString("connectionType");
boolean isConnected = (boolean)obj.getBoolean("isConnected");
setIsConnected(isConnected);
setConnectionType(connectionType);
} catch (JSONException e) {
throw new AdfException("Error while trying to connect to network", AdfException.ERROR);
}
}
</code></pre>
Application screen looks like below when it deployed to Android device, When there is no network available in the device.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5L3aLPFW8D1N82tYaj2mDV8oY-EuSX9v4HHgBclVfh5lDcv_ycFd7sT3xEXOHpuk3awnqgGJwj00yTu9AhlEtMQRuMkcv7rhgBGwV5nLkTsJayzze7XIKNGPizKF2zQWYreJZ_LpbwUk/s1600/NoNetwork.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5L3aLPFW8D1N82tYaj2mDV8oY-EuSX9v4HHgBclVfh5lDcv_ycFd7sT3xEXOHpuk3awnqgGJwj00yTu9AhlEtMQRuMkcv7rhgBGwV5nLkTsJayzze7XIKNGPizKF2zQWYreJZ_LpbwUk/s1600/NoNetwork.png" height="320" width="215" /></a></div>
<br />
Enable the Mobile Data or Wireless and click on the Check button, Connection Type and Network Status will be displayed on the screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguSlR2s2Pj48lO4SkW5fSZ54c7ovSxLPSKv61Wx7AbwrVS7vQQ32VUy6maO9H5h7QVEW-vZvRdKeMm7rvm6HypyPasZ7B9iGIhunxSE-mZ7YLhWjxVVtfsC6INA7zgLWcSwg2Oo_bU_Bw/s1600/Network.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguSlR2s2Pj48lO4SkW5fSZ54c7ovSxLPSKv61Wx7AbwrVS7vQQ32VUy6maO9H5h7QVEW-vZvRdKeMm7rvm6HypyPasZ7B9iGIhunxSE-mZ7YLhWjxVVtfsC6INA7zgLWcSwg2Oo_bU_Bw/s1600/Network.png" height="320" width="215" /></a></div>
<br />
You can download the <a href="https://drive.google.com/uc?export=download&id=0B7hLi4ch7q2ha1J5ekgtWjZGb2c">sample workspace from here</a><br />
[Runs with Oracle JDeveloper 11.1.2.4.0]</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com16tag:blogger.com,1999:blog-3873906122160366310.post-8776297029581581982014-03-06T09:23:00.001-08:002014-03-06T09:23:26.550-08:00ADF Mobile - Popup at center of the window<div dir="ltr" style="text-align: left;" trbidi="on">
Sometimes you may want to position amx:popup at the center of the window. At this moment, in 11.1.2.4.0 there is no declarative solution for this usecase, In this post I'm sharing a code snippet that I noticed from Denis Tyrell(Oracle) for the same.<br />
<br />
You can align the amx:showPopupBehavior with overlapTop property, this indicates how the popup should be aligned relative to the panelPage and then in the amx:popup code you can set the inlineStyle as below:<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 100px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"><amx:popup id="p1" autoDismiss="true"
inlineStyle="position:relative;margin-top:#{(deviceScope.hardware.screen.availableHeight-200)/2}px;margin-left:#{(deviceScope.hardware.screen.availableHeight*10)/100}px;margin-right:#{(deviceScope.hardware.screen.availableHeight*10)/100}px;width:#{deviceScope.hardware.screen.availableWidth};height:200px;">
<amx:outputText value="Popup at center of the window" id="ot4"/>
</amx:popup></code></pre>
Application screen looks like below when it deployed to IOS simulator.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgWXZzFCcAQe-6ZivlNBbbrcYAC532PNpNu-cQVQL1HX1FJ-wPaOzW8Rxsz3RJU-HvbpP4LcJsDkKUdhdol5MmshONocbmGa6H_6QpYA2m7sf7GOKrbdr7qkn7sk2d-nlsSDmYKGYWAv0/s1600/Popup+at+center+of+the+window.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgWXZzFCcAQe-6ZivlNBbbrcYAC532PNpNu-cQVQL1HX1FJ-wPaOzW8Rxsz3RJU-HvbpP4LcJsDkKUdhdol5MmshONocbmGa6H_6QpYA2m7sf7GOKrbdr7qkn7sk2d-nlsSDmYKGYWAv0/s1600/Popup+at+center+of+the+window.png" height="400" width="225" /></a></div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com6tag:blogger.com,1999:blog-3873906122160366310.post-55058872874031201802014-03-02T20:01:00.000-08:002014-03-06T09:24:27.633-08:00ADF Mobile - Reading custom properties from adf-config.xml<div dir="ltr" style="text-align: left;" trbidi="on">
Take a scenario where you have integrated the push notification feature into mobile application and application needs to be shipped to client, to work push notification feature you need Sender ID for both Android and iOS and client want's to use their own Sender Id.<br />
<br />
Next question will be where can we store the custom Sender Id in the application so that the client can edit. Credit goes to Srini Indla(Oracle), I have extracted the idea based on one of his forum reply and below is one of the way.<br />
<br />
Custom values can be stored in add-config.xml file under <adf:adf-properties-child> tag, add-config.xml is used to configure application-level settings, including the Configuration Service parameters and read more on <a href="https://blogs.oracle.com/mobile/entry/adf_mobile_configuration_service_usage">ADF Mobile Configuration Service Usage</a>. The advantage of storing the properties and accessing it via the adf-confg.xml is that the values can be accessible using the EL expression at run time.<br />
<br />
Below is a sample adf-confif.xml with custom properties:<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 370px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><?xml version="1.0" encoding="ISO-8859-1" ?>
<adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:config="http://xmlns.oracle.com/bc4j/configuration"
xmlns:adf="http://xmlns.oracle.com/adf/config/properties">
<adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
<defaults changeEventPolicy="ppr" useBindVarsForViewCriteriaLiterals="true"/>
<startup>
<amconfig-overrides>
<config:Database jbo.locking.mode="optimistic"/>
</amconfig-overrides>
</startup>
</adf-adfm-config>
<adf:adf-properties-child xmlns="http://xmlns.oracle.com/adf/config/properties">
<adf-property name="adfAppUID" value="MobileAdfConfig-1564"/>
<adf-property name="username" value="Weblogic"/>
<adf-property name="password" value="Weblogic1"/>
</adf:adf-properties-child>
</adf-config>
</pre>
<div>
In Amx page you can access the above custom defined properties using EL expression.<br />
For ex: "#{applicationScope.configuration.username}"<br />
<br />
Below is the sample code to access custom properties from adf-config.xml in managed bean.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 150px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">ValueExpression userNameVe =
AdfmfJavaUtilities.getValueExpression("#{applicationScope.configuration.username}", String.class);
String userName = (String)userNameVe.getValue(AdfmfJavaUtilities.getAdfELContext());
ValueExpression passwordVe =
AdfmfJavaUtilities.getValueExpression("#{applicationScope.configuration.password}", String.class);
String password = (String)passwordVe.getValue(AdfmfJavaUtilities.getAdfELContext());
</code></pre>
</div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com23tag:blogger.com,1999:blog-3873906122160366310.post-57376285162996991972014-03-02T19:59:00.001-08:002014-03-02T19:59:57.859-08:00ADF Mobile - How to add a record using Constructor option<div dir="ltr" style="text-align: left;" trbidi="on">
It’s been a while since my last post, but it doesn't mean that new discoveries were not happening. Well to be fair, I have been really busy with various responsibilities, I hope to re-take blogging again it into my daily routine. Now let’s get into business!<br />
<br />
This article is a continuation of "<a href="http://deepakcs.blogspot.in/2013/01/adf-mobile-access-device-native-sqlite.html">ADF Mobile - Access Device Native SQLite Database to Store Data</a>" and here I will try to explain a way of creating the record using the Constructor option with Bean DataControl.<br />
<br />
You can download the <a href="https://drive.google.com/uc?export=download&id=0B7hLi4ch7q2heUNHOHlJSVM0ZU0">sample workspace from here</a><br />
[Runs with Oracle JDeveloper 11.1.2.4.0]<br />
<br />
<u><b>Implementation Steps:- </b></u><br />
<br />
Create an ADF Mobile Application, expand the ViewController project. Locate and expand the Application Sources folder, create a Department.java file and add the below code.
<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class Departments {
protected int departmentId;
protected String departmentName;
protected int locationId;
private transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
public void addPropertyChangeListener(PropertyChangeListener l) {
propertyChangeSupport.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
propertyChangeSupport.removePropertyChangeListener(l);
}
public Departments() {
super();
}
public String getKey() {
Integer i = new Integer(departmentId);
return i.toString();
}
public Departments(int departmentId, String departmentName, int locationId) {
this.setDepartmentId(departmentId);
this.setDepartmentName(departmentName);
this.setLocationId(locationId);
}
Departments(Departments newDepartments) {
this.setDepartmentId(newDepartments.getDepartmentId());
this.setDepartmentName(newDepartments.getDepartmentName());
this.setLocationId(newDepartments.getLocationId());
}
public void setDepartmentId(int departmentId) {
int oldDepartmentId = this.departmentId;
this.departmentId = departmentId;
propertyChangeSupport.firePropertyChange("departmentId", oldDepartmentId, departmentId);
}
public int getDepartmentId() {
return departmentId;
}
public void setLocationId(int locationId) {
int oldLocationId = this.locationId;
this.locationId = locationId;
propertyChangeSupport.firePropertyChange("locationId", oldLocationId, locationId);
}
public int getLocationId() {
return locationId;
}
public void setDepartmentName(String departmentName) {
String oldDepartmentName = this.departmentName;
this.departmentName = departmentName;
propertyChangeSupport.firePropertyChange("departmentName", oldDepartmentName, departmentName);
}
public String getDepartmentName() {
return departmentName;
}
}</code></pre>
Create DepartmentList.java file and add the below code. Create DataControl based on DepartmentList.java file.
<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class DepartmentsList {
private static List s_departments = null;
private Departments editDepartment = new Departments();
private transient ProviderChangeSupport providerChangeSupport = new ProviderChangeSupport(this);
private transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
public void addPropertyChangeListener(PropertyChangeListener l) {
propertyChangeSupport.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
propertyChangeSupport.removePropertyChangeListener(l);
}
public void addProviderChangeListener(ProviderChangeListener l) {
providerChangeSupport.addProviderChangeListener(l);
}
public void removeProviderChangeListener(ProviderChangeListener l) {
providerChangeSupport.removeProviderChangeListener(l);
}
public DepartmentsList() {
if (s_departments == null) {
s_departments = new ArrayList();
Execute();
}
}
public void Execute() {
Trace.log(Utility.ApplicationLogger, Level.INFO, DepartmentsList.class, "Execute",
"!!!!!!!!!!!!!!!!!In DEPARTMENT Execute!!!!!!!!!!!!!!!!!!!!!!!!!");
try {
Connection conn = DBConnectionFactory.getConnection();
s_departments.clear();
conn.setAutoCommit(false);
PreparedStatement stat = conn.prepareStatement("SELECT * from DEPARTMENTS ORDER BY DEPARTMENT_NAME");
ResultSet rs = stat.executeQuery();
Trace.log(Utility.ApplicationLogger, Level.INFO, DepartmentsList.class, "Execute",
"!!!!!!!!!!!!!!!!!Query Executed!!!!!!!!!!!!!!!!!!!!!!!!!");
while (rs.next()) {
Trace.log(Utility.ApplicationLogger, Level.INFO, DepartmentsList.class, "Execute",
"!!!!!!!!!!!!!!!!!Adding Department!!!!!!!!!!!!!!!!!!!!!!!!!");
int departmentId = rs.getInt("DEPARTMENT_ID");
String departmentName = rs.getString("DEPARTMENT_NAME");
int locationId = rs.getInt("LOCATION_ID");
s_departments.add(new Departments(departmentId, departmentName, locationId));
}
rs.close();
providerChangeSupport.fireProviderRefresh("departments");
} catch (SQLException e) {
System.err.println(e.getMessage());
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
public Departments[] getDepartments() {
Departments d[] = null;
d = (Departments[])s_departments.toArray(new Departments[s_departments.size()]);
return d;
}
public void persistDepartments(int departmentId, String departmentName, int locationId) {
Connection conn;
try {
conn = DBConnectionFactory.getConnection();
conn.setAutoCommit(false);
String insertSQL = "Insert into DEPARTMENTS (DEPARTMENT_ID,DEPARTMENT_NAME,LOCATION_ID) values (?,?,?)";
PreparedStatement pStmt = conn.prepareStatement(insertSQL);
pStmt.setInt(1, departmentId);
pStmt.setString(2, departmentName);
pStmt.setInt(3, locationId);
pStmt.execute();
conn.commit();
editDepartment.setDepartmentId(departmentId);
editDepartment.setDepartmentName(departmentName);
editDepartment.setLocationId(locationId);
s_departments.add(0, editDepartment);
providerChangeSupport.fireProviderCreate("departments", editDepartment.getKey(), editDepartment);
} catch (Exception e) {
e.printStackTrace();
}
}
}</code></pre>
In below section I will not show all screen creation, here I'm interested in DeptAdd.amx page. Take a look at the DepartmentList data control in the below image, drag and drop DepartmentsList->Constructors->com.oracle.hr.Departments->Departments as ADF Mobile Parameter Form. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYUc_rYpYe2lKGDSP5NRA2D2TdFZINYu815nsIMAqP-qXv9pFMJRyCpa9uaCQgwIq10EH61XC85rQJUo3lTrpN_gm_b5nwBQjMrTbIHLwZNu-adpRuYKoTrhjNjc-CyfA3rs8Ma2Juz8Y/s1600/Create+Record+Using+Constructor+Data+Control.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYUc_rYpYe2lKGDSP5NRA2D2TdFZINYu815nsIMAqP-qXv9pFMJRyCpa9uaCQgwIq10EH61XC85rQJUo3lTrpN_gm_b5nwBQjMrTbIHLwZNu-adpRuYKoTrhjNjc-CyfA3rs8Ma2Juz8Y/s1600/Create+Record+Using+Constructor+Data+Control.png" height="320" width="167" /></a></div>
<br />
Next drag and drop DepartmentsList->persistDepartment->Method as ADF Mobile Button and in Edit Action Binding window map the parameter binding values as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3bVVx21L2A0IoP4UYCOjsSPbrb9hXCbq_S7VJXjku7tOl3QRI6lnERW7dJi0gQNtah3JqromRD4izDV5qyOeog4uc_Q4QfDDs663xyuvUiDzEKkoSdGQXM4-V3xZ4JrhRq_mufmwl6kA/s1600/Edit+Action+Binding.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3bVVx21L2A0IoP4UYCOjsSPbrb9hXCbq_S7VJXjku7tOl3QRI6lnERW7dJi0gQNtah3JqromRD4izDV5qyOeog4uc_Q4QfDDs663xyuvUiDzEKkoSdGQXM4-V3xZ4JrhRq_mufmwl6kA/s1600/Edit+Action+Binding.png" height="331" width="400" /></a></div>
<br />
Application screen looks like below when it deployed to IOS simulator. Displaying the Departments List is fetched from SQLite, click on the Add button to create new department record.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYCN8uqG5PWg1v01QfrQeTyNzAqBgdpumX1cs4xOPRhJhHa1mkdMuxcZo95v4Y6LJQuFgyVHuV4zFbZqguUco3sR8krYUSeEQuyEpLb-kgYQ-RNb4KeuuR_DRjKpPH_XvI_WYGGlaNuUo/s1600/First+Department+Screen.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYCN8uqG5PWg1v01QfrQeTyNzAqBgdpumX1cs4xOPRhJhHa1mkdMuxcZo95v4Y6LJQuFgyVHuV4zFbZqguUco3sR8krYUSeEQuyEpLb-kgYQ-RNb4KeuuR_DRjKpPH_XvI_WYGGlaNuUo/s1600/First+Department+Screen.png" height="400" width="225" /></a></div>
<br />
Enter the details in the department form and click on Save button. The Department information will saved to the database and moved to Dept List screen and department list will get updated by newly added department record.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiY541MyGQ128-4AcfMyBS9ifV_0a0vvKgm8AFezEeQhA18kpYX61TTSlQ0Y4jriPHEFqlcoITzgXBsiV1vae5I1Lqm8MwqaYAbOVWvLvk56SQHaIT_R3zPpN_hBbvmx5FRYQoY9YLg-4/s1600/Final+Department.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiY541MyGQ128-4AcfMyBS9ifV_0a0vvKgm8AFezEeQhA18kpYX61TTSlQ0Y4jriPHEFqlcoITzgXBsiV1vae5I1Lqm8MwqaYAbOVWvLvk56SQHaIT_R3zPpN_hBbvmx5FRYQoY9YLg-4/s1600/Final+Department.png" height="356" width="400" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com0tag:blogger.com,1999:blog-3873906122160366310.post-4629142152206686912013-10-21T09:46:00.000-07:002014-03-06T09:55:49.673-08:00ADF Mobile - Integrating Signature Capture<div dir="ltr" style="text-align: left;" trbidi="on">
This article provide an example of how to write a custom user control to collect and store of an Electronic Signature created on a Android devices using stylus or a finger on the touch screen. <br />
<br />
I have integrated the <a href="http://thomasjbradley.ca/lab/signature-pad/">SignaturePad</a> jQuery plugin for assisting in the creation of an HTML5 canvas based signature pad. Records the drawn signature in JSON format in SQLite database for later regeneration.<br />
<br />
Application screen looks like below when it deployed and run on Android Device/Emulator. Displays the Employee list on the screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEismVZs6sZHhkY-dDfGo6ISlDjfzq7-pTrg6kyB41cuR53J0ECRXuUcFbO6iZgkxvG_KmMmqScqf7USTbvigL4puyEL3cOEPePZ90IOR-rr6HEScYvNLxmNOAvSfSgBxnZNjgTKHbYbWlQ/s1600/EmployeeList.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEismVZs6sZHhkY-dDfGo6ISlDjfzq7-pTrg6kyB41cuR53J0ECRXuUcFbO6iZgkxvG_KmMmqScqf7USTbvigL4puyEL3cOEPePZ90IOR-rr6HEScYvNLxmNOAvSfSgBxnZNjgTKHbYbWlQ/s400/EmployeeList.png" height="400" width="240" /></a></div>
<br />
Clicking on any employee will take you to the selected Employee details page, click on View Signature button will open up the popup, there is no signature since database doesn't have signature value for this employee. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixaF_0HThYwyOYn23vaQUObp5cAVGcTAYBDziQxz9k9YNIlpZ9I0uVyLYbHNlnn2V0CIyUYfw1Xq9LPnLrftzIT3ZbPw9h1Rd57JoXmQ7O9A09O9whLHGUQDQqSwfk2yDc10FDbGxXPso/s1600/ViewCapture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixaF_0HThYwyOYn23vaQUObp5cAVGcTAYBDziQxz9k9YNIlpZ9I0uVyLYbHNlnn2V0CIyUYfw1Xq9LPnLrftzIT3ZbPw9h1Rd57JoXmQ7O9A09O9whLHGUQDQqSwfk2yDc10FDbGxXPso/s400/ViewCapture.png" height="327" width="400" /></a></div>
<br />
Next click on the Edit button will navigate to the Employee details page, clicking on Capture Signature button will open up the popup and Signature Pad jQuery plugin will transform an HTML form into a signature pad. User can use stylus or a finger on the touch screen to do signature and click the Save button to save the signature value(JSON format) in SQLite database.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsYT5sSZZVnaWl_viCXXXz9q9GBevc4ePsoy0alceb-_VPLaw8HTntkBtQ6t8xfi9Nwnhd7BRgLMzbhX79H9nlhGPOK0GB6dkKeAiQRh6NIJ7pnUlDrt0yLAbJcvxiBelP0Q5EwC8WaHI/s1600/CaptureSignature.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsYT5sSZZVnaWl_viCXXXz9q9GBevc4ePsoy0alceb-_VPLaw8HTntkBtQ6t8xfi9Nwnhd7BRgLMzbhX79H9nlhGPOK0GB6dkKeAiQRh6NIJ7pnUlDrt0yLAbJcvxiBelP0Q5EwC8WaHI/s400/CaptureSignature.png" height="400" width="238" /> </a></div>
<br />
I wasn't able to draw signature of <b><i>King</i></b> properly in android emulator :). Save button will navigate back to Employee details and recorded signature value in database will be used to regenerate the signature on Signature Pad.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE2m3gECREsQ_xgbvBsobuRpIAs-u-6z6zh0iPoIEKaX-iP43Bx9IhjwV5A24sxTlIxcNrZeuJ5ZxCK1bDykvykQwxSm1YW-h2_x_822kYHpl4Hq6zwjX-JhXagybK11lTSue31wge7e0/s1600/ViewCaptureSignature.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE2m3gECREsQ_xgbvBsobuRpIAs-u-6z6zh0iPoIEKaX-iP43Bx9IhjwV5A24sxTlIxcNrZeuJ5ZxCK1bDykvykQwxSm1YW-h2_x_822kYHpl4Hq6zwjX-JhXagybK11lTSue31wge7e0/s400/ViewCaptureSignature.png" height="327" width="400" /></a></div>
<br />
You can <a href="http://ejbdatacontrol-samples.googlecode.com/files/SignatureCapture.zip">download the sample workspace from here.</a><br />
[Runs with Oracle JDeveloper 11.1.2.4.0]<br />
<br />
In this sample application I'm storing the signature value into database, even we can store captured signature value as <a href="http://thomasjbradley.ca/lab/signature-pad/#images">Image format</a>. For more information and option visit <a href="http://thomasjbradley.ca/lab/signature-pad/">Signature Pad</a>.</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com13tag:blogger.com,1999:blog-3873906122160366310.post-88697060448934473342013-09-06T10:33:00.001-07:002013-09-06T10:33:39.531-07:00Jdeveloper 12c - EJB with Rest WebService and Filtering Data Collection<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
In Jdeveloper 12c there is a support for Rest WebService based on EJB and its only for Java Service Facade not for Session Facade. You can create Rest WebService just right click on the Java Service Facade and in context menu click on Create RESTful Service.<br />
<br />
In this blog entry I'm interested in constructing dynamic data collection based on the URI, query-string parameters and send Rest WebService response. Having sensible resource names or paths (e.g., /departments/10 instead of /api?type=departments&id=10) improves the clarity of what a given request does. Using URL query-string parameters is fantastic for filtering, sorting, limit, pagination or dynamic fields. Here HTTP GET method is used to retrieve (or read) a representation of a resource. Read more on <a href="http://www.restapitutorial.com/lessons/httpmethods.html">Rest Webservice</a>.<br />
<br />
The resources are based on EJB Java Service Facade. I tried adding GET parameters (PathParam/QueryParam) to a collection in order to add functionality such as filtering, sorting, filetering fields, limit. I have written logic in Java Service Facade for few resources that looks as below:<br />
<br />
<table border="1px solid #ddd;">
<thead>
<tr>
<th>HTTP Verb</th>
<th><span style="text-align: left;">Resource Naming (URI)</span></th>
<th>Entire Collection (e.g. departments)</th>
</tr>
</thead>
<tbody>
<tr>
<td>GET</td>
<td>RestApplication/resources/model/departments</td>
<td>Return list of departments.</td>
</tr>
<tr>
<td>GET</td>
<td>RestApplication/resources/model/departments?offset=1</td>
<td>Return individual department object.</td>
</tr>
<tr>
<td>GET</td>
<td>RestApplication/resources/model/departments?limit=4&childValue=false</td>
<td>Return list of departments based on limit, if childValue passed as false response will not contains employeeList object.</td>
</tr>
<tr>
<td>GET</td>
<td>RestApplication/resources/model/departments?limit=4&childValue=false&orderBy=departmentId<br />
&orderType=DESC</td>
<td>Return list of departments based on ascending/descending order.</td>
</tr>
<tr>
<td>GET</td>
<td>RestApplication/resources/model/departments?limit=4&childValue=false<br />
&fields=departmentId,departmentName</td>
<td>Return list of departments with selected departments fields dynamically.</td>
</tr>
<tr>
<td>GET</td>
<td>RestApplication/resources/model/departments/20</td>
<td>Return department object by departementId.</td>
</tr>
</tbody>
</table>
<br />
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/RestApplication.zip">download the sample workspace from here</a><br />
[Runs with Oracle JDeveloper 12.1.2.0.0]<br />
<br />
JDeveloper provides WADL supports to run the REST WebService, below are the examples.<br />
<ul style="text-align: left;">
<li>GET http://127.0.0.1:7101/RestApplication/resources/model/departments - Return list of departments</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLulMijUeSWJknExJ8cukCwq437X-rLjaWDDu5Kmx_-sNpPL8DlOsdenzM6RXhfOKgjBCaKfZC3OvIrAGyUYMP5HMd7rpAao-kSMERVSp4o1MTDqkrWMzXMR4H0yl-iT58OQlfkLKpe_s/s1600/DepartmentsAll.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLulMijUeSWJknExJ8cukCwq437X-rLjaWDDu5Kmx_-sNpPL8DlOsdenzM6RXhfOKgjBCaKfZC3OvIrAGyUYMP5HMd7rpAao-kSMERVSp4o1MTDqkrWMzXMR4H0yl-iT58OQlfkLKpe_s/s1600/DepartmentsAll.png" width="570" /></a></div>
<ul>
<li>GET http://127.0.0.1:7101/RestApplication/resources/model/departments?offset=1 - Return department object.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2NfAEUGklOcL-lo0CEXkkmDzgLWVCsZk0frWowKuQyqcv9Qk9RjpPpk8Ug4wy0a0xmKX8RVegByQSAaC6uisKNmXz_j_cxa3IJ-nYKRWsu1Ex3d84yCVdPZK3sON0qrybUiMmFnP0hsU/s1600/Offset.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2NfAEUGklOcL-lo0CEXkkmDzgLWVCsZk0frWowKuQyqcv9Qk9RjpPpk8Ug4wy0a0xmKX8RVegByQSAaC6uisKNmXz_j_cxa3IJ-nYKRWsu1Ex3d84yCVdPZK3sON0qrybUiMmFnP0hsU/s1600/Offset.png" width="570" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li>GET http://127.0.0.1:7101/RestApplication/resources/model/departments?limit=4&childValue=false - Return list of departments based on limit, if childValue passed as false response will not contains employeeList object.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW7wswsjV-qLV_AzvNmhm2KQD27FaqvtXTlrdVZq9Z-U0KA3gXV3LV2X6_HALWSmwqn00KMO6KaC4zAkAScgvrHd4VXJ9ydbnZwjJduIqZNwTJcJe3RJ8wWeHm_u5Sq4QAWdvwkYUOa_k/s1600/Limit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW7wswsjV-qLV_AzvNmhm2KQD27FaqvtXTlrdVZq9Z-U0KA3gXV3LV2X6_HALWSmwqn00KMO6KaC4zAkAScgvrHd4VXJ9ydbnZwjJduIqZNwTJcJe3RJ8wWeHm_u5Sq4QAWdvwkYUOa_k/s1600/Limit.png" width="570" /></a></div>
<ul style="text-align: left;">
<li>GET http://127.0.0.1:7101/RestApplication/resources/model/departments?limit=4&childValue=false&orderBy=departmentId&orderType=DESC - Return list of departments based on ascending/descending order.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPV9OkHSZvI9R160BzcsmGlG8LAF819rWB6Z4K-F-aOc3AeEc7M189UoCpbygCQBihTNb-hCtN8_mCO8VlPo02p0lQb4tl4dZmyUOuSrowtsKoyWZIQ6hTV77cUt2WBXI1foQxyk9OuDY/s1600/OrderBy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPV9OkHSZvI9R160BzcsmGlG8LAF819rWB6Z4K-F-aOc3AeEc7M189UoCpbygCQBihTNb-hCtN8_mCO8VlPo02p0lQb4tl4dZmyUOuSrowtsKoyWZIQ6hTV77cUt2WBXI1foQxyk9OuDY/s1600/OrderBy.png" width="570" /></a></div>
<ul style="text-align: left;">
<li>GET http://127.0.0.1:7101/RestApplication/resources/model/departments?limit=4&childValue=false&fields=departmentId,departmentName - Return list of departments with dynamic departments fields.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCvMTzQj2SpgowJ1hgAuS4FtOzIFFY7VZVPloPWUbYnUF5psqjYWAvjPFBp_WOUCVsGMKZobzyOMddBdudzdW8WCdZU6g042wiGErXeuSzG5Wu8KwTs2pA-5oB5mKT__ID_PM_XLqBmII/s1600/Fields.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCvMTzQj2SpgowJ1hgAuS4FtOzIFFY7VZVPloPWUbYnUF5psqjYWAvjPFBp_WOUCVsGMKZobzyOMddBdudzdW8WCdZU6g042wiGErXeuSzG5Wu8KwTs2pA-5oB5mKT__ID_PM_XLqBmII/s1600/Fields.png" width="570" /></a></div>
<ul style="text-align: left;">
<li>GET http://127.0.0.1:7101/RestApplication/resources/model/departments/20 - Return department object by departementId.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFjxBC3FUbwfd4Km6QbNY67CI9A5AR1lpNpZg_6ScJse2UOnTtkeQQTy15y15NgSH18dfsjciVNbM_5hjkiBIl8m1BuN7z67QteuuaHpxHEROfNjVe5fOYMbLBOS50RgCKPWf61IzfK_U/s1600/departmentId.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFjxBC3FUbwfd4Km6QbNY67CI9A5AR1lpNpZg_6ScJse2UOnTtkeQQTy15y15NgSH18dfsjciVNbM_5hjkiBIl8m1BuN7z67QteuuaHpxHEROfNjVe5fOYMbLBOS50RgCKPWf61IzfK_U/s1600/departmentId.png" width="570" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Below Java Service Facade code explains how to create resources and filter the data collection for above scenarios.</div>
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 400px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">@Path("model")
public class JavaServiceFacade {
private final EntityManager em;
private String XMLResponse;
private String fields = null;
private boolean childValue;
public JavaServiceFacade() {
final EntityManagerFactory emf = Persistence.createEntityManagerFactory("Model-1");
em = emf.createEntityManager();
}
/**
* @param childValue
* @param offset
* @param limit
* @param fields
* @param orderBy
* @param orderType
* @return
*/
@GET
@Produces("application/xml")
@Path("/departments")
public String getDepartmentsFindAll(@DefaultValue("true") @QueryParam("childValue") boolean childValue,
@DefaultValue("0") @QueryParam("offset") int offset,
@DefaultValue("0") @QueryParam("limit") int limit,
@QueryParam("fields") String fields, @QueryParam("orderBy") String orderBy,
@QueryParam("orderType") String orderType) {
this.childValue = childValue;
this.fields = fields;
Query query = null;
if (offset > 0) {
query =
em.createNamedQuery("Departments.findAll", Departments.class).setFirstResult(offset).setMaxResults(1);
this.generateXMlResponse(query, false);
} else if (orderBy != null) {
String qlString = "select o from Departments o order by o." + orderBy;
if (orderType != null)
qlString += " " + orderType;
query = em.createQuery(qlString, Departments.class).setMaxResults(limit);
this.generateXMlResponse(query, false);
} else {
query = em.createNamedQuery("Departments.findAll", Departments.class).setMaxResults(limit);
this.generateXMlResponse(query, false);
}
return this.XMLResponse;
}
/**
* @param departmentId
* @param fields
* @param childValue
* @return
*/
@GET
@Produces("application/xml")
@Path("/departments/{departmentId}")
public String getDepartmentById(@PathParam("departmentId") int departmentId, @QueryParam("fields") String fields,
@DefaultValue("true") @QueryParam("childValue") boolean childValue) {
this.childValue = childValue;
this.fields = fields;
Query query =
em.createNamedQuery("Departments.ByDeptId", Departments.class).setParameter("bind_departmentId",
departmentId);
this.generateXMlResponse(query, true);
return this.XMLResponse;
}
/**
* @param query
* @param singleResult
*/
public void generateXMlResponse(Query query, boolean singleResult) {
if (singleResult == true) {
List deptResultList = query.getResultList();
if (deptResultList.size() > 0) {
this.XMLResponse = "<departmentss>";
Iterator deptListIterator = deptResultList.iterator();
while (deptListIterator.hasNext()) {
this.XMLResponse += "<departments>";
Departments dept = (Departments) deptListIterator.next();
this.constructXML(dept.getClass(), dept, false);
if (this.childValue == true) {
List<employees> empList = dept.getEmployeesList1();
for (int j = 0; j < empList.size(); j++) {
Employees emp = empList.get(j);
this.XMLResponse += "<employeeslist1>";
this.constructXML(emp.getClass(), emp, true);
this.XMLResponse += "</employeeslist1>";
}
}
this.XMLResponse += "</employees></departments>";
}
this.XMLResponse += "</departmentss>";
}
} else {
Vector resultList = (Vector) query.getResultList();
int deptSize = resultList.size();
if (deptSize > 0) {
this.XMLResponse = "<departmentss>";
for (int i = 0; i < deptSize; i++) {
// Object obj = resultList.elementAt(i);
this.XMLResponse += "<departments>";
Departments dept = (Departments) resultList.elementAt(i);
this.constructXML(dept.getClass(), dept, false);
if (this.childValue == true) {
List<employees> empList = dept.getEmployeesList1();
for (int j = 0; j < empList.size(); j++) {
Employees emp = empList.get(j);
this.XMLResponse += "<employeeslist1>";
this.constructXML(emp.getClass(), emp, true);
this.XMLResponse += "</employeeslist1>";
}
}
this.XMLResponse += "</employees></departments>";
}
this.XMLResponse += "</departmentss>";
}
}
}
/**
* @param clazz
* @param obj
* @param childValue
*/
public void constructXML(Class clazz, Object obj, boolean childValue) {
Class noparams[] = { };
try {
Field[] field = clazz.getDeclaredFields();
for (int i = 0; i < field.length; i++) {
String fieldName = field[i].getName();
if (field[i].isAnnotationPresent(Column.class)) {
String methodName =
"get" + field[i].getName().toString().substring(0, 1).toUpperCase() +
field[i].getName().toString().substring(1);
Method method = clazz.getDeclaredMethod(methodName, noparams);
Object fieldValue = method.invoke(obj, null);
if (this.fields == null || childValue == true) {
this.XMLResponse += "<" + fieldName + ">" + fieldValue + "</" + fieldName + ">";
} else {
String columnNames[] = this.fields.split(",");
for (int j = 0; j < columnNames.length; j++) {
if (columnNames[j] != null) {
boolean colNamesExist = this.findFieldExists(Departments.class, columnNames[j]);
if (colNamesExist == true && columnNames[j].equals(fieldName))
this.XMLResponse += "<" + fieldName + ">" + fieldValue + "</" + fieldName + ">";
}
}
}
}
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
/**
*
* @param clazz
* @param fieldName
* @return boolean
*/
public boolean findFieldExists(Class clazz, String fieldName) {
try {
Field field = clazz.getDeclaredField(fieldName);
if (field != null)
return true;
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
return false;
}
/**
* All changes that have been made to the managed entities in the
* persistence context are applied to the database and committed.
*/
private void commitTransaction() {
final EntityTransaction entityTransaction = em.getTransaction();
if (!entityTransaction.isActive()) {
entityTransaction.begin();
}
entityTransaction.commit();
}
public Object queryByRange(String jpqlStmt, int firstResult, int maxResults) {
Query query = em.createQuery(jpqlStmt);
if (firstResult > 0) {
query = query.setFirstResult(firstResult);
}
if (maxResults > 0) {
query = query.setMaxResults(maxResults);
}
return query.getResultList();
}
public <t> T persistEntity(T entity) {
em.persist(entity);
commitTransaction();
return entity;
}
public <t> T mergeEntity(T entity) {
entity = em.merge(entity);
commitTransaction();
return entity;
}
}</t></t></code></pre>
</div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com0tag:blogger.com,1999:blog-3873906122160366310.post-87125609830759064632013-09-05T12:36:00.000-07:002013-09-05T12:36:11.268-07:00ADF Mobile - Programmatically call RestServiceAdapter for POST Request<div dir="ltr" style="text-align: left;" trbidi="on">
In my previous blog entry we saw how to get <a href="http://deepakcs.blogspot.in/2013/08/adf-mobile-get-rest-webservice-based.html">Rest WebService based form values in managed bean programmatically</a>. In this entry will see how RestServiceAdapter interface lets you trigger execution of web service operations without the need to create a web service data control or interact with it directly.<br />
<br />
<div>
Below code will explain how to get REST WebService based form values in managed bean and programmatically call the RestServiceAdapter for the POST request . Already there is a <a href="http://docs.oracle.com/cd/E37975_01/doc.111240/e24475/amxwebservices.htm#CHDJECCJ">documentation</a> on this, but here I'm trying to explain the end to end scenario as mentioned in below steps.<br />
<ol>
<li>Get the form values from departmentsIterator programmatically. </li>
<li>Dynamically construct the response xml based on departmentsIterator.</li>
<li>Set the Rest WebService Connection with POST request option.</li>
</ol>
Take an example with mobile application having two screen. First screen consists of departments list and in second screen you can add new department for the Save button I have created the managed bean with actionListener method as below. </div>
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 400px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class DeptBean {
public DeptBean() {
}
public void addDeptAction(ActionEvent actionEvent) {
RestServiceAdapter restServiceAdapter = Model.createRestServiceAdapter();
// Clear any previously set request properties, if any
restServiceAdapter.clearRequestProperties();
// Set the connection name
restServiceAdapter.setConnectionName("RestServerEndpoint");
restServiceAdapter.setRequestType(RestServiceAdapter.REQUEST_TYPE_POST);
// Specify the type of request
restServiceAdapter.addRequestProperty("Content-Type", "application/xml");
restServiceAdapter.addRequestProperty("Accept", "application/xml; charset=UTF-8");
// Specify the number of retries
restServiceAdapter.setRetryLimit(0);
// Set the URI which is defined after the endpoint in the connections.xml.
// The request is the endpoint + the URI being set
restServiceAdapter.setRequestURI("/EJBRestServiceDemo/jersey/EJBRestServiceDemo");
ValueExpression ve =
AdfmfJavaUtilities.getValueExpression("#{bindings.departmentsIterator.currentRow.dataProvider}",
Object.class);
Object obj = ve.getValue(AdfmfJavaUtilities.getAdfELContext());
if (obj instanceof VirtualJavaBeanObject) {
try {
VirtualJavaBeanObject vjbo = (VirtualJavaBeanObject)obj;
String postData = this.constructXMlResponse(vjbo);
response = restServiceAdapter.send(postData);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* Construct the XMLResponse based on the VirtualJavaBeanObject dynamically
* @param vjbo
* @return
*/
public static String constructXMlResponse(VirtualJavaBeanObject vjbo) {
String XMLResponse = "";
if (vjbo.getAttributeInfoCount() > 0) {
String xmlRootTag = getClassName(vjbo.getName());
XMLResponse += "<" + xmlRootTag + ">";
int count = vjbo.getAttributeInfoCount();
for (int i = 0; i < count; i++) {
AttributeInfo fieldName = vjbo.getAttributeInfo(i);
XMLResponse +=
"<" + fieldName.name + ">" + vjbo.getAttribute(fieldName.name).toString() + "</" + fieldName.name +
">";
}
XMLResponse += "</" + xmlRootTag + ">";
}
return XMLResponse;
}
/**
* Get the class name with/without the package
* @param className
* @return
*/
public static String getClassName(String className) {
int firstChar = className.lastIndexOf('_') + 1;
if (firstChar > 0) {
className = className.substring(firstChar);
}
return className.toLowerCase();
}
}</code></pre>
<i>Note:- The GenericType is only exposed in SOAP data controls, so Rest Webservice data control can't be executed directly using AdfmfJavaUtilities.invokeDataControlMethod.</i><br />
<i><br /></i>
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/PrgmRestServiceAdapter.zip">download the sample workspace from here</a>.<br />
[Runs with Oracle JDeveloper 11.1.2.4.0]</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com9tag:blogger.com,1999:blog-3873906122160366310.post-48111189996618237942013-08-29T05:28:00.001-07:002013-08-29T05:31:52.931-07:00ADF Mobile - How to get the Preferences value in HTML page<div dir="ltr" style="text-align: left;" trbidi="on">
In my previous blog entry I went over "<a href="http://deepakcs.blogspot.in/2013/02/usage-of-user-preferences-in-adf-mobile.html">Usage of User Preferences in ADF Mobile</a>", In this entry we'll see how to get the Preferences value in HTML page.<br />
<br />
<i>In this type of scenarios we can use Javascript Callback Function <b>"adf.mf.api.invokeMethod"</b> invoke a Java method from any class in a classpath.</i><br />
<br />
Below Code illustrate how to call the Java method from HTML and get Preferences values back into the HTML.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 540px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"><script type="text/javascript" charset="utf-8">
/**
* Document is done loading this is called and we add a listener for the
* phonegap event 'deviceready'.
*/
function onBodyLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
};
/**
* When this function is called, PhoneGap has been initialized and is ready to roll.
*/
function onDeviceReady() {
adf.mf.api.invokeMethod("mobile.LoginBean", "getPreferencesData", onSuccess, onFail);
}
function onSuccess(request, response) {
// Process any return values that comes back in the "response" parameter
// Overwrite the below html field values
document.getElementById("username").value = response[0];
document.getElementById("password").value = response[1];
document.getElementById("serviceURL").value = response[2];
}
function onFail(request, response) {
}
</script></code></pre>
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/LoginPreferencesApp.zip">download the sample workspace from here</a><br />
[Runs with Oracle JDeveloper 11.1.2.4.0]<br />
<br />
<b><u>Implementation Steps</u></b><br />
<b><u><br /></u></b>
Create a ADF Mobile application, In ViewController project. Locate and expand the Application Sources folder, then expand the META-INF folder. You will see the adfmf-feature.xml file, click on the adfmf-feature.xml file to launch the Feature editor. Add a new feature by clicking the green plus sign on the Features table near top of the editor this will launch the new Create ADF Mobile Feature dialog, modify the Feature Name as "feature1".<br />
<br />
In the Features table, select the newly created feature feature1 Under the Features table, click the Content tab, and locate the Content table. Notice that the content item feature1.1 is created by default and Type as Local HTML. Next add a new file by clicking the green plus sign and create a index.html file.<br />
<br />
Open adfmf-feature.xml, add the adfmf:preferences for "feature1" as shown below.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"><?xml version="1.0" encoding="UTF-8" ?>
<adfmf:features xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adfmf="http://xmlns.oracle.com/adf/mf">
<adfmf:feature id="feature1" name="feature1" credentials="none">
<adfmf:content id="feature1.1">
<adfmf:constraints/>
<adfmf:localHTML url="feature1/index.html"/>
</adfmf:content>
<adfmf:preferences>
<adfmf:preferenceGroup id="security" label="Security">
<adfmf:preferenceText id="username" label="User Name" default="oracle"/>
<adfmf:preferenceText id="password" label="Password" secret="true" default="oracle12"/>
<adfmf:preferenceText id="serviceURL" label="Security URL" default="http://security.foo.com/provider"/>
</adfmf:preferenceGroup>
</adfmf:preferences>
</adfmf:feature>
</adfmf:features></code></pre>
In ViewController project, locate and expand the Application Sources folder, create a LoginBean.java file and add the below code.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class LoginBean {
public LoginBean() {
super();
}
public List getPreferencesData() {
List preferences = new ArrayList();
String username =
(String)AdfmfJavaUtilities.evaluateELExpression("#{preferenceScope.feature.feature1.security.username}");
String password =
(String)AdfmfJavaUtilities.evaluateELExpression("#{preferenceScope.feature.feature1.security.password}");
String serviceURL = (String)AdfmfJavaUtilities.evaluateELExpression("#{preferenceScope.feature.feature1.security.serviceURL}");
preferences.add(username);
preferences.add(password);
preferences.add(serviceURL);
return preferences;
}
}</code></pre>
Open the index.html page and add the below code.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></meta>
<title>index</title>
<script type="text/javascript">
if (!window.adf)
window.adf = {
};
adf.wwwPath = "../../../../www/";
</script>
<script type="text/javascript" src="../../../../www/js/base.js"></script>
<script type="text/javascript" charset="utf-8">
/**
* Document is done loading this is called and we add a listener for the
* phonegap event 'deviceready'.
*/
function onBodyLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
};
/**
* When this function is called, PhoneGap has been initialized and is ready to roll.
*/
function onDeviceReady() {
adf.mf.api.invokeMethod("mobile.LoginBean", "getPreferencesData", onSuccess, onFail);
}
function onSuccess(request, response) {
// Process any return values that comes back in the "response" parameter
document.getElementById("username").value = response[0];
document.getElementById("password").value = response[1];
document.getElementById("serviceURL").value = response[2];
}
function onFail(request, response) {
}
</script>
</head>
<body id="mainBody" onload="onBodyLoad()">
<div id="bodyPage">
<div class="amx-view-container current">
<div class="amx-node amx-view">
<div class="amx-node amx-panelPage">
<div class="amx-panelPage-header">
<div class="amx-panelPage-facet-header">
<div class="amx-node amx-outputText" id="message">
<br></br>
</div>
</div>
</div>
<div class="amx-panelFormLayout amx-label-position-start amx-field-halign-end amx-layout-one-row amx-node">
<div class="amx-panelFormLayout_body">
<div class="amx-panelFormLayout_sizing">
<div class="field-label"></div>
<div class="field-value"></div>
</div>
<div class="field amx-node amx-inputText">
<div class="field-label">
<label>Security URL</label>
</div>
<div class="field-value">
<input type="text" name="serviceURL" id="serviceURL" value=""/>
</div>
</div>
</div>
</div>
<div class="amx-panelFormLayout amx-label-position-start amx-field-halign-end amx-layout-one-row amx-node">
<div class="amx-panelFormLayout_body">
<div class="amx-panelFormLayout_sizing">
<div class="field-label"></div>
<div class="field-value"></div>
</div>
<div class="field amx-node amx-inputText">
<div class="field-label">
<label>User Name</label>
</div>
<div class="field-value">
<input type="text" name="username" id="username" value=""/>
</div>
</div>
</div>
</div>
<div class="amx-panelFormLayout amx-label-position-start amx-field-halign-end amx-layout-one-row amx-node">
<div class="amx-panelFormLayout_body">
<div class="amx-panelFormLayout_sizing">
<div class="field-label"></div>
<div class="field-value"></div>
</div>
<div class="field amx-node amx-inputText" onclick="adf.mf.login.focusPassword();">
<div class="field-label">
<label>Password</label>
</div>
<div class="field-value">
<input type="password" name="password" id="password" value=""/>
</div>
</div>
</div>
</div>
<div style="text-align: center;">
<div id="loginButton" class="amx-node amx-commandButton">
<div class="amx-node amx-commandButton-label">
<p>Login</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="amx-loading" class="amx-loading hidden"></div>
</div>
</body>
</html></code></pre>
Application screen looks like below when it deployed and run on Android Device/Emulator. When the application loads, Security values will be fetched from Preferences and displayed on the html file.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy8i3lP8kSMlOXWbIwoWV5WdLAS7NGmiwkEmXyclBnUP6PR8p_ReEhTdZPhqL7Z6ZMgAhDV-FCpWOafUVnflJeqhS9_SFL2GRhU1KDBNtqgoy6vMVwvOlm9r1VjModbYc_dWd_8KavV8k/s1600/Login.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy8i3lP8kSMlOXWbIwoWV5WdLAS7NGmiwkEmXyclBnUP6PR8p_ReEhTdZPhqL7Z6ZMgAhDV-FCpWOafUVnflJeqhS9_SFL2GRhU1KDBNtqgoy6vMVwvOlm9r1VjModbYc_dWd_8KavV8k/s400/Login.png" width="238" /></a></div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com3tag:blogger.com,1999:blog-3873906122160366310.post-26833900198296996462013-08-22T08:36:00.000-07:002013-08-22T08:36:08.161-07:00ADF Mobile - Get REST WebService based form values in managed bean<div dir="ltr" style="text-align: left;" trbidi="on">
In my previous blog entry I went over "<a href="http://deepakcs.blogspot.in/2013/03/get-adf-mobile-form-values-in-managed.html">Get ADF Mobile Form values in managed bean using Accessor Iterator</a>", In this entry we'll see how to get Rest WebService based form values in managed bean programmatically.<br />
<br />
Below is one of the way to access Rest WebService based form values, here is the code below.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 300px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">ValueExpression ve =
AdfmfJavaUtilities.getValueExpression("#{bindings.editEmployeeIterator.currentRow.dataProvider}",
Object.class);
Object obj = ve.getValue(AdfmfJavaUtilities.getAdfELContext());
if (obj instanceof VirtualJavaBeanObject) {
VirtualJavaBeanObject vjbo = (VirtualJavaBeanObject)obj;
if (vjbo.getAttributeInfoCount() > 0) {
int count = vjbo.getAttributeInfoCount();
for (int i = 0; i > count; i++) {
AttributeInfo fieldName = vjbo.getAttributeInfo(i);
String fieldValue = vjbo.getAttribute(fieldName.name).toString();
System.out.println(fieldName.name + " :" + fieldValue);
}
}
}
</code></pre>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com0tag:blogger.com,1999:blog-3873906122160366310.post-458862290758449202013-08-01T04:59:00.001-07:002013-08-01T04:59:58.238-07:00EJB provides Accessor iterators for Parameterized Named Query in JDeveloper 12c<div dir="ltr" style="text-align: left;" trbidi="on">
Scenario is to add new row to the ADF Table, here ADF Table is based on Named Query having parameters.<br />
<br />
When a user defines a JPA named query with parameters in Employee entity using persistence xml (for ex: "<b>select o from Employees o where o.departmentId = :bind_departmentId"</b>), these queries were exposed through non-getter methods on the EJB Session or Java Service facade classes and will be exposed as method actions. Method Action looks as below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXP30b9IE7uUUqqobaREpJAcjoHxQiof4aqLN0HHjsAxmLMxlSrSFQm61mN7t3ijVCqxkPIsfGADvET_VfkNelCmRY170ecCm5926FH7ZmMfnYC5YDXj2kj26b0jqblvHgJZfDSKv3fRo/s1600/OldDataControl.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXP30b9IE7uUUqqobaREpJAcjoHxQiof4aqLN0HHjsAxmLMxlSrSFQm61mN7t3ijVCqxkPIsfGADvET_VfkNelCmRY170ecCm5926FH7ZmMfnYC5YDXj2kj26b0jqblvHgJZfDSKv3fRo/s1600/OldDataControl.PNG" /></a></div>
<br />
In JDeveloper 12c same queries will be exposed through getter methods as Accessor iterators. Accessor iterator looks as below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwovF7kG2dsdQpRekl9SP4pzzHfiFb9c_8UzoYvfn9hzfoUOfVUZk7gpuEzM2lRbwiYywxQO2zi_Z7dHTWzsZkOLa5vSbR-0-AhDW7QMmtHSf6PFRfLhl21uYbjkcmPv4IrMTaLhpJTR4/s1600/Accessor+Iterators.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwovF7kG2dsdQpRekl9SP4pzzHfiFb9c_8UzoYvfn9hzfoUOfVUZk7gpuEzM2lRbwiYywxQO2zi_Z7dHTWzsZkOLa5vSbR-0-AhDW7QMmtHSf6PFRfLhl21uYbjkcmPv4IrMTaLhpJTR4/s400/Accessor+Iterators.png" width="400" /></a></div>
<br />
<i>Note:- Named Query name should be defined in following pattern: <b>"<entity name>.<query name>"</b> and query name should start with <b>"get" + "<first char should be uppercase>"</b></i><br />
<i>For ex: <b>Employees.</b></i><i><b>getByDeptId</b></i><br />
<br />
<i>If the named query name doesn't follow the above pattern, then it will be exposed as Method Action.</i><br />
<br />
You can <a href="http://ejbdatacontrol-samples.googlecode.com/files/NamedQueryHavingParameters.zip">download the sample workspace from here</a><br />
[Runs with Oracle JDeveloper 12.1.2.0.0]<br />
<br />
<u style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><b>Implementation Steps</b></u><br />
<br />
Create Fusion Web Application with entity based on Employees table, open the employees entity java class and add the below Named Query inside @NamedQueries section.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">@NamedQuery(name = "Employees.getByDeptId",
query = "select o from Employees o where o.departmentId = :bind_departmentId")</code></pre>
Next create a session bean and expose all methods to local/remote interface and generate data control.<br />
<br />
In ViewController project, create and open the index.jspx page and follow the below steps:<br />
<ul style="text-align: left;">
<li>In the Data Controls accordion, expand the SessionEJBBean node, drop employeesGetByDeptId->Operations->ExecuteWithParams as ADF Parameter Form. Notice in the below image, parameter value binding will be bind_departmentId.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2MCHObBZicBaF6oWw9AOlLjuab7FHTLPQHDPj7qIBGpjOzb3Qcyq-0gOaQVMvK8nlSB7O7K8Sg-ReQ1_vvOsG1F-AI-cvc1Wl4b6LtW1dxUyhnkkbXboXnOpr3WAteWes9d3Lkm0XOoc/s1600/CreateForm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="307" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2MCHObBZicBaF6oWw9AOlLjuab7FHTLPQHDPj7qIBGpjOzb3Qcyq-0gOaQVMvK8nlSB7O7K8Sg-ReQ1_vvOsG1F-AI-cvc1Wl4b6LtW1dxUyhnkkbXboXnOpr3WAteWes9d3Lkm0XOoc/s400/CreateForm.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<i>Note:- <b>ExecuteWithParams </b>operation is supported in EJB Datacontrols from Jdeveloper 12c.</i><br />
<ul style="text-align: left;">
<li>Drop employeesGetByDeptId->Table/List View as ADF Table. </li>
<li>In the Data Controls accordion, expand the SessionEJBBean node, drop employeesGetByDeptId->Operations->Create as ADF Button</li>
<li>Drop the persistEntity(Object) as Method->ADF Button. In Edit Action Binding window select the binding value as "#{bindings.employeesGetByDeptIdIterator.currentRow.dataProvider}"</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM7P1ccDPEupVTFP1THKqo5PKRvmBQ0fiYg0Rya1An3lN6-N4PCQllMZhoruVcSVqurs0EkA1o90gC_ellCXeFTrV-yOf9KW40p2N62CDcP4XVhqybzdIzPPCwWh5s-3T7jPCG7yLIdIo/s1600/PersistObject.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM7P1ccDPEupVTFP1THKqo5PKRvmBQ0fiYg0Rya1An3lN6-N4PCQllMZhoruVcSVqurs0EkA1o90gC_ellCXeFTrV-yOf9KW40p2N62CDcP4XVhqybzdIzPPCwWh5s-3T7jPCG7yLIdIo/s400/PersistObject.png" width="380" /></a></div>
<div>
<br /></div>
Run the index.jspx page and enter values in search form with departmentId as 90 and click on ExecuteWithParam button. Named query will filter the data and display employee records which are associated with departmentId.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSxXK3MyuPJc_0wbbTBea2_WlCEG7biRQi4ex6d5tqWAWSaHPmOGzkJ3SUzCgwkUZRu93j4oR91k_VG4-tgNq5m80XGZgRoCimr4l7G7cZXvAkieZ42wLeb8O3MtGldjMj5szWprbFuy4/s1600/ExecuteWithParams.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="113" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSxXK3MyuPJc_0wbbTBea2_WlCEG7biRQi4ex6d5tqWAWSaHPmOGzkJ3SUzCgwkUZRu93j4oR91k_VG4-tgNq5m80XGZgRoCimr4l7G7cZXvAkieZ42wLeb8O3MtGldjMj5szWprbFuy4/s640/ExecuteWithParams.png" width="560" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Next clicking on Create Button will insert new row inside the table, enter the employee information and click on persistEntity button to save the record.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLj6KCJhjYIoPMXVQ-0m46gtlIUd65GPhdOf6x_y3E24cMceRJKT8_a8FBmOqySNoWzzHcvbXMBQSLiIAQ-yUxIo_UIdk1gRHbhWaS7r8kyNKfCqP4-qMuhvpOM8ikZe7VlA6KvM333E4/s1600/AddRecord.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="114" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLj6KCJhjYIoPMXVQ-0m46gtlIUd65GPhdOf6x_y3E24cMceRJKT8_a8FBmOqySNoWzzHcvbXMBQSLiIAQ-yUxIo_UIdk1gRHbhWaS7r8kyNKfCqP4-qMuhvpOM8ikZe7VlA6KvM333E4/s640/AddRecord.png" width="560" /></a></div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com1tag:blogger.com,1999:blog-3873906122160366310.post-82685519164945730652013-07-31T09:14:00.000-07:002013-07-31T09:14:57.805-07:00JDeveloper 12c - WebService support for EJB entities having foreign key relationship<div dir="ltr" style="text-align: left;" trbidi="on">
Oracle Jdeveloper provides an easily way to create SOAP Webservice based on EJB entities, just need to annotate SessionEJBBean with @Webservice or right click on the SessionEJBBean and in context menu click on "Create Web Service".<br />
<br />
In earlier version of Jdeveloper you can create Webservice based on EJB entities having foreign key relationship(Departments and Employees tables). Run the Webservice in Jdeveloper WADL, this will give the Response HTTP headers Status as 200 but no content will be displayed because of the foreign key relationship.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqrsJ_OWHSHOzxutwqnyTS5GtfTi5Ysa6aTz-il2y-own6N07HZGS-WdATvk1ZPM0CFo4Z1E4uevHgKy9ucMqES7urTtdihwJ9S2k0txYOPisquKk9-p-BZ0W5OsvVZQS2JpwKrXiLe28/s1600/11.1.2.4.0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="176" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqrsJ_OWHSHOzxutwqnyTS5GtfTi5Ysa6aTz-il2y-own6N07HZGS-WdATvk1ZPM0CFo4Z1E4uevHgKy9ucMqES7urTtdihwJ9S2k0txYOPisquKk9-p-BZ0W5OsvVZQS2JpwKrXiLe28/s640/11.1.2.4.0.png" width="560" /></a></div>
<br />
Now Jdeveloper 12c supports creating the Webservice based on EJB entities having foreign key relationship(Departments and Employees tables), to achieve this while creating the "EJB Entities from Tables" we need to select "Generate For Webservice".<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGkHEhQLpMYtxSb7hGpgZ0IcWNd3FGSLt4x6FfG6Iuov33uXLbgJM60wnhxmByp2sGEP8vXJYi5CdSrAzunQtgJqmCh9VcLdaHBI4_Po_f5AHfSklbL06toKD9Bg7venLI7TaUKoXncZo/s1600/GenerateWebService.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="342" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGkHEhQLpMYtxSb7hGpgZ0IcWNd3FGSLt4x6FfG6Iuov33uXLbgJM60wnhxmByp2sGEP8vXJYi5CdSrAzunQtgJqmCh9VcLdaHBI4_Po_f5AHfSklbL06toKD9Bg7venLI7TaUKoXncZo/s400/GenerateWebService.png" width="400" /></a></div>
<br />
Here Departments entity has foreign key relationship with Employees entity but when we run the Webservice in Jdeveloper WADL, this will give the Response HTTP headers Status as 200 and records will be returned only for Departments entity not employee list associated with departmentId.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU2_nCcnDKgFGeYx7O924XeHhi0ChtYXjJw_ZJrTYBDkRAImrv2PPFb-6A-s4Kyz11drWKN3nXt0x9ri3CNk15aENpxDSQFSVjdGJ7udzA9jRess7_jWCUPHxQhKlRlfKsjUXjJvpNwjY/s1600/12C.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="243" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU2_nCcnDKgFGeYx7O924XeHhi0ChtYXjJw_ZJrTYBDkRAImrv2PPFb-6A-s4Kyz11drWKN3nXt0x9ri3CNk15aENpxDSQFSVjdGJ7udzA9jRess7_jWCUPHxQhKlRlfKsjUXjJvpNwjY/s640/12C.png" width="560" /></a></div>
<span id="goog_1900455897"></span><span id="goog_1900455898"></span><br /></div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com0tag:blogger.com,1999:blog-3873906122160366310.post-83756461154778273972013-06-19T13:47:00.001-07:002013-06-19T13:52:11.858-07:00ADF Mobile Push Notifications With Google Cloud Messaging (GCM) Part 2<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Server Side Code Implementation Using PHP</b><br />
<br />
In this tutorial I have used PHP as server side programming language and MySQL database to store data. Since sending message from PHP to GCM is easy, here we'll be using CURL to create a message request to send for Google GCM server. <a href="http://php.net/manual/en/book.curl.php"><b>CURL</b></a> is a library that lets you make HTTP requests in PHP.<br />
<div>
<br /></div>
<div>
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/php_gcm.zip">download the workspace from here</a>. Extract the file to public html folder and modify the PHP files code as shown in below section to make PHP application work.</div>
<div>
<br /></div>
<div>
Open the config.php and enter the Mysql sever details where your Mysql DB is installed. Also change the Google API Key associated with Google project. Create the gcm_users table in the database, gcm_users.sql script is located in etc folder.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnW_I849G_IjlLXJvUxJxQm2xVkWTX1rt6WjB54kGeUQm80Jd5u6krxIEEInAeaZHkw842kB7Ah8FPfakcD4IooulMTnHAoL6PgPvvajUWZlH43GfMLr8wwyS-yTRnp-Q3PL4Q4_IGXJ4/s1600/Config.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnW_I849G_IjlLXJvUxJxQm2xVkWTX1rt6WjB54kGeUQm80Jd5u6krxIEEInAeaZHkw842kB7Ah8FPfakcD4IooulMTnHAoL6PgPvvajUWZlH43GfMLr8wwyS-yTRnp-Q3PL4Q4_IGXJ4/s640/Config.png" width="560" /></a></div>
<div>
<br /></div>
<div>
Developed the SOAP based Web service to receive device token/ registration id from ADF mobile and store that in Mysql database. Here I have used <a href="http://nusoap.sourceforge.net/"><b>NuSOAP</b></a> to create webservice, NuSOAP is a rewrite of SOAPx4, provided by NuSphere and Dietrich Ayala. It is a set of PHP classes - no PHP extensions required - that allow developers to create and consume web services based on SOAP 1.1, WSDL 1.1 and HTTP 1.0/1.1<br />
<br />
Open the <b>http://hostname/GcmService.php</b> in browser, you can see the gcmService as showed below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnjxbebJiK5Xmv6LiN2Dj_hZ7u-0lLHcrHgfG2WFNzIzr26Cl476M11ethWWjKAI0JX73nCJDq4n8w7Hl7Oc9AnL4UZe0PpWzPq4-N_vH8dqnu9v2p2wcZLuTKLPTwPoIklrKTL7b4fF0/s1600/gcmService.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnjxbebJiK5Xmv6LiN2Dj_hZ7u-0lLHcrHgfG2WFNzIzr26Cl476M11ethWWjKAI0JX73nCJDq4n8w7Hl7Oc9AnL4UZe0PpWzPq4-N_vH8dqnu9v2p2wcZLuTKLPTwPoIklrKTL7b4fF0/s640/gcmService.png" width="560" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Clicking on the WSDL link will loads the Webservice WSDL URL - "<b>http://hostname/GcmService.php?wsdl</b>", which will be used in the <a href="http://deepakcs.blogspot.in/2013/06/adf-mobile-push-notifications-with.html"><i>ADF Mobile Push Notifications With Google Cloud Messaging (GCM) Part 1</i></a> to create Web service data control to send data back to provider application server.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Open the http://hostname/index.php in the browser, page loads with no devices is registered. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgqgGIoZR1SLAptGNsQM_xmbH9-72v4e-ceijLrZZYyV9KCIIhRhhT0dIbXmqjhY9-ddZPX2iQG0R9lh9CjxIIOqIQLp-sfpFsKoEGk8nkfRES5DPs7q9_1SnPWBHVq2Da91n_hsp3qg0/s1600/NoDevices.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgqgGIoZR1SLAptGNsQM_xmbH9-72v4e-ceijLrZZYyV9KCIIhRhhT0dIbXmqjhY9-ddZPX2iQG0R9lh9CjxIIOqIQLp-sfpFsKoEGk8nkfRES5DPs7q9_1SnPWBHVq2Da91n_hsp3qg0/s640/NoDevices.png" width="560" /></a></div>
<br />
Push Notification provides a channel to push notifications to clients, and the notification payload can contain some limited set of parameter-value pairs that can be parsed by the ADF Mobile app, when you click on the notification message. In this example I am sending the payload as<br />
<br />
<b>"$message = array("alert" => $message, 'sound' => 'default', 'customMessage' => $customMessage);"</b><br />
<br />
You can alter the payload in send_message.php. Once the users registered with GCM, http://hostname/index.php screen will looks as below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr14sVpLxYnGG8ZB8kevueOWpvcQfLcZ6baabMWzttbrk_lo3EaVGcQGmLzfjB_b79Xu8RwrRGmzezKTZ-YV9TwY_OeGOP4cDUIv0e5tpJn0_vU50vWJ4AyzmiKrnEs_yNz8aThkxKJ8c/s1600/DeviceFound.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr14sVpLxYnGG8ZB8kevueOWpvcQfLcZ6baabMWzttbrk_lo3EaVGcQGmLzfjB_b79Xu8RwrRGmzezKTZ-YV9TwY_OeGOP4cDUIv0e5tpJn0_vU50vWJ4AyzmiKrnEs_yNz8aThkxKJ8c/s640/DeviceFound.png" width="560" /></a></div>
<br />
Now you can send the Push Notification message to registered users.</div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com14tag:blogger.com,1999:blog-3873906122160366310.post-38642518910460294182013-06-19T13:47:00.000-07:002013-06-19T21:02:19.643-07:00ADF Mobile Push Notifications With Google Cloud Messaging (GCM) Part 1<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html">Oracle ADF Mobile 11.1.2.4</a> release adds the Push Notification Support, now ADF Mobile application can register to receive notifications through both the Apple and Google notification services. In this article I try to explain on how to implement <b>“Google Cloud Messaging for Android (<a href="http://developer.android.com/google/gcm/index.html">GCM</a>) with ADF Mobile, GCM is a service that helps developers to send data from servers to their Android applications on Android devices“</b>.<br />
<br />
Thanks to Joe Haung his article helped me to understand the implementation of <a href="https://blogs.oracle.com/mobile/entry/push_notification_support_and_provide">ADF Mobile with push notification.</a> <br />
<br />
Below diagram illustrates the overview working concept of ADF Mobile with Push Notification support.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA5wN_CbFtJZQYmI2YKebhXkDhx7fgW7YW8aaX_QkB35-yb_KoMkcbUDZp6SpN1b1cgv_gPXdt0hdWKCB1Stj3eJrwTo8gn6KC6NGdfolfthng8HaEOUc84t7lpFpiGR4mJpNnRGnp7mw/s1600/ADF+Mobile+Push+Notification.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA5wN_CbFtJZQYmI2YKebhXkDhx7fgW7YW8aaX_QkB35-yb_KoMkcbUDZp6SpN1b1cgv_gPXdt0hdWKCB1Stj3eJrwTo8gn6KC6NGdfolfthng8HaEOUc84t7lpFpiGR4mJpNnRGnp7mw/s640/ADF+Mobile+Push+Notification.png" width="560" /></a></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/PushNotification.zip">download the sample workspace from here</a></div>
<div class="separator" style="clear: both;">
[Runs with Oracle JDeveloper 11.1.2.4.0].</div>
<div class="separator" style="clear: both;">
<br /></div>
<b>Registering with Google Cloud Messaging</b><br />
<ul style="text-align: left;">
<li>Open <a href="https://code.google.com/apis/console">Google APIs Console</a> page and create a new project. (If you haven’t created already otherwise it will take you to dashboard). <b> </b></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg88atCaEf5QIUYIbzXNVAG852E-juAE48-Eqpwbe17EQrQN9H7vh0pb5qaCa6oZ_W-u2uIAtSq_JpWNuMyqA57t5Zg10Fle9l0UAMZUPuyV-aAzvOpVH_FL6y-ND3Rwj0ysgxE5B4ZXR0/s1600/GoogleAPIs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="371" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg88atCaEf5QIUYIbzXNVAG852E-juAE48-Eqpwbe17EQrQN9H7vh0pb5qaCa6oZ_W-u2uIAtSq_JpWNuMyqA57t5Zg10Fle9l0UAMZUPuyV-aAzvOpVH_FL6y-ND3Rwj0ysgxE5B4ZXR0/s400/GoogleAPIs.png" width="400" /></a></div>
<ul style="text-align: left;">
<li>After creating project, click on Overview tab. Note down the <b>Project Number</b> which will be used as <i><b>Sender Id / Authorization Id</b></i> in ADF Mobile application
</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW7tv5bZmnvJdBxlloO9tAtTUglqLJ8dwDB-TNkyf8yERFb3ruWrs1_DvB5vBKN4GnVlCLlPV_6kAqjiAJFGAZDUGok6yMBFfoFXteIwF0orvAll56GH6IYLsz09tMyT86NgJrr0OlCDc/s1600/Project+Id.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="233" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW7tv5bZmnvJdBxlloO9tAtTUglqLJ8dwDB-TNkyf8yERFb3ruWrs1_DvB5vBKN4GnVlCLlPV_6kAqjiAJFGAZDUGok6yMBFfoFXteIwF0orvAll56GH6IYLsz09tMyT86NgJrr0OlCDc/s640/Project+Id.png" width="560" /></a></div>
<ul style="text-align: left;">
<li>Click on Services tab on the left panel and turn on Google Cloud Messaging for Android.
</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdd5pSGVBNoWTk-ovLZF0iqY38Fr7AKG-qQgXIETNG2RNI9iVAY5EHdDiPNKXTla2BzqRCOlMCNo5kAavqi5FXX-6KfIPCsIPtvhWxC_xbFqKFVREO-eH0BlHZRqQmtYDIeez4LsNbf-c/s1600/Enable+GCM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdd5pSGVBNoWTk-ovLZF0iqY38Fr7AKG-qQgXIETNG2RNI9iVAY5EHdDiPNKXTla2BzqRCOlMCNo5kAavqi5FXX-6KfIPCsIPtvhWxC_xbFqKFVREO-eH0BlHZRqQmtYDIeez4LsNbf-c/s640/Enable+GCM.png" width="560" /></a></div>
<ul style="text-align: left;">
<li>Once you are done, click on API Access and note down the API Key. This API key will be used when sending requests to GCM server.
</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih3M1noHJ6U9iJ2ho1h1F4sE0jfu-zLMDvnu0TKyhSl7K62x0eWk2c4yxE-KHsE6MTPoy0H-fBjBtaCb03_1alLKEsV_3IXrPrtQsGhGhnTfg1IOLgTjBlTikSHBRdnjHX_GBikrRlhV8/s1600/API+key.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="348" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih3M1noHJ6U9iJ2ho1h1F4sE0jfu-zLMDvnu0TKyhSl7K62x0eWk2c4yxE-KHsE6MTPoy0H-fBjBtaCb03_1alLKEsV_3IXrPrtQsGhGhnTfg1IOLgTjBlTikSHBRdnjHX_GBikrRlhV8/s640/API+key.png" width="560" /></a></div>
<b><br /></b>
<b>ADF Mobile Implementation Steps</b><br />
<br />
Create an ADF Mobile application, In the application controller project, register an application lifecycle event listener (ALCL) class. Open the Application Resources -> Descriptors -> ADF META-INF -> adfmf-application.xml, click on the LifeCycle Event Listener search icon and added “application.LifeCycleListenerImpl”.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJq6lR6dBiszM_M3mKPoE6qmDgdJnhuteyhX_uND3pEBqMEZLXJE1N8hlkzALCziqRitc9V0_BmIH4aahn-xEk6isi38N6oevdZ-SIe5R3mUWetplrxAy7kPHalh3bK3qcWopt0i07vtQ/s1600/LifeCycleListener.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJq6lR6dBiszM_M3mKPoE6qmDgdJnhuteyhX_uND3pEBqMEZLXJE1N8hlkzALCziqRitc9V0_BmIH4aahn-xEk6isi38N6oevdZ-SIe5R3mUWetplrxAy7kPHalh3bK3qcWopt0i07vtQ/s640/LifeCycleListener.png" width="560" /></a></div>
<br />
Open the LifeCycleListenerImpl class and implement the <code>oracle.adfmf.application.PushNotificationConfig</code> interface. This interface provides the registration configuration for push notifications. Override and implement the <code>getNotificationStyle</code> and <code>getSourceAuthorizationID</code> methods of the <code>PushNotificationConfig</code> interface. LifeCycleListenerImpl java class looks like below.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 280px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class LifeCycleListenerImpl implements LifeCycleListener, PushNotificationConfig {
public LifeCycleListenerImpl() {
}
public long getNotificationStyle() {
return 0L;
}
public String getSourceAuthorizationId() {
return null;
}
public void start() {
// Add code here...
}
public void stop() {
// Add code here...
}
public void activate() {
// Add code here...
}
public void deactivate() {
// Add code here...
}
} </code></pre>
In the application controller project, create a push notification listener class (for example, <code>NativePushNotificationListener</code>) that handles push notification events. This class must implement the oracle.adfmf.framework.event.EventListener interface that defines an event listener.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class NativePushNotificationListener implements EventListener {
public NativePushNotificationListener() {
super();
}
public void onMessage(Event event) {
//Parsing the payload JSON string
JSONBeanSerializationHelper jsonHelper = new JSONBeanSerializationHelper();
try {
PayloadServiceResponse serviceResponse =
(PayloadServiceResponse)jsonHelper.fromJSON(PayloadServiceResponse.class, event.getPayload());
//Can access the variables like below
serviceResponse.getCustomMessage();
// To do
} catch (Exception e) {
e.printStackTrace();
}
}
public void onError(AdfException adfException) {
}
public void onOpen(String string) {
// Storing the regisration id send by GCM server in #{applicationScope.deviceToken} for further usage
ValueExpression ve = AdfmfJavaUtilities.getValueExpression("#{applicationScope.deviceToken}", String.class);
ve.setValue(AdfmfJavaUtilities.getAdfELContext(), string);
}
}</code></pre>
Create a PayloadServiceResponse.java class and add the below code.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 280px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class PayloadServiceResponse {
private double from;
private String collapse_key;
private String customMessage;
private String sound;
private String alert;
public void setFrom(double from) {
this.from = from;
}
public double getFrom() {
return from;
}
public void setCollapse_key(String collapse_key) {
this.collapse_key = collapse_key;
}
public String getCollapse_key() {
return collapse_key;
}
public void setCustomMessage(String customMessage) {
this.customMessage = customMessage;
}
public String getCustomMessage() {
return customMessage;
}
public void setSound(String sound) {
this.sound = sound;
}
public String getSound() {
return sound;
}
public void setAlert(String alert) {
this.alert = alert;
}
public String getAlert() {
return alert;
}
}
</code></pre>
Open the LifeCycleListenerImpl class and modify the below method code as followed.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 280px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public void start() {
//Create an EventSource object that represents the source of a native push notification event:
EventSource evtSource =
EventSourceFactory.getEventSource(NativePushNotificationEventSource.NATIVE_PUSH_NOTIFICATION_REMOTE_EVENT_SOURCE_NAME);
//Create and add an object of the push notification listener class to the event source
evtSource.addListener(new NativePushNotificationListener());
}
public long getNotificationStyle() {
return 0L;
}
public String getSourceAuthorizationId() {
//Here AuthorizationId is the "Sender Id" of Google project created earlier
String senderId = "765350429141";
ValueExpression ve = AdfmfJavaUtilities.getValueExpression("#{applicationScope.applicationId}", String.class);
ve.setValue(AdfmfJavaUtilities.getAdfELContext(), senderId);
return senderId;
}
</code></pre>
In the application controller project, click on new gallery expand the General - Data Control nodes and select
Webservice Service Data Control. <i>Refer to the <a href="http://deepakcs.blogspot.in/2013/06/adf-mobile-push-notifications-with_19.html">ADF Mobile Push Notifications With Google Cloud Messaging (GCM) Part 2</a>, set the server side code to access http://hostname/GCMService.php?wsdl</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTImzj1CbKX8hEDXrAgS-RemI-TkdKpn9kHyw_cXENn7lsP9M8POmLzw6_E1XZNbLnFxBkiTq4ulS09hInob8MPa_glHySZPXNrCsiYcn_d9DjHqrktG-D3I0F8dq-JVOgYOY7Wwdjduw/s1600/DataSource.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="476" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTImzj1CbKX8hEDXrAgS-RemI-TkdKpn9kHyw_cXENn7lsP9M8POmLzw6_E1XZNbLnFxBkiTq4ulS09hInob8MPa_glHySZPXNrCsiYcn_d9DjHqrktG-D3I0F8dq-JVOgYOY7Wwdjduw/s640/DataSource.png" width="560" /></a></div>
<br />
In the Create Web Service Data Control - Step 2 of 5 wizard, move the persistGCMUser from available to selected and click on Finish.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh56qIC0hNgjU6Tu_7D5eDl5m2ydkfRXyJaXKV1FOjBAl4ZIa0kz_0sHEVJ_8NM7iZvMwH3HtnGNXO3weyPpuDbEHxm_EoK5IDqbjnfzEsYYw-b3QHVUP4uoBzHX76XA-rQ4oo8Y65Rdgo/s1600/DataSource1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="484" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh56qIC0hNgjU6Tu_7D5eDl5m2ydkfRXyJaXKV1FOjBAl4ZIa0kz_0sHEVJ_8NM7iZvMwH3HtnGNXO3weyPpuDbEHxm_EoK5IDqbjnfzEsYYw-b3QHVUP4uoBzHX76XA-rQ4oo8Y65Rdgo/s640/DataSource1.png" width="560" /></a></div>
<br />
In ViewController project. Locate and expand the Application Sources
folder, then expand the META-INF folder. You will see the
adfmf-feature.xml file, click on the adfmf-feature.xml file to launch
the Feature editor. Add a new feature by clicking the green plus sign on
the Features table near top of the editor this will launch the new
Create ADF Mobile Feature dialog, modify the values as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwDdWeVNGwsofgmcha0sGp49bLpUlS0eRRmPTT9ZLtpr-i1aoL4PbVXdugsJB6yCI2pP7CqAtfuUvledbmBdEF-rQX7KggD94Wh4nfZufBt_l6ICf4NfSGCqCzV5wWmnxx5qLHqoOyHTg/s1600/SaveDeviceToken.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="113" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwDdWeVNGwsofgmcha0sGp49bLpUlS0eRRmPTT9ZLtpr-i1aoL4PbVXdugsJB6yCI2pP7CqAtfuUvledbmBdEF-rQX7KggD94Wh4nfZufBt_l6ICf4NfSGCqCzV5wWmnxx5qLHqoOyHTg/s400/SaveDeviceToken.png" width="400" /></a></div>
<br />
In the Features table, select the newly created feature SaveDeviceToken. Under the
Features table, click the Content tab, and locate the Content table.
Notice that the content item SaveDeviceToken.1 is created by default. Next add a
new file by clicking the green plus sign and select ADF Mobile AMX Page option,
this will launch the new Create ADF Mobile AMX Page, modify the File Name as "SaveDeviceToken.amx".<br />
<br />
From Data Control palette drag and drop GCMService->persistGCMUser_parameters->gcmUser as ADF Mobile Form and GCMService->persistGCMUser as ADF Mobile button as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiC9AH9iTnwVgzbk4jheBaIGyB-m-JUQKWmkH7jIclcFrlBi2GsuVEGA3ouk8Hw79y3Zhzvg76S39Hw_nCVlXULlUMRcxtM1uCfMho3wDa528Qxj9qyAG1quCK3NZm5GVfIcOcsdgmkiTI/s1600/Action+Binding.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="372" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiC9AH9iTnwVgzbk4jheBaIGyB-m-JUQKWmkH7jIclcFrlBi2GsuVEGA3ouk8Hw79y3Zhzvg76S39Hw_nCVlXULlUMRcxtM1uCfMho3wDa528Qxj9qyAG1quCK3NZm5GVfIcOcsdgmkiTI/s400/Action+Binding.png" width="400" /></a></div>
<br />
In SaveDeviceToken.amx page, create a managed bean with action listener method (name as executePersistGCMUser) and map to persistGCMuser button action listener.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKMiEsspbxoYKKLhNo7K_Q2Ng1tb_CJLYWrcIsotOY1Nv0LeDYihzf4Lp2w7BvTHVMhtxlnbvlgDA0C6xPjv-9dhaDjxAujQ3uA3uv06d7H8720pMckC1H6jjespAiLA9xnP8pH6Yhbno/s1600/ActionListener.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="124" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKMiEsspbxoYKKLhNo7K_Q2Ng1tb_CJLYWrcIsotOY1Nv0LeDYihzf4Lp2w7BvTHVMhtxlnbvlgDA0C6xPjv-9dhaDjxAujQ3uA3uv06d7H8720pMckC1H6jjespAiLA9xnP8pH6Yhbno/s320/ActionListener.png" width="320" /></a></div>
<br />
Open the SaveDeviceToken.amx and modify the page with below code.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 280px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="word-wrap: normal;"><?xml version="1.0" encoding="UTF-8" ?>
<amx:view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amx="http://xmlns.oracle.com/adf/mf/amx"
xmlns:dvtm="http://xmlns.oracle.com/adf/mf/amx/dvt">
<amx:panelPage id="pp1">
<amx:facet name="header">
<amx:outputText value="Save Device Token" id="ot1"/>
</amx:facet>
<amx:panelFormLayout id="pfl1">
<amx:inputText value="#{bindings.username.inputValue}" label="#{bindings.username.hints.label}" id="it4"/>
<amx:inputText value="#{bindings.email.inputValue}" label="#{bindings.email.hints.label}" id="it3"/>
<amx:panelLabelAndMessage label="GCM Device Token" id="plam1">
<amx:outputText value="#{applicationScope.deviceToken}" id="ot3"/>
</amx:panelLabelAndMessage>
</amx:panelFormLayout>
<amx:commandButton actionListener="#{SaveDeviceTokenBean.executePersistGCMUser}" text="Save GCM User"
disabled="#{!bindings.persistGCMUser.enabled}" id="cb1">
<amx:setPropertyListener id="spl1" from="#{applicationScope.applicationId}"
to="#{bindings.applicationId.inputValue}" type="action"/>
<amx:setPropertyListener id="spl2" from="#{deviceScope.device.os}" to="#{bindings.deviceType.inputValue}"
type="action"/>
<amx:setPropertyListener id="spl3" from="#{applicationScope.deviceToken}"
to="#{bindings.deviceToken.inputValue}" type="action"/>
</amx:commandButton>
</amx:panelPage>
</amx:view>
</code></pre>
Open the SaveDeviceTokenBean.java class and modify the executePersistGCMUser as shown below.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 175px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public void executePersistGCMUser(ActionEvent actionEvent) {
MethodExpression me =
AdfmfJavaUtilities.getMethodExpression("#{bindings.persistGCMUser.execute}", Object.class,
new Class[] { });
me.invoke(AdfmfJavaUtilities.getAdfELContext(), new Object[] { });
//Navigate to the Tasks feature
AdfmfContainerUtilities.gotoFeature("Tasks");
}
</code></pre>
SaveDeviceToken.amx preview looks as below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIKTe6dcsqOxJs3NC2JZwYpSpUpfPkHHhZxxPIWSfowvxHeOTV7weq4hyphenhyphenEPXptdUfmfEPUi_rIYc56-YeCHF7OahO3zvpcoQ9agt_J5uNEW5WhdXgC5EYr6-xRCz6NaXeqsfXpOsf_U4M/s1600/SaveDeviceTokenPreview.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIKTe6dcsqOxJs3NC2JZwYpSpUpfPkHHhZxxPIWSfowvxHeOTV7weq4hyphenhyphenEPXptdUfmfEPUi_rIYc56-YeCHF7OahO3zvpcoQ9agt_J5uNEW5WhdXgC5EYr6-xRCz6NaXeqsfXpOsf_U4M/s400/SaveDeviceTokenPreview.png" width="240" /></a></div>
<br />
Open on the adfmf-feature.xml file to launch the Feature editor. Add a new feature by clicking the green plus sign on the Features table near top of the editor this will launch the new Create ADF Mobile Feature dialog, modify the values as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimm0zehKK9w1gsooSyW-si7azI-eKFZYGIl2_rZEAtYrhg33U2b5a2_t1mbY7pKR8Mbc73EiI3f7Ba2k445SiH7_1i-trqq3DgFxBcavS1kGU3UA_CtE_jHbrWrcqROXXxpC5R7SO06hU/s1600/TasksFeature.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="113" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimm0zehKK9w1gsooSyW-si7azI-eKFZYGIl2_rZEAtYrhg33U2b5a2_t1mbY7pKR8Mbc73EiI3f7Ba2k445SiH7_1i-trqq3DgFxBcavS1kGU3UA_CtE_jHbrWrcqROXXxpC5R7SO06hU/s400/TasksFeature.png" width="400" /></a></div>
<br />
In the Features table, select the newly created feature Tasks. Under the Features table, click the Content tab, and locate the Content table. Notice that the content item Tasks.1 is created by default. Next add a new file by clicking the green plus sign and select ADF Mobile AMX Page option, this will launch the new Create ADF Mobile AMX Page, modify the File Name as "TasksIndexPage.amx". Page preview looks like below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0dihfRUb2V74zGEFKu6iSRAVKdtn6deuppZQjcU2wL8Ad18lYiYRZDADV1a7Il5bN-bDARmGs5LDh-tRvm3cHQBlkRW6IwBaHFoCQImD2Ua3u8RfEcwiQ8P9CNamFP8W9dUtNBPk-VYc/s1600/TasksDetails.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0dihfRUb2V74zGEFKu6iSRAVKdtn6deuppZQjcU2wL8Ad18lYiYRZDADV1a7Il5bN-bDARmGs5LDh-tRvm3cHQBlkRW6IwBaHFoCQImD2Ua3u8RfEcwiQ8P9CNamFP8W9dUtNBPk-VYc/s400/TasksDetails.png" width="238" /></a></div>
<br />
Deployed and tested the Push Notification support on both Android Device/Emulator and work's fine. If your are running the application on the emulator make sure you select target as Google APIs while creating the Android Virtual Device.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHqmuxtmxGhIKXvOD1Kg0o8BinTHxPaHh4zl3rTWRxb732VwzCZ7VEpEnOY4bBxRtSjDTxnhHYyW63lfi9n8VAQYpVh_Yoq01w73VRGRW35vYigMWeaO0ZrEnOoACf7rWmj4rdF1In2s0/s1600/AVD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHqmuxtmxGhIKXvOD1Kg0o8BinTHxPaHh4zl3rTWRxb732VwzCZ7VEpEnOY4bBxRtSjDTxnhHYyW63lfi9n8VAQYpVh_Yoq01w73VRGRW35vYigMWeaO0ZrEnOoACf7rWmj4rdF1In2s0/s400/AVD.png" width="251" /></a></div>
<br />
Click on the Settings icon in the emulator and go to ACCOUNTS section. Add the Google account, so that <a href="https://developers.google.com/android/c2dm/">C2DM</a> configure with Gmail account for mapping a unique device.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUPIN7T4hLTuFA1It-cs8_uHb4zaQkI-dX6lj9_hj6qKbcG-MvzxE-GufxMR89uyfVPje74p5NMIE6g6q97e6948vsQ_U5FvFZEWfttaAg9lS8JQ5iPGFDEXulLAM1Y639P6eDRCfH524/s1600/GoogleAccount.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUPIN7T4hLTuFA1It-cs8_uHb4zaQkI-dX6lj9_hj6qKbcG-MvzxE-GufxMR89uyfVPje74p5NMIE6g6q97e6948vsQ_U5FvFZEWfttaAg9lS8JQ5iPGFDEXulLAM1Y639P6eDRCfH524/s400/GoogleAccount.png" width="238" /></a></div>
<br />
Application screen looks like below when it run on Android Device/Emulator. At this stage the application would initiate a registration request with push notification services, after successful registration, GCM server issues registration id back to the android device that would uniquely identify the ADF Mobile application and the device. <i>Note in the first screen GCM Device Token is displayed after successful registration.</i><br />
<i><br /></i>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI3Gm6n0N8YwOAfxxu-W1kOQmNzWZppFA2KJIcZ0Ifvo3NnraA5y7VBzmzOeos-0Lj6hTWncnDZiCfKsIH8gs7kSD8FDfYdh8GbowSZksGEpck6hHnweHSPPtporK6SwcCLk5Pjf78jyU/s1600/Save+Token+Page.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="325" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI3Gm6n0N8YwOAfxxu-W1kOQmNzWZppFA2KJIcZ0Ifvo3NnraA5y7VBzmzOeos-0Lj6hTWncnDZiCfKsIH8gs7kSD8FDfYdh8GbowSZksGEpck6hHnweHSPPtporK6SwcCLk5Pjf78jyU/s400/Save+Token+Page.png" width="400" /></a></div>
<br />
Enter form details and click save button to send back the data to application provider server, also navigates to Tasks Details screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvTxikkmxj9pikqwoo_Q6MzWztDo1UWdb54Bti905MPXSrefA0Ys37HArU0nk0nH7fYebZc6UGLpYk8vnFt_RZRD63Oy5HDO3_ul6cjHWkfRA46pmDmlQQMmcDPnKqh8F4CpKutRYf-7Y/s1600/TasksDetails.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvTxikkmxj9pikqwoo_Q6MzWztDo1UWdb54Bti905MPXSrefA0Ys37HArU0nk0nH7fYebZc6UGLpYk8vnFt_RZRD63Oy5HDO3_ul6cjHWkfRA46pmDmlQQMmcDPnKqh8F4CpKutRYf-7Y/s400/TasksDetails.png" width="238" /></a></div>
<b><i><br /></i></b>
<b><i>Handling Push Notifications</i></b><br />
<ul style="text-align: left;">
<li><i>The ADF Mobile application is installed, but not running and ADF Mobile application is running in the background</i> - In both the cases notification the notification message displays with the registered notification style (none, banner, or alert). When the user taps the message (if its a banner-style notification) or touches the action button (if the message appears as an alert), the ADF Mobile application launches, invoking the application notification handlers. </li>
<li><i>The ADF Mobile application is running in the foreground - </i>No notification message displays. The application notification handlers are invoked.</li>
</ul>
Open the http://hostname in the browser will load the index.php page and displays devices which are registered and send the message.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzDy3lfQgV_IEzxYP8PfmQKnWrnCy9y7ejsFA54COAc3c1I1z6iEbShqbRLr4TJLYDOeQ7rziOz7KpLTochrMkmF0nOsb4vmSLiovspVhTwsnNYCTSTQAEGxPpD-lVjqyURBDrlW-ND5I/s1600/DeviceFoundType.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzDy3lfQgV_IEzxYP8PfmQKnWrnCy9y7ejsFA54COAc3c1I1z6iEbShqbRLr4TJLYDOeQ7rziOz7KpLTochrMkmF0nOsb4vmSLiovspVhTwsnNYCTSTQAEGxPpD-lVjqyURBDrlW-ND5I/s640/DeviceFoundType.png" width="560" /></a></div>
<br />
<i>Refer the <a href="http://deepakcs.blogspot.in/2013/06/adf-mobile-push-notifications-with_19.html">ADF Mobile Push Notifications With Google Cloud Messaging (GCM) Part 2</a>, how to </i><i>set the server side code to access http://hostname/index.php and</i><i> send message from sever side to GCM</i>. Once the message is sent you can see the notification in both Device/Emulator as shown below.<br />
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGYH6lZZ8q9QqE3j9l18hxqTdKrXJ5qAa0KcNjstrf3hyphenhyphenzTSCJV1cZNAlO09-7VjDCVUf9LKjr-OHSAbjSTfD_iw9oKKpVJK5LUBIpK7n5yqRtzQ_vkp8SBO4KV7GpzLVglHLeks-DyDM/s1600/Notification.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGYH6lZZ8q9QqE3j9l18hxqTdKrXJ5qAa0KcNjstrf3hyphenhyphenzTSCJV1cZNAlO09-7VjDCVUf9LKjr-OHSAbjSTfD_iw9oKKpVJK5LUBIpK7n5yqRtzQ_vkp8SBO4KV7GpzLVglHLeks-DyDM/s400/Notification.png" width="238" /></a></div>
<div>
</div>
<div>
<div>
<br />
In the NativePushNotificationListener class - <b>onMessage method load, you can parse the event payload and invoke additional application logic accordingly</b>. Below is the example how the payload looks when you run in the debug mode. You can refer to NativePushNotificationListener class I have showed how to parse the payload. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibFSZAfEAg5Bv0cFchkuXCRRisUEIqacLlL6yb26gnpOLAbqQj1DW8APnKmXqSPx0cFX_HXqDEqEh40xkz2ldVsEZc-lkRIc-UH4G-2TOXl4W9IKDXlpC_oRLscq0ewWtjGe0d3Xp92vE/s1600/Debug.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibFSZAfEAg5Bv0cFchkuXCRRisUEIqacLlL6yb26gnpOLAbqQj1DW8APnKmXqSPx0cFX_HXqDEqEh40xkz2ldVsEZc-lkRIc-UH4G-2TOXl4W9IKDXlpC_oRLscq0ewWtjGe0d3Xp92vE/s640/Debug.png" width="560" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both;">
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/PushNotification.zip">download the sample workspace from here</a></div>
<div class="separator" style="clear: both;">
[Runs with Oracle JDeveloper 11.1.2.4.0].</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
For more details you can refer to <a href="https://blogs.oracle.com/mobile/entry/push_notification_support_and_provide">Push Notification Support and (Provide Your Own?) Provider (Part 1)</a>, <a href="http://docs.oracle.com/cd/E37975_01/doc.111240/e24475/pushnotification.htm#CJHJGGEA">Oracle Mobile Developer's Guide on Push Notifications</a>.</div>
</div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com18tag:blogger.com,1999:blog-3873906122160366310.post-71279921912081387192013-06-10T13:19:00.000-07:002013-06-10T13:19:13.811-07:00Offline Data Synchronization for ADF Mobile <div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
In Mobile applications very desired feature is able to work offline. For data-driven applications, it means user can store (a subset of) the application data locally, and implement a data synchronization mechanism that keeps your local and server data in sync.<br />
<br />
In work offline scenario user need not connect to the internet always, but needs to collect data (offline) for later submission. Another usage can be an offline cache on the client for faster data access and also preserve network bandwidth.<br />
<br />
In this article we will create an ADF Mobile application with offline capability, here user can add/modify the data and store it in persistent local database. Every once in a while we push all the added/modified data to the server using SOAP based WebService to sync online data.<br />
<br />
<b>Architecture Diagram</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBkhZHmycOQxRGVhN4oekh-xJRpygHmQ8vF6xQryUonumh1dI1VtbsakFBjDtynJ0fWtdSMRd-ua6Z3etkvu_yWvPl_OYmqo0ogC1KHj2BsN7Sn7tMCsIcoCuR5tCsN55QxT39uO-JgBw/s1600/Offline+Data+Synchronization+for++Mobile+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBkhZHmycOQxRGVhN4oekh-xJRpygHmQ8vF6xQryUonumh1dI1VtbsakFBjDtynJ0fWtdSMRd-ua6Z3etkvu_yWvPl_OYmqo0ogC1KHj2BsN7Sn7tMCsIcoCuR5tCsN55QxT39uO-JgBw/s1600/Offline+Data+Synchronization+for++Mobile+.png" width="560" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<b><i>Note: - </i></b>
<br />
<ul style="text-align: left;">
<li><i>WebServices exposed are based on </i><i><i>EJB.</i></i></li>
<li><i>Current implementation supports unidirectional (client to server) synchronize from Local DB to Server DB.</i> </li>
</ul>
<b>Workflow</b><br />
<ol style="text-align: left;">
<li><b>Data Initialization</b> - When the application loads for the first time, required data will be pulled from Local DB to Server DB. In this demo application I'm pulling all departments detail to Local DB, so that sample departments detail can be displayed on application load.</li>
<li><b>Auto Sync - </b>User can add/modify the data and click on save button, here first step is to save data into Local DB then check for the synchronization settings
preferences. If Auto Sync is enabled then check for the network
connection is available, if yes push the current request data to the
Server DB.</li>
<li><b>Manual Sync</b> - Next is to turn it into an app that is able to run offline, without network connection present, user can go to synchronization settings preferences and disable the Auto
Sync, so that data will be stored and cached locally
for faster access and also preserve network bandwidth. Once in a while
push all the added/modified data to Server DB from Local DB.</li>
</ol>
</div>
<div>
Application screen looks like below when it is deployed and run on the Android Device/Emulator. As soon application starts it will bring the "Data Initialization Screen", click on "Start Data Initialization" button then required data will be populated from Server DB to Local DB using SOAP services.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKfDMGu4wOYFGoY_UrJTalL8jozO2FQG5Xyigoq2XRdqSBZqeyCTVt79WixmtkNgfPHXndrMbeRs_5QrqggF_r7haEkGE5vWMXIZnM6Vriwo7CMYku5GW9h7QmgkuwpCCVWui6JnH1sWk/s1600/DataInitialization.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKfDMGu4wOYFGoY_UrJTalL8jozO2FQG5Xyigoq2XRdqSBZqeyCTVt79WixmtkNgfPHXndrMbeRs_5QrqggF_r7haEkGE5vWMXIZnM6Vriwo7CMYku5GW9h7QmgkuwpCCVWui6JnH1sWk/s400/DataInitialization.png" width="243" /></a></div>
<br />
Above screen will appear only when application start for the first time, once the data initialization completes it will navigates automatically to Dept List screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF_cpue1y3qlMkLMxoDQUr1y4L3qZUiI4XPxktFr1HgSTdZKmJRPk4C77KsA-rNKsktG9-8oTibGbsXqcFPjCKqmtrFHn9VK-M2R0r2ebIQL49JB5pqn1Ea18AICJwznWD4tLS_kYB-HQ/s1600/DeptList.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF_cpue1y3qlMkLMxoDQUr1y4L3qZUiI4XPxktFr1HgSTdZKmJRPk4C77KsA-rNKsktG9-8oTibGbsXqcFPjCKqmtrFHn9VK-M2R0r2ebIQL49JB5pqn1Ea18AICJwznWD4tLS_kYB-HQ/s400/DeptList.png" width="241" /></a></div>
<br />
Click on the menu button, this will launch the Navigation Bar with Preferences, Hide Navigation and Springboard options. Click on Preferences icon.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgamFWDJMbGLSuj66Zo5sawBFMNawL5RQxvz8ERa-_t9N4iZsaq7X6-nON91v3gIlc8eQVSSlvwPxggdyxYgIvvY_HIKmSufPqobKXyYmRQ0li6Z5dVwI0Pph-iN3sxy2b3Bf1tHX_CARI/s1600/AutoSyncNew.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="326" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgamFWDJMbGLSuj66Zo5sawBFMNawL5RQxvz8ERa-_t9N4iZsaq7X6-nON91v3gIlc8eQVSSlvwPxggdyxYgIvvY_HIKmSufPqobKXyYmRQ0li6Z5dVwI0Pph-iN3sxy2b3Bf1tHX_CARI/s400/AutoSyncNew.png" width="400" /></a></div>
<br />
<b>Synchronization Settings</b><br />
<ul style="text-align: left;">
<li>If Auto Sync is checked, when ever user perform CRUD operations the data will be first saved to the local db and immediately check the network connection, if connection exists send the current request data to the Server DB.</li>
<li>If Auto Sync is unchecked, when ever user perform CRUD operations the data will be first saved to the local db and current request data will not be send to Server DB. </li>
</ul>
From Dept List screen click on add button to add the new record. Enter the details and click on Save button to submit the data, newly added records appears on Dept List screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV_VG2OQIdx1YtzpqotoC_cwRUBbPsrO5OZTqYWIhZKjjGEqNa6BKTMmRD6ynEVcJOxgMM61k_30BdBNNTwaf4ce7Ybn9Pm2Y3sVcnCWJd-baX8X7XJaYvsC7_93S8h2nGur8fbwL03tI/s1600/AddDeptList.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="316" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV_VG2OQIdx1YtzpqotoC_cwRUBbPsrO5OZTqYWIhZKjjGEqNa6BKTMmRD6ynEVcJOxgMM61k_30BdBNNTwaf4ce7Ybn9Pm2Y3sVcnCWJd-baX8X7XJaYvsC7_93S8h2nGur8fbwL03tI/s400/AddDeptList.png" width="400" /></a></div>
<br />
Clicking on any department will take you to the selected Department details page, click on the edit button to edit the details, modify the details and click on the Save button to submit the data and navigate back to detail screen. Clicking on delete button will delete the current department.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWbSVhV5MIJI8UkYkv2Pqv96fJ6XFg47nNUD4CCYqRmmjbsXD83SA_J92CSQvEhQ0JJ_6l1fxTn_HK68WOTLAwTGdvMIklWCwRf9GVF6Pjwt_eVFRaLBmbAcZHkOzqnTsyICe4KTfCxS8/s1600/EditDeptList.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="216" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWbSVhV5MIJI8UkYkv2Pqv96fJ6XFg47nNUD4CCYqRmmjbsXD83SA_J92CSQvEhQ0JJ_6l1fxTn_HK68WOTLAwTGdvMIklWCwRf9GVF6Pjwt_eVFRaLBmbAcZHkOzqnTsyICe4KTfCxS8/s400/EditDeptList.png" width="400" /></a></div>
<br />
From main screen clicking on the Sync button will first check the network connection, if connection not exists alert notification will be displayed on the screen and synchronization of data will not happen. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2lbDBfuII90PLc0qQlDmMETJd_rkrib5DDbuZ0EzFfzClhG9sNkgr0H0Q5q2eTpPev1dxCeq8JregyZCn7p1-J3nu7TwceboRPFFRSGlazBJysYxbq0HDRpQaE561_RNF4upkInOh8ug/s1600/NetworkStatus.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2lbDBfuII90PLc0qQlDmMETJd_rkrib5DDbuZ0EzFfzClhG9sNkgr0H0Q5q2eTpPev1dxCeq8JregyZCn7p1-J3nu7TwceboRPFFRSGlazBJysYxbq0HDRpQaE561_RNF4upkInOh8ug/s320/NetworkStatus.png" width="192" /></a></div>
<br />
So after enabling the connection, click on Sync button to send all the new/modified data to Server DB from Local DB, once the synchronization completes alert notification will be displayed on the screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxOWPHS_M66nUO629qjqS9wqPaJoFuyDZIsJkUJG3fwUnv2wFP2S-3zicxflcy6mIZaZXL2hy3VMbHJu-9CBsYMIAB2H57T_JVFwLP5yuX0vsKuo6DlUDtjTgvRhAXxKByu5yIwz0AvjI/s1600/DataSync.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxOWPHS_M66nUO629qjqS9wqPaJoFuyDZIsJkUJG3fwUnv2wFP2S-3zicxflcy6mIZaZXL2hy3VMbHJu-9CBsYMIAB2H57T_JVFwLP5yuX0vsKuo6DlUDtjTgvRhAXxKByu5yIwz0AvjI/s400/DataSync.png" width="238" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/ADFMobileSynchronizationApp.zip">download the sample workspace from here</a>, sample workspace contains both EJBSyncWebServiceApp and SyncMobileApp applications.</div>
[Runs with Oracle JDeveloper 11.1.2.4.0]<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In below section I will not provide all the steps to create the application from scratch, only key ones will be explained. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>EJBSyncWebServiceApp </b>- If you are deploying application to standalone server, modify the application with following steps:</div>
<ol style="text-align: left;">
<li>Create the DataSource in standalone server and name as "MobiledemoDS".</li>
<li>Open the persistence.xml and modify the string "java:/app/jdbc/jdbc/MobiledemoDS" to "jdbc/MobiledemoDS" in jta-data-source and property tag.</li>
<li>Right click on the Application navigator and select application properties and go to Deployment->Weblogic, there uncheck "Auto Generate and Synchronize WebLogic JDBC Descriptors During Deployment"option</li>
</ol>
<b>SyncMobileApp - </b><br />
<ol style="text-align: left;">
<li>Following DataControls are created in application. <ul>
<li>DepartmentsDC - Consists of methods to cache and store the data locally</li>
</ul>
<ol>
</ol>
<ul>
<li>EJBServiceWSDC - Consists of methods to access remote server data </li>
</ul>
<ol>
</ol>
<ul>
<li>SynchronizationDC - Consists of methods to synchronize data from offline to online </li>
</ul>
</li>
<li>In connections.xml provide the path where EJBSyncWebServiceApp Webservices is deployed. </li>
<li>Used <b>"navigator.network.connection.type"</b> cordova api to check the
active network connection that is being used. This property is a fast
way to determine the device's network connection state, and type of
connection.<b><br /></b></li>
</ol>
</div>
</div>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
</ul>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com10tag:blogger.com,1999:blog-3873906122160366310.post-54406932626012176162013-05-30T00:10:00.000-07:002013-05-30T00:10:28.723-07:00Problematic while calling WebService Data Control in LifeCycleListenerImpl on application start<div dir="ltr" style="text-align: left;" trbidi="on">
In this article I wants to share the issue faced while working on sample online/offline data synchronization application. Here I wanted to populate user related data from online to offline database(SQLite db) on application start, so that offline data can be used across the feature. I assumed that it can be done when the ApplicationController initialized by the LifeCycleListenerImpl and call web service data control programmatic way using AdfmfJavaUtilities.invokeDataControlMethod.<br />
<br />
I have created the data control in ApplicationController project, since I need to call the web service data control in LifeCycleListenerImpl. My assumption went wrong, I noticed when application run in debug mode, web service data control will not be called at all in LifeCycleListenerImpl. Because AdfmfJavaUtilities.invokeDataControlMethod requires DataBindings.cpx with Data Control Name entry in Data Control Usages section. But DataBindings.cpx will be created in ViewController project.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
In one of forum entry as explained by Denis Tyrell and Chris Muir, above approach will not work when we have <b><i>Secured Web Service</i></b>, since the login page won't be displayed yet and we won't have the credentials to use for the Web Service.<br />
<br />
Sometime you may also hit the error while using AdfmfJavaUtilities.invokeDataControlMethod - "<i>[SEVERE - oracle.adfmf.framework - AmxBindingContext - loadDataControlById] Unable to load Data Control testDataControl due to following error: ERROR [oracle.adfmf.framework.exception.AdfException] - Unable to load definition for testDataControl</i>".<br />
<br />
Make sure you have a data control name entry in DataBindings.cpx as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpISOcdowy9iby6ILz1tGRRwWC5aArQNhDjuBy6yNwAP_XttUJldX6L88-bucrqoUfluhPB51J1yvBGMdMepKmXdmRq9329NKqj6D58TdEo2ECeBOAYngTZs6jhEdWU32g48iniB4990A/s1600/DataBindings.cpx.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="336" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpISOcdowy9iby6ILz1tGRRwWC5aArQNhDjuBy6yNwAP_XttUJldX6L88-bucrqoUfluhPB51J1yvBGMdMepKmXdmRq9329NKqj6D58TdEo2ECeBOAYngTZs6jhEdWU32g48iniB4990A/s640/DataBindings.cpx.png" width="565" /></a></div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com1tag:blogger.com,1999:blog-3873906122160366310.post-856789504506063732013-05-19T04:18:00.001-07:002013-05-19T04:18:18.809-07:00ADF Mobile With EJB Restful Web Service<div dir="ltr" style="text-align: left;" trbidi="on">
This article is the continuation of my previous article on <a href="http://deepakcs.blogspot.in/2013/04/configuring-ejb-with-restful-web.html">Configuring EJB with Restful Web Service in ADF</a>. Here will see how to integrate EJB Restful Web Service with ADF mobile.<br />
<br />
Application screen looks like below when it is deployed and run on the Android Device/Emulator. In the below screen Department list will be displayed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIiEWurgxvYXUYD8deh-sDwGXcYEUofB3kVTgy_61RcYKz1MNi_wwImZYBXOxwlyoUSDj7tIEcLdhq52UW17KkwmogyZBeXpOxkPx2LoP3ZinanTZ3F7Nt_j5OtEztmU7qyicgyKiUec8/s1600/Department+List.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIiEWurgxvYXUYD8deh-sDwGXcYEUofB3kVTgy_61RcYKz1MNi_wwImZYBXOxwlyoUSDj7tIEcLdhq52UW17KkwmogyZBeXpOxkPx2LoP3ZinanTZ3F7Nt_j5OtEztmU7qyicgyKiUec8/s400/Department+List.png" width="238" /></a></div>
<br />
Clicking on any department will take you to the selected Department details page, edit the details and click on the Save button to submit the data. Clicking on delete button will delete the current department.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpHnbTWAcV-FdPIWB1Bbarxa93pSxRYJpB6zk1PriqIF_9XJWm8zJi2khbR1JEX55A_y6yyJhtI2xC2cQ7LjMDAF4mbbfyYMwI0QGNof7r-Ek0BZJSHXy_7lXV6seRPi9mZDeKFvswx5k/s1600/Edit+Dept.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpHnbTWAcV-FdPIWB1Bbarxa93pSxRYJpB6zk1PriqIF_9XJWm8zJi2khbR1JEX55A_y6yyJhtI2xC2cQ7LjMDAF4mbbfyYMwI0QGNof7r-Ek0BZJSHXy_7lXV6seRPi9mZDeKFvswx5k/s400/Edit+Dept.png" width="238" /></a></div>
<br />
From Department List screen, click on add button to add the new record. Enter the details and click on Save button to submit the data.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieUAHtH9kN_za7fJ69P7oHgPkG8szm7ZJU5QBU-O88NeAimRvAvs77jvaiVWYiWBR_bDRCwF4UHoHHYVwRvVwsL7uT8BH-Af53_OQpQxeCYMq093N8t1ofUyj-7fvbrLE_VR_i7q10QD8/s1600/Add+Dept.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieUAHtH9kN_za7fJ69P7oHgPkG8szm7ZJU5QBU-O88NeAimRvAvs77jvaiVWYiWBR_bDRCwF4UHoHHYVwRvVwsL7uT8BH-Af53_OQpQxeCYMq093N8t1ofUyj-7fvbrLE_VR_i7q10QD8/s400/Add+Dept.png" width="240" /></a></div>
<br />
After the below actions, updated department result page will be displayed as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJs0AehhJaVNaHJI0TxhiTRRF1_Js3hIePIEqqgjeas-cyB3EOYOloV9ahpBo2nACDpc5Jucon6WVKwBPntC10RCL_hacf-Ea-DBuMduIqhhloukvFU3XSNQJ_SF6CTo_6CbeizlRWjUM/s1600/Updated+Result.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJs0AehhJaVNaHJI0TxhiTRRF1_Js3hIePIEqqgjeas-cyB3EOYOloV9ahpBo2nACDpc5Jucon6WVKwBPntC10RCL_hacf-Ea-DBuMduIqhhloukvFU3XSNQJ_SF6CTo_6CbeizlRWjUM/s400/Updated+Result.png" width="238" /></a></div>
<br />
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/EJBRestFulServiceMobileApp.zip">download the sample workspace from here</a><br />
[Runs with Oracle JDeveloper 11.1.2.4.0 + HR Schema]<br />
<br />
<b style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><u>Implementation Steps</u></b><br />
<br />
Create an ADF Mobile Application, the application consists of two projects. Application Controller project of Application LifeCycle, Listeners, Device Features DataControl and ViewController project contains mobile features content like AMX Files, Task Flows and DataControl.<br />
<br />
In Application Controller project, create a Departments.java file and add the below code.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class Departments {
private BigDecimal departmentId;
private String departmentName;
private BigDecimal locationId;
private BigDecimal managerId;
public Departments() {
super();
}
public Departments(BigDecimal departmentId, String departmentName, BigDecimal locationId, BigDecimal managerId) {
this.departmentId = departmentId;
this.departmentName = departmentName;
this.locationId = locationId;
this.managerId = managerId;
}
public void setDepartmentId(BigDecimal departmentId) {
this.departmentId = departmentId;
}
public BigDecimal getDepartmentId() {
return departmentId;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getDepartmentName() {
return departmentName;
}
public void setLocationId(BigDecimal locationId) {
this.locationId = locationId;
}
public BigDecimal getLocationId() {
return locationId;
}
public void setManagerId(BigDecimal managerId) {
this.managerId = managerId;
}
public BigDecimal getManagerId() {
return managerId;
}
}</code></pre>
Create DepartmentsDC.java file and add the below code, create DataControl based on DepartmentsDC file<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 200px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public class DepartmentsDC {
public DepartmentsDC() {
super();
}
public Departments ediDepartment(BigDecimal departmentId, String departmentName, BigDecimal locationId,
BigDecimal managerId) {
return new Departments(departmentId, departmentName, locationId, managerId);
}
public Departments addDepartment() {
BigDecimal defaultVal = new BigDecimal("0");
return new Departments(defaultVal, "", defaultVal, defaultVal);
}
}</code></pre>
In the New Gallery expand the General - XML nodes and select XML Schema and click OK, enter Departments.xsd in File Name field and the following attributes as shown in below image.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHjnKV9lCyUakBHUUmTGcPXegIwuHuxiIIH8IQSpdBnj0B8PXTHLHXn5iWdOIhVWnyNSGRns0UmkmdBjFn2qcEHykjKEljxM5vHA9palV7jvzQunznxs3_Zh7d3Gto-f_7J6ADcob-jM0/s1600/departmentsXSD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="323" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHjnKV9lCyUakBHUUmTGcPXegIwuHuxiIIH8IQSpdBnj0B8PXTHLHXn5iWdOIhVWnyNSGRns0UmkmdBjFn2qcEHykjKEljxM5vHA9palV7jvzQunznxs3_Zh7d3Gto-f_7J6ADcob-jM0/s400/departmentsXSD.png" width="400" /></a></div>
<br />
In the New Gallery expand the General - Connection nodes and select URL Connection and click OK, enter the URL Endpoint details, You can download <a href="http://deepakcs.blogspot.in/2013/04/configuring-ejb-with-restful-web.html">Configuring EJB with Restful Web Service</a><a href="http://www.blogger.com/blogger.g?blogID=3873906122160366310"> in ADF</a> from my previous article.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghMATaoxivzFUgW_mtoDNqEpZ2fdbPd9sa2fLr4RK8QmmJy2IZluROzNr3iGJ6jGimDf9BDmHR3_7uS8DOhPdxMeiqS_wH-vY-h8L189Q0vmrvUkJpHLJZTnwJxEgxt4CTljOjKJ9OcSM/s1600/Connection.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghMATaoxivzFUgW_mtoDNqEpZ2fdbPd9sa2fLr4RK8QmmJy2IZluROzNr3iGJ6jGimDf9BDmHR3_7uS8DOhPdxMeiqS_wH-vY-h8L189Q0vmrvUkJpHLJZTnwJxEgxt4CTljOjKJ9OcSM/s400/Connection.png" width="328" /></a></div>
<br />
<i>Note: - Next create a URL Service Data Control from - http://IpAddress:7101/EJBRestService/jersey/EJBRESTService api with HTTP Methods: GET, PUT, POST, DELETE. </i><br />
<br />
In the New Gallery expand the General - Data Control nodes and select URL Service Data Control and click OK and enter the details to create the <b>GET </b>method<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtcQQw4hi525RhnMf-ZDdIp5FVaZCZbcdKH9P4qx2yO-EHdCPaqnhEenDcqEb3ReKA7noSq4Z4J1Dm8dmtdA89YD7rKCBeGYrC_U9rX9t5zkrV4WO-0eODzdMWzaZcP8-CVcrj8I8ngkc/s1600/RestFulWebserviceGetMethod.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="298" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtcQQw4hi525RhnMf-ZDdIp5FVaZCZbcdKH9P4qx2yO-EHdCPaqnhEenDcqEb3ReKA7noSq4Z4J1Dm8dmtdA89YD7rKCBeGYrC_U9rX9t5zkrV4WO-0eODzdMWzaZcP8-CVcrj8I8ngkc/s400/RestFulWebserviceGetMethod.png" width="400" /></a></div>
<br />
In the New Gallery expand the General - Data Control nodes and select
URL Service Data Control and click OK and enter the details to create
the <b>POST </b>method.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6fBSLiqxGB5Sc0rOuY6lDA0bW1XAJFuRFg3Ibs90aYsk-3Aem9igoSEYIf6CX9pE6xlqZ-8vCF3T46Zk6gDUbnCYR8jRlyUVAiDhxl9mvGnjMZUYX6F2XX0Wdb1JVkVARCAUCWnCUcUs/s1600/RestFulWebservicePostMethod.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="298" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6fBSLiqxGB5Sc0rOuY6lDA0bW1XAJFuRFg3Ibs90aYsk-3Aem9igoSEYIf6CX9pE6xlqZ-8vCF3T46Zk6gDUbnCYR8jRlyUVAiDhxl9mvGnjMZUYX6F2XX0Wdb1JVkVARCAUCWnCUcUs/s400/RestFulWebservicePostMethod.png" width="400" /></a></div>
<br />
In Create URL Service Data Control wizard - step 3 of 5, specify the XSD url which we created earlier.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2o0kQigwfl2e4GQexKc-r3L9JWltUNLZn6L6rO7xjqsGryfQxahXRO6CW9W-aE7F8fxCbywgOOTHB1HWo3kQutuQTMuM8QHz7CTiaabG54QFRKw90o94oaiESK_KPTvy6o5bn1U3pa8E/s1600/RestFulWebservicePostMethodXSD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2o0kQigwfl2e4GQexKc-r3L9JWltUNLZn6L6rO7xjqsGryfQxahXRO6CW9W-aE7F8fxCbywgOOTHB1HWo3kQutuQTMuM8QHz7CTiaabG54QFRKw90o94oaiESK_KPTvy6o5bn1U3pa8E/s400/RestFulWebservicePostMethodXSD.png" width="400" /></a></div>
<br />
In the New Gallery expand the General - Data Control nodes and select
URL Service Data Control and click OK and enter the details to create
the <b>PUT</b> method.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFHo8vlB1Nf70VD-PrRO82DXHpF2k8awdlxjZ99yvNAwuZdiY3f1JJUZHiMiRoRGbVRkkkvfYXutsz1CVzSeSPWNeDe7wHMp2DQo7LdcmFRAKFjkiHAZZUU8y-VpPR1WxhYXoQxpVXBiw/s1600/RestFulWebservicePutMethod.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="298" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFHo8vlB1Nf70VD-PrRO82DXHpF2k8awdlxjZ99yvNAwuZdiY3f1JJUZHiMiRoRGbVRkkkvfYXutsz1CVzSeSPWNeDe7wHMp2DQo7LdcmFRAKFjkiHAZZUU8y-VpPR1WxhYXoQxpVXBiw/s400/RestFulWebservicePutMethod.png" width="400" /></a></div>
<br />
In Create URL Service Data Control wizard - step 3 of 5, specify the XSD url which we created earlier.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2o0kQigwfl2e4GQexKc-r3L9JWltUNLZn6L6rO7xjqsGryfQxahXRO6CW9W-aE7F8fxCbywgOOTHB1HWo3kQutuQTMuM8QHz7CTiaabG54QFRKw90o94oaiESK_KPTvy6o5bn1U3pa8E/s1600/RestFulWebservicePostMethodXSD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2o0kQigwfl2e4GQexKc-r3L9JWltUNLZn6L6rO7xjqsGryfQxahXRO6CW9W-aE7F8fxCbywgOOTHB1HWo3kQutuQTMuM8QHz7CTiaabG54QFRKw90o94oaiESK_KPTvy6o5bn1U3pa8E/s400/RestFulWebservicePostMethodXSD.png" width="400" /></a></div>
<br />
In the New Gallery expand the General - Data Control nodes and select
URL Service Data Control and click OK and enter the details to create
the <b>DELETE</b> method.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc_DaVLC8Id7gwOcXoMyroPBNdznMtTBOKpu4X-44zJxKkPyDD9-wzbx3fsvXfdV4GlOBC2rZ6CES0YxYV54kXAaPLZ3k7mkg5nMB6buXQSKqgBWQetYXyTCJrd3SCATdJJGh69NFR4RM/s1600/RestFulWebserviceDeleteMethod.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="298" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc_DaVLC8Id7gwOcXoMyroPBNdznMtTBOKpu4X-44zJxKkPyDD9-wzbx3fsvXfdV4GlOBC2rZ6CES0YxYV54kXAaPLZ3k7mkg5nMB6buXQSKqgBWQetYXyTCJrd3SCATdJJGh69NFR4RM/s400/RestFulWebserviceDeleteMethod.png" width="400" /></a></div>
<br />
In Create URL Service Data Control wizard - step 3 of 5, enter the departmentId value as 0.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilN2eYyjNcyLWiPCBvlI5zEJ7v7YYoZgOAhBlxiYi214hec46PXeQemvnvguA4n1gLl8DMIoOK1ITxrDGj9yQ8TObZJ_J5Y4tFRnz9UU5IJ_mxTJxvV1ly4FKko_mgjyKfIrGDp4ctfK8/s1600/RestFulWebserviceDeleteMethodParameters.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilN2eYyjNcyLWiPCBvlI5zEJ7v7YYoZgOAhBlxiYi214hec46PXeQemvnvguA4n1gLl8DMIoOK1ITxrDGj9yQ8TObZJ_J5Y4tFRnz9UU5IJ_mxTJxvV1ly4FKko_mgjyKfIrGDp4ctfK8/s400/RestFulWebserviceDeleteMethodParameters.png" width="400" /></a></div>
<br />
Next open the DataControls.dcx file and change the Definition id values to looks like below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFbNklNNjD46Lxxg50ldYEaW7cRC0gneo-J0Rnk53BTHUdnrsiWIIkQYmPImSLhP_bK9mc4kbrR4EiNLfb_gF1MOOfgZKip6wXfSlGdWcmzfOY7N0pKQjafGWc_wqJwCpAkePcAgilUXY/s1600/DataControl.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFbNklNNjD46Lxxg50ldYEaW7cRC0gneo-J0Rnk53BTHUdnrsiWIIkQYmPImSLhP_bK9mc4kbrR4EiNLfb_gF1MOOfgZKip6wXfSlGdWcmzfOY7N0pKQjafGWc_wqJwCpAkePcAgilUXY/s320/DataControl.png" width="320" /></a></div>
<br />
In ViewController project. Locate and expand the Application Sources folder, then expand the META-INF folder. You will see the adfmf-feature.xml file, click on the adfmf-feature.xml file to launch the Feature editor. Add a new feature by clicking the green plus sign on the Features table near top of the editor this will launch the new Create ADF Mobile Feature dialog, modify the values as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtJCbuGDnLGgmvs3ZZ5dRsnuuiCtuAy1IJB2PCVl5-bmxBxPCayGYxyck1fkShqa7dgvinpoldIPn6aDgdRuaObLjZ9nmSJGqTs7zkIi6k31RgKDeRkhkMTGFSrtPrsERq2hNnZwJU3ns/s1600/DepartmentsFeature.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="103" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtJCbuGDnLGgmvs3ZZ5dRsnuuiCtuAy1IJB2PCVl5-bmxBxPCayGYxyck1fkShqa7dgvinpoldIPn6aDgdRuaObLjZ9nmSJGqTs7zkIi6k31RgKDeRkhkMTGFSrtPrsERq2hNnZwJU3ns/s400/DepartmentsFeature.png" width="400" /></a></div>
<br />
In the Features table, select the newly created feature Departments. Under the Features table, click the Content tab, and locate the Content table. Notice that the content item Departments.1 is created by default. Next add a new file by clicking the green plus sign and select taskflow option, this will launch the new Create ADF Mobile Task Flow dialog, modify the value as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2rJ-UPcKkxFtMmZzSVMyYlCQ2mrtOKA06CMLPUKXCCe5nW8qwEtHt3sNqlrhgLRZDFMfRve1N9NME8vHCvxzIgapEjiEG_ZncdvcP8zjXZIk_wZO0iz7WpcQNwaOEid0L2mkmFEASvgc/s1600/DepartmentsTaskFlow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="126" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2rJ-UPcKkxFtMmZzSVMyYlCQ2mrtOKA06CMLPUKXCCe5nW8qwEtHt3sNqlrhgLRZDFMfRve1N9NME8vHCvxzIgapEjiEG_ZncdvcP8zjXZIk_wZO0iz7WpcQNwaOEid0L2mkmFEASvgc/s400/DepartmentsTaskFlow.png" width="400" /></a></div>
<br />
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Click on the DepartmentsTaskflow.xml to open the file in taskflow editor and follow the below steps.</span><br />
<ol style="text-align: left;">
</ol>
<ul style="text-align: left;">
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Create three views and name them as deptList, deptAdd and deptEdit respectively</span></span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Draw the control flow case from deptList to addDept and Outcome as "add"</span></span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Draw the control flow case from deptList to editDept and Outcome as "edit" </span></span></span></span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">From DataControl palette drag and drop getDepartmentsFindAll and drop as method-call</span></span></span></span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Draw the control flow case from </span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">getDepartmentsFindAll method-call to </span></span></span></span>deptList and Outcome as "getDepartmentsFindAll"</span></span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Draw the control flow case from addDept to </span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">getDepartmentsFindAll </span></span></span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">method-call </span></span></span></span></span></span>and Outcome as "list"</span></span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Draw the control flow case from </span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">editDept </span></span></span></span>to </span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">getDepartmentsFindAll </span></span></span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">method-call </span></span></span></span></span></span>and Outcome as "list"</span></span></li>
</ul>
<ol style="text-align: left;">
</ol>
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">DepartmentsTaskflow.xml will looks as shown below diagram.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigUQweEjdq2hTEm7nZbXD05Dp8tSBExowSGMGkRFVjtVldZfc1JOdTSLn7oeWsyVg7YyU_5j4iW7LRxOKKXQcI8qJBA_jMvGTMmxVicvCnWhmypSJfyNXpJ8MBnnccBqCy_JNfM5Agqb8/s1600/DepartmentTaskFlowDiagram.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="350" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigUQweEjdq2hTEm7nZbXD05Dp8tSBExowSGMGkRFVjtVldZfc1JOdTSLn7oeWsyVg7YyU_5j4iW7LRxOKKXQcI8qJBA_jMvGTMmxVicvCnWhmypSJfyNXpJ8MBnnccBqCy_JNfM5Agqb8/s400/DepartmentTaskFlowDiagram.png" width="400" /></a></span></div>
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><br /></span>
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Double click on deptList view will launch Create ADF Mobile AMX Page dialog, in page facets select Header and Secondary Action. Go to source tab and follow the below steps:</span><br />
<ol style="text-align: left;">
</ol>
<ul style="text-align: left;">
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In Header facet, amx:outputText set the value as "Dept List"</span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In Secondary Action facet, for amx:commandButton modify the values text: Add, action: add</span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">From DC palette drag and drop EJBService->getDepartmentsFindAll()->Return->departmentss->departments->ADF Mobile List View and select the default options</span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In </span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">amx:Item, set the action as "edit"</span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Inside amx:Item set the setPropertyListener as shown below</span></li>
</ul>
<ol style="text-align: left;">
</ol>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhoDjNpWHTz-yUw1AwMVR3e7UcKt2hcxtcomYDbFZPU6PE0PNEm9rBmp9hylrFUtGWPBZzLpaHe_7sCJEpOT8JX8LeR9OjZLSRCDrltz8lX_CSHnXPNUO1lwxG7RVONOrqRzkAV0jv1Cw/s1600/Departments+PageFlowScope.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="122" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhoDjNpWHTz-yUw1AwMVR3e7UcKt2hcxtcomYDbFZPU6PE0PNEm9rBmp9hylrFUtGWPBZzLpaHe_7sCJEpOT8JX8LeR9OjZLSRCDrltz8lX_CSHnXPNUO1lwxG7RVONOrqRzkAV0jv1Cw/s400/Departments+PageFlowScope.png" width="400" /></a></div>
<br />
<i>Note:- Created the DataControl </i><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><i>DepartmentsDC with addDepartment and editDepartment methods, so that the type casting the ADF form values to departments object will be easy.</i></span><br />
<br />
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Double
click on deptAdd view will launch Create ADF Mobile AMX Page dialog,
in page facets select Header, Primary Action. Go to source tab and
follow the below steps:</span><br />
<ol style="text-align: left;">
</ol>
<ul>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In Header facet, amx:outputText set the value as "Add Dept"</span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In Primary Action facet, for amx:commandButton modify the values text: Back, action: __back</span></span></li>
<li>From <span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">DC palette drag and drop DepartmentsDC->addDepartment->Departments-></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Form as ADF Mobile Form.</span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Go to bindings and add the following attributesValues, departmentId, departmentName, locationId, managerId as shown below. </span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV0TznHJ6Tf3LkI8ze8EX_cfzc9c24baUBfNpGgdUmVsRwq4Y9VizY1YHvIi2OzLL_AtX1CyoOZnL_Y8AsfKE3zUwgxmEiMIJGOXFo9k0k1GhWUVDNGtOWDjjeJGPt43KEcT9ER70frd8/s1600/attributeValues.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV0TznHJ6Tf3LkI8ze8EX_cfzc9c24baUBfNpGgdUmVsRwq4Y9VizY1YHvIi2OzLL_AtX1CyoOZnL_Y8AsfKE3zUwgxmEiMIJGOXFo9k0k1GhWUVDNGtOWDjjeJGPt43KEcT9ER70frd8/s400/attributeValues.png" width="400" /></a></div>
<ul style="text-align: left;">
<li>From <span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">DC palette drag and drop postDepartments->Method as ADF Mobile Button, set name as "Save", action as "list" and </span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">set the setPropertyListener as shown below </span>
</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyaAEUusg4gja3OyEueZQVHJz30Vmy_m4aQMRfCwH5A5PLn9E6e9dgCrnBNYOdhxQV0umPPpQgFK_zeJ6AfRbmYKxIWZxLET4q74TErd3juhOJzGUjBApha3J4GkKcNHBO9tXfHN6j058/s1600/setPropertyListener.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="97" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyaAEUusg4gja3OyEueZQVHJz30Vmy_m4aQMRfCwH5A5PLn9E6e9dgCrnBNYOdhxQV0umPPpQgFK_zeJ6AfRbmYKxIWZxLET4q74TErd3juhOJzGUjBApha3J4GkKcNHBO9tXfHN6j058/s400/setPropertyListener.png" width="400" /></a></div>
<br />
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Double
click on deptAdd view will launch Create ADF Mobile AMX Page dialog,
in page facets select Header, Primary, </span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Secondary </span> Action. Go to source tab and
follow the below steps:</span><br />
<ul>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In Header facet, amx:outputText set the value as "Edit Dept"</span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In Primary Action facet, for amx:commandButton modify the values text: Back, action: __back</span></span></li>
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">In Secondary Action facet, </span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">from <span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">DC palette drag and drop </span></span></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">EJBService->deleteDepartments</span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">->Method as ADF Mobile Button, </span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">set action as "list". In Edit Action Binding wizard mention the parameter for departmentId as #{pageFlowScope.departmentId}</span></li>
<li>From <span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">DC palette drag and drop DepartmentsDC->editDepartment->Departments-></span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Form as ADF Mobile Form and in edit action binding wizard </span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">mention the parameters as shown below </span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNTFjvSYU2QQzwsIjJmz2stK_UMs64qHyQjnR8PNJM1YzxjeC-oJo2MBHmxIZy8srrvRt6keYj03kjNawQpYJcTUPPWv9CbUOSSdG6jYxoLUc8tMHpQ93AfGBzleY-IeLITTJ65khIJ2c/s1600/editDepartment.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="347" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNTFjvSYU2QQzwsIjJmz2stK_UMs64qHyQjnR8PNJM1YzxjeC-oJo2MBHmxIZy8srrvRt6keYj03kjNawQpYJcTUPPWv9CbUOSSdG6jYxoLUc8tMHpQ93AfGBzleY-IeLITTJ65khIJ2c/s400/editDepartment.png" width="400" /></a></div>
<ul style="text-align: left;">
<li><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">Go to bindings and add the following attributesValues, departmentId, departmentName, locationId, managerId as shown below.</span>
</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV0TznHJ6Tf3LkI8ze8EX_cfzc9c24baUBfNpGgdUmVsRwq4Y9VizY1YHvIi2OzLL_AtX1CyoOZnL_Y8AsfKE3zUwgxmEiMIJGOXFo9k0k1GhWUVDNGtOWDjjeJGPt43KEcT9ER70frd8/s1600/attributeValues.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV0TznHJ6Tf3LkI8ze8EX_cfzc9c24baUBfNpGgdUmVsRwq4Y9VizY1YHvIi2OzLL_AtX1CyoOZnL_Y8AsfKE3zUwgxmEiMIJGOXFo9k0k1GhWUVDNGtOWDjjeJGPt43KEcT9ER70frd8/s400/attributeValues.png" width="400" /></a></div>
<ul style="text-align: left;">
<li>From <span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">DC palette drag and drop putDepartments->Method as ADF Mobile Button, set </span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">name as "Save", </span>action as "list" and </span><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">set the setPropertyListener as shown below.</span>
</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkwmuCM-2qr0x2f5ZRcjNrt008NCkLJsceJq4q9OY3KxnaqdGlrRuOqzon4GwNfspCv1HZvcj7gAspZMxeQft9RI5i8bthtZTOslCBMmO5wEKFPK2NJJP5Dm2vNLGghxaLL6RsQpMT6fo/s1600/putDepartment.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="97" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkwmuCM-2qr0x2f5ZRcjNrt008NCkLJsceJq4q9OY3KxnaqdGlrRuOqzon4GwNfspCv1HZvcj7gAspZMxeQft9RI5i8bthtZTOslCBMmO5wEKFPK2NJJP5Dm2vNLGghxaLL6RsQpMT6fo/s400/putDepartment.png" width="400" /></a></div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com3tag:blogger.com,1999:blog-3873906122160366310.post-57592853360802911132013-04-18T08:01:00.000-07:002013-04-18T08:01:06.381-07:00Configuring EJB with Restful Web Service in ADF <div dir="ltr" style="text-align: left;" trbidi="on">
In current JDeveloper we can expose EJB's as Web Service, however this will be a SOAP based web service. In this article will discuss on configuring EJB with restful web service using jersey support. This article provides an example of building a complete RESTful API using the different HTTP methods:
<br />
<ul style="text-align: left;">
<li>GET to retrieve data</li>
<li>POST to add data</li>
<li>PUT to update data</li>
<li>DELETE to delete data</li>
</ul>
<div>
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/EJBRestService.zip">download the sample workspace from here</a><br />
[Runs with Oracle JDeveloper 11.1.2.3.0 + HR Schema]<br />
<br />
<b><u>Implementation Steps:-</u></b><br />
<br />
Create a EJB project, then create the DEPARTMENT JPA/EJB 3.0 Entity using the"Entities from tables" EJB wizard, create a Stateless Session bean and select Departments JPA Entity to generates façade methods.<br />
<br />
Open the Departments entity and annotate with @XmlRootElement, when a top level class or an enum type is annotated with the @XmlRootElement annotation, then its value is represented as XML element in an XML document. Basically this allow ADF to convert this object directly to XML.JSON.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaZ-G5ygNh2g_KjRXWLwrCd3hhE_G1ua9KtR7BnDb6JqaMBEYAIuhKqrhyphenhyphenABDqlsaKNxW95pouH2qSCnunv6MFbkvJMHTmEzInYB9p6mAqRLSv7HbwGiKfdw4WHEaaU-e3eDSUoE38a4M/s1600/XmlRootElement.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaZ-G5ygNh2g_KjRXWLwrCd3hhE_G1ua9KtR7BnDb6JqaMBEYAIuhKqrhyphenhyphenABDqlsaKNxW95pouH2qSCnunv6MFbkvJMHTmEzInYB9p6mAqRLSv7HbwGiKfdw4WHEaaU-e3eDSUoE38a4M/s640/XmlRootElement.png" width="550" /></a></div>
<br /></div>
Add a new project ('REST Web Service Project') in the application and mention the name as WebService. Go to 'Project properties' > 'Dependencies' and add the Model project as a dependency.<br />
<br />
Next add the supporting libraries to the Rest Web Service project, go to 'Project properties' > 'Libraries and Classpath'. Libraries are listed in the below screen shot, you can find the libraries in <a href="https://ejbdatacontrol-samples.googlecode.com/files/EJBRestService.zip">EJBRestService</a>/libs folder.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4kdEajG1b8sFZ-VMjNtBLROFwRd5xq2xTl1KAL7CzsZQGpDw5k3pNNfhKmnUy9tcN2_vK93lLMp-8FTFPuQAaY0FOrB01xBwCkHKihX_EI7DcTeutdnEz9DgBxl1Pe7vGTLRwE6ikSj0/s1600/Libs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4kdEajG1b8sFZ-VMjNtBLROFwRd5xq2xTl1KAL7CzsZQGpDw5k3pNNfhKmnUy9tcN2_vK93lLMp-8FTFPuQAaY0FOrB01xBwCkHKihX_EI7DcTeutdnEz9DgBxl1Pe7vGTLRwE6ikSj0/s400/Libs.png" width="400" /></a></div>
<br />
Create and open EJBRestService java class, annotate with @Path("EJBRESTService") on class level. Click on the @Path notice on the left side yellow bulb will be appeared and click on the bulb to "Configure web.xml for jersey JAX-RS web services" as shown in below.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYa2nnMGjrzmqaPvUddDtZIIrYLvR464a1SF4fI1OLbrtW44gGwuu_nmOqF-yZtr4c4FpJhpIMYacmOxRC4MNqAkXu1ijDTXlvnKjNPAXZ9o7PR4T8aJfht0HN8fXmSyNuuTpuum-d1yU/s1600/JAX-RS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYa2nnMGjrzmqaPvUddDtZIIrYLvR464a1SF4fI1OLbrtW44gGwuu_nmOqF-yZtr4c4FpJhpIMYacmOxRC4MNqAkXu1ijDTXlvnKjNPAXZ9o7PR4T8aJfht0HN8fXmSyNuuTpuum-d1yU/s400/JAX-RS.png" width="400" /></a></div>
<br />
Now web.xml is created under WEB-INF folder. Open the file and replace with the below xml code.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 280px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"><?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<filter>
<filter-name>JpsFilter</filter-name>
<filter-class>oracle.security.jps.ee.http.JpsFilter</filter-class>
<init-param>
<param-name>enable.anonymous</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>JpsFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>jersey</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
<param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>webservice</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<!--load-on-startup>1</load-on-startup-->
</servlet>
<servlet-mapping>
<servlet-name>jersey</servlet-name>
<url-pattern>/jersey/*</url-pattern>
</servlet-mapping>
<ejb-local-ref>
<ejb-ref-name>ejb/SessionEJBBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>model.SessionEJBLocal</local>
<ejb-link>SessionEJB</ejb-link>
</ejb-local-ref>
</web-app></code></pre>
Points to be noticed from the above xml code are :<br />
<ol style="text-align: left;">
<li>param-value under com.sun.jersey.config.property.packages tag - change the package name by your own package name used in the application.</li>
<li>Add the Ejb References </li>
</ol>
Open the EJBRestService.java file and add the below code.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 280px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">@Path("EJBRESTService")
public class EJBRestService {
public EJBRestService() {
super();
}
@GET
@Produces(MediaType.APPLICATION_XML)
public List<departments> getAllDepts() {
List<departments> list = new ArrayList<departments>();
try {
Context ic = getInitialContext();
SessionEJBLocal sessionEJB = (SessionEJBLocal)ic.lookup("java:comp/env/ejb/SessionEJBBean");
for (Departments departments : (List<departments>)sessionEJB.getDepartmentsFindAll()) {
list.add(departments);
}
ic.close();
} catch (NamingException e) {
e.printStackTrace();
}
return list;
}
@POST
@Consumes(MediaType.APPLICATION_XML)
public void persistDept(Departments departments) {
try {
Context ic = getInitialContext();
SessionEJBLocal sessionEJB = (SessionEJBLocal)ic.lookup("java:comp/env/ejb/SessionEJBBean");
sessionEJB.persistDepartments(departments);
ic.close();
} catch (NamingException e) {
e.printStackTrace();
}
}
@PUT
@Consumes(MediaType.APPLICATION_XML)
public void mergeDept(Departments departments) {
try {
Context ic = getInitialContext();
SessionEJBLocal sessionEJB = (SessionEJBLocal)ic.lookup("java:comp/env/ejb/SessionEJBBean");
sessionEJB.mergeDepartments(departments);
ic.close();
} catch (NamingException e) {
e.printStackTrace();
}
}
@DELETE
@Path("{departmentId}")
public void removeDept(@PathParam("departmentId")
BigDecimal departmentId) {
try {
Context ic = getInitialContext();
SessionEJBLocal sessionEJB = (SessionEJBLocal)ic.lookup("java:comp/env/ejb/SessionEJBBean");
Departments departments = new Departments();
departments.setDepartmentId(departmentId);
sessionEJB.removeDepartments(departments);
ic.close();
} catch (NamingException e) {
e.printStackTrace();
}
}
private static Context getInitialContext() throws NamingException {
InitialContext ic = new InitialContext(); // WebLogic Server 10.x connection details
return ic;
}
}</departments></departments></departments></departments></code></pre>
Now deploy/run the EJBRestService.java client in the Integrated Weblogic Server to test. Once client runs it will provide the Target Application WADL/Target URL in JDeveloper console, click on any link to run the service in HTTP Analyzer. Below screen shows the GET method accessed in HTTP Analyzer with result.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioIQkOgZu_7eMZzp5N7gfprJCMjEWReBRKffsLk1RjHEI3eiPE9ROMzfKw9X7kWAp5bPj3YcPwWBBOyD89HiJ0R-HUhgV1j0QmgTbkgo6AOATStsFtkB4I8WtnjuSV-7ZCVu-IB9QBVPQ/s1600/result.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="308" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioIQkOgZu_7eMZzp5N7gfprJCMjEWReBRKffsLk1RjHEI3eiPE9ROMzfKw9X7kWAp5bPj3YcPwWBBOyD89HiJ0R-HUhgV1j0QmgTbkgo6AOATStsFtkB4I8WtnjuSV-7ZCVu-IB9QBVPQ/s640/result.png" width="550" /></a></div>
<br />
<b>Note:- </b>Put and Post method are not working with HTTP Analyzer, you might need to create java client/ADF application to test these methods.</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com2tag:blogger.com,1999:blog-3873906122160366310.post-26243680661912012452013-04-02T10:36:00.001-07:002013-04-02T10:45:17.017-07:00Sync Device Back Button With ADF Mobile App's Back Button In TaskFlows<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
This article is the continuation of my previous article on <a href="http://deepakcs.blogspot.in/2013/03/handling-device-back-button-in-adf.html">Handling the Device Back button in ADF Mobile Application</a>. Scenario in this article is to use the device back button to go back to previous page within taskflows, Android device has a back button and our apps should take an advantage of that.<br />
<br />
Thanks for <b><i>Bryan Laipple</i></b>, in his forum reply he provided the solution on how to programmatically navigate within task flows. Application screen looks like below when it is deployed and run on the Android Device/Emulator. In the below screen Employee list will be displayed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi76Qk_0kQZxGiDwYSvwvzBWya2D36HpFC8dd8UToGR58_sjxitDqRDHKEkAmTIjmEOYTi9gW2ol3XRo5xyoJd_Ter-gbDldLSjpVTP1BZRs1IO-F7TtLHZyaURKAHPen1jmZgfJHrXjr8/s1600/EmployeeList.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi76Qk_0kQZxGiDwYSvwvzBWya2D36HpFC8dd8UToGR58_sjxitDqRDHKEkAmTIjmEOYTi9gW2ol3XRo5xyoJd_Ter-gbDldLSjpVTP1BZRs1IO-F7TtLHZyaURKAHPen1jmZgfJHrXjr8/s400/EmployeeList.png" width="241" /></a></div>
<br />
Clicking on any employee will take you to the selected Employee details page. Notice in the below screen there is no back button provided explicitly, here we can take an advantage of device back button to navigate back to previous page. Now click on the device back button to go back to previous page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKcUWK_3N7xPgGMR9oWMOcmOuCWtdN7jK4CaY-rFYvzkXfX_qVAa0SWCBk6hNZcFRWBMCaBXqrKK8D-2GCWINoOHVVn4EXGajoLISco3F5SvW-RTPXeLrr924AHfvXSi1-umhzdLr6JLc/s1600/DeviceBackButton.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKcUWK_3N7xPgGMR9oWMOcmOuCWtdN7jK4CaY-rFYvzkXfX_qVAa0SWCBk6hNZcFRWBMCaBXqrKK8D-2GCWINoOHVVn4EXGajoLISco3F5SvW-RTPXeLrr924AHfvXSi1-umhzdLr6JLc/s400/DeviceBackButton.png" width="355" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/HandleDeviceBackButtonInTaskFlow.zip">download the sample workspace from here</a>. I have checked in Android Device/Emulator and it's working fine.<br />
<br />
In below section I will not provide all the steps to create the application from scratch, only key ones are shown. Created DeviceBackButtonTaskFlow.xml taskflow in this application looks like below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXavrKSa4rZ1KQDBYkjOU-zRt3XgxYIoNCwmgFyCRC15xU4Fm9eZq6wTcLRnb9szXnMjbqOStLQtnpVwMBE3xUMP24rzF_7okgbHzOmqDjkHzivjg59cHNd_djBcCVKLFmMwuSwWMVmF8/s1600/TaskFlow.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXavrKSa4rZ1KQDBYkjOU-zRt3XgxYIoNCwmgFyCRC15xU4Fm9eZq6wTcLRnb9szXnMjbqOStLQtnpVwMBE3xUMP24rzF_7okgbHzOmqDjkHzivjg59cHNd_djBcCVKLFmMwuSwWMVmF8/s400/TaskFlow.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b><i>Programmatically navigate within task flows in two ways: -</i></b><br />
<ul style="text-align: left;">
<li><b>Javascript </b>- Create Javascript file under the feature and add the below code which catches the event that fires when the user presses the device back button. In Javascript function directly call adf.mf.api.amx.doNavigation(outcome), here outcome is the variable that represents the navigation string corresponding to the control flow case.</li>
</ul>
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 280px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">//This is an event that fires when the user presses the device back button
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", backKeyDown, true);
}
function backKeyDown() {
//Check the device back button action happened in Employee.amx
if ($('#EmployeeId').length) {
//Navigate within taskflows using javascript
adf.mf.api.amx.doNavigation("backToEmployeeList");
}
}</code></pre>
<ul style="text-align: left;">
<li><b>Java </b>- Create Javascript file under the feature and add the below code which catches the event that fires when the user presses the device back button.</li>
</ul>
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 450px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">//This is an event that fires when the user presses the device back button
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", backKeyDown, true);
}
function backKeyDown() {
//Check the device back button action happened in Employee.amx
if ($('#EmployeeId').length) {
//Call the java method in managed bean
adf.mf.api.invokeMethod("mobile.EmployeeManagedBean", "handleNavigation", onInvokeSuccess, onFail);
}
}
function onInvokeSuccess(param) {
//To do code after success
};
function onFail() {
//To do code after failure
};</code></pre>
Next create a EmployeeManagedBean class under DeviceBackButtonTaskFlow. Add the below code to navigate within the taskflow. This method will be called from javascript function.
</div>
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 140px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">public void handleNavigation() {
//Code to naviagte within task flows programmatically
AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureName(),
"adf.mf.api.amx.doNavigation",
new Object[] { "backToEmployeeList" });
}</code></pre>
<br /></div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com2tag:blogger.com,1999:blog-3873906122160366310.post-74709895698235061892013-04-02T07:46:00.002-07:002013-04-02T07:46:38.004-07:00Oracle JDeveloper and Oracle ADF 11g Release 1 (11.1.1.7.0) released<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 16px;">The 11g Release 1 (11.1.1.7.0) version of JDeveloper and ADF is a minor update release, download <a href="http://www.oracle.com/technetwork/developer-tools/jdev/downloads/jdeveloper11117-1917330.html">here</a>. It contains many bug fixes as well as a few <a href="http://www.oracle.com/technetwork/developer-tools/jdev/index-088099.html">new features</a> to enjoy.</span></div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com0tag:blogger.com,1999:blog-3873906122160366310.post-40988857536146582342013-03-31T22:04:00.000-07:002013-04-02T09:34:21.460-07:00Handling the Device Back button in ADF Mobile Application<div dir="ltr" style="text-align: left;" trbidi="on">
While developing an ADF Mobile application for Android/IOS, you may require to capture the device back button on user click. Here we will add little logic to exit the application once the user clicks on device back button.<br />
<br />
We can directly use the phone gap <a href="http://docs.phonegap.com/en/2.5.0/cordova_events_events.md.html#backbutton">backbutton</a> api to override the default back button behaviour, you can register an event listener for the 'backbutton' event. It is no longer necessary to call any other method to over ride the back button behaviour. Now, you only need to register an event listener for 'backbutton'.<br />
<br />
Application screen looks like below when it is deployed and run on the Android
Device/Emulator. Click on the device back button will launch the confirm dialog, user can click OK to exit the application.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc8bVX8mqf2w6gJ_uLNp66zetnmvQxrvP-brB5TbmbX3IdJ0LCJRpFmQ0qlAHm39wWuvLq78CvxfhEJuAISKWXWh3SItm_lh8QrPDE-YGFARe8AcKM74bPBVjG_bdgTZTYAcac_Ja1-b4/s1600/DeviceBackButton.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc8bVX8mqf2w6gJ_uLNp66zetnmvQxrvP-brB5TbmbX3IdJ0LCJRpFmQ0qlAHm39wWuvLq78CvxfhEJuAISKWXWh3SItm_lh8QrPDE-YGFARe8AcKM74bPBVjG_bdgTZTYAcac_Ja1-b4/s400/DeviceBackButton.png" width="355" /></a></div>
<br />
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/HandleDeviceBackButton.zip">download the sample workspace from here</a>. I have checked in Android Device/Emulator and it's working fine, not sure in IOS device.<br />
<br />
<b style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><u>Implementation Steps</u></b><br />
<b style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><u><br /></u></b>
Create an ADF Mobile Application, the application consists of two projects. Application Controller project of Application LifeCycle, Listeners, Device Features DataControl and ViewController project contains mobile features content like AMX Files, Task Flows and DataControl.
<br />
<br />
Right click on the ViewController project and in New Gallery window, select Web Tier-> HTML -> JavaScript File and name as "index.js". Next locate and expand the Application Sources folder, then expand the META-INF folder. You will see the adfmf-feature.xml file, click on the adfmf-feature.xml file to launch the Feature editor. Add a new feature by clicking the green plus sign on the Features table near top of the editor this will launch the new Create ADF Mobile Feature dialog, leave the default values and click ok.<br />
<br />
In the Features table, select the newly created feature "feature1". Under the Features table, click the Content tab, and locate the Content table. Notice that the content item feature1.1 is created by default. Next add a new file by clicking the green plus sign and select ADF Mobile AMX Page, this will launch the new Create ADF Mobile AMX Page dialog, modify the File Name as index.amx.<br />
<br />
Next in Includes section, click the green plus sign and Insert Include the javascript file as shown below.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6bOaJL9wedxTO1YXI4EYl99g_00NAKq5B3qaNWIuc7NaIM9FMl6DBlcXC5KCEQPiWHvnkqxvzIOpWeJl4TFwx2HnG_W0DVAhbsM4ZlZuUyUnpMNwyzwqoMGOQbV3Gb4Ubt6mhqfZoA8Y/s1600/Javascript.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="258" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6bOaJL9wedxTO1YXI4EYl99g_00NAKq5B3qaNWIuc7NaIM9FMl6DBlcXC5KCEQPiWHvnkqxvzIOpWeJl4TFwx2HnG_W0DVAhbsM4ZlZuUyUnpMNwyzwqoMGOQbV3Gb4Ubt6mhqfZoA8Y/s400/Javascript.png" width="400" /></a></div>
<br />
Open the index.js file and below code catches the event that fires when the user presses the device back button.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 250px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">//This is an event that fires when the user presses the device back button
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", backKeyDown, true);
}
function backKeyDown() {
var cFirm = confirm("Are you sure you want to exit the application?");
if (cFirm == true) {
//Code to exit the application
navigator.app.exitApp();
}
}</code></pre>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com79tag:blogger.com,1999:blog-3873906122160366310.post-65821685911375403162013-03-26T00:33:00.000-07:002013-04-02T05:05:24.425-07:00ADF Mobile : Display Custom Springboard layout with 3 * 3 matrix<div dir="ltr" style="text-align: left;" trbidi="on">
Scenario here is to display 3 * 3 matrix dynamic table in custom springboard amx page using ApplicationFeatures data control with Features data collection.<br />
<br />
Using amx:tableLayout only we might not be able to get the required structure. We need to use amx:panelGroupLayout with inlineStyle to achieve the above scenario. Credit goes to <b><i>Matt Cooper</i></b>, I have extracted the idea based on one of his forum reply. Here is the code below.<br />
<pre style="background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: 300px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"><amx:tableLayout id="tl1" shortDesc="features-table" inlineStyle="width:100%;">
<amx:rowLayout id="rl1">
<amx:cellFormat id="cf1" shortDesc="features-column" inlineStyle="width:100%;">
<amx:panelGroupLayout id="pgl1" layout="wrap">
<amx:iterator var="row" value="#{bindings.features.collectionModel}" id="i1">
<amx:panelGroupLayout id="plam2" inlineStyle="width:33%;display:inline-block;" halign="center"
valign="middle">
<amx:tableLayout id="tl2">
<amx:rowLayout id="rl2">
<amx:cellFormat id="cf2" halign="center" valign="middle">
<amx:commandLink id="cl1" actionListener="#{bindings.gotoFeature.execute}">
<amx:image id="i2" source="/images/#{row.name}-springboard.png"
inlineStyle="width:36px;height:36px"/>
<amx:setPropertyListener from="#{row.id}" to="#{pageFlowScope.FeatureId}" type="action"/>
</amx:commandLink>
</amx:cellFormat>
</amx:rowLayout>
<amx:rowLayout id="rl3">
<amx:cellFormat id="cf3" halign="center" valign="middle">
<amx:commandLink id="cl2" actionListener="#{bindings.gotoFeature.execute}">
<amx:outputText value="#{row.name}" id="ot2"/>
<amx:setPropertyListener from="#{row.id}" to="#{pageFlowScope.FeatureId}" type="action"/>
</amx:commandLink>
</amx:cellFormat>
</amx:rowLayout>
</amx:tableLayout>
<amx:spacer id="s2" height="25"/>
</amx:panelGroupLayout>
</amx:iterator>
</amx:panelGroupLayout>
</amx:cellFormat>
</amx:rowLayout>
</amx:tableLayout></code></pre>
<i>Notice: - In panelGroupLayout, I have set the width to 33%, since I need 3 columns per row. Adjust the width as desired to fit the number of features Items per row based on our requirements.</i><br />
<br />
Application screen looks like below when it deployed and run on Android Device/Emulator. Click on any image/link will take you to the respective feature tab.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGErkd8N6xz0dbN_Y5NbS620BPeXnMn6UMw2lUPoWpjowxi32x3cz8GG3YDwd1nc-WWxhaL14ai7VnO518pet4qqiEtf9-RG9XP5a8miENb1rwqthMx01022Tqn33uYAcz41GHgzuoI88/s1600/Springboard.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGErkd8N6xz0dbN_Y5NbS620BPeXnMn6UMw2lUPoWpjowxi32x3cz8GG3YDwd1nc-WWxhaL14ai7VnO518pet4qqiEtf9-RG9XP5a8miENb1rwqthMx01022Tqn33uYAcz41GHgzuoI88/s400/Springboard.png" width="267" /></a></div>
<div>
You can <a href="https://ejbdatacontrol-samples.googlecode.com/files/SpringboardDemo.zip">download the sample workspace from here</a>. You can get more details on <a href="http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/define_features.htm#CIHGJJGD">Configuring the custom Springboard and Navigation Bar Behavior</a>.</div>
</div>
Testhttp://www.blogger.com/profile/13240923727846054335noreply@blogger.com7