Search in sources :

Example 1 with CaseRoleImpl

use of org.jbpm.casemgmt.impl.model.CaseRoleImpl in project jbpm by kiegroup.

the class CaseRuntimeDataServiceImpl method collectCaseRoles.

private Collection<CaseRole> collectCaseRoles(Process process) {
    String roles = (String) process.getMetaData().get("customCaseRoles");
    if (roles == null) {
        return Collections.emptyList();
    }
    List<CaseRole> result = new ArrayList<CaseRole>();
    String[] roleStrings = roles.split(",");
    for (String roleString : roleStrings) {
        String[] elements = roleString.split(":");
        CaseRoleImpl role = new CaseRoleImpl(elements[0]);
        result.add(role);
        if (elements.length > 1) {
            role.setCardinality(Integer.parseInt(elements[1]));
        }
    }
    return result;
}
Also used : CaseRoleImpl(org.jbpm.casemgmt.impl.model.CaseRoleImpl) CaseRole(org.jbpm.casemgmt.api.model.CaseRole) ArrayList(java.util.ArrayList)

Example 2 with CaseRoleImpl

use of org.jbpm.casemgmt.impl.model.CaseRoleImpl in project jbpm by kiegroup.

the class CommentNotificationEventListenerTest method buildCaseFile.

protected CaseFileInstance buildCaseFile(List<String> mentionedRoles) {
    CaseFileInstanceImpl caseFile = new CaseFileInstanceImpl("CASE-00001", "dummy", new HashMap<>());
    List<CaseRole> roles = mentionedRoles.stream().map(roleName -> new CaseRoleImpl(roleName)).collect(Collectors.toList());
    caseFile.setupRoles(roles);
    caseFile.assignUser("owner", "john");
    caseFile.assignUser("manager", "mary");
    return caseFile;
}
Also used : COMMENT_PARAM(org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.COMMENT_PARAM) CaseRole(org.jbpm.casemgmt.api.model.CaseRole) CaseRoleImpl(org.jbpm.casemgmt.impl.model.CaseRoleImpl) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CREATED_AT_PARAM(org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.CREATED_AT_PARAM) CaseFileInstance(org.jbpm.casemgmt.api.model.instance.CaseFileInstance) Set(java.util.Set) HashMap(java.util.HashMap) Test(org.junit.Test) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) OrganizationalEntity(org.kie.api.task.model.OrganizationalEntity) List(java.util.List) AUTHOR_PARAM(org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.AUTHOR_PARAM) COMMENT_ID_PARAM(org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.COMMENT_ID_PARAM) Map(java.util.Map) CASE_ID_PARAM(org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.CASE_ID_PARAM) CaseCommentEvent(org.jbpm.casemgmt.api.event.CaseCommentEvent) CaseFileInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl) CommentInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CommentInstanceImpl) TestNotificationPublisher(org.jbpm.casemgmt.impl.util.TestNotificationPublisher) User(org.kie.api.task.model.User) CaseRoleImpl(org.jbpm.casemgmt.impl.model.CaseRoleImpl) CaseFileInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl) CaseRole(org.jbpm.casemgmt.api.model.CaseRole)

Aggregations

ArrayList (java.util.ArrayList)2 CaseRole (org.jbpm.casemgmt.api.model.CaseRole)2 CaseRoleImpl (org.jbpm.casemgmt.impl.model.CaseRoleImpl)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 CaseCommentEvent (org.jbpm.casemgmt.api.event.CaseCommentEvent)1 CaseFileInstance (org.jbpm.casemgmt.api.model.instance.CaseFileInstance)1 AUTHOR_PARAM (org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.AUTHOR_PARAM)1 CASE_ID_PARAM (org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.CASE_ID_PARAM)1 COMMENT_ID_PARAM (org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.COMMENT_ID_PARAM)1 COMMENT_PARAM (org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.COMMENT_PARAM)1 CREATED_AT_PARAM (org.jbpm.casemgmt.impl.event.CommentNotificationEventListener.CREATED_AT_PARAM)1 CaseFileInstanceImpl (org.jbpm.casemgmt.impl.model.instance.CaseFileInstanceImpl)1 CommentInstanceImpl (org.jbpm.casemgmt.impl.model.instance.CommentInstanceImpl)1 TestNotificationPublisher (org.jbpm.casemgmt.impl.util.TestNotificationPublisher)1 Test (org.junit.Test)1