Search in sources :

Example 31 with JBossUserGroupCallbackImpl

use of org.jbpm.services.task.identity.JBossUserGroupCallbackImpl in project jbpm by kiegroup.

the class HumanTaskResolver method getRuntimeManager.

private RuntimeManager getRuntimeManager(String process, int i) {
    Properties properties = new Properties();
    properties.setProperty("krisv", "");
    properties.setProperty("sales-rep", "sales");
    properties.setProperty("john", "PM");
    KnowledgeBuilder knowledgeBuilder = createKBuilder(process, ResourceType.BPMN2);
    KieBase kieBase = knowledgeBuilder.newKieBase();
    UserGroupCallback userGroupCallback = new JBossUserGroupCallbackImpl(properties);
    // load up the knowledge base
    TimerServiceRegistry.getInstance();
    RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().userGroupCallback(userGroupCallback).persistence(true).entityManagerFactory(emf).knowledgeBase(kieBase).get();
    return RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment, "id-" + i);
}
Also used : KnowledgeBuilder(org.kie.internal.builder.KnowledgeBuilder) RuntimeEnvironment(org.kie.api.runtime.manager.RuntimeEnvironment) KieBase(org.kie.api.KieBase) JBossUserGroupCallbackImpl(org.jbpm.services.task.identity.JBossUserGroupCallbackImpl) Properties(java.util.Properties) UserGroupCallback(org.kie.internal.task.api.UserGroupCallback)

Example 32 with JBossUserGroupCallbackImpl

use of org.jbpm.services.task.identity.JBossUserGroupCallbackImpl in project jbpm by kiegroup.

the class JBPMHelper method getUserGroupCallback.

@Deprecated
@SuppressWarnings("unchecked")
public static UserGroupCallback getUserGroupCallback() {
    Properties properties = getProperties();
    String className = properties.getProperty("taskservice.usergroupcallback");
    if (className != null) {
        try {
            Class<UserGroupCallback> clazz = (Class<UserGroupCallback>) Class.forName(className);
            return clazz.newInstance();
        } catch (Exception e) {
            throw new IllegalArgumentException("Cannot create instance of UserGroupCallback " + className, e);
        }
    } else {
        return new JBossUserGroupCallbackImpl("classpath:/usergroups.properties");
    }
}
Also used : JBossUserGroupCallbackImpl(org.jbpm.services.task.identity.JBossUserGroupCallbackImpl) Properties(java.util.Properties) UserGroupCallback(org.kie.api.task.UserGroupCallback)

Example 33 with JBossUserGroupCallbackImpl

use of org.jbpm.services.task.identity.JBossUserGroupCallbackImpl in project jbpm by kiegroup.

the class JbpmJUnitTestCase method createKnowledgeBase.

protected KieBase createKnowledgeBase(Map<String, ResourceType> resources) {
    RuntimeEnvironmentBuilder builder = null;
    if (!setupDataSource) {
        builder = RuntimeEnvironmentBuilder.Factory.get().newEmptyBuilder().addConfiguration("drools.processSignalManagerFactory", DefaultSignalManagerFactory.class.getName()).addConfiguration("drools.processInstanceManagerFactory", DefaultProcessInstanceManagerFactory.class.getName());
    } else if (sessionPersistence) {
        builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder();
    } else {
        builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultInMemoryBuilder();
    }
    builder.userGroupCallback(new JBossUserGroupCallbackImpl("classpath:/usergroups.properties"));
    for (Map.Entry<String, ResourceType> entry : resources.entrySet()) {
        builder.addAsset(ResourceFactory.newClassPathResource(entry.getKey()), entry.getValue());
    }
    environment = builder.get();
    return environment.getKieBase();
}
Also used : JBossUserGroupCallbackImpl(org.jbpm.services.task.identity.JBossUserGroupCallbackImpl) DefaultSignalManagerFactory(org.jbpm.process.instance.event.DefaultSignalManagerFactory) ResourceType(org.kie.api.io.ResourceType) Map(java.util.Map) HashMap(java.util.HashMap) RuntimeEnvironmentBuilder(org.kie.api.runtime.manager.RuntimeEnvironmentBuilder)

Example 34 with JBossUserGroupCallbackImpl

use of org.jbpm.services.task.identity.JBossUserGroupCallbackImpl in project jbpm by kiegroup.

the class PerCaseRuntimeManagerTest method setup.

@Before
public void setup() {
    Properties properties = new Properties();
    properties.setProperty("mary", "HR");
    properties.setProperty("john", "HR");
    userGroupCallback = new JBossUserGroupCallbackImpl(properties);
    pds = TestUtil.setupPoolingDataSource();
    emf = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.persistence.jpa");
}
Also used : JBossUserGroupCallbackImpl(org.jbpm.services.task.identity.JBossUserGroupCallbackImpl) Properties(java.util.Properties) Before(org.junit.Before)

Example 35 with JBossUserGroupCallbackImpl

use of org.jbpm.services.task.identity.JBossUserGroupCallbackImpl in project jbpm by kiegroup.

the class PerProcessInstanceRuntimeManagerTest method setup.

@Before
public void setup() {
    Properties properties = new Properties();
    properties.setProperty("mary", "HR");
    properties.setProperty("john", "HR");
    userGroupCallback = new JBossUserGroupCallbackImpl(properties);
    pds = TestUtil.setupPoolingDataSource();
    emf = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.persistence.jpa");
}
Also used : JBossUserGroupCallbackImpl(org.jbpm.services.task.identity.JBossUserGroupCallbackImpl) Properties(java.util.Properties) Before(org.junit.Before)

Aggregations

JBossUserGroupCallbackImpl (org.jbpm.services.task.identity.JBossUserGroupCallbackImpl)41 Properties (java.util.Properties)38 Before (org.junit.Before)29 HashMap (java.util.HashMap)8 UserGroupCallback (org.kie.api.task.UserGroupCallback)8 Test (org.junit.Test)7 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)7 ArrayList (java.util.ArrayList)6 KieSession (org.kie.api.runtime.KieSession)6 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)6 WorkflowProcessInstance (org.jbpm.workflow.instance.WorkflowProcessInstance)5 NodeLeftCountDownProcessEventListener (org.jbpm.test.listener.NodeLeftCountDownProcessEventListener)4 DefaultProcessEventListener (org.kie.api.event.process.DefaultProcessEventListener)4 ProcessEventListener (org.kie.api.event.process.ProcessEventListener)4 ProcessNodeLeftEvent (org.kie.api.event.process.ProcessNodeLeftEvent)4 RuntimeEnvironment (org.kie.api.runtime.manager.RuntimeEnvironment)4 Status (org.kie.api.task.model.Status)4 TaskSummary (org.kie.api.task.model.TaskSummary)4 UserTransaction (javax.transaction.UserTransaction)3 SessionNotFoundException (org.kie.internal.runtime.manager.SessionNotFoundException)3