10-29-2014 03:16 PM
@Configuration
public class WorkflowConfig {
@Bean
public DataSource activitiDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("xxxx");
dataSource.setUsername("xxxx");
dataSource.setPassword("xxxx");
return dataSource;
}
@Bean
@DependsOn({ "activitiDataSource" })
public PlatformTransactionManager txManager() {
return new DataSourceTransactionManager(activitiDataSource());
}
@Bean
@DependsOn({ "txManager" })
public SpringProcessEngineConfiguration processEngineConfiguration() {
SpringProcessEngineConfiguration processEngineConfig = new SpringProcessEngineConfiguration();
processEngineConfig.setDataSource(activitiDataSource());
processEngineConfig.setTransactionManager(txManager());
processEngineConfig.setDatabaseSchemaUpdate("true");
processEngineConfig.setDatabaseType("mysql");
processEngineConfig.setJobExecutorActivate(true);
processEngineConfig
.setDeploymentResources(new ClassPathResource[] {
new ClassPathResource("invoiceWorkflow.bpmn")
});
return processEngineConfig;
}
@Bean
@DependsOn({ "processEngineConfiguration" })
public ProcessEngine processEngine() {
return processEngineConfiguration().buildProcessEngine();
}
@Bean
public WorkflowService workflowService() {
return new WorkflowService();
}
@Bean
public FetchTicket fetchTicket() {
return new FetchTicket();
}
}
public class FetchTicket implements JavaDelegate {
@Autowired
private TicketService ticketService;
@Override
public void execute(DelegateExecution execution) throws Exception {
System.out.println(ticket);
}
}
<definitions ….>
<process id="invoiceGenerationProcess" name="Invoice Generation Process"
isExecutable="true">
<startEvent id="start" name="Start" />
<serviceTask id="showTickets" name="Show Tickets"
activiti:delegateExpression="${fetchTicket}" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="showTickets" />
<userTask id="generateInvoice" name="Generate Invoice" />
<sequenceFlow id="flow2" sourceRef="showTickets"
targetRef="generateInvoice" />
<endEvent id="endevent1" name="End" />
<sequenceFlow id="flow3" sourceRef="generateInvoice"
targetRef="endevent1" />
</process>
</definitions>
10-29-2014 03:19 PM
10-30-2014 11:50 AM
10-31-2014 02:47 AM
10-31-2014 11:50 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.