Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-3854 | AppointmentEventsAdvice should not throw when older validateAndSave is called #141

Merged
merged 1 commit into from
May 28, 2024

Conversation

ibacher
Copy link
Contributor

@ibacher ibacher commented Nov 21, 2023

Apologies for not creating a ticket; my browser and Atlassian cloud are not working at the moment.

In #117, AppointmentEventsAdvice was added to enable publishing events when appointments are created. This advice is bound to the validateAndSave() method on AppointmentService. Unfortunately, there are two validateAndSave() methods on AppoinmentService, one which takes a Supplier<Appointment> and one which just takes an appointment. The advice assumes it is called by the version that takes a Supplier<Appointment> so that if the other one is called, an exception is thrown, aborting the attempt to save.

This PR fixes that by ensuring the advice also works if the first argument is not an appointment. I also added some extra defensive checks to ensure that the Supplier returns an Appointment as expected.

@ibacher
Copy link
Contributor Author

ibacher commented Nov 21, 2023

@gsluthra Could you have someone look at this please?

@ojwanganto
Copy link
Contributor

@angshu this PR is very critical. We encountered the same error and had to customize the code to support our implementations. I will appreciate if we get someone look into this

@gokultw
Copy link

gokultw commented May 21, 2024

In #117, AppointmentEventsAdvice was added to enable publishing events when appointments are created. This advice is bound to the validateAndSave() method on AppointmentService. Unfortunately, there are two validateAndSave() methods on AppoinmentService, one which takes a Supplier<Appointment> and one which just takes an appointment. The advice assumes it is called by the version that takes a Supplier<Appointment> so that if the other one is called, an exception is thrown, aborting the attempt to save.

This PR fixes that by ensuring the advice also works if the first argument is not an appointment. I also added some extra defensive checks to ensure that the Supplier returns an Appointment as expected.

@ojwanganto, I have created a card https://bahmni.atlassian.net/browse/BAH-3854, someone who has bandwidth will pick this up soon.

@ibacher ibacher changed the title AppointmentEventsAdvice should not throw when older validateAndSave is called BAH-3854 | AppointmentEventsAdvice should not throw when older validateAndSave is called May 21, 2024
@rahu1ramesh rahu1ramesh merged commit 552a579 into Bahmni:master May 28, 2024
2 checks passed
@rahu1ramesh
Copy link
Contributor

@ibacher @ojwanganto I have approved and merged the changes from the PR. Could you please validate if the issue is resolved? Thank you!

@ojwanganto
Copy link
Contributor

Thanks @rahu1ramesh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants