org.kie.api.task.model.Task.getName()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(16.9k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中org.kie.api.task.model.Task.getName()方法的一些代码示例,展示了Task.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getName()方法的具体详情如下:
包路径:org.kie.api.task.model.Task
类名称:Task
方法名:getName

Task.getName介绍

暂无

代码示例

代码示例来源:origin: kiegroup/jbpm

private String buildDefafultEmailSubject(TaskData taskData,Task task){
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("taskName", task.getName());
    vars.put("processId", taskData.getProcessId());
    String body = (String) TemplateRuntime.eval(defaultEmailSubject, vars);
    return body;
  }
}

代码示例来源:origin: kiegroup/jbpm

private String buildDefafultEmailBody(TaskData taskData,Task task){
  Map<String, Object> vars = new HashMap<String, Object>();
  vars.put("taskName", task.getName());
  vars.put("taskId", task.getId());
  vars.put("deploymentId", taskData.getDeploymentId());
  vars.put("processId", taskData.getProcessId());
  vars.put("processInstanceId", taskData.getProcessInstanceId());
  String body = (String) TemplateRuntime.eval(defaultEmailBody, vars);
  return body;
}

代码示例来源:origin: kiegroup/jbpm

protected void resolveTaskDetailsForTaskProperties(Task task) {
  Map<String, Object> parameters = new HashMap<String, Object>();
  parameters.put("name", task.getName());
  parameters.put("description", task.getDescription());
  parameters.put("subject", task.getSubject());
  parameters.put("formName", ((InternalTask)task).getFormName());
  
  Map<String, Object> replacements = resolveTaskDetails(parameters, task);
  ((InternalTask)task).setName((String) replacements.get("name"));
  ((InternalTask)task).setDescription((String) replacements.get("description"));
  ((InternalTask)task).setSubject((String) replacements.get("subject"));
  ((InternalTask)task).setFormName((String) replacements.get("formName"));
}

代码示例来源:origin: kiegroup/jbpm

/**
 * Generates a queue name that is based on data retrieved from the task. The form of the generated queue name is:
 * Process ID + "_" + Deployment ID + " " + Task Name
 * @param task Source of the data used to generate the queue name
 * @return The generated queue name
 */
protected String getQueueName(Task task) {
  return task.getTaskData().getProcessId() + "_" + task.getTaskData().getDeploymentId() + "_" + task.getName();
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskForwardedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  StringBuilder message = new StringBuilder();
  String entitiesAsString = (ti.getPeopleAssignments().getPotentialOwners()).stream().map(oe -> oe.getId()).collect(Collectors.joining(","));
  message.append("Forward to [" + entitiesAsString + "]");
  TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.FORWARDED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId, message.toString());
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 4);
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskNominatedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.NOMINATED, userId, new Date());
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 4);
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskFailedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
  try {            
    persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.FAILED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId));
    
    AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti);
    if (auditTaskImpl == null) {
      logger.warn("Unable find audit task entry for task id {} '{}', skipping audit task update", ti.getId(), ti.getName());
      return;
    }
    auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
    auditTaskImpl.setActualOwner(getActualOwner(ti));
    auditTaskImpl.setLastModificationDate(event.getEventDate());
    persistenceContext.merge(auditTaskImpl);
  } finally {
    cleanup(persistenceContext);
  }
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskStartedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
  try {
    
    persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.STARTED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId ));
       
    AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti);
    if (auditTaskImpl == null) {
      logger.warn("Unable find audit task entry for task id {} '{}', skipping audit task update", ti.getId(), ti.getName());
      return;
    }
    auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
    auditTaskImpl.setActualOwner(getActualOwner(ti));
    auditTaskImpl.setLastModificationDate(event.getEventDate());
    persistenceContext.merge(auditTaskImpl);
  } finally {
    cleanup(persistenceContext);
  }
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskCompletedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
  try {            
    persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.COMPLETED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId));    
    
    AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti);
    if (auditTaskImpl == null) {
      logger.warn("Unable find audit task entry for task id {} '{}', skipping audit task update", ti.getId(), ti.getName());
      return;
    }
    auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
    auditTaskImpl.setActualOwner(getActualOwner(ti));
    auditTaskImpl.setLastModificationDate(event.getEventDate());
    persistenceContext.merge(auditTaskImpl);
  } finally {
    cleanup(persistenceContext);
  }
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskStoppedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
  try {            
    persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.STOPPED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId));
         
    AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti);
    if (auditTaskImpl == null) {
      logger.warn("Unable find audit task entry for task id {} '{}', skipping audit task update", ti.getId(), ti.getName());
      return;
    }
    auditTaskImpl.setDescription(ti.getDescription());
    auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
    auditTaskImpl.setActualOwner(getActualOwner(ti));
    auditTaskImpl.setLastModificationDate(event.getEventDate());
    persistenceContext.merge(auditTaskImpl);
  } finally {
    cleanup(persistenceContext);
  }
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskActivatedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
  try {            
    persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.ACTIVATED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId));
       
    AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti);
    if (auditTaskImpl == null) {
      logger.warn("Unable find audit task entry for task id {} '{}', skipping audit task update", ti.getId(), ti.getName());
      return;
    }
    auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
    auditTaskImpl.setActualOwner(getActualOwner(ti));
    auditTaskImpl.setDescription(ti.getDescription());    
    auditTaskImpl.setLastModificationDate(event.getEventDate());
    persistenceContext.merge(auditTaskImpl);
  } finally {
    cleanup(persistenceContext);
  }
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskSkippedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
  try {            
    persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.SKIPPED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId));
        AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti);
    if (auditTaskImpl == null) {
      logger.warn("Unable find audit task entry for task id {} '{}', skipping audit task update", ti.getId(), ti.getName());
      return;
    }
    auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
    auditTaskImpl.setActualOwner(getActualOwner(ti));
    auditTaskImpl.setDescription(ti.getDescription());
    auditTaskImpl.setLastModificationDate(event.getEventDate());
    persistenceContext.merge(auditTaskImpl);
    
  } finally {
    cleanup(persistenceContext);
  }
  
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskClaimedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
  try {            
    persistenceContext.persist(new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.CLAIMED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId));
    
    AuditTaskImpl auditTaskImpl = getAuditTask(event, persistenceContext, ti);
    if (auditTaskImpl == null) {
      logger.warn("Unable find audit task entry for task id {} '{}', skipping audit task update", ti.getId(), ti.getName());
      return;
    }
    auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
    auditTaskImpl.setActualOwner(getActualOwner(ti));
    auditTaskImpl.setDescription(ti.getDescription());
    auditTaskImpl.setLastModificationDate(event.getEventDate());
    persistenceContext.merge(auditTaskImpl);
  } finally {
    cleanup(persistenceContext);
  }
}

代码示例来源:origin: kiegroup/jbpm

private void testTaskWithExpectedDescription(final Task task, final String expectedDescription) {
  assertEquals("TaskName " + task.getTaskData().getProcessInstanceId(), task.getName());
  assertEquals(10, task.getPriority().intValue());
  assertEquals(expectedDescription, task.getDescription());
  assertEquals(Status.Reserved, task.getTaskData().getStatus());
  assertEquals("Darth Vader", task.getTaskData().getActualOwner().getId());
  assertEquals(10L, task.getTaskData().getProcessInstanceId());
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskReleasedEvent(TaskEvent event) {        
  Task ti = event.getTask();
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  sendMessage(new AuditTaskData(auditTaskImpl), 8);
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskDelegatedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.DELEGATED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 4);
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskResumedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.RESUMED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 6);
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskExitedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.EXITED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 2);
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskSuspendedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.SUSPENDED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 6);
}

代码示例来源:origin: kiegroup/jbpm

@Override
public void afterTaskReassignedEvent(TaskEvent event) {
  String userId = event.getTaskContext().getUserId();
  Task ti = event.getTask();
  TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.DELEGATED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
      
  AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
  auditTaskImpl.setDescription(ti.getDescription());
  auditTaskImpl.setName(ti.getName());  
  auditTaskImpl.setActivationTime(ti.getTaskData().getActivationTime());
  auditTaskImpl.setPriority(ti.getPriority());
  auditTaskImpl.setDueDate(ti.getTaskData().getExpirationTime());
  auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
  auditTaskImpl.setActualOwner(getActualOwner(ti));
  auditTaskImpl.setLastModificationDate(event.getEventDate());
  
  sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 4);
}

相关文章