Java Reference
In-Depth Information
<bean id="customerService"
class="com.apress.springenterpriserecipes.jbpm.jbpm4.customers.CustomerServiceImpl">
<property name="processDefinitions">
<list>
<value>/process-efinitions/RegisterCustomer.jpdl.xml</value>
</list>
</property>
</bean>
</beans>
The first few elements are familiar: we set up the AOP-based transaction management and apply it
to the services deployed under the jbpm4 package in our solution. Next, we override the List bean (with id
annotatedHibernateClasses ) that we created for the last recipe ( jbpm4-context.xml ) to provide the
session factory with a collection of annotated entities; here, the Customer entity. Finally, we have a bean
to handle the customerService bean. This bean leverages Hibernate (through the HibernateTemplate
instance) to handle persistence and it leverages jBPM (through the SpringConfiguration instance) to
handle BPM. We provide the customerService bean with a list of business processes we want to ensure
are deployed, which the bean handles as part of its duties in its post-initialization phase (the method
annotated with @PostConstruct will be run after the bean's been configured to let the user inject custom
initialization logic). In this case, we're deploying only one business process. Note that the business
process file's name needs to end in jpdl.xml ; otherwise jBPM won't deploy it. The customerService bean
is an implementation of the interface CustomerService , whose definition is as follows:
package com.apress.springenterpriserecipes.jbpm.jbpm4.customers;
public interface CustomerService {
void sendWelcomeEmail(Long customerId);
void deauthorizeCustomer(Long customerId);
void authorizeCustomer(Long customerId);
Customer getCustomerById(Long customerId);
Customer createCustomer(String email, String password, String firstName, String
lastName);
void sendCustomerVerificationEmail(Long customerId);
}
The interface is trivial, and only provides creation and mutation services for a Customer record. The
implementation is where we see all the pieces come together.
package com.apress.springenterpriserecipes.jbpm.jbpm4.customers;
Search WWH ::




Custom Search