OpenMRSLocationService

public interface OpenMRSLocationService

Interface for handling locations on the OpenMRS server.

Methods

createLocation

Location createLocation(String configName, Location location)

Creates the given location on the OpenMRS server. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • location – the location to be created
Returns:

the created location

deleteLocation

void deleteLocation(String configName, String uuid)

Deletes the location with the given uuid from the OpenMRS server. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • uuid – the UUID of the location

getAllLocations

List<Location> getAllLocations(String configName)

Returns a list of all the locations on the OpenMRS server. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
Returns:

the list of all locations

getLocationByUuid

Location getLocationByUuid(String configName, String uuid)

Returns the location with the given uuid. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • uuid – the UUID of the location
Returns:

the location with the given UUID

getLocations

List<Location> getLocations(String configName, int page, int pageSize)

Returns a list of the locations. The returned list will contain maximum of pageSize locations fetched from the page with the given page number. The list might contain less entries if the given page is the last one and there is less than pageSize locations on it. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • page – the number of the page
  • pageSize – the size of the page
Returns:

the list of locations on the given page

getLocations

List<Location> getLocations(String configName, String locationName)

Returns a list of locations that have the given locationName. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • locationName – the name of the location
Returns:

the list of matching locations

updateLocation

Location updateLocation(String configName, Location location)

Updates the location with the information stored in the given location. Configuration with the given configName will be used while performing this action.

Parameters:
  • configName – the name of the configuration
  • location – the location to be used as an update source
Returns:

the updated location, null if a location with the UUID given in the location doesn’t exist