/** * Process the next form entry in the database and then remove the form entry from the database. */ @Override public void execute() { try { Context.openSession(); log.info("****************************** SEND EMAIL TASK: Executing task ..."); } finally { Context.closeSession(); } }
@Override public void run() { isDaemonThread.set(true); try { Context.openSession(); //Suppressing sonar issue "squid:S1217" //We intentionally do not start a new thread yet, rather wrap the run call in a session. runnable.run(); } finally { Context.closeSession(); } } };
@Override public void run() { isDaemonThread.set(true); try { Context.openSession(); //Suppressing sonar issue "squid:S1217" //We intentionally do not start a new thread yet, rather wrap the run call in a session. runnable.run(); } finally { Context.closeSession(); } } };
@Override public void run() { isDaemonThread.set(true); try { Context.openSession(); returnedObject = ModuleFactory.startModuleInternal(module, isOpenmrsStartup, applicationContext); } catch (Exception e) { exceptionThrown = e; } finally { Context.closeSession(); } } };
@Override public void run() { isDaemonThread.set(true); try { Context.openSession(); TimerSchedulerTask.execute(task); } catch (Exception e) { exceptionThrown = e; } finally { Context.closeSession(); } } };
@Override public void run() { isDaemonThread.set(true); try { Context.openSession(); service.onStartup(); } catch (Exception e) { exceptionThrown = e; } finally { Context.closeSession(); } } };
/** * Process the next form entry in the database and then remove the form entry from the database. */ @Override public void execute() { Context.openSession(); try { log.debug("Processing HL7 queue ... "); processor.processHL7InQueue(); } catch (HL7Exception e) { log.error("Error running hl7 in queue task", e); throw new APIException("Hl7inQueue.error.running", null, e); } finally { Context.closeSession(); } }
Context.openSession();
setRuntimeProperties(properties); openSession(); // so that the startup method can use proxyPrivileges
Context.openSession();
ServletFileUpload upload = new ServletFileUpload(factory); try { Context.openSession(); List<FileItem> items = upload.parseRequest(requestContext); for (FileItem item : items) {
public void run() { Context.openSession(); Context.setUserContext(userContext); setTransferStatus(Status.RUNNING);
threads.add(new Thread(() -> { try { Context.openSession(); Context.addProxyPrivilege(PrivilegeConstants.ADD_ORDERS); uniqueOrderNumbers.add(((OrderNumberGenerator) orderService).getNewOrderNumber(null));
@Override public void afterTestClass(TestContext testContext) throws Exception { StartModule startModuleAnnotation = testContext.getTestClass().getAnnotation(StartModule.class); if (startModuleAnnotation != null) { if (!Context.isSessionOpen()) { Context.openSession(); } // re-registering the bean definitions that we may have removed for (String beanName : filteredDefinitions.keySet()) { ((GenericApplicationContext) testContext.getApplicationContext()) .registerBeanDefinition(beanName, filteredDefinitions.get(beanName)); } filteredDefinitions.clear(); ModuleUtil.shutdown(); Context.closeSession(); } } }
Context.openSession();
/** * Starts the OpenMRS System Should be called prior to any kind of activity * * @param props Runtime properties to use for startup * @throws InputRequiredException if the {@link DatabaseUpdater} has determined that updates * cannot continue without input from the user * @throws DatabaseUpdateException if database updates are required, see * {@link DatabaseUpdater#executeChangelog()} * @throws ModuleMustStartException if a module that should be started is not able to * @see InputRequiredException#getRequiredInput() InputRequiredException#getRequiredInput() for * the required question/datatypes */ public static synchronized void startup(Properties props) throws DatabaseUpdateException, InputRequiredException, ModuleMustStartException { // do any context database specific startup getContextDAO().startup(props); // find/set/check whether the current database version is compatible checkForDatabaseUpdates(props); // this should be first in the startup routines so that the application // data directory can be set from the runtime properties OpenmrsUtil.startup(props); openSession(); clearSession(); // add any privileges/roles that /must/ exist for openmrs to work // correctly. checkCoreDataset(); getContextDAO().setupSearchIndex(); // Loop over each module and startup each with these custom properties ModuleUtil.startup(props); }
Context.openSession();
Context.openSession();
Context.openSession(); authenticate();
public static OpenMRSSecurityUser login(String userName, String password) { Context.openSession(); Context.authenticate(userName, password); OpenMRSSecurityUser openMRSUser = new OpenMRSSecurityUser(Context.getAuthenticatedUser(), password); Context.closeSession(); return openMRSUser; } }