@Transactional public interface LocationService extends OpenmrsService
List locations = Context.getLocationService().getAllLocations();
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAddressTemplate()
Returns the xml of default address template.
|
java.util.List<LocationAttributeType> |
getAllLocationAttributeTypes() |
java.util.List<Location> |
getAllLocations()
Returns all locations, includes retired locations.
|
java.util.List<Location> |
getAllLocations(boolean includeRetired)
Returns all locations.
|
java.util.List<LocationTag> |
getAllLocationTags()
Returns all location tags, includes retired location tags.
|
java.util.List<LocationTag> |
getAllLocationTags(boolean includeRetired)
Returns all location tags.
|
java.lang.Integer |
getCountOfLocations(java.lang.String nameFragment,
java.lang.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(java.lang.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(java.lang.String name)
Returns a location given the location's exact
name A null value is returned if
there is no location with this name |
LocationAttribute |
getLocationAttributeByUuid(java.lang.String uuid) |
LocationAttributeType |
getLocationAttributeType(java.lang.Integer id) |
LocationAttributeType |
getLocationAttributeTypeByUuid(java.lang.String uuid) |
Location |
getLocationByUuid(java.lang.String uuid)
Returns a location by uuid
|
java.util.List<Location> |
getLocations(java.lang.String nameFragment)
Returns locations that match the beginning of the given string.
|
java.util.List<Location> |
getLocations(java.lang.String nameFragment,
boolean includeRetired,
java.lang.Integer start,
java.lang.Integer length)
Deprecated.
|
java.util.List<Location> |
getLocations(java.lang.String nameFragment,
Location parent,
java.util.Map<LocationAttributeType,java.lang.Object> attributeValues,
boolean includeRetired,
java.lang.Integer start,
java.lang.Integer length)
Gets the locations matching the specified arguments.
|
java.util.List<Location> |
getLocationsByTag(LocationTag tag)
Returns locations that contain the given tag.
|
java.util.List<Location> |
getLocationsHavingAllTags(java.util.List<LocationTag> tags)
Returns locations that are mapped to all given tags.
|
java.util.List<Location> |
getLocationsHavingAnyTag(java.util.List<LocationTag> tags)
Returns locations that are mapped to any of the given tags.
|
LocationTag |
getLocationTag(java.lang.Integer locationTagId)
Returns a location tag given that locations primary key
locationTagId . |
LocationTag |
getLocationTagByName(java.lang.String tag)
Returns a location tag given the location's exact name (tag).
|
LocationTag |
getLocationTagByUuid(java.lang.String uuid)
Returns a location tag by uuid
|
java.util.List<LocationTag> |
getLocationTags(java.lang.String search)
Returns location tags that match the beginning of the given string.
|
java.util.List<java.lang.String> |
getPossibleAddressValues(Address incomplete,
java.lang.String fieldName)
Given an Address object, returns all the possible values for the specified AddressField.
|
java.util.List<Location> |
getRootLocations(boolean includeRetired)
Returns all root locations (i.e.
|
void |
purgeLocation(Location location)
Completely remove a location from the database (not reversible) This method delegates to
#purgeLocation(location, boolean) method
|
void |
purgeLocationAttributeType(LocationAttributeType locationAttributeType)
Completely removes a location attribute type from the database
|
void |
purgeLocationTag(LocationTag tag)
Completely remove a location tag from the database (not reversible).
|
Location |
retireLocation(Location location,
java.lang.String reason)
Retires the given location.
|
LocationAttributeType |
retireLocationAttributeType(LocationAttributeType locationAttributeType,
java.lang.String reason)
Retires the given location attribute type in the database
|
LocationTag |
retireLocationTag(LocationTag tag,
java.lang.String reason)
Retire the given location tag.
|
void |
saveAddressTemplate(java.lang.String xml)
Saved default address template to global properties
|
Location |
saveLocation(Location location)
Save location to database (create if new or update if changed)
|
LocationAttributeType |
saveLocationAttributeType(LocationAttributeType locationAttributeType)
Creates or updates the given location attribute type in the database
|
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.
|
LocationAttributeType |
unretireLocationAttributeType(LocationAttributeType locationAttributeType)
Restores a location attribute type that was previous retired in the database
|
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(java.lang.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(java.lang.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(java.lang.String uuid) throws APIException
uuid
- is the uuid of the desired locationAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") LocationTag getLocationTagByUuid(java.lang.String uuid) throws APIException
uuid
- is the uuid of the desired location tagAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getAllLocations() throws APIException
APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getAllLocations(boolean includeRetired) throws APIException
includeRetired
- whether or not to include retired locationsAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getLocations(java.lang.String nameFragment) throws APIException
nameFragment
nameFragment
- is the string used to search for locationsAPIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getLocations(java.lang.String nameFragment, boolean includeRetired, java.lang.Integer start, java.lang.Integer length) throws APIException
getLocations(String, org.openmrs.Location, java.util.Map, boolean, Integer, Integer)
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") java.util.List<Location> getLocations(java.lang.String nameFragment, Location parent, java.util.Map<LocationAttributeType,java.lang.Object> attributeValues, boolean includeRetired, java.lang.Integer start, java.lang.Integer length) throws APIException
nameFragment
. If start
and length are not specified, then all matches are returned.nameFragment
- is the string used to search for locationsparent
- only return children of this parentattributeValues
- the attribute valuesincludeRetired
- specifies if retired locations should also be returnedstart
- the beginning indexlength
- the number of matching locations to returnAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getLocationsByTag(LocationTag tag) throws APIException
tag
- LocationTag criterionAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getLocationsHavingAllTags(java.util.List<LocationTag> tags) throws APIException
tags
- Set of LocationTag criteriaAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getLocationsHavingAnyTag(java.util.List<LocationTag> tags) throws APIException
tags
- Set of LocationTag criteriaAPIException
@Authorized(value="Manage Locations") Location retireLocation(Location location, java.lang.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(java.lang.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(java.lang.String tag) throws APIException
tag
- the exact name of the tag to match onAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<LocationTag> getAllLocationTags() throws APIException
APIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<LocationTag> getAllLocationTags(boolean includeRetired) throws APIException
includeRetired
- whether or not to include retired location tagsAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<LocationTag> getLocationTags(java.lang.String search) throws APIException
search
search
- is the string used to search for tagsAPIException
@Authorized(value="Manage Location Tags") LocationTag retireLocationTag(LocationTag tag, java.lang.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") java.lang.Integer getCountOfLocations(java.lang.String nameFragment, java.lang.Boolean includeRetired)
nameFragment
- is the string used to search for locationsincludeRetired
- Specifies if retired locations should be counted or ignored@Transactional(readOnly=true) @Authorized(value="View Locations") java.util.List<Location> getRootLocations(boolean includeRetired)
includeRetired
- java.util.List<java.lang.String> getPossibleAddressValues(Address incomplete, java.lang.String fieldName) throws APIException
incomplete
- the incomplete addressfield
- the address field we are looking for possible values forAPIException
@Transactional(readOnly=true) @Authorized(value="View Locations") java.lang.String getAddressTemplate() throws APIException
APIException
OpenmrsConstants.GLOBAL_PROPERTY_ADDRESS_TEMPLATE
,
OpenmrsConstants.DEFAULT_ADDRESS_TEMPLATE
@Authorized(value="Manage Address Templates") void saveAddressTemplate(java.lang.String xml) throws APIException
xml
- is a string to be saved as address templateAPIException
@Transactional(readOnly=true) @Authorized(value="View Location Attribute Types") java.util.List<LocationAttributeType> getAllLocationAttributeTypes()
LocationAttributeType
s@Transactional(readOnly=true) @Authorized(value="View Location Attribute Types") LocationAttributeType getLocationAttributeType(java.lang.Integer id)
id
- LocationAttributeType
with the given internal id@Transactional(readOnly=true) @Authorized(value="View Location Attribute Types") LocationAttributeType getLocationAttributeTypeByUuid(java.lang.String uuid)
uuid
- LocationAttributeType
with the given uuid@Authorized(value="Manage Location Attribute Types") LocationAttributeType saveLocationAttributeType(LocationAttributeType locationAttributeType)
locationAttributeType
- @Authorized(value="Manage Location Attribute Types") LocationAttributeType retireLocationAttributeType(LocationAttributeType locationAttributeType, java.lang.String reason)
locationAttributeType
- @Authorized(value="Manage Location Attribute Types") LocationAttributeType unretireLocationAttributeType(LocationAttributeType locationAttributeType)
locationAttributeType
- @Authorized(value="Purge Location Attribute Types") void purgeLocationAttributeType(LocationAttributeType locationAttributeType)
locationAttributeType
- @Transactional(readOnly=true) @Authorized(value="View Locations") LocationAttribute getLocationAttributeByUuid(java.lang.String uuid)
uuid
- LocationAttribute
with the given uuidCopyright © 2018 OpenMRS Inc.. All Rights Reserved.