Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

delete an order (using REST API) only when order status =DRAFT

User_XGAL8Jun 22 2022

Hi,
I have enabled delete operation in rest resource file but I want to first check order status of an order and if it is DRAFT then only delete is allowed.

where I can add this condition? currently delete is working for all the order status

This post has been answered by Timo Hahn on Jun 22 2022
Jump to Answer

Comments

Timo Hahn
Answer

User, tell us your exact JDev version, please!
Have your tried to overwrite the remove() method of the VO and do the check there?

Timo

Marked as Answer by User_XGAL8 · Jun 22 2022
User_XGAL8

Thanks @timo-hahn1 , I have tried this solution and it worked out.

User_XGAL8

@timo-hahn1 , I have overridden remove method and it's working also.
but the problem , I am not able to return any msg in API response if condition is not met because return type for remove() is void. is there any way so that I can return failure msgs when condition is not met.

Timo Hahn

you can throw a ValidationException with your message. This will be translated into a status 400 and the message will be passed as detail.

Timo

User_XGAL8

Yes Timo , but throwing an exception will give me 400 api response with incident log info in response.

I want a proper failure that needs to be returned in api response. so that UI team can fetch that msg

Timo Hahn

What do you mean by 'proper failure'?
A return code of 400 means 'failure' in REST.

Timo

Shyam Patel

SELECT source_order_number,
change_version_number,
status_code,
source_order_system,
source_order_id
FROM fusion.doo_headers_all
WHERE status_code = 'DOO_DRAFT'
ORDER BY creation_date DESC

1 - 7

Post Details

Added on Jun 22 2022
7 comments
665 views