org.openmrs.api
Interface LocationService

All Superinterfaces:
OpenmrsService
All Known Implementing Classes:
LocationServiceImpl

@Transactional
public interface LocationService
extends OpenmrsService

API methods for managing Locations Use: List locations = Context.getLocationService().getAllLocations();

See Also:
Context

Method Summary
 java.util.List<Location> getAllLocations()
          Returns all locations, includes retired locations.
 java.util.List<Location> getAllLocations(boolean includeRetired)
          Returns all locations.
 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
 Location getLocationByGuid(java.lang.String guid)
          Returns a location by guid TODO: Not yet implemented.
 java.util.List<Location> getLocations(java.lang.String nameFragment)
          Returns locations that match the beginning of the given string.
 void purgeLocation(Location location)
          Completely remove a location from the database (not reversible) This method delegates to #purgeLocation(location, boolean) method
 Location retireLocation(Location location, java.lang.String reason)
          Retires the given location.
 Location saveLocation(Location location)
          Save location 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.
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onShutdown, onStartup
 

Method Detail

setLocationDAO

void setLocationDAO(LocationDAO dao)
Set the data access object that the service will use to interact with the database. This is set by spring in the applicationContext-service.xml file

Parameters:
dao -

saveLocation

@Authorized(value="Manage Locations")
Location saveLocation(Location location)
                      throws APIException
Save location to database (create if new or update if changed)

Parameters:
location - is the location to be saved to the database
Throws:
APIException

getLocation

@Transactional(readOnly=true)
@Authorized(value="View Locations")
Location getLocation(java.lang.Integer locationId)
                     throws APIException
Returns a location given that locations primary key locationId A null value is returned if no location exists with this location.

Parameters:
locationId - integer primary key of the location to find
Throws:
APIException

getLocation

@Transactional(readOnly=true)
@Authorized(value="View Locations")
Location getLocation(java.lang.String name)
                     throws APIException
Returns a location given the location's exact name A null value is returned if there is no location with this name

Parameters:
name - the exact name of the location to match on
Throws:
APIException

getLocationByGuid

@Transactional(readOnly=true)
@Authorized(value="View Locations")
Location getLocationByGuid(java.lang.String guid)
                           throws APIException
Returns a location by guid TODO: Not yet implemented.

Parameters:
guid - is the guid of the desired location
Throws:
APIException

getAllLocations

@Transactional(readOnly=true)
@Authorized(value="View Locations")
java.util.List<Location> getAllLocations()
                                         throws APIException
Returns all locations, includes retired locations. This method delegates to the #getAllLocations(boolean) method

Throws:
APIException

getAllLocations

@Transactional(readOnly=true)
@Authorized(value="View Locations")
java.util.List<Location> getAllLocations(boolean includeRetired)
                                         throws APIException
Returns all locations.

Parameters:
includeRetired - whether or not to include retired locations
Throws:
APIException

getLocations

@Transactional(readOnly=true)
@Authorized(value="View Locations")
java.util.List<Location> getLocations(java.lang.String nameFragment)
                                      throws APIException
Returns locations that match the beginning of the given string. A null list will never be returned. An empty list will be returned if there are no locations. Search is case insensitive. matching this nameFragment

Parameters:
nameFragment - is the string used to search for locations
Throws:
APIException

retireLocation

@Authorized(value="Manage Locations")
Location retireLocation(Location location,
                                        java.lang.String reason)
                        throws APIException
Retires the given location. This effectively removes the location from circulation or use.

Parameters:
location - location to be retired
reason - is the reason why the location is being retired
Throws:
APIException

unretireLocation

@Authorized(value="Manage Locations")
Location unretireLocation(Location location)
                          throws APIException
Unretire the given location. This restores a previously retired location back into circulation and use.

Parameters:
location -
Returns:
Throws:
APIException

purgeLocation

@Authorized(value="Purge Locations")
void purgeLocation(Location location)
                   throws APIException
Completely remove a location from the database (not reversible) This method delegates to #purgeLocation(location, boolean) method

Parameters:
location - the Location to clean out of the database.
Throws:
APIException

OpenMRS-trunk

Generated May 29 2008 02:01 AM. NOTE - these libraries are in active development and subject to change