Search in sources :

Example 1 with QueryStringCommand

use of org.jbpm.shared.services.impl.commands.QueryStringCommand in project jbpm by kiegroup.

the class CaseInstanceAuditEventListener method afterCaseRoleAssignmentAdded.

@Override
public void afterCaseRoleAssignmentAdded(CaseRoleAssignmentEvent event) {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("caseId", event.getCaseId());
    QueryStringCommand<List<Long>> queryCommand = new QueryStringCommand<List<Long>>(FIND_CASE_PROCESS_INST_ID_QUERY, parameters);
    List<Long> processInstanceId = commandService.execute(queryCommand);
    if (processInstanceId.isEmpty()) {
        return;
    }
    CaseRoleAssignmentLog assignmentLog = new CaseRoleAssignmentLog(processInstanceId.get(0), event.getCaseId(), event.getRole(), event.getEntity());
    commandService.execute(new PersistObjectCommand(assignmentLog));
}
Also used : QueryStringCommand(org.jbpm.shared.services.impl.commands.QueryStringCommand) HashMap(java.util.HashMap) PersistObjectCommand(org.jbpm.shared.services.impl.commands.PersistObjectCommand) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 PersistObjectCommand (org.jbpm.shared.services.impl.commands.PersistObjectCommand)1 QueryStringCommand (org.jbpm.shared.services.impl.commands.QueryStringCommand)1