private void installProcessDefinitions() { if ( isProcessDeploymentEnabled() ) { JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext(); try { if (processDefinitions!=null) { for ( String definitionResource : processDefinitions ) { deployProcess(jbpmContext, definitionResource); } } } catch (RuntimeException e) { throw new RuntimeException("could not deploy a process definition", e); } finally { jbpmContext.close(); } } }
protected ProcessDefinition getPageflowProcessDefinition(String pageflowName) { ProcessDefinition pageflowProcessDefinition = Jbpm.instance().getPageflowProcessDefinition(pageflowName); if (pageflowProcessDefinition==null) { throw new IllegalArgumentException("pageflow definition not found: " + pageflowName); } return pageflowProcessDefinition; }
public String switchProcess() { jbpmContext.deployProcessDefinition(jbpm .getProcessDefinitionFromResource(currentProcessDefinition)); return null; }
private boolean isPageflow(final ExecutionContext context) { return Contexts.isConversationContextActive() && Jbpm.instance().isPageflowProcessDefinition( context.getProcessDefinition().getName() ); }
@Create public void create() throws NamingException, RollbackException, SystemException { jbpmContext = Jbpm.instance().getJbpmConfiguration().createJbpmContext(); assertNoTransactionManagement(); log.debug( "created seam managed jBPM context"); }
@Create public void startup() throws Exception { log.debug( "Starting jBPM" ); ProcessState.setDefaultSubProcessResolver( new SeamSubProcessResolver() ); installProcessDefinitions(); installPageflowDefinitions(); //JbpmExpressionEvaluator.setVariableResolver( new SeamVariableResolver() ); //JbpmExpressionEvaluator.setFunctionMapper( new SeamFunctionMapper() ); JbpmExpressionEvaluator.setExpressionEvaluator( new SeamExpressionEvaluator() ); UserCodeInterceptorConfig.setUserCodeInterceptor( new SeamUserCodeInterceptor() ); }
public static ProcessDefinition parseReaderSource(Reader reader) { JbpmContext jbpmContext = createPageflowContext(); try { return new PageflowParser(reader).readProcessDefinition(); } finally { jbpmContext.close(); } }
public JbpmConfiguration getJbpmConfiguration() { if (jbpmConfiguration==null) { initJbpmConfiguration(); } return jbpmConfiguration; }
private void installPageflowDefinitions() { Set<String> mergedPageflowDefinitions = new LinkedHashSet<String>(); if ( pageflowDefinitions!=null ) { mergedPageflowDefinitions.addAll(Arrays.asList(pageflowDefinitions)); } for (FileDescriptor fileDescriptor : ((PageflowDeploymentHandler) ((DeploymentStrategy) Contexts.getEventContext().get(StandardDeploymentStrategy.NAME)).getDeploymentHandlers().get(PageflowDeploymentHandler.NAME)).getResources()) { mergedPageflowDefinitions.add(fileDescriptor.getName()); } for (String pageflow: mergedPageflowDefinitions) { ProcessDefinition pd = getPageflowDefinitionFromResource(pageflow); pageflowProcessDefinitions.put( pd.getName(), pd ); } }
public static ProcessDefinition parseInputSource(InputSource inputSource) { JbpmContext jbpmContext = createPageflowContext(); try { return new PageflowParser(inputSource).readProcessDefinition(); } finally { jbpmContext.close(); } }
private static void signal(ProcessInstance processInstance, String outcome) { JbpmContext jbpmContext = Jbpm.createPageflowContext(); try { log.debug("signaling pageflow transition for outcome: " + outcome); processInstance.signal(outcome); } finally { jbpmContext.close(); } }
private static ProcessInstance createInstance(ProcessDefinition processDefinition) { JbpmContext jbpmContext = Jbpm.createPageflowContext(); try { log.debug( "new pageflow instance for definition: " + processDefinition.getName() ); return processDefinition.createProcessInstance(); } finally { jbpmContext.close(); } }