use of org.jbpm.shared.services.impl.TransactionalCommandService in project jbpm by kiegroup.
the class DeploymentStoreTest method setup.
@Before
public void setup() {
buildDatasource();
emf = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.domain");
store = new DeploymentStore();
store.setCommandService(new TransactionalCommandService(emf));
}
use of org.jbpm.shared.services.impl.TransactionalCommandService in project jbpm by kiegroup.
the class ProcessInstanceAdminServiceImplTest method prepare.
@Before
public void prepare() {
configureServices();
logger.debug("Preparing kjar");
KieServices ks = KieServices.Factory.get();
// version 1 of kjar
ReleaseId releaseId = ks.newReleaseId(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1);
List<String> processes = new ArrayList<String>();
processes.add("repo/processes/general/humanTask.bpmn");
processes.add("repo/processes/general/BPMN2-IntermediateCatchEventTimerDuration.bpmn2");
processes.add("repo/processes/errors/BPMN2-BrokenScriptTask.bpmn2");
processes.add("repo/processes/errors/BPMN2-UserTaskWithRollback.bpmn2");
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes);
File pom = new File("target/admin", "pom.xml");
pom.getParentFile().mkdir();
try {
FileOutputStream fs = new FileOutputStream(pom);
fs.write(getPom(releaseId).getBytes());
fs.close();
} catch (Exception e) {
}
KieMavenRepository repository = getKieMavenRepository();
repository.installArtifact(releaseId, kJar1, pom);
processAdminService = new ProcessInstanceAdminServiceImpl();
((ProcessInstanceAdminServiceImpl) processAdminService).setProcessService(processService);
((ProcessInstanceAdminServiceImpl) processAdminService).setRuntimeDataService(runtimeDataService);
((ProcessInstanceAdminServiceImpl) processAdminService).setCommandService(new TransactionalCommandService(emf));
((ProcessInstanceAdminServiceImpl) processAdminService).setIdentityProvider(identityProvider);
// now let's deploy to runtime both kjars
deploymentUnit = new KModuleDeploymentUnit(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
}
use of org.jbpm.shared.services.impl.TransactionalCommandService in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method prepare.
@Before
public void prepare() {
configureServices();
logger.debug("Preparing kjar");
KieServices ks = KieServices.Factory.get();
// version 1 of kjar
ReleaseId releaseId = ks.newReleaseId(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1);
List<String> processes = new ArrayList<String>();
processes.add("repo/processes/general/humanTask.bpmn");
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes);
File pom = new File("target/admin", "pom.xml");
pom.getParentFile().mkdir();
try {
FileOutputStream fs = new FileOutputStream(pom);
fs.write(getPom(releaseId).getBytes());
fs.close();
} catch (Exception e) {
}
KieMavenRepository repository = getKieMavenRepository();
repository.installArtifact(releaseId, kJar1, pom);
userTaskAdminService = new UserTaskAdminServiceImpl();
((UserTaskAdminServiceImpl) userTaskAdminService).setUserTaskService(userTaskService);
((UserTaskAdminServiceImpl) userTaskAdminService).setRuntimeDataService(runtimeDataService);
((UserTaskAdminServiceImpl) userTaskAdminService).setIdentityProvider(identityProvider);
((UserTaskAdminServiceImpl) userTaskAdminService).setCommandService(new TransactionalCommandService(emf));
// now let's deploy to runtime both kjars
deploymentUnit = new KModuleDeploymentUnit(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
// set user to administrator so it will be allowed to do operations
identityProvider.setName("Administrator");
identityProvider.setRoles(Collections.singletonList(""));
}
use of org.jbpm.shared.services.impl.TransactionalCommandService in project jbpm by kiegroup.
the class DeactivateDeploymentServiceWithSyncTest method configureDeploymentSync.
protected void configureDeploymentSync() {
assertNotNull(deploymentService);
store = new DeploymentStore();
if (commandService == null) {
commandService = new TransactionalCommandService(emf);
}
store.setCommandService(commandService);
sync = new DeploymentSynchronizer();
sync.setDeploymentService(deploymentService);
sync.setDeploymentStore(store);
invoker = new DeploymentSyncInvoker(sync, 1L, 1L, TimeUnit.SECONDS);
}
use of org.jbpm.shared.services.impl.TransactionalCommandService in project jbpm by kiegroup.
the class CaseConfigurationDeploymentListener method onDeploy.
@Override
public void onDeploy(DeploymentEvent event) {
InternalRuntimeManager runtimeManager = (InternalRuntimeManager) event.getDeployedUnit().getRuntimeManager();
if (runtimeManager instanceof PerCaseRuntimeManager) {
List<CaseEventListener> caseEventListeners = getEventListenerFromDescriptor(runtimeManager);
logger.debug("Adding following case event listeners {} for deployment {}", caseEventListeners, event.getDeploymentId());
TransactionalCommandService commandService = transactionalCommandService;
if (commandService == null) {
commandService = new TransactionalCommandService(((SimpleRuntimeEnvironment) runtimeManager.getEnvironment()).getEmf());
}
CaseInstanceAuditEventListener auditEventListener = new CaseInstanceAuditEventListener(commandService);
caseEventListeners.add(auditEventListener);
caseEventListeners.add(new NotifyParentCaseEventListener(identityProvider));
CaseEventSupport caseEventSupport = new CaseEventSupport(identityProvider, caseEventListeners);
((PerCaseRuntimeManager) runtimeManager).setCaseEventSupport(caseEventSupport);
logger.debug("CaseEventSupport configured for deployment {}", event.getDeploymentId());
}
}
Aggregations