Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions api/src/main/java/org/openmrs/api/MedicationDispenseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -34,22 +35,25 @@ 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<MedicationDispense> getMedicationDispenseByCriteria(MedicationDispenseCriteria criteria);

/**
* 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);
Expand All @@ -58,23 +62,30 @@ 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);

/**
* 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);

/**
* 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 <i>should</i> 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);
Expand Down