org.openmrs.api.impl
Class ObsServiceImpl

java.lang.Object
  extended by org.openmrs.api.impl.BaseOpenmrsService
      extended by org.openmrs.api.impl.ObsServiceImpl
All Implemented Interfaces:
ObsService, OpenmrsService

public class ObsServiceImpl
extends BaseOpenmrsService
implements ObsService

Default implementation of the Observation Service

See Also:
ObsService

Field Summary
protected  ObsDAO dao
          The data access object for the obs service
 
Fields inherited from interface org.openmrs.api.ObsService
PATIENT, PERSON, USER
 
Constructor Summary
ObsServiceImpl()
          Default empty constructor for this obs service
 
Method Summary
 void createObs(Obs obs)
          Deprecated.  
 void createObsGroup(Obs[] obs)
          Deprecated. This method should no longer need to be called on the api. This was meant as temporary until we created a true ObsGroup pojo.
 void deleteObs(Obs obs)
          Deprecated. use #purgeObs(Obs)
 java.util.List<Obs> findObsByGroupId(java.lang.Integer obsGroupId)
          Deprecated. -- should use obs.getGroupMembers
 java.util.List<Obs> findObservations(java.lang.String search, boolean includeVoided, java.lang.Integer personType)
          Deprecated.  
 java.util.List<MimeType> getAllMimeTypes()
          Deprecated.  
 java.util.List<MimeType> getAllMimeTypes(boolean includeRetired)
          Deprecated.  
 Obs getComplexObs(java.lang.Integer obsId, java.lang.String view)
          Get a complex observation.
 ComplexObsHandler getHandler(Obs obs)
          Convenience method to get the ComplexObsHandler associated with a complex Obs.
 ComplexObsHandler getHandler(java.lang.String key)
          Get the ComplexObsHandler that has been registered with the given key
 java.util.Map<java.lang.String,ComplexObsHandler> getHandlers()
          Gets the handlers map registered
 java.util.List<Obs> getLastNObservations(java.lang.Integer n, Person who, Concept question, boolean includeVoided)
          Deprecated.  
 MimeType getMimeType(java.lang.Integer mimeTypeId)
          Deprecated.  
 java.util.List<MimeType> getMimeTypes()
          Deprecated. use getAllMimeTypes()
 java.util.List<java.lang.Object[]> getNumericAnswersForConcept(Concept question, java.lang.Boolean sortByValue, java.lang.Integer personType, boolean includeVoided)
          Deprecated.  
 Obs getObs(java.lang.Integer obsId)
          Get an observation
 Obs getObsByUuid(java.lang.String uuid)
          Get Obs by its UUID
 java.lang.Integer getObservationCount(java.util.List<ConceptName> conceptNames, boolean includeVoided)
          Gets the number of observations(including voided ones) that are using the specified conceptNames as valueCodedName answers
 java.lang.Integer getObservationCount(java.util.List<Person> whom, java.util.List<Encounter> encounters, java.util.List<Concept> questions, java.util.List<Concept> answers, java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes, java.util.List<Location> locations, java.lang.Integer obsGroupId, java.util.Date fromDate, java.util.Date toDate, boolean includeVoidedObs)
          This method fetches the count of observations according to the criteria in the given arguments.
 java.util.List<Obs> getObservations(Cohort patients, java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
          Deprecated.  
 java.util.List<Obs> getObservations(Concept c, Location loc, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
          Deprecated.  
 java.util.List<Obs> getObservations(Concept question, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
          Deprecated.  
 java.util.Set<Obs> getObservations(Encounter whichEncounter)
          Deprecated. use org.openmrs.Encounter#getObs()
 java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
          Deprecated.  
 java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate, boolean includeVoided)
          Deprecated.  
 java.util.List<Obs> getObservations(java.util.List<Person> whom, java.util.List<Encounter> encounters, java.util.List<Concept> questions, java.util.List<Concept> answers, java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes, java.util.List<Location> locations, java.util.List<java.lang.String> sort, java.lang.Integer mostRecentN, java.lang.Integer obsGroupId, java.util.Date fromDate, java.util.Date toDate, boolean includeVoidedObs)
          This method fetches observations according to the criteria in the given arguments.
 java.util.Set<Obs> getObservations(Person who, boolean includeVoided)
          Deprecated. use getObservationsByPerson(Person)
 java.util.Set<Obs> getObservations(Person who, Concept question, boolean includeVoided)
          Deprecated.  
 java.util.List<Obs> getObservations(java.lang.String searchString)
          This implementation queries the obs table comparing the given searchString with the patient's identifier, encounterId, and obsId
 java.util.List<Obs> getObservationsAnsweredByConcept(Concept answer, java.lang.Integer personType, boolean includeVoided)
          Deprecated.  
 java.util.List<Obs> getObservationsByPerson(Person who)
          Get all Observations for the given person.
 java.util.List<Obs> getObservationsByPersonAndConcept(Person who, Concept question)
          Get all nonvoided observations for the given patient with the given concept as the question concept (conceptId)
 java.util.List<Obs> getVoidedObservations()
          Deprecated.  
 void onShutdown()
          Clean up after this class.
protected  boolean purgeComplexData(Obs obs)
          Internal method to remove ComplexData when an Obs is purged.
 void purgeMimeType(MimeType mimeType)
          Deprecated.  
 void purgeObs(Obs obs)
          Completely remove an observation from the database.
 void purgeObs(Obs obs, boolean cascade)
          Completely remove an observation from the database.
 void registerHandler(java.lang.String key, ComplexObsHandler handler)
          Registers the given handler with the given key If the given String key exists, that handler is overwritten with the given handler
 void registerHandler(java.lang.String key, java.lang.String handlerClass)
          Convenience method for ObsService.registerHandler(String, ComplexObsHandler)
 void removeHandler(java.lang.String key)
          Remove the handler associated with the key from list of available handlers
 MimeType saveMimeType(MimeType mimeType)
          Deprecated.  
 Obs saveObs(Obs obs, java.lang.String changeMessage)
          Save the given obs to the database.
 void setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> newHandlers)
          Add the given map to this service's handlers.
 void setObsDAO(ObsDAO dao)
          Set the given dao on this obs service.
 Obs unvoidObs(Obs obs)
          Unvoids an Obs
 void updateObs(Obs obs)
          Deprecated.  
 MimeType voidMimeType(MimeType mimeType, java.lang.String reason)
          Deprecated.  
 Obs voidObs(Obs obs, java.lang.String reason)
          Voids an Obs If the Obs argument is an obsGroup, all group members will be voided.
 
Methods inherited from class org.openmrs.api.impl.BaseOpenmrsService
onStartup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onStartup
 

Field Detail

dao

protected ObsDAO dao
The data access object for the obs service

Constructor Detail

ObsServiceImpl

public ObsServiceImpl()
Default empty constructor for this obs service

Method Detail

setObsDAO

public void setObsDAO(ObsDAO dao)
Description copied from interface: ObsService
Set the given dao on this obs service. The dao will act as the conduit through with all obs calls get to the database

Specified by:
setObsDAO in interface ObsService
Parameters:
dao - specific ObsDAO to use for this service
See Also:
ObsService.setObsDAO(org.openmrs.api.db.ObsDAO)

onShutdown

public void onShutdown()
Clean up after this class. Set the static var to null so that the classloader can reclaim the space.

Specified by:
onShutdown in interface OpenmrsService
Overrides:
onShutdown in class BaseOpenmrsService
See Also:
BaseOpenmrsService.onShutdown()

saveObs

public Obs saveObs(Obs obs,
                   java.lang.String changeMessage)
            throws APIException
Description copied from interface: ObsService
Save the given obs to the database. This will move the contents of the given obs to the database. This acts as both the initial save and an update kind of save. The returned obs will be the same as the obs passed in. It is included for chaining. If this is an initial save, the obsId on the given obs object will be updated to reflect the auto numbering from the database. The obsId on the returned obs will also have this number. If there is already an obsId on the given obs object, the given obs will be voided and a new row in the database will be created that has a new obs id.

Specified by:
saveObs in interface ObsService
Parameters:
obs - the Obs to save to the database
changeMessage - String explaining why obs is being changed. If obs is a new obs, changeMessage is nullable, or if it is being updated, it would be required
Returns:
Obs that was saved to the database
Throws:
APIException
See Also:
ObsService.saveObs(org.openmrs.Obs, String)

getObs

public Obs getObs(java.lang.Integer obsId)
           throws APIException
Description copied from interface: ObsService
Get an observation

Specified by:
getObs in interface ObsService
Parameters:
obsId - integer obsId of observation desired
Returns:
matching Obs
Throws:
APIException
See Also:
ObsService.getObs(java.lang.Integer)

updateObs

@Deprecated
public void updateObs(Obs obs)
               throws APIException
Deprecated. 

Description copied from interface: ObsService
Save changes to observation

Specified by:
updateObs in interface ObsService
Throws:
APIException
See Also:
ObsService.updateObs(org.openmrs.Obs)

voidObs

public Obs voidObs(Obs obs,
                   java.lang.String reason)
            throws APIException
Voids an Obs If the Obs argument is an obsGroup, all group members will be voided.

Specified by:
voidObs in interface ObsService
Parameters:
obs - the Obs to void
reason - the void reason
Throws:
APIException
See Also:
ObsService.voidObs(org.openmrs.Obs, java.lang.String)

unvoidObs

public Obs unvoidObs(Obs obs)
              throws APIException
Unvoids an Obs

If the Obs argument is an obsGroup, all group members with the same dateVoided will also be unvoided.

Specified by:
unvoidObs in interface ObsService
Parameters:
obs - the Obs to unvoid
Returns:
the unvoided Obs
Throws:
APIException
See Also:
ObsService.unvoidObs(org.openmrs.Obs)

purgeObs

public void purgeObs(Obs obs,
                     boolean cascade)
              throws APIException
Description copied from interface: ObsService
Completely remove an observation from the database. This should typically not be called because we don't want to ever lose data. The data really should be voided and then it is not seen in interface any longer (see #voidObs(Obs) for that one)

Specified by:
purgeObs in interface ObsService
Parameters:
obs - the observation to remove from the database
cascade - true/false whether or not to cascade down to other things that link to this observation (like Orders and ObsGroups)
Throws:
APIException
See Also:
ObsService.purgeObs(org.openmrs.Obs, boolean)

purgeObs

public void purgeObs(Obs obs)
              throws APIException
Description copied from interface: ObsService
Completely remove an observation from the database. This should typically not be called because we don't want to ever lose data. The data really should be voided and then it is not seen in interface any longer (see #voidObs(Obs) for that one) If other things link to this obs, an error will be thrown.

Specified by:
purgeObs in interface ObsService
Throws:
APIException
See Also:
ObsService.purgeObs(org.openmrs.Obs)

getMimeTypes

@Deprecated
public java.util.List<MimeType> getMimeTypes()
                                      throws APIException
Deprecated. use getAllMimeTypes()

Specified by:
getMimeTypes in interface ObsService
Throws:
APIException
See Also:
ObsService.getMimeTypes()

getAllMimeTypes

@Deprecated
public java.util.List<MimeType> getAllMimeTypes()
                                         throws APIException
Deprecated. 

Description copied from interface: ObsService
Gets all mime types (including retired ones)

Specified by:
getAllMimeTypes in interface ObsService
Returns:
list of MimeTypes in the system
Throws:
APIException
See Also:
ObsService.getAllMimeTypes()

getAllMimeTypes

@Deprecated
public java.util.List<MimeType> getAllMimeTypes(boolean includeRetired)
Deprecated. 

Description copied from interface: ObsService
Gets all mime types and disregards the retired ones if includeRetired is true

Specified by:
getAllMimeTypes in interface ObsService
Parameters:
includeRetired - true/false of whether to also return the retired ones
Returns:
list of MimeTypes lll
See Also:
ObsService.getAllMimeTypes(boolean)

saveMimeType

@Deprecated
public MimeType saveMimeType(MimeType mimeType)
                      throws APIException
Deprecated. 

Description copied from interface: ObsService
Save the given mimeType to the database. If mimeType is not null, the mimeType is updated in the database. If mimeType is null, a new mimeType is added to the database

Specified by:
saveMimeType in interface ObsService
Parameters:
mimeType - mimeType
Returns:
mimeType that was saved/updated in the database
Throws:
APIException
See Also:
ObsService.saveMimeType(org.openmrs.MimeType)

voidMimeType

@Deprecated
public MimeType voidMimeType(MimeType mimeType,
                                        java.lang.String reason)
                      throws APIException
Deprecated. 

Description copied from interface: ObsService
This effectively removes the given mimeType from the system. Voided mimeTypes are still linked to from complexObs, they just aren't shown in the list of available mimeTypes

Specified by:
voidMimeType in interface ObsService
Parameters:
mimeType - the MimeType to remove
reason - the reason this mimeType is being voided
Returns:
the voided MimeType
Throws:
APIException
See Also:
ObsService.voidMimeType(org.openmrs.MimeType, java.lang.String)

getMimeType

@Deprecated
public MimeType getMimeType(java.lang.Integer mimeTypeId)
                     throws APIException
Deprecated. 

Description copied from interface: ObsService
Get mimeType by internal identifier

Specified by:
getMimeType in interface ObsService
Returns:
mimeType with given internal identifier
Throws:
APIException
See Also:
ObsService.getMimeType(java.lang.Integer)

purgeMimeType

@Deprecated
public void purgeMimeType(MimeType mimeType)
Deprecated. 

Description copied from interface: ObsService
This completely removes the given MimeType from the database. If data has been stored already that points at this mimeType an exception is thrown

Specified by:
purgeMimeType in interface ObsService
Parameters:
mimeType - the MimeType to remove
See Also:
ObsService.purgeMimeType(org.openmrs.MimeType)

getObservations

public java.util.List<Obs> getObservations(java.util.List<Person> whom,
                                           java.util.List<Encounter> encounters,
                                           java.util.List<Concept> questions,
                                           java.util.List<Concept> answers,
                                           java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes,
                                           java.util.List<Location> locations,
                                           java.util.List<java.lang.String> sort,
                                           java.lang.Integer mostRecentN,
                                           java.lang.Integer obsGroupId,
                                           java.util.Date fromDate,
                                           java.util.Date toDate,
                                           boolean includeVoidedObs)
                                    throws APIException
Description copied from interface: ObsService
This method fetches observations according to the criteria in the given arguments. All arguments are optional and nullable. If more than one argument is non-null, the result is equivalent to an "and"ing of the arguments. (e.g. if both a location and a fromDate are given, only Obs that are both at that Location and after the fromDate are returned).

Note: If whom has elements, personType is ignored

Note: to get all observations on a certain date, use:
Date fromDate = "2009-08-15";
Date toDate = OpenmrsUtil.lastSecondOfDate(fromDate); List obs = getObservations(...., fromDate, toDate, ...);

Specified by:
getObservations in interface ObsService
Parameters:
whom - List to restrict obs to (optional)
encounters - List to restrict obs to (optional)
questions - List to restrict the obs to (optional)
answers - List to restrict the valueCoded to (optional)
personTypes - List objects to restrict this to. Only used if whom is an empty list (optional)
locations - The org.openmrs.Location objects to restrict to (optional)
sort - list of column names to sort on (obsId, obsDatetime, etc) if null, defaults to obsDatetime (optional)
mostRecentN - restrict the number of obs returned to this size (optional)
obsGroupId - the Obs.getObsGroupId() to this integer (optional)
fromDate - the earliest Obs date to get (optional)
toDate - the latest Obs date to get (optional)
includeVoidedObs - true/false whether to also include the voided obs (required)
Returns:
list of Observations that match all of the criteria given in the arguments
Throws:
APIException
See Also:
ObsService.getObservations(java.util.List, java.util.List, java.util.List, java.util.List, List, List, java.util.List, java.lang.Integer, java.lang.Integer, java.util.Date, java.util.Date, boolean)

getObservationCount

public java.lang.Integer getObservationCount(java.util.List<Person> whom,
                                             java.util.List<Encounter> encounters,
                                             java.util.List<Concept> questions,
                                             java.util.List<Concept> answers,
                                             java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes,
                                             java.util.List<Location> locations,
                                             java.lang.Integer obsGroupId,
                                             java.util.Date fromDate,
                                             java.util.Date toDate,
                                             boolean includeVoidedObs)
                                      throws APIException
Description copied from interface: ObsService
This method fetches the count of observations according to the criteria in the given arguments. All arguments are optional and nullable. If more than one argument is non-null, the result is equivalent to an "and"ing of the arguments. (e.g. if both a location and a fromDate are given, only Obs that are both at that Location and after the fromDate are returned).

Note: If whom has elements, personType is ignored

Note: to get all observations count on a certain date, use:
Date fromDate = "2009-08-15";
Date toDate = OpenmrsUtil.lastSecondOfDate(fromDate); List obs = getObservations(...., fromDate, toDate, ...);

Specified by:
getObservationCount in interface ObsService
Parameters:
whom - List to restrict obs to (optional)
encounters - List to restrict obs to (optional)
questions - List to restrict the obs to (optional)
answers - List to restrict the valueCoded to (optional)
personTypes - List objects to restrict this to. Only used if whom is an empty list (optional)
locations - The org.openmrs.Location objects to restrict to (optional) obsDatetime (optional)
obsGroupId - the Obs.getObsGroupId() to this integer (optional)
fromDate - the earliest Obs date to get (optional)
toDate - the latest Obs date to get (optional)
includeVoidedObs - true/false whether to also include the voided obs (required)
Returns:
list of Observations that match all of the criteria given in the arguments
Throws:
APIException
See Also:
ObsService.getObservationCount(java.util.List, java.util.List, java.util.List, java.util.List, java.util.List, java.util.List, java.lang.Integer, java.util.Date, java.util.Date, boolean)

getObservations

public java.util.List<Obs> getObservations(java.lang.String searchString)
This implementation queries the obs table comparing the given searchString with the patient's identifier, encounterId, and obsId

Specified by:
getObservations in interface ObsService
Parameters:
searchString - The string to search on
Returns:
observations matching the given string
See Also:
ObsService.getObservations(java.lang.String)

createObs

@Deprecated
public void createObs(Obs obs)
               throws APIException
Deprecated. 

Description copied from interface: ObsService
Create an observation

Specified by:
createObs in interface ObsService
Throws:
APIException
See Also:
ObsService.createObs(org.openmrs.Obs)

createObsGroup

@Deprecated
public void createObsGroup(Obs[] obs)
                    throws APIException
Deprecated. This method should no longer need to be called on the api. This was meant as temporary until we created a true ObsGroup pojo.

Correct use case:
 Obs parent = new Obs();
 Obs child1 = new Obs();
 Obs child2 = new Obs();
 
 parent.addGroupMember(child1);
 parent.addGroupMember(child2);
 

Specified by:
createObsGroup in interface ObsService
Parameters:
obs - - array of observations to be grouped
Throws:
APIException
See Also:
ObsService.createObsGroup(org.openmrs.Obs[])

deleteObs

@Deprecated
public void deleteObs(Obs obs)
               throws APIException
Deprecated. use #purgeObs(Obs)

Description copied from interface: ObsService
This method shouldn't be used. Use either ObsService.purgeObs(Obs) or ObsService.voidObs(Obs,String)

Specified by:
deleteObs in interface ObsService
Throws:
APIException
See Also:
ObsService.deleteObs(org.openmrs.Obs)

getObservationsByPerson

public java.util.List<Obs> getObservationsByPerson(Person who)
Description copied from interface: ObsService
Get all Observations for the given person. Does not return voided observations

Specified by:
getObservationsByPerson in interface ObsService
Parameters:
who - the user to match on
Returns:
a List object containing all non-voided observations for the specified person
See Also:
ObsService.getObservationsByPerson(org.openmrs.Person)

getObservations

@Deprecated
public java.util.Set<Obs> getObservations(Person who,
                                                     boolean includeVoided)
Deprecated. use getObservationsByPerson(Person)

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(org.openmrs.Person, boolean includeVoided)

getObservations

@Deprecated
public java.util.List<Obs> getObservations(Concept c,
                                                      Location loc,
                                                      java.lang.String sort,
                                                      java.lang.Integer personType,
                                                      boolean includeVoided)
Deprecated. 

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(org.openmrs.Concept, org.openmrs.Location, java.lang.String, java.lang.Integer, boolean includeVoided)

getObservations

@Deprecated
public java.util.Set<Obs> getObservations(Person who,
                                                     Concept question,
                                                     boolean includeVoided)
Deprecated. 

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(org.openmrs.Person, org.openmrs.Concept, boolean)

getObservationsByPersonAndConcept

public java.util.List<Obs> getObservationsByPersonAndConcept(Person who,
                                                             Concept question)
                                                      throws APIException
Description copied from interface: ObsService
Get all nonvoided observations for the given patient with the given concept as the question concept (conceptId)

Specified by:
getObservationsByPersonAndConcept in interface ObsService
Parameters:
who - person to match on
question - conceptId to match on
Returns:
list of all nonvoided observations matching these criteria
Throws:
APIException
See Also:
ObsService.getObservationsByPersonAndConcept(org.openmrs.Person, org.openmrs.Concept)

getLastNObservations

@Deprecated
public java.util.List<Obs> getLastNObservations(java.lang.Integer n,
                                                           Person who,
                                                           Concept question,
                                                           boolean includeVoided)
Deprecated. 

Specified by:
getLastNObservations in interface ObsService
See Also:
ObsService.getLastNObservations(java.lang.Integer, org.openmrs.Person, org.openmrs.Concept, boolean includeVoided)

getObservations

@Deprecated
public java.util.List<Obs> getObservations(Concept question,
                                                      java.lang.String sort,
                                                      java.lang.Integer personType,
                                                      boolean includeVoided)
Deprecated. 

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(org.openmrs.Concept, java.lang.String, java.lang.Integer, boolean includeVoided)

getObservationsAnsweredByConcept

@Deprecated
public java.util.List<Obs> getObservationsAnsweredByConcept(Concept answer,
                                                                       java.lang.Integer personType,
                                                                       boolean includeVoided)
Deprecated. 

Specified by:
getObservationsAnsweredByConcept in interface ObsService
See Also:
ObsService.getObservationsAnsweredByConcept(org.openmrs.Concept, java.lang.Integer, boolean includeVoided)

getNumericAnswersForConcept

@Deprecated
public java.util.List<java.lang.Object[]> getNumericAnswersForConcept(Concept question,
                                                                                 java.lang.Boolean sortByValue,
                                                                                 java.lang.Integer personType,
                                                                                 boolean includeVoided)
Deprecated. 

Description copied from interface: ObsService
Return all numeric answer values for the given concept ordered by value numeric low to high personType should be one of PATIENT, PERSON, or USER;

Specified by:
getNumericAnswersForConcept in interface ObsService
sortByValue - true/false if sorting by valueNumeric. If false, will sort by obsDatetime
Returns:
List [0]=obsId, [1]=obsDatetime, [2]= valueNumerics
See Also:
ObsService.getNumericAnswersForConcept(org.openmrs.Concept, java.lang.Boolean, java.lang.Integer, boolean includeVoided)

getObservations

@Deprecated
public java.util.Set<Obs> getObservations(Encounter whichEncounter)
Deprecated. use org.openmrs.Encounter#getObs()

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(org.openmrs.Encounter)

getVoidedObservations

@Deprecated
public java.util.List<Obs> getVoidedObservations()
Deprecated. 

Specified by:
getVoidedObservations in interface ObsService
See Also:
ObsService.getVoidedObservations()

findObservations

@Deprecated
public java.util.List<Obs> findObservations(java.lang.String search,
                                                       boolean includeVoided,
                                                       java.lang.Integer personType)
Deprecated. 

Specified by:
findObservations in interface ObsService
See Also:
ObsService.findObservations(java.lang.String, boolean, java.lang.Integer)

findObsByGroupId

@Deprecated
public java.util.List<Obs> findObsByGroupId(java.lang.Integer obsGroupId)
Deprecated. -- should use obs.getGroupMembers

Specified by:
findObsByGroupId in interface ObsService
See Also:
ObsService.findObsByGroupId(java.lang.Integer)

getObsByUuid

public Obs getObsByUuid(java.lang.String uuid)
                 throws APIException
Description copied from interface: ObsService
Get Obs by its UUID

Specified by:
getObsByUuid in interface ObsService
Returns:
Throws:
APIException
See Also:
ObsService.getObsByUuid(java.lang.String)

getObservations

@Deprecated
public java.util.List<Obs> getObservations(java.util.List<Concept> concepts,
                                                      java.util.Date fromDate,
                                                      java.util.Date toDate,
                                                      boolean includeVoided)
Deprecated. 

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(List, Date, Date, boolean)

getObservations

@Deprecated
public java.util.List<Obs> getObservations(java.util.List<Concept> concepts,
                                                      java.util.Date fromDate,
                                                      java.util.Date toDate)
Deprecated. 

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(List, Date, Date)

getObservations

@Deprecated
public java.util.List<Obs> getObservations(Cohort patients,
                                                      java.util.List<Concept> concepts,
                                                      java.util.Date fromDate,
                                                      java.util.Date toDate)
Deprecated. 

Specified by:
getObservations in interface ObsService
See Also:
ObsService.getObservations(Cohort, List, Date, Date)

getComplexObs

public Obs getComplexObs(java.lang.Integer obsId,
                         java.lang.String view)
                  throws APIException
Description copied from interface: ObsService
Get a complex observation. If obs.isComplex() is true, then returns an Obs with its ComplexData. Otherwise returns a simple Obs. TODO: Possibly remove this method. It is confusing because you may have a complexObs, but not want the complexData attached at the time. Nevertheless, you may think that this method is necessary to use, when you could just call getObs(). This will attach the complexData onto the obs.

Specified by:
getComplexObs in interface ObsService
Returns:
Obs with a ComplexData
Throws:
APIException
See Also:
ObsService.getComplexObs(Integer, String)

purgeComplexData

protected boolean purgeComplexData(Obs obs)
                            throws APIException
Internal method to remove ComplexData when an Obs is purged.

Throws:
APIException

getHandler

public ComplexObsHandler getHandler(Obs obs)
                             throws APIException
Convenience method to get the ComplexObsHandler associated with a complex Obs. Returns the ComplexObsHandler. Returns null if the Obs.isComplexObs() is false or there is an error instantiating the handler class.

Parameters:
obs - A complex Obs.
Returns:
ComplexObsHandler for the complex Obs. or null on error.
Throws:
APIException

getHandler

public ComplexObsHandler getHandler(java.lang.String key)
Description copied from interface: ObsService
Get the ComplexObsHandler that has been registered with the given key

Specified by:
getHandler in interface ObsService
Parameters:
key - that has been registered with a handler class
Returns:
Object representing the handler for the given key
See Also:
ObsService.getHandler(java.lang.String)

setHandlers

public void setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> newHandlers)
                 throws APIException
Description copied from interface: ObsService
Add the given map to this service's handlers. This method registers each ComplexObsHandler to this service. If the given String key exists, that handler is overwritten with the given handler For most situations, this map is set via spring, see the applicationContext-service.xml file to add more handlers.

Specified by:
setHandlers in interface ObsService
Parameters:
newHandlers - Map of class to handler object
Throws:
APIException
See Also:
ObsService.setHandlers(Map), registerHandler(String, ComplexObsHandler)

getHandlers

public java.util.Map<java.lang.String,ComplexObsHandler> getHandlers()
                                                              throws APIException
Description copied from interface: ObsService
Gets the handlers map registered

Specified by:
getHandlers in interface ObsService
Returns:
map of keys to handlers
Throws:
APIException
See Also:
ObsService.getHandlers()

registerHandler

public void registerHandler(java.lang.String key,
                            ComplexObsHandler handler)
                     throws APIException
Description copied from interface: ObsService
Registers the given handler with the given key If the given String key exists, that handler is overwritten with the given handler

Specified by:
registerHandler in interface ObsService
Parameters:
key - the key name to use for this handler
handler - the class to register with this key
Throws:
APIException
See Also:
ObsService.registerHandler(String, ComplexObsHandler)

registerHandler

public void registerHandler(java.lang.String key,
                            java.lang.String handlerClass)
                     throws APIException
Description copied from interface: ObsService
Convenience method for ObsService.registerHandler(String, ComplexObsHandler)

Specified by:
registerHandler in interface ObsService
Parameters:
key - the key name to use for this handler
handlerClass - the class to register with this key
Throws:
APIException
See Also:
ObsService.registerHandler(String, String)

getObservationCount

public java.lang.Integer getObservationCount(java.util.List<ConceptName> conceptNames,
                                             boolean includeVoided)
Description copied from interface: ObsService
Gets the number of observations(including voided ones) that are using the specified conceptNames as valueCodedName answers

Specified by:
getObservationCount in interface ObsService
Parameters:
conceptNames - the conceptNames to be searched against
includeVoided - whether voided observation should be included
Returns:
The number of observations using the specified conceptNames as valueCodedNames
See Also:
ObsService.getObservationCount(java.util.List, boolean)

removeHandler

public void removeHandler(java.lang.String key)
Description copied from interface: ObsService
Remove the handler associated with the key from list of available handlers

Specified by:
removeHandler in interface ObsService
Parameters:
key - the key of the handler to unregister
See Also:
ObsService.removeHandler(java.lang.String)

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change