Java Code Examples for org.activiti.engine.impl.persistence.entity.TaskEntity#setName()

The following examples show how to use org.activiti.engine.impl.persistence.entity.TaskEntity#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestActivitiEntityEventTaskListener.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected Task copy(Task aTask) {
  TaskEntity ent = Context.getCommandContext().getTaskEntityManager().create();
	ent.setId(aTask.getId());
	ent.setName(aTask.getName());
	ent.setDescription(aTask.getDescription());
	ent.setOwner(aTask.getOwner());
	ent.setDueDate(aTask.getDueDate());
	ent.setAssignee(aTask.getAssignee());
	ent.setPriority(aTask.getPriority());
	return ent;
}
 
Example 2
Source File: TestFlowableEntityEventTaskListener.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
private Task copy(Task aTask) {
    TaskEntity ent = TaskEntity.create(aTask.getCreateTime());
    ent.setId(aTask.getId());
    ent.setName(aTask.getName());
    ent.setDescription(aTask.getDescription());
    ent.setOwner(aTask.getOwner());
    ent.setDueDateWithoutCascade(aTask.getDueDate());
    ent.setAssignee(aTask.getAssignee());
    ent.setPriority(aTask.getPriority());
    return ent;
}
 
Example 3
Source File: ModifyTaskNameCmd.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public Task execute(CommandContext commandContext) {
    TaskEntityManager taskEntityManager = commandContext.getTaskEntityManager();
    TaskEntity task = taskEntityManager.findTaskById(taskId);
    task.setName(taskName);
    task.update();
    return task;
}
 
Example 4
Source File: CompleteNotice.java    From lemon with Apache License 2.0 4 votes vote down vote up
public void processComplete(DelegateTask delegateTask,
        BpmConfNotice bpmConfNotice) {
    UserConnector userConnector = ApplicationContextHelper
            .getBean(UserConnector.class);
    NotificationConnector notificationConnector = ApplicationContextHelper
            .getBean(NotificationConnector.class);

    //
    Map<String, Object> data = new HashMap<String, Object>();
    TaskEntity taskEntity = new TaskEntity();
    taskEntity.setId(delegateTask.getId());
    taskEntity.setName(delegateTask.getName());
    taskEntity.setAssigneeWithoutCascade(userConnector.findById(
            delegateTask.getAssignee()).getDisplayName());
    taskEntity.setVariableLocal("initiator",
            getInitiator(userConnector, delegateTask));

    //
    data.put("task", taskEntity);
    data.put("initiator", this.getInitiator(userConnector, delegateTask));

    String receiver = bpmConfNotice.getReceiver();

    /*
     * BpmMailTemplate bpmMailTemplate = bpmConfNotice.getBpmMailTemplate(); ExpressionManager expressionManager =
     * Context .getProcessEngineConfiguration().getExpressionManager();
     */
    UserDTO userDto = null;

    if ("任务接收人".equals(receiver)) {
        userDto = userConnector.findById(delegateTask.getAssignee());
    } else if ("流程发起人".equals(receiver)) {
        userDto = userConnector.findById((String) delegateTask
                .getVariables().get("initiator"));
    } else {
        HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
                .getCommandContext()
                .getHistoricProcessInstanceEntityManager()
                .findHistoricProcessInstance(
                        delegateTask.getProcessInstanceId());
        userDto = userConnector.findById(historicProcessInstanceEntity
                .getStartUserId());
    }

    /*
     * String subject = expressionManager .createExpression(bpmMailTemplate.getSubject())
     * .getValue(taskEntity).toString();
     * 
     * String content = expressionManager .createExpression(bpmMailTemplate.getContent())
     * .getValue(taskEntity).toString(); this.sendMail(userDto, subject, content); this.sendSiteMessage(userDto,
     * subject, content);
     */
    NotificationDTO notificationDto = new NotificationDTO();
    notificationDto.setReceiver(userDto.getId());
    notificationDto.setReceiverType("userid");
    notificationDto.setTypes(Arrays.asList(bpmConfNotice
            .getNotificationType().split(",")));
    notificationDto.setData(data);
    notificationDto.setTemplate(bpmConfNotice.getTemplateCode());
    notificationConnector.send(notificationDto, delegateTask.getTenantId());
}
 
Example 5
Source File: ArrivalNotice.java    From lemon with Apache License 2.0 4 votes vote down vote up
public void processArrival(DelegateTask delegateTask,
        BpmConfNotice bpmConfNotice) {
    UserConnector userConnector = ApplicationContextHelper
            .getBean(UserConnector.class);
    NotificationConnector notificationConnector = ApplicationContextHelper
            .getBean(NotificationConnector.class);

    //
    Map<String, Object> data = new HashMap<String, Object>();

    TaskEntity taskEntity = new TaskEntity();
    taskEntity.setId(delegateTask.getId());
    taskEntity.setName(delegateTask.getName());
    taskEntity.setAssigneeWithoutCascade(userConnector.findById(
            delegateTask.getAssignee()).getDisplayName());
    taskEntity.setVariableLocal("initiator",
            getInitiator(userConnector, delegateTask));
    logger.debug("initiator : {}", delegateTask.getVariable("initator"));
    logger.debug("variables : {}", delegateTask.getVariables());
    //
    data.put("task", taskEntity);
    data.put("initiator", this.getInitiator(userConnector, delegateTask));

    String receiver = bpmConfNotice.getReceiver();

    /*
     * BpmMailTemplate bpmMailTemplate = bpmConfNotice.getBpmMailTemplate(); ExpressionManager expressionManager =
     * Context .getProcessEngineConfiguration().getExpressionManager();
     */
    UserDTO userDto = null;

    /*
     * String subject = expressionManager .createExpression(bpmMailTemplate.getSubject())
     * .getValue(taskEntity).toString();
     * 
     * String content = expressionManager .createExpression(bpmMailTemplate.getContent())
     * .getValue(taskEntity).toString();
     */
    if ("任务接收人".equals(receiver)) {
        userDto = userConnector.findById(delegateTask.getAssignee());
    } else if ("流程发起人".equals(receiver)) {
        userDto = userConnector.findById((String) delegateTask
                .getVariables().get("initiator"));
    } else {
        HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
                .getCommandContext()
                .getHistoricProcessInstanceEntityManager()
                .findHistoricProcessInstance(
                        delegateTask.getProcessInstanceId());
        userDto = userConnector.findById(historicProcessInstanceEntity
                .getStartUserId());
    }

    // this.sendMail(userDto, subject, content);
    // this.sendSiteMessage(userDto, subject, content);
    NotificationDTO notificationDto = new NotificationDTO();
    notificationDto.setReceiver(userDto.getId());
    notificationDto.setReceiverType("userid");
    notificationDto.setTypes(Arrays.asList(bpmConfNotice
            .getNotificationType().split(",")));
    notificationDto.setData(data);
    notificationDto.setTemplate(bpmConfNotice.getTemplateCode());
    notificationConnector.send(notificationDto, delegateTask.getTenantId());
}
 
Example 6
Source File: TimeoutNotice.java    From lemon with Apache License 2.0 4 votes vote down vote up
public void processTimeout(DelegateTask delegateTask,
        BpmConfNotice bpmConfNotice) {
    try {
        Date dueDate = delegateTask.getDueDate();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(dueDate);

        DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
        Duration duration = datatypeFactory.newDuration("-"
                + bpmConfNotice.getDueDate());
        duration.addTo(calendar);

        Date noticeDate = calendar.getTime();
        Date now = new Date();

        if ((now.getTime() < noticeDate.getTime())
                && ((noticeDate.getTime() - now.getTime()) < (60 * 1000))) {
            UserConnector userConnector = ApplicationContextHelper
                    .getBean(UserConnector.class);
            NotificationConnector notificationConnector = ApplicationContextHelper
                    .getBean(NotificationConnector.class);

            //
            Map<String, Object> data = new HashMap<String, Object>();
            TaskEntity taskEntity = new TaskEntity();
            taskEntity.setId(delegateTask.getId());
            taskEntity.setName(delegateTask.getName());
            taskEntity.setAssigneeWithoutCascade(userConnector.findById(
                    delegateTask.getAssignee()).getDisplayName());
            taskEntity.setVariableLocal("initiator",
                    getInitiator(userConnector, delegateTask));
            //
            data.put("task", taskEntity);
            data.put("initiator",
                    this.getInitiator(userConnector, delegateTask));

            String receiver = bpmConfNotice.getReceiver();

            /*
             * BpmMailTemplate bpmMailTemplate = bpmConfNotice .getBpmMailTemplate(); ExpressionManager
             * expressionManager = Context .getProcessEngineConfiguration().getExpressionManager();
             */
            UserDTO userDto = null;

            if ("任务接收人".equals(receiver)) {
                userDto = userConnector
                        .findById(delegateTask.getAssignee());
            } else if ("流程发起人".equals(receiver)) {
                userDto = userConnector.findById((String) delegateTask
                        .getVariables().get("initiator"));
            } else {
                HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
                        .getCommandContext()
                        .getHistoricProcessInstanceEntityManager()
                        .findHistoricProcessInstance(
                                delegateTask.getProcessInstanceId());
                userDto = userConnector
                        .findById(historicProcessInstanceEntity
                                .getStartUserId());
            }

            /*
             * String subject = expressionManager .createExpression(bpmMailTemplate.getSubject())
             * .getValue(taskEntity).toString();
             * 
             * String content = expressionManager .createExpression(bpmMailTemplate.getContent())
             * .getValue(taskEntity).toString();
             * 
             * this.sendMail(userDto, subject, content); this.sendSiteMessage(userDto, subject, content);
             */
            NotificationDTO notificationDto = new NotificationDTO();
            notificationDto.setReceiver(userDto.getId());
            notificationDto.setReceiverType("userid");
            notificationDto.setTypes(Arrays.asList(bpmConfNotice
                    .getNotificationType().split(",")));
            notificationDto.setData(data);
            notificationDto.setTemplate(bpmConfNotice.getTemplateCode());

            notificationConnector.send(notificationDto,
                    delegateTask.getTenantId());
        }
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
    }
}