本文整理汇总了Java中org.activiti.engine.delegate.DelegateTask类的典型用法代码示例。如果您正苦于以下问题:Java DelegateTask类的具体用法?Java DelegateTask怎么用?Java DelegateTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DelegateTask类属于org.activiti.engine.delegate包,在下文中一共展示了DelegateTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notify
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public void notify(DelegateTask task)
{
// Check all mandatory properties are set. This is checked here instead of in
// the completeTask() to allow taskListeners to set variable values before checking
propertyConverter.checkMandatoryProperties(task);
// Set properties for ended task
Map<String, Object> endTaskVariables = new HashMap<String, Object>();
// Set task status to completed
String statusKey = qNameConverter.mapQNameToName(WorkflowModel.PROP_STATUS);
endTaskVariables.put(statusKey, "Completed");
// Add pooled actors to task-variables to be preserved in history (if any)
addPooledActorsAsVariable(task, endTaskVariables);
// Set variables locally on the task
task.setVariablesLocal(endTaskVariables);
}
示例2: createHumanTask
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
public HumanTaskDTO createHumanTask(DelegateTask delegateTask)
throws Exception {
HumanTaskDTO humanTaskDto = new HumanTaskBuilder()
.setDelegateTask(delegateTask)
.setVote(this.isVote(delegateTask)).build();
humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);
logger.debug("candidates : {}", delegateTask.getCandidates());
for (IdentityLink identityLink : delegateTask.getCandidates()) {
String type = identityLink.getType();
ParticipantDTO participantDto = new ParticipantDTO();
participantDto.setType(type);
participantDto.setHumanTaskId(humanTaskDto.getId());
if ("user".equals(type)) {
participantDto.setCode(identityLink.getUserId());
} else {
participantDto.setCode(identityLink.getGroupId());
}
humanTaskConnector.saveParticipant(participantDto);
}
return humanTaskDto;
}
示例3: updateTaskCandidates
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
private void updateTaskCandidates(DelegateTask task, UserAndGroupUpdates updates)
{
// Only new candidates are present in pooledUsers and pooledGroups, create Links for these
for (String user : updates.getUsers())
{
task.addCandidateUser( user);
}
for (String group : updates.getGroups())
{
task.addCandidateGroup( group);
}
// Remove all candidates which have been removed
for (IdentityLink link : updates.linksToRemove)
{
if (link.getUserId() != null)
{
task.deleteUserIdentityLink(link.getUserId(), link.getType());
}
else
{
task.deleteGroupIdentityLink(link.getGroupId(), link.getType());
}
}
}
示例4: notify
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public void notify(DelegateTask task)
{
// Set all default properties, based on the type-definition
propertyConverter.setDefaultTaskProperties(task);
String taskFormKey = getFormKey(task);
// Fetch definition and extract name again. Possible that the default is used if the provided is missing
TypeDefinition typeDefinition = propertyConverter.getWorkflowObjectFactory().getTaskTypeDefinition(taskFormKey, false);
taskFormKey = typeDefinition.getName().toPrefixString();
// The taskDefinition key is set as a variable in order to be available
// in the history
task.setVariableLocal(ActivitiConstants.PROP_TASK_FORM_KEY, taskFormKey);
// Add process initiator as involved person
ActivitiScriptNode initiatorNode = (ActivitiScriptNode) task.getExecution().getVariable(WorkflowConstants.PROP_INITIATOR);
if(initiatorNode != null) {
task.addUserIdentityLink((String) initiatorNode.getProperties().get(ContentModel.PROP_USERNAME.toPrefixString()), IdentityLinkType.STARTER);
}
}
示例5: addPooledActorsAsVariable
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
private void addPooledActorsAsVariable(DelegateTask task,
Map<String, Object> variables)
{
List<IdentityLinkEntity> links = ((TaskEntity)task).getIdentityLinks();
if (links.size() > 0)
{
// Add to list of IdentityLink
List<IdentityLink> identityLinks = new ArrayList<IdentityLink>();
identityLinks.addAll(links);
List<NodeRef> pooledActorRefs = propertyConverter.getPooledActorsReference(identityLinks);
// Save references as a variable
List<String> nodeIds = new ArrayList<String>();
for (NodeRef ref : pooledActorRefs)
{
nodeIds.add(ref.toString());
}
variables.put(ActivitiConstants.PROP_POOLED_ACTORS_HISTORY, nodeIds);
}
}
示例6: processPosition
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
public void processPosition(DelegateTask delegateTask, String value) {
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
String initiator = historicProcessInstanceEntity.getStartUserId();
OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
.getBean(OrgConnector.class);
// 获得发起人的职位
int initiatorLevel = orgConnector.getJobLevelByUserId(initiator);
// 获得审批人的职位
int assigneeLevel = orgConnector.getJobLevelByUserId(delegateTask
.getAssignee());
// 比较
if (initiatorLevel >= assigneeLevel) {
logger.info("skip task : {}", delegateTask.getId());
logger.info("initiatorLevel : {}, assigneeLevel : {}",
initiatorLevel, assigneeLevel);
new CompleteTaskWithCommentCmd(delegateTask.getId(),
Collections.<String, Object> emptyMap(), "高级职位自动跳过")
.execute(Context.getCommandContext());
}
}
示例7: onCreate
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
public void onCreate(DelegateTask delegateTask) throws Exception {
HumanTaskDTO humanTaskDto = null;
// 根据delegateTask创建HumanTaskDTO
try {
DelegateTaskHolder.setDelegateTask(delegateTask);
humanTaskDto = this.createHumanTask(delegateTask);
// 任务抄送
this.checkCopyHumanTask(delegateTask, humanTaskDto);
} finally {
DelegateTaskHolder.clear();
}
if (humanTaskDto != null) {
delegateTask.setAssignee(humanTaskDto.getAssignee());
delegateTask.setOwner(humanTaskDto.getOwner());
}
}
示例8: onComplete
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
/**
* 如果直接完成了activiti的task,要同步完成HumanTask.
*/
public void onComplete(DelegateTask delegateTask) throws Exception {
HumanTaskDTO humanTaskDto = humanTaskConnector
.findHumanTaskByTaskId(delegateTask.getId());
if ("complete".equals(humanTaskDto.getStatus())) {
return;
}
humanTaskDto.setStatus("complete");
humanTaskDto.setCompleteTime(new Date());
if ("start".equals(humanTaskDto.getCatalog())) {
humanTaskDto.setAction("提交");
} else {
humanTaskDto.setAction("完成");
}
humanTaskConnector.saveHumanTask(humanTaskDto, false);
}
示例9: onDelete
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
public void onDelete(DelegateTask delegateTask) throws Exception {
HumanTaskDTO humanTaskDto = humanTaskConnector
.findHumanTaskByTaskId(delegateTask.getId());
if (humanTaskDto == null) {
return;
}
if ("complete".equals(humanTaskDto.getStatus())) {
return;
}
humanTaskDto.setStatus("delete");
humanTaskDto.setCompleteTime(new Date());
humanTaskDto.setAction("人工终止");
humanTaskDto.setOwner(humanTaskDto.getAssignee());
humanTaskDto.setAssignee(Authentication.getAuthenticatedUserId());
humanTaskConnector.saveHumanTask(humanTaskDto, false);
}
示例10: onCreate
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public void onCreate(DelegateTask delegateTask) throws Exception {
HumanTaskDTO humanTaskDto = null;
// 根据delegateTask创建HumanTaskDTO
try {
DelegateTaskHolder.setDelegateTask(delegateTask);
humanTaskDto = this.createHumanTask(delegateTask);
// 任务抄送
this.checkCopyHumanTask(delegateTask, humanTaskDto);
} finally {
DelegateTaskHolder.clear();
}
if (humanTaskDto != null) {
delegateTask.setAssignee(humanTaskDto.getAssignee());
delegateTask.setOwner(humanTaskDto.getOwner());
}
}
示例11: onComplete
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
/**
* 如果直接完成了activiti的task,要同步完成HumanTask.
*/
@Override
public void onComplete(DelegateTask delegateTask) throws Exception {
HumanTaskDTO humanTaskDto = humanTaskConnector
.findHumanTaskByTaskId(delegateTask.getId());
if ("complete".equals(humanTaskDto.getStatus())) {
return;
}
humanTaskDto.setStatus("complete");
humanTaskDto.setCompleteTime(new Date());
humanTaskDto.setAction("完成");
humanTaskConnector.saveHumanTask(humanTaskDto, false);
}
示例12: onDelete
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
@Override
public void onDelete(DelegateTask delegateTask) throws Exception {
HumanTaskDTO humanTaskDto = humanTaskConnector
.findHumanTaskByTaskId(delegateTask.getId());
if (humanTaskDto == null) {
return;
}
if (!"complete".equals(humanTaskDto.getStatus())) {
humanTaskDto.setStatus("delete");
humanTaskDto.setCompleteTime(new Date());
humanTaskDto.setAction("人工终止");
humanTaskDto.setOwner(humanTaskDto.getAssignee());
humanTaskDto.setAssignee(Authentication.getAuthenticatedUserId());
humanTaskConnector.saveHumanTask(humanTaskDto, false);
}
}
示例13: process
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
public void process(DelegateTask delegateTask) {
if (delegateTask.getAssignee() == null) {
return;
}
String taskDefinitionKey = delegateTask.getTaskDefinitionKey();
String processDefinitionId = delegateTask.getProcessDefinitionId();
List<BpmConfNotice> bpmConfNotices = ApplicationContextHelper
.getBean(BpmConfNoticeManager.class)
.find("from BpmConfNotice where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
processDefinitionId, taskDefinitionKey);
for (BpmConfNotice bpmConfNotice : bpmConfNotices) {
if (TYPE_ARRIVAL == bpmConfNotice.getType()) {
processArrival(delegateTask, bpmConfNotice);
}
}
}
示例14: createHumanTask
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
/**
* 创建humanTask.
*/
public HumanTaskDTO createHumanTask(DelegateTask delegateTask,
HistoricTaskInstanceEntity historicTaskInstanceEntity)
throws Exception {
HumanTaskConnector humanTaskConnector = ApplicationContextHelper
.getBean(HumanTaskConnector.class);
HumanTaskDTO humanTaskDto = new HumanTaskBuilder().setDelegateTask(
delegateTask).build();
if ("发起流程".equals(historicTaskInstanceEntity.getDeleteReason())) {
humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START);
}
HistoricProcessInstance historicProcessInstance = Context
.getCommandContext()
.getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(
delegateTask.getProcessInstanceId());
humanTaskDto
.setProcessStarter(historicProcessInstance.getStartUserId());
humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);
return humanTaskDto;
}
示例15: createHumanTask
import org.activiti.engine.delegate.DelegateTask; //导入依赖的package包/类
public HumanTaskDTO createHumanTask(DelegateTask delegateTask,
HistoricTaskInstanceEntity historicTaskInstanceEntity)
throws Exception {
HumanTaskConnector humanTaskConnector = ApplicationContextHelper
.getBean(HumanTaskConnector.class);
HumanTaskDTO humanTaskDto = new HumanTaskBuilder().setDelegateTask(
delegateTask).build();
if ("发起流程".equals(historicTaskInstanceEntity.getDeleteReason())) {
humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START);
}
HistoricProcessInstance historicProcessInstance = Context
.getCommandContext()
.getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(
delegateTask.getProcessInstanceId());
humanTaskDto
.setProcessStarter(historicProcessInstance.getStartUserId());
humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);
return humanTaskDto;
}