Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-2393

Add AOP around save methods to invoke validators

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Must
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: OpenMRS 1.9.0
    • Component/s: None
    • Labels:
    • Complexity:
      High

      Description

      We have validation being handled in the web layer fairly well but it would be nice to have this validation being done at the API level using AOP around save methods, this has the benefit of saving API users from having to call validators in their code, also it ensures the validation in enforced just in case some developers forget to do so before saving objects.

      Possible TODOs:
      1- Use Handlers to find the exact validator for a given Type that has to be invoked
      2- Add an Exception class e.g InvalidObjectException
      3- The AOP should spit invalid objects with the InvalidObjectException whose error message is a comma separated string of the validation error messages.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darius Darius Jazayeri
                Reporter:
                wyclif Wyclif Luyima
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: