Uploaded image for project: 'Radiology Module'
  1. Radiology Module
  2. RAD-97

Add validation via AOP on placeRadiologyOrder

    XMLWordPrintable

    Details

    • Complexity:
      Undetermined

      Description

      The openmrs-core uses Validator's via AOP on methods starting with name "save" or "create". At the moment it will use all validators that are registered for the type that will be saved. In our case it calls RadiologyOrder.validate() and as well OrderValidator.validate() on new RadiologyOrders.

      The issue we are facing is that Order.encounter has a not null constraint. We are creating a radiology encounter in placeRadiologyOrder() thus our custom validator RadiologyOrderValidator does not enforce this constraint. But since the OrderValidator is called as well by openmrs AOP settings saving an order will fail. To avoid this we had to name the method anything but "saveRadiologyOrder" or "createRadiologyOrder".

      Unfortunately, we only check the RadiologyOrder for validity in the controller with our RadiologyOrderValidator but not in the API. To improve this we should set up AOP for placeRadiologyOrder in our module, so that we enforce the same contraints on RadiologyOrder in the web and api.

      for more info see https://talk.openmrs.org/t/custom-validator/3083/4

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              teleivo Ivo Ulrich
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: