@Transactional public interface LocationService extends OpenmrsService
List locations = Context.getLocationService().getAllLocations();
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, onStartup
void setLocationDAO(LocationDAO dao)
dao
- @Authorized(value="Manage Locations") Location saveLocation(Location location) throws APIException
location
- is the location to be saved to the databaseAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") Location getLocation(Integer locationId) throws APIException
locationId
A null value is
returned if no location exists with this location.locationId
- integer primary key of the location to findlocationId
passed in.APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") Location getLocation(String name) throws APIException
name
A null value is returned if
there is no location with this namename
- the exact name of the location to match onname
to Location.nameAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") Location getDefaultLocation() throws APIException
APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") Location getLocationByUuid(String uuid) throws APIException
uuid
- is the uuid of the desired locationAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") LocationTag getLocationTagByUuid(String uuid) throws APIException
uuid
- is the uuid of the desired location tagAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<Location> getAllLocations() throws APIException
APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<Location> getAllLocations(boolean includeRetired) throws APIException
includeRetired
- whether or not to include retired locationsAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<Location> getLocations(String nameFragment) throws APIException
nameFragment
nameFragment
- is the string used to search for locationsAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<Location> getLocations(String nameFragment, boolean includeRetired, Integer start, Integer length) throws APIException
nameFragment
. If start and length are not specified, then all matches are
returnednameFragment
- is the string used to search for locationsincludeRetired
- Specifies if retired locations should be returnedstart
- the beginning indexlength
- the number of matching locations to returnAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<Location> getLocationsByTag(LocationTag tag) throws APIException
tag
- LocationTag criterionAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<Location> getLocationsHavingAllTags(List<LocationTag> tags) throws APIException
tags
- Set of LocationTag criteriaAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<Location> getLocationsHavingAnyTag(List<LocationTag> tags) throws APIException
tags
- Set of LocationTag criteriaAPIException
@Authorized(value="Manage Locations") Location retireLocation(Location location, String reason) throws APIException
location
- location to be retiredreason
- is the reason why the location is being retiredAPIException
@Authorized(value="Manage Locations") Location unretireLocation(Location location) throws APIException
location
- APIException
@Authorized(value="Purge Locations") void purgeLocation(Location location) throws APIException
location
- the Location to clean out of the database.APIException
@Authorized(value="Manage Location Tags") LocationTag saveLocationTag(LocationTag tag) throws APIException
tag
- is the tag to be saved to the databaseAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") LocationTag getLocationTag(Integer locationTagId) throws APIException
locationTagId
. A null
value is returned if no tag exists with this ID.locationTagId
- integer primary key of the location tag to findlocationTagId
passed in.APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") LocationTag getLocationTagByName(String tag) throws APIException
tag
- the exact name of the tag to match onAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<LocationTag> getAllLocationTags() throws APIException
APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<LocationTag> getAllLocationTags(boolean includeRetired) throws APIException
includeRetired
- whether or not to include retired location tagsAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") List<LocationTag> getLocationTags(String search) throws APIException
search
search
- is the string used to search for tagsAPIException
@Authorized(value="Manage Location Tags") LocationTag retireLocationTag(LocationTag tag, String reason) throws APIException
tag
- location tag to be retiredreason
- is the reason why the location tag is being retiredAPIException
@Authorized(value="Manage Location Tags") LocationTag unretireLocationTag(LocationTag tag) throws APIException
tag
- APIException
@Authorized(value="Purge Location Tags") void purgeLocationTag(LocationTag tag) throws APIException
tag
- the LocationTag to clean out of the database.APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") Integer getCountOfLocations(String nameFragment, Boolean includeRetired)
nameFragment
- is the string used to search for locationsincludeRetired
- Specifies if retired locations should be counted or ignoredList<String> getPossibleAddressValues(Address incomplete, String fieldName) throws APIException
incomplete
- the incomplete addressfield
- the address field we are looking for possible values forAPIException
Copyright © 2018 OpenMRS LLC.. All Rights Reserved.