Forum Stats

  • 3,826,352 Users
  • 2,260,634 Discussions
  • 7,896,914 Comments

Discussions

Update operation/API is allowed only when Order status=DRAFT

Hi,

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

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

Tagged:

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,457 Red Diamond

    User, tell us your exact JDev version, please!

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,457 Red Diamond

    You should not use JDev 12.1.0, it's outdated.

    I ask for the exact version because there are about 6-10 different versions out.


    Timo

  • User_XGAL8
    User_XGAL8 Posts: 10 Employee

    Oracle JDeveloper 12c 12.2.1.5.0

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,457 Red Diamond

    OK, you are using an Oracle internal version that is not available to the public. There might have been some changes in the REST area we don't know about. So to get a definite answer you should use an internal channel.


    I can think of two solutions.

    1) you create another endpoint (a different view) that only handles rows with DRAFT status. To this endpoint, you allow update operation and remove the update from the other endpoint. This way nobody can update other rows.

    2) you implement this business logic directly in the EO by overwriting the prepareForDML() or doDML() methods. Do the check there and throw an exception if your criteria are not matched.

    There might be some more elegant way to set some kind of validation to the REST operation, but I don't know about it.


    Timo