• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DelegateTask类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.camunda.bpm.engine.delegate.DelegateTask的典型用法代码示例。如果您正苦于以下问题:Java DelegateTask类的具体用法?Java DelegateTask怎么用?Java DelegateTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DelegateTask类属于org.camunda.bpm.engine.delegate包,在下文中一共展示了DelegateTask类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: notifyPool

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
/**
 * Notifies about unassigned (pooled) task.
 *
 * @param task task no notify about
 */
public void notifyPool(DelegateTask task) {
    Set<IdentityLink> links = task.getCandidates();

    links.stream()
            .filter(link -> link.getUserId() != null)
            .map(IdentityLink::getUserId)
            .forEach(username -> {
                UserDetails user = userDetailsService.loadUserById(username);
                notNull(user, () -> new MissingObject(UserDetails.class, username));

                if (hasTaskNotifyEnabled(task)) {
                    mailCenter.sendPoolAssignment(user.getEmail(), task.getExecution().getBusinessKey(),
                            task.getId(), task.getName(), task.getTaskDefinitionKey(),
                            task.getCreateTime().toInstant(),
                            task.getDueDate() != null ? task.getDueDate().toInstant() : null);
                }
            });
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:24,代码来源:NotificationCenter.java


示例2: notifyPoolDueDate

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
/**
 * Notifies about unassigned (pooled) task due date imminent.
 *
 * @param task task no notify about
 */
public void notifyPoolDueDate(DelegateTask task) {
    Set<IdentityLink> links = task.getCandidates();

    links.stream()
            .filter(link -> link.getUserId() != null)
            .map(IdentityLink::getUserId)
            .forEach(username -> {
                UserDetails user = userDetailsService.loadUserById(username);
                notNull(user, () -> new MissingObject(UserDetails.class, username));

                if (hasTaskNotifyEnabled(task)) {
                    mailCenter.sendPoolAssignment(user.getEmail(), task.getExecution().getBusinessKey(),
                            task.getId(), task.getName(), task.getTaskDefinitionKey(),
                            task.getCreateTime().toInstant(),
                            task.getDueDate() != null ? task.getDueDate().toInstant() : null);
                }
            });
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:24,代码来源:NotificationCenter.java


示例3: createCommand

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
protected CreateTaskCommand createCommand(DelegateTask task) {
  return CreateTaskCommand.builder()
    .taskId(task.getId())
    .taskDefinitionKey(task.getTaskDefinitionKey())
    .name(task.getName())
    .description(task.getDescription())
    .priority(task.getPriority())
    .assignee(task.getAssignee())
    .owner(task.getOwner())
    .processInstanceId(task.getProcessInstanceId())
    .caseDefinitionId(task.getCaseDefinitionId())
    .caseExecutionId(task.getCaseExecutionId())
    .createTime(task.getCreateTime())
    .dueDate(task.getDueDate())
    .formKey(getFormKey(task))
    .engineId(appName)
    .eventType(TaskListener.EVENTNAME_CREATE)
    .tenantId(task.getTenantId())
    .build();
}
 
开发者ID:holisticon,项目名称:camunda-bpm-cloud,代码行数:22,代码来源:TaskCreateListener.java


示例4: createCommand

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
protected DeleteTaskCommand createCommand(DelegateTask task) {
  return DeleteTaskCommand.builder()
    .taskId(task.getId())
    .taskDefinitionKey(task.getTaskDefinitionKey())
    .name(task.getName())
    .description(task.getDescription())
    .priority(task.getPriority())
    .assignee(task.getAssignee())
    .owner(task.getOwner())
    .processInstanceId(task.getProcessInstanceId())
    .caseDefinitionId(task.getCaseDefinitionId())
    .caseExecutionId(task.getCaseExecutionId())
    .createTime(task.getCreateTime())
    .dueDate(task.getDueDate())
    .formKey(getFormKey(task))
    .engineId(appName)
    .eventType(TaskListener.EVENTNAME_CREATE)
    .tenantId(task.getTenantId())
    .build();
}
 
开发者ID:holisticon,项目名称:camunda-bpm-cloud,代码行数:22,代码来源:TaskDeleteListener.java


示例5: createCommand

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
protected CompleteTaskCommand createCommand(DelegateTask task) {
  return CompleteTaskCommand.builder()
    .taskId(task.getId())
    .taskDefinitionKey(task.getTaskDefinitionKey())
    .name(task.getName())
    .description(task.getDescription())
    .priority(task.getPriority())
    .assignee(task.getAssignee())
    .owner(task.getOwner())
    .processInstanceId(task.getProcessInstanceId())
    .caseDefinitionId(task.getCaseDefinitionId())
    .caseExecutionId(task.getCaseExecutionId())
    .createTime(task.getCreateTime())
    .dueDate(task.getDueDate())
    .formKey(getFormKey(task))
    .engineId(appName)
    .eventType(TaskListener.EVENTNAME_CREATE)
    .tenantId(task.getTenantId())
    .build();
}
 
开发者ID:holisticon,项目名称:camunda-bpm-cloud,代码行数:22,代码来源:TaskCompleteListener.java


示例6: creates_key_for_task

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Test
public void creates_key_for_task() {
  ProcessDefinition processDefinition = CamundaReactorTestHelper.processDefinition();
  final DelegateTask task = mock(DelegateTask.class, RETURNS_DEEP_STUBS);

  RepositoryService repositoryService = mock(RepositoryService.class);
  when(repositoryService.getProcessDefinition(processDefinition.getId())).thenReturn(processDefinition);
  when(task.getProcessEngineServices().getRepositoryService()).thenReturn(repositoryService);

  when(task.getBpmnModelElementInstance().getElementType().getTypeName()).thenReturn("userTask");
  when(task.getProcessDefinitionId()).thenReturn("process:1:1");

  when(task.getEventName()).thenReturn("create");
  when(task.getTaskDefinitionKey()).thenReturn("task1");

  assertThat(SelectorBuilder.selector(task).key()).isEqualTo("/camunda/task/{type}/process/task1/create");
}
 
开发者ID:camunda,项目名称:camunda-bpm-reactor,代码行数:18,代码来源:SelectorBuilderTest.java


示例7: notify

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public void notify(DelegateTask delegateTask) {
  delegateTask.setDueDate(Process.DUE_DATE);

  delegateTask.addCandidateGroup(Process.GROUP_1);
  delegateTask.addCandidateGroups(Arrays.asList(Process.GROUP_2,Process.GROUP_3));
}
 
开发者ID:camunda,项目名称:camunda-bpm-reactor,代码行数:8,代码来源:TaskCreateListener.java


示例8: taskListenerSetsCandidateGroup

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Test
public void taskListenerSetsCandidateGroup() throws Exception {
  DelegateTask delegateTask = new DelegateTaskFake()
    .withTaskDefinitionKey("the_task")
    .withEventName(EVENTNAME_CREATE)
    .withVariableLocal("nextGroup", "foo");


  TaskListener taskListener = task -> {
    if (EVENTNAME_CREATE.equals(task.getEventName()) && "the_task".equals(task.getTaskDefinitionKey())) {
      task.addCandidateGroup((String) task.getVariableLocal("nextGroup"));
    }
  };

  taskListener.notify(delegateTask);

  assertThat(DelegateTaskFake.candidateGroupIds(delegateTask)).containsOnly("foo");

}
 
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:20,代码来源:DelegateTaskFakeTest.java


示例9: createEvent

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
protected BusinessProcessEvent createEvent(DelegateTask task) {
  ExecutionContext executionContext = Context.getExecutionContext();
  ProcessDefinitionEntity processDefinition = null;
  if (executionContext != null) {
    processDefinition = executionContext.getProcessDefinition();
  }

  // map type
  String eventName = task.getEventName();
  BusinessProcessEventType type = null;
  if (TaskListener.EVENTNAME_CREATE.equals(eventName)) {
    type = BusinessProcessEventType.CREATE_TASK;
  }
  else if (TaskListener.EVENTNAME_ASSIGNMENT.equals(eventName)) {
    type = BusinessProcessEventType.ASSIGN_TASK;
  }
  else if (TaskListener.EVENTNAME_COMPLETE.equals(eventName)) {
    type = BusinessProcessEventType.COMPLETE_TASK;
  }
  else if (TaskListener.EVENTNAME_DELETE.equals(eventName)) {
    type = BusinessProcessEventType.DELETE_TASK;
  }

  return new CdiBusinessProcessEvent(task, processDefinition, type, ClockUtil.getCurrentTime());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:CdiEventListener.java


示例10: notify

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
public void notify(final DelegateTask delegateTask){
  if(delegateTask.getExecution() == null) {
    LOG.taskNotRelatedToExecution(delegateTask);
  } else {
    final DelegateExecution execution = delegateTask.getExecution();
    Callable<Void> notification = new Callable<Void>() {
      public Void call() throws Exception {
        notifyTaskListener(delegateTask);
        return null;
      }
    };
    try {
      performNotification(execution, notification);
    } catch(Exception e) {
      throw LOG.exceptionWhileNotifyingPaTaskListener(e);
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:ProcessApplicationEventListenerDelegate.java


示例11: notifyTaskListener

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
protected void notifyTaskListener(DelegateTask task) throws Exception {
  ProcessApplicationReference processApp = Context.getCurrentProcessApplication();
  try {
    ProcessApplicationInterface processApplication = processApp.getProcessApplication();
    TaskListener taskListener = processApplication.getTaskListener();
    if(taskListener != null) {
      taskListener.notify(task);

    } else {
      LOG.paDoesNotProvideTaskListener(processApp.getName());

    }
  } catch (ProcessApplicationUnavailableException e) {
    // Process Application unavailable => ignore silently
    LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:ProcessApplicationEventListenerDelegate.java


示例12: notify

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
public void notify(DelegateTask delegateTask) {
  // Note: we can't cache the result of the expression, because the
  // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}'

  VariableScope variableScope = delegateTask.getExecution();
  if (variableScope == null) {
    variableScope = delegateTask.getCaseExecution();
  }

  Object delegate = expression.getValue(variableScope);
  applyFieldDeclaration(fieldDeclarations, delegate);

  if (delegate instanceof TaskListener) {
    try {
      Context.getProcessEngineConfiguration()
        .getDelegateInterceptor()
        .handleInvocation(new TaskListenerInvocation((TaskListener)delegate, delegateTask));
    }catch (Exception e) {
      throw new ProcessEngineException("Exception while invoking TaskListener: "+e.getMessage(), e);
    }
  } else {
    throw new ProcessEngineException("Delegate expression " + expression
            + " did not resolve to an implementation of " + TaskListener.class );
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:DelegateExpressionTaskListener.java


示例13: createActivityInstanceUpdateEvt

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public HistoryEvent createActivityInstanceUpdateEvt(DelegateExecution execution, DelegateTask task) {
  final ExecutionEntity executionEntity = (ExecutionEntity) execution;

  // create event instance
  HistoricActivityInstanceEventEntity evt = loadActivityInstanceEventEntity(executionEntity);

  // initialize event
  initActivityInstanceEvent(evt, executionEntity, HistoryEventTypes.ACTIVITY_INSTANCE_UPDATE);

  // update task assignment
  if(task != null) {
    evt.setTaskId(task.getId());
    evt.setTaskAssignee(task.getAssignee());
  }

  return evt;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:DefaultHistoryEventProducer.java


示例14: createTaskInstanceCompleteEvt

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
public HistoryEvent createTaskInstanceCompleteEvt(DelegateTask task, String deleteReason) {

    // create event instance
    HistoricTaskInstanceEventEntity evt = loadTaskInstanceEvent(task);

    // initialize event
    initTaskInstanceEvent(evt, (TaskEntity) task, HistoryEventTypes.TASK_INSTANCE_COMPLETE);

    // set end time
    evt.setEndTime(ClockUtil.getCurrentTime());
    if(evt.getStartTime() != null) {
      evt.setDurationInMillis(evt.getEndTime().getTime()-evt.getStartTime().getTime());
    }

    // set delete reason
    evt.setDeleteReason(deleteReason);

    return evt;
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:DefaultHistoryEventProducer.java


示例15: notify

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
public void notify(DelegateTask task, String event) {
  String eventCounterName = event + "EventCounter";

  Integer eventCounter = (Integer) task.getVariable(eventCounterName);

  if (eventCounter == null) {
    eventCounter = 0;
  }

  Integer counter = (Integer) task.getVariable("eventCounter");

  if (counter == null) {
    counter = 0;
  }

  task.setVariable(event, true);
  task.setVariable(eventCounterName, eventCounter + 1);
  task.setVariable("eventCounter", counter + 1);

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:MyTaskListener.java


示例16: sendMailToExecutors

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
public void sendMailToExecutors(DelegateTask delegateTask) {
    TechOrder techOrder = (TechOrder) delegateTask.getVariable("techorder");
    Letter letter = letterTemplateService.generateCommonForTechOrder(techOrder.getId(), delegateTask.getId());
    String assignee = delegateTask.getAssignee();
    if ((assignee != null) && (!assignee.isEmpty())) {
        mailService.sendMail(assignee, letter.getSubject(), letter.getBody());
    } else {
        Set<String> candidates = delegateTask.getCandidates().stream().map(IdentityLink::getUserId).collect(Collectors.toSet());
        for (String candidate : candidates) {
            mailService.sendMail(candidate, letter.getSubject(), letter.getBody());
        }
    }
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:14,代码来源:TechOrderNotification.java


示例17: adminResult

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
public void adminResult(DelegateTask task, TechOrder techOrder) {
    if (techOrder.getWarehouse()) {
        ProcessHelper.createComment(task, historyMessages.getToAdminInWarehouse());
    } else {
        ProcessHelper.createComment(task, historyMessages.getToAdminNewOrder());
    }
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:8,代码来源:TechOrderHistory.java


示例18: notify

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public void notify(DelegateTask delegateTask) {
    TechOrder techOrder = (TechOrder) delegateTask.getVariable("techorder");
    String approve = (String) delegateTask.getVariable("approve");
    String commentMsg;
    if (approve.equals("no")) {
        commentMsg = String.format(historyMessages.getToStatusDeclined(), techOrder.getDeclineReason());
        this.orgStructure.getUsers().stream()
                .filter(user -> delegateTask.getAssignee().equals(user.getEmail())).findFirst()
                .ifPresent(techOrder::setDeclineUser);
    } else {
        commentMsg = historyMessages.getToStatusApproved();
    }
    ProcessHelper.createComment(delegateTask, commentMsg);
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:16,代码来源:TechOrderReject.java


示例19: notify

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public void notify(DelegateTask delegateTask) {
    String processReaders = (String) delegateTask.getVariable("processReaders");
    if ((processReaders != null) && (!processReaders.isEmpty())) {
        for (String processReader : processReaders.split(",")) {
            setReader(processReader, delegateTask);
        }
    }
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:10,代码来源:CreateTaskListener.java


示例20: setReader

import org.camunda.bpm.engine.delegate.DelegateTask; //导入依赖的package包/类
private void setReader(String user, DelegateTask delegateTask) {
    if (!isUserAuthorized(user, delegateTask)) {
        DbEntityManager dbEntityManager = Context.getCommandContext().getSession(DbEntityManager.class);
        AuthorizationEntity newAuthorization = createReadAuthorization(user, delegateTask.getId());
        if (!isAuthExitInDbEntityCache(newAuthorization, dbEntityManager)) {
            dbEntityManager.insert(newAuthorization);
        }
    }
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:10,代码来源:CreateTaskListener.java



注:本文中的org.camunda.bpm.engine.delegate.DelegateTask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InputDirectory类代码示例发布时间:2022-05-22
下一篇:
Java Main类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap