public class ServiceContext
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
Service Context, which returns the services represented
 throughout the system. Context class. getService(Class)Context| Modifier and Type | Method and Description | 
|---|---|
void | 
addAdvice(java.lang.Class cls,
         org.aopalliance.aop.Advice advice)  | 
void | 
addAdvisor(java.lang.Class cls,
          org.springframework.aop.Advisor advisor)  | 
static void | 
destroyInstance()
Null out the current instance of the ServiceContext. 
 | 
void | 
doneRefreshingContext()
Should be called right after any spring context refresh This wakes up all calls to
 getService that were waiting because  
startRefreshingContext was called | 
ActiveListService | 
getActiveListService()
Gets the ActiveListService used in the context. 
 | 
AdministrationService | 
getAdministrationService()  | 
AlertService | 
getAlertService()  | 
org.springframework.context.ApplicationContext | 
getApplicationContext()  | 
ArdenService | 
getArdenService()  | 
CohortService | 
getCohortService()  | 
ConceptService | 
getConceptService()  | 
DataSetService | 
getDataSetService()
Deprecated. 
 
see reportingcompatibility module 
 | 
DatatypeService | 
getDatatypeService()
Gets the datatype service 
 | 
EncounterService | 
getEncounterService()  | 
FormService | 
getFormService()  | 
HL7Service | 
getHL7Service()  | 
static ServiceContext | 
getInstance()
There should only be one ServiceContext per openmrs (java virtual machine). 
 | 
LocationService | 
getLocationService()  | 
LogicService | 
getLogicService()  | 
MessageService | 
getMessageService()  | 
MessageSourceService | 
getMessageSourceService()
Gets the MessageSourceService used in the context. 
 | 
java.util.List<OpenmrsService> | 
getModuleOpenmrsServices(java.lang.String modulePackage)
Gets a list of services implementing the  
OpenmrsService interface, for a given
 module. | 
ObsService | 
getObsService()  | 
OrderService | 
getOrderService()  | 
PatientService | 
getPatientService()  | 
PatientSetService | 
getPatientSetService()  | 
PersonService | 
getPersonService()  | 
ProgramWorkflowService | 
getProgramWorkflowService()  | 
ProviderService | 
getProviderService()
Gets the provider service. 
 | 
<T> T | 
getRegisteredComponent(java.lang.String beanName,
                      java.lang.Class<T> type)
Retrieves a bean that match the given type (including subclasses) and name. 
 | 
<T> java.util.List<T> | 
getRegisteredComponents(java.lang.Class<T> type)
Retrieves all Beans which have been registered in the Spring  
ApplicationContext that
 match the given object type (including subclasses). | 
ReportObjectService | 
getReportObjectService()
Deprecated. 
 
see reportingcompatibility module 
 | 
ReportService | 
getReportService()
Deprecated. 
 
see reportingcompatibility module 
 | 
SchedulerService | 
getSchedulerService()  | 
SerializationService | 
getSerializationService()  | 
<T> T | 
getService(java.lang.Class<? extends T> cls)
Returns the current proxy that is stored for the Class  
cls | 
UserService | 
getUserService()  | 
VisitService | 
getVisitService()
Gets the visit service. 
 | 
boolean | 
isRefreshingContext()
Returns true/false whether startRefreshingContext() has been called without a subsequent call
 to doneRefreshingContext() yet. 
 | 
boolean | 
isUseSystemClassLoader()
Checks if we are using the system class loader. 
 | 
void | 
removeAdvice(java.lang.Class cls,
            org.aopalliance.aop.Advice advice)  | 
void | 
removeAdvisor(java.lang.Class cls,
             org.springframework.aop.Advisor advisor)  | 
void | 
setActiveListService(ActiveListService activeListService)
Sets the ActiveListService used in the context 
 | 
void | 
setAdministrationService(AdministrationService administrationService)  | 
void | 
setAlertService(AlertService alertService)  | 
void | 
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)  | 
void | 
setArdenService(ArdenService ardenService)  | 
void | 
setCohortService(CohortService cs)  | 
void | 
setConceptService(ConceptService conceptService)  | 
void | 
setDataSetService(DataSetService dataSetService)
Deprecated. 
 
see reportingcompatibility module 
 | 
void | 
setDatatypeService(DatatypeService datatypeService)
Sets the datatype service 
 | 
void | 
setEncounterService(EncounterService encounterService)  | 
void | 
setFormService(FormService formService)  | 
void | 
setHl7Service(HL7Service hl7Service)  | 
void | 
setLocationService(LocationService locationService)  | 
void | 
setLogicService(LogicService logicService)  | 
void | 
setMessageService(MessageService messageService)
Sets the message service. 
 | 
void | 
setMessageSourceService(MessageSourceService messageSourceService)
Sets the MessageSourceService used in the context. 
 | 
void | 
setModuleService(java.util.List<java.lang.Object> params)
Allow other services to be added to our service layer  
Classes will be found/loaded with the ModuleClassLoader params[0] = string representing the service interfaceparams[1] = service instance | 
void | 
setObsService(ObsService obsService)  | 
void | 
setOrderService(OrderService orderService)  | 
void | 
setPatientService(PatientService patientService)  | 
void | 
setPatientSetService(PatientSetService patientSetService)  | 
void | 
setPersonService(PersonService personService)  | 
void | 
setProgramWorkflowService(ProgramWorkflowService programWorkflowService)  | 
void | 
setProviderService(ProviderService providerService)
Sets the provider service. 
 | 
void | 
setReportObjectService(ReportObjectService reportObjectService)
Deprecated. 
 
see reportingcompatibility module 
 | 
void | 
setReportService(ReportService reportService)
Deprecated. 
 
see reportingcompatibility module 
 | 
void | 
setSchedulerService(SchedulerService schedulerService)
Set the scheduler service. 
 | 
void | 
setSerializationService(SerializationService serializationService)  | 
void | 
setService(java.lang.Class cls,
          java.lang.Object classInstance)
Allow other services to be added to our service layer 
 | 
void | 
setUserService(UserService userService)  | 
void | 
setUseSystemClassLoader(boolean useSystemClassLoader)
Set this service context to use the system class loader if the
  
useSystemClassLoader is set to true. | 
void | 
setVisitService(VisitService visitService)
Sets the visit service. 
 | 
void | 
startRefreshingContext()
Should be called right before any spring context refresh This forces all calls to
 getService to wait until  
doneRefreshingContext is called | 
public static ServiceContext getInstance()
Contextpublic static void destroyInstance()
public EncounterService getEncounterService()
public LocationService getLocationService()
public ObsService getObsService()
public PatientSetService getPatientSetService()
public CohortService getCohortService()
public void setCohortService(CohortService cs)
cs - cohort related servicepublic OrderService getOrderService()
public FormService getFormService()
@Deprecated public ReportObjectService getReportObjectService()
public SerializationService getSerializationService()
@Deprecated public ReportService getReportService()
public AdministrationService getAdministrationService()
public ProgramWorkflowService getProgramWorkflowService()
public ArdenService getArdenService()
public LogicService getLogicService()
public SchedulerService getSchedulerService()
public void setSchedulerService(SchedulerService schedulerService)
schedulerService - public AlertService getAlertService()
public void setAlertService(AlertService alertService)
alertService - public void setProgramWorkflowService(ProgramWorkflowService programWorkflowService)
programWorkflowService - public void setArdenService(ArdenService ardenService)
ardenService - public void setLogicService(LogicService logicService)
logicService - public MessageService getMessageService()
public void setMessageService(MessageService messageService)
messageService - public HL7Service getHL7Service()
public void setHl7Service(HL7Service hl7Service)
hl7Service - the hl7Service to setpublic void setAdministrationService(AdministrationService administrationService)
administrationService - the administrationService to setpublic void setEncounterService(EncounterService encounterService)
encounterService - the encounterService to setpublic void setLocationService(LocationService locationService)
locationService - the LocationService to setpublic void setFormService(FormService formService)
formService - the formService to setpublic void setObsService(ObsService obsService)
obsService - the obsService to setpublic void setOrderService(OrderService orderService)
orderService - the orderService to setpublic void setPatientSetService(PatientSetService patientSetService)
patientSetService - the patientSetService to set@Deprecated public void setReportObjectService(ReportObjectService reportObjectService)
reportObjectService - the reportObjectService to set@Deprecated public void setReportService(ReportService reportService)
reportService - public void setSerializationService(SerializationService serializationService)
serializationService - @Deprecated public void setDataSetService(DataSetService dataSetService)
dataSetService - @Deprecated public DataSetService getDataSetService()
public PatientService getPatientService()
public void setPatientService(PatientService patientService)
patientService - the patientService to setpublic PersonService getPersonService()
public void setPersonService(PersonService personService)
personService - the personService to setpublic ConceptService getConceptService()
public void setConceptService(ConceptService conceptService)
conceptService - the conceptService to setpublic UserService getUserService()
public void setUserService(UserService userService)
userService - the userService to setpublic MessageSourceService getMessageSourceService()
public void setMessageSourceService(MessageSourceService messageSourceService)
messageSourceService - the MessageSourceService to usepublic ActiveListService getActiveListService()
public void setActiveListService(ActiveListService activeListService)
public void addAdvisor(java.lang.Class cls,
                       org.springframework.aop.Advisor advisor)
cls - advisor - public void addAdvice(java.lang.Class cls,
                      org.aopalliance.aop.Advice advice)
cls - advice - public void removeAdvisor(java.lang.Class cls,
                          org.springframework.aop.Advisor advisor)
cls - advisor - public void removeAdvice(java.lang.Class cls,
                         org.aopalliance.aop.Advice advice)
cls - advice - public <T> T getService(java.lang.Class<? extends T> cls)
clscls - cls classpublic void setService(java.lang.Class cls,
                       java.lang.Object classInstance)
cls - Interface to proxyclassInstance - the actual instance of the cls interfacepublic void setModuleService(java.util.List<java.lang.Object> params)
params[0] = string representing the service interfaceparams[1] = service instanceparams - list of parameterspublic void setUseSystemClassLoader(boolean useSystemClassLoader)
useSystemClassLoader is set to true. If false, the openmrs class loader is used
 to load module servicesuseSystemClassLoader - true/false whether to use the system class loaderpublic boolean isUseSystemClassLoader()
public void startRefreshingContext()
doneRefreshingContext is calledpublic void doneRefreshingContext()
startRefreshingContext was calledpublic boolean isRefreshingContext()
public <T> java.util.List<T> getRegisteredComponents(java.lang.Class<T> type)
ApplicationContext that
 match the given object type (including subclasses).
 NOTE: This method introspects top-level beans only. It does not check nested beans which might match the specified type as well.
type - the type of Bean to retrieve from the Spring ApplicationContextListableBeanFactory.getBeansOfType(Class)public <T> T getRegisteredComponent(java.lang.String beanName,
                                    java.lang.Class<T> type)
                             throws APIException
beanName - the name of registered bean to retrievetype - the type of bean to retrieveAPIExceptionpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext in interface org.springframework.context.ApplicationContextAwareapplicationContext - the applicationContext to setpublic org.springframework.context.ApplicationContext getApplicationContext()
public java.util.List<OpenmrsService> getModuleOpenmrsServices(java.lang.String modulePackage)
OpenmrsService interface, for a given
 module.modulePackage - the module's package name.public VisitService getVisitService()
public void setVisitService(VisitService visitService)
visitService - the visitService to setpublic ProviderService getProviderService()
public void setProviderService(ProviderService providerService)
providerService - the providerService to setpublic DatatypeService getDatatypeService()
public void setDatatypeService(DatatypeService datatypeService)
datatypeService - the datatypeService to setCopyright © 2022 OpenMRS Inc.. All Rights Reserved.