/** * obtains the current JbpmContext from a thread local. The current contexts are maintained in * a stack so that you can do nested context operations for different jbpm configurations. * * <p> * it is <strong>strongly recommended</strong> that client code invokes * {@link JbpmConfiguration#getCurrentJbpmContext()} in preference to this method. * </p> */ public static JbpmContext getCurrentJbpmContext() { JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getCurrentJbpmConfiguration(); return jbpmConfiguration != null ? jbpmConfiguration.getCurrentJbpmContext() : null; }
/** * obtains the current JbpmContext from a thread local. The current contexts are maintained in * a stack so that you can do nested context operations for different jbpm configurations. * * <p> * it is <strong>strongly recommended</strong> that client code invokes * {@link JbpmConfiguration#getCurrentJbpmContext()} in preference to this method. * </p> */ public static JbpmContext getCurrentJbpmContext() { JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getCurrentJbpmConfiguration(); return jbpmConfiguration != null ? jbpmConfiguration.getCurrentJbpmContext() : null; }
protected ProcessDefinition getProcessDefinition() { if (processDefinition != null) return processDefinition; if (jbpmConfiguration != null) { // is there an active context? JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext(); if (jbpmContext != null) { // check if transaction is still active before loading process definition // https://jira.jboss.org/browse/JBPM-2918 PersistenceService persistenceService = jbpmContext.getServices() .getPersistenceService(); if (persistenceService instanceof DbPersistenceService) { DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService; if (dbPersistenceService.isTransactionActive()) { return persistenceService.getGraphSession() .loadProcessDefinition(processDefinitionId); } } } } return null; }
protected ProcessDefinition getProcessDefinition() { if (processDefinition != null) return processDefinition; if (jbpmConfiguration != null) { // is there an active context? JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext(); if (jbpmContext != null) { // check if transaction is still active before loading process definition // https://jira.jboss.org/browse/JBPM-2918 PersistenceService persistenceService = jbpmContext.getServices() .getPersistenceService(); if (persistenceService instanceof DbPersistenceService) { DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService; if (dbPersistenceService.isTransactionActive()) { return persistenceService.getGraphSession() .loadProcessDefinition(processDefinitionId); } } } } return null; }