/** * @return "active" user who has been authenticated, otherwise <code>null</code> */ public static User getAuthenticatedUser() { if (Daemon.isDaemonThread()) { return Daemon.getDaemonThreadUser(); } return getUserContext().getAuthenticatedUser(); }
/** * Convenience method. Passes through to userContext.hasPrivilege(String) * * @should give daemon user full privileges */ public static boolean hasPrivilege(String privilege) { // the daemon threads have access to all things if (Daemon.isDaemonThread()) { return true; } return getUserContext().hasPrivilege(privilege); }
/** * @return location services */ public static LocationService getLocationService() { return getServiceContext().getLocationService(); }
/** * Convenience method. Passes through to {@link UserContext#setLocale(Locale)} */ public static void setLocale(Locale locale) { getUserContext().setLocale(locale); }
/** * Convenience method. Passes through to userContext.getAllRoles(User) */ public static Set<Role> getAllRoles(User user) throws Exception { return getUserContext().getAllRoles(); }
public void setApplicationContext(ApplicationContext context) { if (!applicationContextMocked) { realApplicationContext = Context.getServiceContext().getApplicationContext(); applicationContextMocked = true; } Context.getServiceContext().setApplicationContext(context); this.applicationContext = context; }
/** * @return order service */ public static OrderService getOrderService() { return getServiceContext().getOrderService(); }
/** * @return orderSet service * @since 1.12 */ public static OrderSetService getOrderSetService() { return getServiceContext().getOrderSetService(); }
/** * @return serialization service * @since 1.5 */ public static SerializationService getSerializationService() { return getServiceContext().getSerializationService(); }
/** * @return alert service */ public static AlertService getAlertService() { return getServiceContext().getAlertService(); }
/** * Removes the given AOP advice object from Class <code>cls</code> * * @param cls * @param advice */ public static void removeAdvice(Class cls, Advice advice) { getServiceContext().removeAdvice(cls, advice); }
/** * @see ServiceContext#getModuleOpenmrsServices(String) * @since 1.9 */ public static List<OpenmrsService> getModuleOpenmrsServices(String modulePackage) { return getServiceContext().getModuleOpenmrsServices(modulePackage); }
/** * @see org.openmrs.api.context.ServiceContext#setUseSystemClassLoader(boolean) * @since 1.10 */ public static void setUseSystemClassLoader(boolean useSystemClassLoader) { getServiceContext().setUseSystemClassLoader(useSystemClassLoader); }
/** * @see org.openmrs.api.context.ServiceContext#isUseSystemClassLoader() * @since 1.10 */ public static boolean isUseSystemClassLoader() { return getServiceContext().isUseSystemClassLoader(); } }
/** * @return condition-related services * * @since 2.2 */ public static ConditionService getConditionService(){ return getServiceContext().getConditionService(); }
/** * @return Returns the hl7Service. */ public static HL7Service getHL7Service() { return getServiceContext().getHL7Service(); }
/** * @return logic service */ public static LogicService getLogicService() { return getServiceContext().getLogicService(); }
/** * @since 1.9 * @see ServiceContext#getVisitService() */ public static VisitService getVisitService() { return getServiceContext().getVisitService(); }
/** * @return concept dictionary-related services */ public static ConceptService getConceptService() { return getServiceContext().getConceptService(); }
/** * @see ServiceContext#getRegisteredComponent(String, Class) * @since 1.9.4 */ public static <T> T getRegisteredComponent(String beanName, Class<T> type) throws APIException { return getServiceContext().getRegisteredComponent(beanName, type); }