This discussion is archived
6 Replies Latest reply: Jan 14, 2013 11:38 PM by Cvele_new_account RSS

ADM mobile: CRUD operations through Web Service

Cvele_new_account Expert
Currently Being Moderated
I am trying to implement basic CRUD operation in the ADF mobile application, an I need to work with the data supplied by the web service.
I have read several articles on the web, i.e.:

https://blogs.oracle.com/shay/entry/adf_mobile_update_through_web

an similar, but "direct work" with Web services confuses me a bit.
At first, I came up with the idea to integrate the web service with ADF business components as described in
http://www.oracle.com/technetwork/issue-archive/2012/12-jul/o42adf-1653060.html
but just discovered that ADF Mobile doesn't support Java Web Service proxy:
http://andrejusb.blogspot.com/2012/11/adf-mobile-secured-web-service-access.html

so I am goind to use Web Service Data Control directly.

For example, I exposed the Update and Find (by SQL statement) operations for one of my BC View Object in the App module Service interface, and (in the ADM mobile app) I created the Web Service data control.
Dropped the result of Find operation on the .amx page as amx:listView, and then show the current row data on the amx:popup, in order to update them.

So popup shows data from the same iterator as a listView.

The popup have OK-Cancel button, therefore, the usual situation that is often found in ADF Fusion web application.
Then, I change the value of one or more fields.

_1. The first problem_ - I do not see a way to undo the change when the user pressed Cancel button.
In the ADF Fussion web app, there is number of approach, for example:

http://jjzheng.blogspot.com/2010/09/undo-changes-java-codes.html

Wondering, how to translate this code in the ADF mobile app ?

_2. The second question_ - when user inserts a new record on the popup, (thus performing web service Create operation), how to refresh amx:listView in order to show that new record ? Similar for deletion

_3. And finally_ - how to deal with exceptions which may occur durring CRUD operation ?

- Thanks,...
  • 1. Re: ADM mobile: CRUD operations through Web Service
    user404 Pro
    Currently Being Moderated
    Hi,

    1) What do you mean by undo the changes? As long as you don't press your Save button (the one that executes the web service action) nothing gets changed.
    You can close the popup by using this
    <amx:commandButton text="Cancel" styleClass="adfmf-commandButton-hightlight"
                                   inlineStyle="width:200px;" id="cb7">
                                   <amx:closePopupBehavior popupId="editEmpPopup"/>
            </amx:commandButton>
    2) About refreshing your data when adding/deleting data :
    You need to check out Data Change events:
    http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/amxbinding.htm#CHDHFGAF
  • 2. Re: ADM mobile: CRUD operations through Web Service
    Cvele_new_account Expert
    Currently Being Moderated
    Thanks for quick answer,

    1) What do you mean by undo the changes? As long as you don't press your Save button (the one that executes the web service action) nothing gets changed.
    You can close the popup by using this...
    -Yes, but when I close popup, the data I changed on the popup remains on the read-only viewList behind popup too.
    Popup shows data from the same iterator as a listView.
  • 3. Re: ADM mobile: CRUD operations through Web Service
    user404 Pro
    Currently Being Moderated
    Cvele_new_account wrote:
    Thanks for quick answer,

    1) What do you mean by undo the changes? As long as you don't press your Save button (the one that executes the web service action) nothing gets changed.
    You can close the popup by using this...
    -Yes, but when I close popup, the data I changed on the popup remains on the read-only viewList behind popup too.
    Popup shows data from the same iterator as a listView.
    When you open the popup, you could set the selected item (assume a Employee view/object) in your bean/data control (for example selectedEmployee).
    When you close your popup (when using the cancel button) you can trigger an action listener where you revert the changed manually (using the selectedEmployee which contains the original values).
  • 4. Re: ADM mobile: CRUD operations through Web Service
    Cvele_new_account Expert
    Currently Being Moderated
    Do you have any example on how to use Data change event mechanism with web services ?

    Regarding refreshing data when adding/deleting: there really is not any different, more simple mechanism?
    What I am looking for, is a some "standard", recommended way to perform simple CRUD operation when using web service.
    Is there any ?
  • 5. Re: ADM mobile: CRUD operations through Web Service
    DenisT Explorer
    Currently Being Moderated
    The best way to achieve what you want is to wrap your web service with a bean first. You are binding the UI directly to the web service but it would probably be better to bind it to a BeanDC and when you execute the WS, you fill your bean collection. Then you can have an instance of an object you use to create new elements and when someone hits the "save" button, then you copy it into the collection.

    I suggest you first review the blog article about Programmatic web services here . Then review the StockTracker demo app included with your ADFMobile extension in the /JDeveloper/jdev/extensions.oracle.adf.mobile/Samples folder. It will show you how to fire provider change events to refresh collections so the UI updates.
  • 6. Re: ADM mobile: CRUD operations through Web Service
    Cvele_new_account Expert
    Currently Being Moderated
    Denis,

    Thanks for response.
    I think a such one demo application (basic CRUD operation through Web Service) can be of very great benefit to all ADF mobile developers.
    I think Oracle would need to make such a demo, so we have clearly defined standards that such applications should be developed. Thus it comes down to pat the dark and guessing...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points