How to detect JBO Exception from within Apps Module Custom Method ?

Hi all,
I have a custom method in apps module (AM) to set "Status" attribute to "A' in an antity, this is for approval.
Also there is a rule that the transaction cannot be approved if it is already cancelled by another user (in multi user environment).
The problem is :
If the AM custom method fail (because it throws JBOException in the entity setter method), How can I know that it fails ?
and report it back to the backing beans that call the custom method ?
Thank you for your help,
xtanto
Below is the code :
1. create a custom method in AM to do : setStatus ("A") ;
public void approve(){
ViewObject bphVo = findViewObject("BpHView1");
BpHViewRowImpl vBphViewRow = (BpHViewRowImpl)bphVo.getCurrentRow();
vBphViewRow.setStatus("A");
2. Do a validation inside setStatus method of the entity :
public void setStatus(String value) {
if (! getCancel() == true )
setAttributeInternal(STATUS, value);
else
throw new JboException("Error ! transaction already cancelled");
3. On backing beans :
public String approveButton_action() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding("approve");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
System.out.println("There is JBO Error !!");
return null;
else{
commitButton_action();
return "back";
}

Try this code:
approveButtonAction()  {
String navigationString = null;
try {
Object result = operationBinding.execute();
naviagionString = success;
catch (JboException e) {
   navigationString = null;
   (DCBindingContainer)bc.cacheException(e);
} finally {
if(navigationString != null)
  return commitButtonAction();
else
  return navigationString;
}

Similar Messages

  • How to call Apps Module Custom Method from Entity Object / View Object ?

    Hi All,
    I create a custom method in AppsModuleImpl.java. How can I call that custom method from a setter method on Entity Object / View Object ?
    (I have tried to use Configuration.createRootApplicationModule(amDef,config); but it is not the correct way, is it? )
    Below is my code :
    The setter on MyEntityImpl.java :
    public void setKodeprd(String value) {
    setAttributeInternal(KODEPRD, value);
    if (getProduct() != null) {
    // CALL the getSalesPrice custom method from here, HOW ??
    The Application Module custom method :
    public Number getSalesPrice(String priceCode, String kodePrd) {
    Number price = new Number(0);
    String [] theKey = {priceCode, kodePrd};
    Key priceKey = new Key(theKey) ;
    ViewObject SalesPrice = getSalespricedView1();
    Row[] salesPriceRow = SalesPrice.findByKey(priceKey, 1);
    price = ((SalespricedViewRowImpl)salesPriceRow[0]).getPrice();
    SalesPrice.remove();
    return price;
    Thank you for your help,
    xtanto

    inside the EntityObjectImpl :
    YourAppModuleImpl am = (YourAppModuleImpl)getDBTransaction().getRootApplicationModule().findApplicationModule("YourAppModuleorServiceName");

  • How do I remove images from Notes app?

    How do I remove images from Notes app?
    I sometimes find that, when cutting and pasting text from the web, an image is also copied (pretty much at all times I try and avoid this, but sometimes the selection process doesn't allow for fine enough control - e.g. a whole block of content may be selected, rather than just the few words I'm trying to copy).
    I then find, once it's part of my note, that I cannot select the unwanted image and remove it. Can anyone tell me if this is something that can be done, and if so... how?
    Thanks, Sebastain

    Hi Drew & Kilgore*
    Thanks for your replies. I also have and use Simplenote, although I went off it for a while, when it started crashing all the time on me. It seems to be more stable again now, so I'll start using it more regularly again, perhaps.
    I am, obviously, disappointed that one can't simply select ANY object within a Notes document and choose to delete it. As I rather suspected, the only solution is an annoying workaround. Apple stuff seems to get more like this as time goes by. At least in my experience.
    I solved the issue my own way in the end, but I guess it was close to your 1st idea DR, and your 2nd option, KT: I basically cut and pasted everything above, and then everything below, the image, and pasted both chunks of text into a new note. So it took two passes, and left me with the original note just displaying the image, which I then trashed.
    Tapping to the right of the image followed by deletion was what I hoped & expected would work. But instead the image stayed put and the text below the cursor would simply slide along the right hand side, moving upwards as I deleted! Most bizarre, to my mind at least.
    Anyway thanks for the feedback. But, for anyone else that might want to know how to do this, the answer is: NO, you can't select and delete an image once it's in one of your notes!
    * I quite recently watched the rather strange Bruce Willis / Nick Nolte 'Breakfast of Champions' movie... I think I still prefer the book to the film!

  • How to detect AIR for Android closing app event? AIR analog to Activity.onDestroy()

    How to detect AIR for Android closing app event (remove app from dock "Recent Apps")?
    In AndroidActivityWrapper.StateChangeCallback exist method onActivityStateChanged. But he have only DESTROYED state, which it seems received where app finish exiting. Activity.onDestroy() called if app start exiting.

    DPI aside, you can just set your resolution on the project to the target devices resolution to preview how it will look. While vectors will render much smoother on the device (higher DPI), it's a very easy way to target various resolutions for testing.
    If you have the full CC suite you might want to consider using Flash Builder 4.7 which has many different device presets and allows you to create your own presets to mimic tablets and phones. It really depends how complex your project is to move over to FB.

  • I have a Verizon IPhone 4 and i can't figure out how to get my ringtones from an app to my iTunes account, it doesn't have a tab for Ringtones! I have tried unplugging it and checking if would show up but it didn't, how do you enable the ringtone folder?

    I have a verizon IPhone and i can't figure out how to get my ringtones from the app to iTunes, my account doesn't have a ringtone section in the liRingtone Folder?brary, how do you enable the ringtone folder?

    Edit > Preferences.  Select the check box for Ringtones, this will add them to the listing in iTunes. 
    Not sure that really answers your question though.

  • TS1702 how do you stop itunes from downloading apps over and over again and again like for ever it wont stop  help.

    how do you stop itunes from downloading apps over and over again and again like for ever it wont stop  help.
    i tryed everything i  can in the setting and so on , i even clicked on the downloads arrow to pause it and delete them but like i said it will now stop.
    theres apps i just dont want. theres a list of them but theres not a place were i can get rid of them. it also says some stuff about icloud yeah right like i have ios 5 or 7 ha . pod touch 2 is what i have lol . plz help thanks.

    to the right by search library theres an arrow there click on it : it will show you what it is downloading , from there you can pause and select all and delete them but still will continue to download them if you tell itunes to check for downloads. that download engien is crazy i tell yeah.
    no matter what we do it will still download them trust me i tryed everything and i also went to icloud to see if it was there but to what i see is that there is no apps there this is some crazy itune program that needs to remade.

  • Hi, please how can I transfer purchases from the app store on Mac to my iPad ? I purchased  keynotes, numbers ,pages and other items. I really want to have them on my iPad . Thanks.

    Hi please how can I transfer purchases from the app store on Mac to my iPad . I downloaded  keynotes , numbers, pages and others and will want to have them on my I pad thanks.

    Apps that are written for the Mac OS cannot be used on iOS devices, such as the iPad. You can purchase the iOS versions of some of these apps in the iTunes App Store.

  • How can I purchase products from the app store while travelling outside my country of residence?

    How can I purchase products from the app store while travelling outside my country of residence? We are from Canada, travelling in the USA and wish to buy a TV series but get a message to buy it from the Canadian store. When we tried to do this we got the same message.

    According to the terms of sale, you have to be in your country of residence in order to make a purchase. I've heard of people able to make purchases outside their country and also of people being unable to do so. It appears that Apple's enforcement is not 100%.
    In order to buy from the U.S. iTunes Store, you would need to have a valid billing address in the U.S., a credit card billed to that address or an iTunes Gift card purchased in the U.S. and be physically present in the U.S. at the time of purchase.
    International copyright law is currently very inconvenient for the consumer.
    Best of luck.

  • Hello everyone!  i have a new macbook pro and i want to download aperture.  my app store says it is already installed (on my old macbook pro).  how do i install aperture from the app store in this instance please?

    hello everyone!  i have a new macbook pro and i want to download aperture.  my app store says it is already installed (on my old macbook pro).  how do i install aperture from the app store in this instance please?

    Are yoy sure that Apeture is not in the Applications folder of the new system? If it is move it to the trash and the App Store will let you download Aperture from it.
    You will need to make sure you use the same Apple ID you used to purchase it in the past.
    regards

  • HT1491 how do I purchase games from the app store with an itunes card from my device?

    How do I purchase games from the app store using an itunes card from my device?

    Redeem the card into your iTunes account and make purchases.
    Apple - iTunes - Inside iTunes - How to Redeem Free Download Codes and Gift Cards In the App Store and iTunes

  • How do I stop itunes from transferring apps from my ipad or iphone to my pc ?

    How do I stop iTunes from transferring apps from my iPad or iPhone to my PC ? I have App sync turn off and I have add files to library turned off. Yet every time
    I sync iTunes transfers all my apps to my PC. I have 20-30 gig of apps on each. A lot of them are 1gig each and it takes for ever to sync , plus I don't want 100 gig of apps just sitting on my hard drive for no reason. Any app I ever want is always available in the cloud so what's the point of having them on my PC in the 1st place?

    I'm pretty sure that the space is used up on your computer's hardrive.
    Anyway my solution to this nuisance of apps/itunes transfer was to allow itunes to download the apps from my phone...
    ...First of all I had tried to uncheck a few boxes in itunes a) automatically sync when device is connected (in the summary section) b) prevent devices from syncing (edit>preferences>devices) and c) Automatically sync new apps (apps section of device)
    HOWEVER, when I would click sync in any section, apps tried to transfer to itunes from my iphone.
    So after all my apps went on my computer (approx. 9 GB), I checked the boxes back, disconnected my device and deleted all the apps from itunes and my computer simultaneously (by clicking del/move to recycle bin).
    Now when I connect my iphone it does it's backup/sync thing automatically ...but no apps try to transfer
    Note: apps from your library cannot be set to sync with your device
    I can now also click sync in any section and no apps transfer.
    (This problem started when I downloaded an app from itunes rather than my device and I later transfered the app to my device. My apps section in itunes is completely empty now and no apps appear in windows explorer either)
    the only thing I am unsure of now is; what's going to happen if I purchase an app from itunes on my pc again ...I'm guessing I'll have to repeat the process (might want to avoid that)     

  • How do i extract pages from within a pdf document?

    how do i extract pages from within a pdf document?

    Hi adobespurs,
    To extract pages from a PDF, you need to use Acrobat. If you don't have Acrobat, you can try it for free for 30 days. Please see www.adobe.com/products/acrobat.html for more information.
    Best,
    Sara

  • How do i delete albums from photos app

    how do i delete albums from photos app?

    The same way you put them on the device. Use iTunes on your computer.
    iOS and iPod: Syncing photos using iTunes

  • How to execute Linux command from Java app.

    Hi all,
    Could anyone show me how to execute Linux command from Java app. For example, I have the need to execute the "ls" command from my Java app (which is running on the Linux machine), how should I write the codes?
    Thanks a lot,

    You can use "built-in" shell commands, you just need to invoke the shell and tell it to run the command. See the -c switch in the man page for your shell. But, "ls" isn't built-in anyays.
    If you use exec, you will want to set the directory with the dir argument to exec, or add it to the command or cmdarray. See the API for the variants of java.lang.Runtime.exec(). (If you're invoking it repeatedly, you can most likely modify a cmdarray more efficiently than having exec() decompose your command).
    You will also definitely want to save the returned Process and read the output from it (possibly stderr too and get an exit status). See API for java.lang.Process. Here's an example
    java.io.BufferedReader br =
    new java.io.BufferedReader(new java.io.InputStreamReader(
    Runtime.getRuntime().exec ("/sbin/ifconfig ppp0").
    getInputStream()));
    while ((s = br.readLine()) != null) {...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to download paid games from the App Store in the absence of a credit card?

    How to download paid games from the App Store in the absence of a credit card?

    If you don't have a credit card, you'll need a prepaid iTunes card or iTunes gift certificate. Or, if you're in the US, you can use PayPal, though it's often an unreliable method of payment.
    Regards.

Maybe you are looking for