diff --git a/api/src/main/java/org/openmrs/api/MedicationDispenseService.java b/api/src/main/java/org/openmrs/api/MedicationDispenseService.java index dfdf54c3f0dc..14fb32743fea 100644 --- a/api/src/main/java/org/openmrs/api/MedicationDispenseService.java +++ b/api/src/main/java/org/openmrs/api/MedicationDispenseService.java @@ -26,6 +26,7 @@ public interface MedicationDispenseService extends OpenmrsService { * Gets a MedicationDispense by id * @param medicationDispenseId the id of the MedicationDispense to retrieve * @return the MedicationDispense with the given id, or null if none exists + * @throws IllegalArgumentException if medicationDispenseId is null */ @Authorized({ PrivilegeConstants.GET_MEDICATION_DISPENSE }) MedicationDispense getMedicationDispense(Integer medicationDispenseId); @@ -34,15 +35,16 @@ public interface MedicationDispenseService extends OpenmrsService { * Gets a MedicationDispense based on the uuid * * @param uuid - uuid of the MedicationDispense to be returned - * @return the MedicationDispense + * @return the MedicationDispense, or null if not found + * @throws IllegalArgumentException if uuid is null or empty */ @Authorized({ PrivilegeConstants.GET_MEDICATION_DISPENSE }) MedicationDispense getMedicationDispenseByUuid(String uuid); - /** + /** * Gets all MedicationDispense results that match the given criteria * @param criteria - the criteria for the returned MedicationDispense results - * @return a list of MedicationDispenses + * @return a list of MedicationDispenses, or an empty list if no matches are found */ @Authorized({ PrivilegeConstants.GET_MEDICATION_DISPENSE }) List getMedicationDispenseByCriteria(MedicationDispenseCriteria criteria); @@ -50,6 +52,8 @@ public interface MedicationDispenseService extends OpenmrsService { /** * Saves a MedicationDispense * @param medicationDispense - the MedicationDispense to be saved + * @return the saved MedicationDispense instance + * @throws IllegalArgumentException if medicationDispense is null */ @Authorized({ PrivilegeConstants.EDIT_MEDICATION_DISPENSE }) MedicationDispense saveMedicationDispense(MedicationDispense medicationDispense); @@ -58,6 +62,8 @@ public interface MedicationDispenseService extends OpenmrsService { * Voids a MedicationDispense * @param medicationDispense the MedicationDispense to be voided * @param reason the reason for voiding the MedicationDispense + * @return the voided MedicationDispense + * @throws IllegalArgumentException if medicationDispense or reason is null */ @Authorized({ PrivilegeConstants.EDIT_MEDICATION_DISPENSE }) MedicationDispense voidMedicationDispense(MedicationDispense medicationDispense, String reason); @@ -65,6 +71,8 @@ public interface MedicationDispenseService extends OpenmrsService { /** * Un-void a previously voided MedicationDispense * @param medicationDispense MedicationDispense to un-void + * @return the un-voided MedicationDispense + * @throws IllegalArgumentException if medicationDispense is null */ @Authorized(PrivilegeConstants.EDIT_MEDICATION_DISPENSE) MedicationDispense unvoidMedicationDispense(MedicationDispense medicationDispense); @@ -72,9 +80,12 @@ public interface MedicationDispenseService extends OpenmrsService { /** * Completely remove a MedicationDispense from the database. This should typically not be called * because we don't want to ever lose data. The data really should be voided and then it - * is not seen in interface any longer (see #voidMedicationDispense(MedicationDispense) for that one) + * is not seen in interface any longer (see #voidMedicationDispense(MedicationDispense) for that one) * If other data references this medicationDispense, an error will be thrown. + * * @param medicationDispense the MedicationDispense to be purged + * @throws IllegalArgumentException if medicationDispense is null + * @throws UnsupportedOperationException if purging is restricted by business rules */ @Authorized(PrivilegeConstants.DELETE_MEDICATION_DISPENSE) void purgeMedicationDispense(MedicationDispense medicationDispense);