Search in sources :

Example 46 with UserGroupCallback

use of org.kie.api.task.UserGroupCallback in project jbpm by kiegroup.

the class LDAPUserGroupCallbackImplTest method testGroupExistsDefaultProperties.

@Test
public void testGroupExistsDefaultProperties() {
    UserGroupCallback ldapUserGroupCallback = createLdapUserGroupCallback(Configuration.DEFAULT);
    Assertions.assertThat(ldapUserGroupCallback).isNotNull();
    boolean groupExists = ldapUserGroupCallback.existsGroup("manager");
    Assertions.assertThat(groupExists).isTrue();
}
Also used : UserGroupCallback(org.kie.api.task.UserGroupCallback) Test(org.junit.Test)

Example 47 with UserGroupCallback

use of org.kie.api.task.UserGroupCallback in project jbpm by kiegroup.

the class UserTaskPotOwnerQueryBuilder method build.

@Override
public ColumnFilter build() {
    // return null if it was already invoked
    if (built) {
        return null;
    }
    String columnName = "potOwner";
    UserGroupCallback userGroupCallback = UserDataServiceProvider.getUserGroupCallback();
    List<String> potOwners = (List<String>) parameters.get(columnName);
    List<String> potOwnersList = new ArrayList<String>();
    for (String potOwner : potOwners) {
        potOwnersList.add(potOwner);
        List<String> groups = userGroupCallback.getGroupsForUser(potOwner);
        if (groups != null) {
            potOwnersList.addAll(groups);
        }
    }
    ColumnFilter filter = FilterFactory.AND(FilterFactory.in(columnName, potOwnersList));
    filter.setColumnId(columnName);
    built = true;
    return filter;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ColumnFilter(org.dashbuilder.dataset.filter.ColumnFilter) UserGroupCallback(org.kie.api.task.UserGroupCallback)

Aggregations

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