public class LocationServiceImpl extends BaseOpenmrsService implements LocationService
LocationService
This class should not be instantiated alone, get a service class from the Context: Context.getLocationService();
Context,
LocationService,
Location| Constructor and Description |
|---|
LocationServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
List<Location> |
getAllLocations()
Returns all locations, includes retired locations.
|
List<Location> |
getAllLocations(boolean includeRetired)
Returns all locations.
|
List<LocationTag> |
getAllLocationTags()
Returns all location tags, includes retired location tags.
|
List<LocationTag> |
getAllLocationTags(boolean includeRetired)
Returns all location tags.
|
Integer |
getCountOfLocations(String nameFragment,
Boolean includeRetired)
Return the number of all locations that start with the given name fragment, if the name
fragment is null or an empty string, then the number of all locations will be returned
|
Location |
getDefaultLocation()
Returns the default location for this implementation.
|
Location |
getLocation(Integer locationId)
Returns a location given that locations primary key
locationId A null value is
returned if no location exists with this location. |
Location |
getLocation(String name)
Returns a location given the location's exact
name A null value is returned if
there is no location with this name |
Location |
getLocationByUuid(String uuid)
Returns a location by uuid
|
List<Location> |
getLocations(String nameFragment)
Returns locations that match the beginning of the given string.
|
List<Location> |
getLocations(String nameFragment,
boolean includeRetired,
Integer start,
Integer length)
Returns a specific number locations from the specified starting position that match the
beginning of the given string.
|
List<Location> |
getLocationsByTag(LocationTag tag)
Returns locations that contain the given tag.
|
List<Location> |
getLocationsHavingAllTags(List<LocationTag> tags)
Returns locations that are mapped to all given tags.
|
List<Location> |
getLocationsHavingAnyTag(List<LocationTag> tags)
Returns locations that are mapped to any of the given tags.
|
LocationTag |
getLocationTag(Integer locationTagId)
Returns a location tag given that locations primary key
locationTagId. |
LocationTag |
getLocationTagByName(String tag)
Returns a location tag given the location's exact name (tag).
|
LocationTag |
getLocationTagByUuid(String uuid)
Returns a location tag by uuid
|
List<LocationTag> |
getLocationTags(String search)
Returns location tags that match the beginning of the given string.
|
List<String> |
getPossibleAddressValues(Address incomplete,
String fieldName)
Given an Address object, returns all the possible values for the specified AddressField.
|
void |
purgeLocation(Location location)
Completely remove a location from the database (not reversible) This method delegates to
#purgeLocation(location, boolean) method
|
void |
purgeLocationTag(LocationTag tag)
Completely remove a location tag from the database (not reversible).
|
Location |
retireLocation(Location location,
String reason)
Retires the given location.
|
LocationTag |
retireLocationTag(LocationTag tag,
String reason)
Retire the given location tag.
|
Location |
saveLocation(Location location)
Save location to database (create if new or update if changed)
|
LocationTag |
saveLocationTag(LocationTag tag)
Save location tag to database (create if new or update if changed)
|
void |
setLocationDAO(LocationDAO dao)
Set the data access object that the service will use to interact with the database.
|
Location |
unretireLocation(Location location)
Unretire the given location.
|
LocationTag |
unretireLocationTag(LocationTag tag)
Unretire the given location tag.
|
onShutdown, onStartupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonShutdown, onStartuppublic void setLocationDAO(LocationDAO dao)
LocationServicesetLocationDAO in interface LocationServiceLocationService.setLocationDAO(org.openmrs.api.db.LocationDAO)public Location saveLocation(Location location) throws APIException
LocationServicesaveLocation in interface LocationServicelocation - is the location to be saved to the databaseAPIExceptionLocationService.saveLocation(org.openmrs.Location)public Location getLocation(Integer locationId) throws APIException
LocationServicelocationId A null value is
returned if no location exists with this location.getLocation in interface LocationServicelocationId - integer primary key of the location to findlocationId passed in.APIExceptionLocationService.getLocation(java.lang.Integer)public Location getLocation(String name) throws APIException
LocationServicename A null value is returned if
there is no location with this namegetLocation in interface LocationServicename - the exact name of the location to match onname to Location.nameAPIExceptionLocationService.getLocation(java.lang.String)public Location getDefaultLocation() throws APIException
LocationServicegetDefaultLocation in interface LocationServiceAPIExceptionLocationService.getDefaultLocation()public Location getLocationByUuid(String uuid) throws APIException
LocationServicegetLocationByUuid in interface LocationServiceuuid - is the uuid of the desired locationAPIExceptionLocationService.getLocationByUuid(java.lang.String)public LocationTag getLocationTagByUuid(String uuid) throws APIException
LocationServicegetLocationTagByUuid in interface LocationServiceuuid - is the uuid of the desired location tagAPIExceptionLocationService.getLocationTagByUuid(java.lang.String)public List<Location> getAllLocations() throws APIException
LocationServicegetAllLocations in interface LocationServiceAPIExceptionLocationService.getAllLocations()public List<Location> getAllLocations(boolean includeRetired) throws APIException
LocationServicegetAllLocations in interface LocationServiceincludeRetired - whether or not to include retired locationsAPIExceptionLocationService.getAllLocations(boolean)public List<Location> getLocations(String nameFragment) throws APIException
LocationServicenameFragmentgetLocations in interface LocationServicenameFragment - is the string used to search for locationsAPIExceptionLocationService.getLocations(java.lang.String)public List<Location> getLocationsByTag(LocationTag tag) throws APIException
LocationServicegetLocationsByTag in interface LocationServicetag - LocationTag criterionAPIExceptionLocationService.getLocationsByTag(LocationTag)public List<Location> getLocationsHavingAllTags(List<LocationTag> tags) throws APIException
LocationServicegetLocationsHavingAllTags in interface LocationServicetags - Set of LocationTag criteriaAPIExceptionLocationService.getLocationsHavingAllTags(List)public List<Location> getLocationsHavingAnyTag(List<LocationTag> tags) throws APIException
LocationServicegetLocationsHavingAnyTag in interface LocationServicetags - Set of LocationTag criteriaAPIExceptionLocationService.getLocationsHavingAnyTag(List)public Location retireLocation(Location location, String reason) throws APIException
LocationServiceretireLocation in interface LocationServicelocation - location to be retiredreason - is the reason why the location is being retiredAPIExceptionLocationService.retireLocation(Location, String)public Location unretireLocation(Location location) throws APIException
LocationServiceunretireLocation in interface LocationServiceAPIExceptionLocationService.unretireLocation(org.openmrs.Location)public void purgeLocation(Location location) throws APIException
LocationServicepurgeLocation in interface LocationServicelocation - the Location to clean out of the database.APIExceptionLocationService.purgeLocation(org.openmrs.Location)public LocationTag saveLocationTag(LocationTag tag) throws APIException
LocationServicesaveLocationTag in interface LocationServicetag - is the tag to be saved to the databaseAPIExceptionLocationService.saveLocationTag(org.openmrs.LocationTag)public LocationTag getLocationTag(Integer locationTagId) throws APIException
LocationServicelocationTagId. A null
value is returned if no tag exists with this ID.getLocationTag in interface LocationServicelocationTagId - integer primary key of the location tag to findlocationTagId
passed in.APIExceptionLocationService.getLocationTag(java.lang.Integer)public LocationTag getLocationTagByName(String tag) throws APIException
LocationServicegetLocationTagByName in interface LocationServicetag - the exact name of the tag to match onAPIExceptionLocationService.getLocationTagByName(java.lang.String)public List<LocationTag> getAllLocationTags() throws APIException
LocationServicegetAllLocationTags in interface LocationServiceAPIExceptionLocationService.getAllLocationTags()public List<LocationTag> getAllLocationTags(boolean includeRetired) throws APIException
LocationServicegetAllLocationTags in interface LocationServiceincludeRetired - whether or not to include retired location tagsAPIExceptionLocationService.getAllLocationTags(boolean)public List<LocationTag> getLocationTags(String search) throws APIException
LocationServicesearchgetLocationTags in interface LocationServicesearch - is the string used to search for tagsAPIExceptionLocationService.getLocationTags(java.lang.String)public LocationTag retireLocationTag(LocationTag tag, String reason) throws APIException
LocationServiceretireLocationTag in interface LocationServicetag - location tag to be retiredreason - is the reason why the location tag is being retiredAPIExceptionLocationService.retireLocationTag(LocationTag, String)public LocationTag unretireLocationTag(LocationTag tag) throws APIException
LocationServiceunretireLocationTag in interface LocationServiceAPIExceptionLocationService.unretireLocationTag(org.openmrs.LocationTag)public void purgeLocationTag(LocationTag tag) throws APIException
LocationServicepurgeLocationTag in interface LocationServicetag - the LocationTag to clean out of the database.APIExceptionLocationService.purgeLocationTag(org.openmrs.LocationTag)public Integer getCountOfLocations(String nameFragment, Boolean includeRetired)
LocationServicegetCountOfLocations in interface LocationServicenameFragment - is the string used to search for locationsincludeRetired - Specifies if retired locations should be counted or ignoredLocationService.getCountOfLocations(String, Boolean)public List<Location> getLocations(String nameFragment, boolean includeRetired, Integer start, Integer length) throws APIException
LocationServicenameFragment. If start and length are not specified, then all matches are
returnedgetLocations in interface LocationServicenameFragment - is the string used to search for locationsincludeRetired - Specifies if retired locations should be returnedstart - the beginning indexlength - the number of matching locations to returnAPIExceptionLocationService.getLocations(String, boolean, Integer, Integer)public List<String> getPossibleAddressValues(Address incomplete, String fieldName) throws APIException
LocationServicegetPossibleAddressValues in interface LocationServiceincomplete - the incomplete addressAPIExceptionorg.openmrs.api.LocationService#getPossibleAddressValues(org.openmrs.Address, org.openmrs.AddressField)Copyright © 2018 OpenMRS LLC.. All Rights Reserved.