public static final BPMTaskService newTaskService(
Environment environment,
EntityManagerFactory entityManagerFactory,
UserGroupCallback userGroupCallback,
ClassLoader loader) {
InternalTaskService internalTaskService;
if (entityManagerFactory != null) {
internalTaskService = (InternalTaskService)HumanTaskServiceFactory.newTaskServiceConfigurator()
.environment(environment)
.entityManagerFactory(entityManagerFactory)
.userGroupCallback(userGroupCallback)
.getTaskService();
String deploymentId = (String)environment.get(Environments.DEPLOYMENT_ID);
internalTaskService.addMarshallerContext(deploymentId, new ContentMarshallerContext(environment, loader));
} else {
internalTaskService = null;
}
InvocationHandler invocationHandler = new TaskServiceInvocationHandler(internalTaskService);
return (BPMTaskService)Proxy.newProxyInstance(BPMTaskService.class.getClassLoader(), new Class[]{BPMTaskService.class}, invocationHandler);