Interface | Description |
---|---|
AdministrationService |
Contains methods pertaining to doing some administrative tasks in OpenMRS
Use:
List<GlobalProperty> globalProperties = Context.getAdministrationService().getGlobalProperties(); |
CohortService |
API methods related to Cohorts and CohortDefinitions
A Cohort is a list of patient ids.
|
ConceptService |
Contains methods pertaining to creating/updating/deleting/retiring Concepts, Drugs, Concept
Proposals, and all other things 'Concept'.
|
ConditionService |
This interface defines methods for condition objects.
|
DatatypeService |
API methods related to
CustomDatatype and CustomDatatypeHandler . |
DiagnosisService |
API methods for managing diagnoses
|
EncounterService |
Services for Encounters and Encounter Types
|
FormService |
This service contains methods relating to Form, FormField, and Field.
|
GlobalPropertyListener |
This interface allows code to be run when global properties are created, edited, or deleted.
|
LocationService |
API methods for managing Locations
Example Usage:
List<Location> locations = Context.getLocationService().getAllLocations();
|
MedicationDispenseService |
This interface defines an API for interacting with MedicationDispense objects.
|
ObsService |
The ObsService deals with saving and getting Obs to/from the database Usage:
ObsService obsService = Context.getObsService();
// get the obs for patient with internal identifier of 1235
List<Obs> someObsList = obsService.getObservationsByPerson(new Patient(1235));
There are also a number of convenience methods for extracting obs pertaining to certain Concepts,
people, or encounters
|
OpenmrsService |
Base OpenMRS Service Interface All services registered to the
ServiceContext are required
to implement this interface. |
OrderNumberGenerator |
Will be implemented by classes that auto generate order numbers.
|
OrderService |
Contains methods pertaining to creating/deleting/voiding Orders
|
OrderSetService |
Contains methods pertaining to creating/deleting/voiding Order Sets.
|
PatientService |
Contains methods pertaining to Patients in the system
Usage:
List<Patient> patients = Context.getPatientService().getAllPatients();
|
PersonService |
Contains methods pertaining to Persons in the system Use:
List<Person> personObjects = Context.getPersonService().getAllPersons(); |
ProgramWorkflowService |
Contains methods pertaining to management of Programs, ProgramWorkflows, ProgramWorkflowStates,
PatientPrograms, PatientStates, and ConceptStateConversions Use:
Program program = new Program(); program.set___(___); ...etc Context.getProgramWorkflowService().saveProgram(program); |
ProviderService |
This service contains methods relating to providers.
|
SerializationService |
Contains methods for retrieving registered Serializer instances, and for
persisting/retrieving/deleting objects using serialization
|
UserService |
Contains methods pertaining to Users in the system Use:
List<User> users = Context.getUserService().getAllUsers(); |
VisitService |
This service contains methods relating to visits.
|
Class | Description |
---|---|
EventListeners |
Holds all OpenMRS event listeners
|
OrderContext |
Contains contextual information like the OrderType, CareSetting and any other custom attributes
that are passed to the service layer when placing a new Order E.g you could add a user defined
order number from a form that can be looked up from the context and returned by a custom
OrderNumberGenerator
|
Enum | Description |
---|---|
ConceptNameType |
The concept name type enumeration
FULLY_SPECIFIED - Indicates that the name is marked as the fully specified name, which is returned by default for a locale in case there is no preferred name set, a concept can have only one fully specified name per locale. |
PersonService.ATTR_VIEW_TYPE |
These enumerations are used when determining which person attr types to display.
|
Exception | Description |
---|---|
AmbiguousOrderException |
This exception is thrown on attempt to do some action with order, and there are multiple active
orders for the given concept so the action is ambiguous
|
APIAuthenticationException |
Represents often fatal errors that occur within the API infrastructure involving a user's lack of
privileges.
|
APIException |
Represents often fatal errors that occur within the API infrastructure.
|
BlankIdentifierException |
Exception thrown when a
Patient or PatientIdentifier is being saved with an empty
or null PatientIdentifier.getIdentifier() |
CannotDeleteObjectInUseException |
An instance of this exception is thrown if a delete operation is attempted on an object that is
referenced by others, typically this should be thrown when deleting an existing object is
detrimental to the integrity of objects referencing it or any other existing associated data.
|
CannotDeleteRoleWithChildrenException |
This exception is thrown when a user tries remove role with child.
|
CannotStopDiscontinuationOrderException |
Thrown when attempt is made to discontinue a discontinuation order.
|
CannotStopInactiveOrderException |
Thrown when the Order has already been discontinued.
|
CannotUnvoidOrderException |
Thrown when an attempt to unvoid an order fails.
|
CannotUpdateObjectInUseException |
An instance of this exception is thrown if an update operation is attempted on an object that is
referenced by others, typically this should be thrown when altering an existing object is
detrimental to the integrity of objects referencing it or any other existing associated data.
|
ConceptInUseException |
This exception is thrown when concept is used/attached to an observation.
|
ConceptNameInUseException |
This exception is thrown when one attempts to delete a concept that has a conceptName that is
being used by an observation
|
ConceptsLockedException |
This exception is thrown when a specific implementation has chosen to lock down their concepts
and prevent editing.
|
ConceptStopWordException |
This exception is thrown whenever a concept stop word service failed.
|
DuplicateConceptNameException |
An error of this type is thrown when a concept name is found in the database when one tries to
create a new one with the same preferred name in the same locale
|
DuplicateIdentifierException | |
EditedOrderDoesNotMatchPreviousException |
Thrown when the new edited order contains modified properties that must be the same as previous
order.
|
EncounterTypeLockedException |
This exception is thrown when a encounter types are locked and the user tries to edit an encounter type
type, this is done by a global property being true/false.
|
FormsLockedException |
This exception is thrown when a user tries to save or delete a form while forms are locked
|
IdentifierNotUniqueException | |
InsufficientIdentifiersException | |
InvalidActivationKeyException |
Represents fatal errors that occur due to invalid or expired activation key.
|
InvalidCharactersPasswordException |
Password exception when the password doesn't comply to the minimum set of required characters.
|
InvalidCheckDigitException | |
InvalidFileTypeException |
Exception thrown for situations of an invalid file type
|
InvalidIdentifierFormatException | |
InvalidOperationOnObjectException |
An instance of this exception is thrown if an operation is attempted on an object, typically this
should be thrown when any operation is made to an existing object and is considered detrimental
to the integrity of any existing associated data.
|
MissingRequiredIdentifierException | |
MissingRequiredPropertyException |
An instance of this exception is thrown when a required property has not been set on an Object.
|
OrderEntryException |
Superclass of all order entry related exceptions and should typically be thrown whenever there is
no more specific type can be thrown.
|
PasswordException |
Represents common exceptions that happen when validating a
User 's password. |
PatientIdentifierException | |
PatientIdentifierTypeLockedException |
This exception is thrown when a user tries manipulate of a patient identifier type while patient identifier types are locked
|
PersonAttributeTypeLockedException |
This exception is thrown when a user tries manipulate of a person attribute type while person attribute types are locked
|
ProgramNameDuplicatedException |
This exception is thrown when one attempts to retrieve a program by name while there accidentally
are more than one programs with the same name in the dB.
|
ServiceNotFoundException | |
ShortPasswordException |
Password exception when the length is less than the minimum allowed.
|
UnchangeableObjectException |
An instance of this exception is thrown if an attempt is made to update an unchangeable object
|
UnchangeablePropertyException |
An instance of this exception is thrown if an attempt is made to update an unchangeable property
on an object
|
ValidationException |
Represents often fatal errors that occur when an object fails validation
|
WeakPasswordException |
Password exception when the password is a simple word or matches the
User 's username or
system id. |
The primary OpenMRS API interfaces. These services provide the necessary methods to access and manipulate OpenMRS domain objects.
Services are obtained statically from the Context
.
These services compose the OpenMRS business layer API. The majority of developer interaction with the
OpenMRS system should occur through these services. Lower level (database) API methods are
reflected within these services so that business logic hooks may be placed in front of the database
layer. Developers should favor calling these services for database access, rather than going directly
to the DAO objects in the org.openmrs.api.db
package.
For example, using the API alone, a start-to-end application would look like this:
Context.startup("jdbc:mysql://localhost:3306/db-name?autoReconnect=true", "openmrs-db-user", "3dx$ijt", new Properties()); try { Context.openSession(); Context.authenticate("admin", "test"); PatientService ps = Context.getPatientService(); // fetch patient with identifier 3-4 Patient patient = ps.getPatientByIdentifier("3-4"); // set the patient's birthdate to today patient.setBirthdate(new Date()); // save the patient to database ps.savePatient(patient); finally { Context.closeSession(); }
Note: When using OpenMRS within a managed environment (like our web application war file), the only calls that are needed are to get the PatientService, set the birthdate, save the patient with the PatientService.
Copyright © 2024 OpenMRS Inc.. All rights reserved.