Search in sources :

Example 6 with TransactionalCommandService

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));
}
Also used : DeploymentStore(org.jbpm.kie.services.impl.store.DeploymentStore) TransactionalCommandService(org.jbpm.shared.services.impl.TransactionalCommandService) Before(org.junit.Before)

Example 7 with TransactionalCommandService

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);
}
Also used : ArrayList(java.util.ArrayList) KieServices(org.kie.api.KieServices) ReleaseId(org.kie.api.builder.ReleaseId) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) FileOutputStream(java.io.FileOutputStream) KieMavenRepository.getKieMavenRepository(org.kie.scanner.KieMavenRepository.getKieMavenRepository) KieMavenRepository(org.kie.scanner.KieMavenRepository) TransactionalCommandService(org.jbpm.shared.services.impl.TransactionalCommandService) File(java.io.File) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 8 with TransactionalCommandService

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(""));
}
Also used : ArrayList(java.util.ArrayList) KieServices(org.kie.api.KieServices) ReleaseId(org.kie.api.builder.ReleaseId) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) TaskNotFoundException(org.jbpm.services.api.TaskNotFoundException) FileOutputStream(java.io.FileOutputStream) KieMavenRepository.getKieMavenRepository(org.kie.scanner.KieMavenRepository.getKieMavenRepository) KieMavenRepository(org.kie.scanner.KieMavenRepository) TransactionalCommandService(org.jbpm.shared.services.impl.TransactionalCommandService) File(java.io.File) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 9 with TransactionalCommandService

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);
}
Also used : DeploymentStore(org.jbpm.kie.services.impl.store.DeploymentStore) DeploymentSyncInvoker(org.jbpm.kie.services.impl.store.DeploymentSyncInvoker) DeploymentSynchronizer(org.jbpm.kie.services.impl.store.DeploymentSynchronizer) TransactionalCommandService(org.jbpm.shared.services.impl.TransactionalCommandService)

Example 10 with TransactionalCommandService

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());
    }
}
Also used : SimpleRuntimeEnvironment(org.jbpm.runtime.manager.impl.SimpleRuntimeEnvironment) InternalRuntimeManager(org.kie.internal.runtime.manager.InternalRuntimeManager) PerCaseRuntimeManager(org.jbpm.runtime.manager.impl.PerCaseRuntimeManager) CaseInstanceAuditEventListener(org.jbpm.casemgmt.impl.audit.CaseInstanceAuditEventListener) TransactionalCommandService(org.jbpm.shared.services.impl.TransactionalCommandService) NotifyParentCaseEventListener(org.jbpm.casemgmt.impl.wih.NotifyParentCaseEventListener) CaseEventListener(org.jbpm.casemgmt.api.event.CaseEventListener) NotifyParentCaseEventListener(org.jbpm.casemgmt.impl.wih.NotifyParentCaseEventListener)

Aggregations

TransactionalCommandService (org.jbpm.shared.services.impl.TransactionalCommandService)14 Produces (javax.enterprise.inject.Produces)4 DeploymentStore (org.jbpm.kie.services.impl.store.DeploymentStore)3 Before (org.junit.Before)3 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 EntityManagerFactory (javax.persistence.EntityManagerFactory)2 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)2 FormManagerServiceImpl (org.jbpm.kie.services.impl.FormManagerServiceImpl)2 KModuleDeploymentService (org.jbpm.kie.services.impl.KModuleDeploymentService)2 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)2 ProcessServiceImpl (org.jbpm.kie.services.impl.ProcessServiceImpl)2 RuntimeDataServiceImpl (org.jbpm.kie.services.impl.RuntimeDataServiceImpl)2 UserTaskServiceImpl (org.jbpm.kie.services.impl.UserTaskServiceImpl)2 BPMN2DataServiceImpl (org.jbpm.kie.services.impl.bpmn2.BPMN2DataServiceImpl)2 QueryServiceImpl (org.jbpm.kie.services.impl.query.QueryServiceImpl)2 DeploymentSyncInvoker (org.jbpm.kie.services.impl.store.DeploymentSyncInvoker)2