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

Java ActivitiListener类代码示例

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

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



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

示例1: parseChildElement

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
  
  listener = new ActivitiListener();
  BpmnXMLUtil.addXMLLocation(listener, xtr);
  if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS))) {
    listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS));
    listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
  } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EXPRESSION))) {
    listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EXPRESSION));
    listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
  } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION))) {
    listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION));
    listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
  } else {
    model.addProblem("Element 'class' or 'expression' is mandatory on executionListener", xtr);
  }
  listener.setEvent(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EVENT));
  
  parseChildElements(xtr, listener, model, new FieldExtensionParser());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:21,代码来源:ActivitiListenerParser.java


示例2: configEvent

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public void configEvent(TaskDefinition taskDefinition, BpmnParse bpmnParse,
        String eventName) {
    ActivitiListener activitiListener = new ActivitiListener();
    activitiListener.setEvent(eventName);
    activitiListener
            .setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
    activitiListener.setImplementation("#{" + taskListenerId + "}");
    taskDefinition
            .addTaskListener(eventName, bpmnParse.getListenerFactory()
                    .createDelegateExpressionTaskListener(activitiListener));
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:12,代码来源:ProxyUserTaskBpmnParseHandler.java


示例3: processListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
/**
 * 配置监听器.
 */
public void processListener(List<ActivitiListener> activitiListeners,
        BpmConfNode bpmConfNode) {
    Map<String, Integer> eventTypeMap = new HashMap<String, Integer>();
    eventTypeMap.put("start", 0);
    eventTypeMap.put("end", 1);
    eventTypeMap.put("take", 2);
    eventTypeMap.put("create", 3);
    eventTypeMap.put("assignment", 4);
    eventTypeMap.put("complete", 5);
    eventTypeMap.put("delete", 6);

    BpmConfListenerManager bpmConfListenerManager = getBpmConfListenerManager();

    for (ActivitiListener activitiListener : activitiListeners) {
        String value = activitiListener.getImplementation();
        int type = eventTypeMap.get(activitiListener.getEvent());
        BpmConfListener bpmConfListener = bpmConfListenerManager
                .findUnique(
                        "from BpmConfListener where value=? and type=? and status=0 and bpmConfNode=?",
                        value, type, bpmConfNode);

        if (bpmConfListener == null) {
            bpmConfListener = new BpmConfListener();
            bpmConfListener.setValue(value);
            bpmConfListener.setType(type);
            bpmConfListener.setBpmConfNode(bpmConfNode);
            bpmConfListenerManager.save(bpmConfListener);
        }
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:34,代码来源:SyncProcessCmd.java


示例4: executeParse

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, UserTask userTask) {
    super.executeParse(bpmnParse, userTask);

    // 实验后不能添加
    ActivitiListener listener = new ActivitiListener();
    listener.setEvent("create");
    listener.setImplementationType("class");
    listener.setImplementation("me.kafeitu.activiti.chapter21.listeners.TaskAutoRedirectListener");
    userTask.getTaskListeners().add(listener);
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:11,代码来源:TaskAutoRedirectParseHandler.java


示例5: createExecutionListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
protected ExecutionListener createExecutionListener(BpmnParse bpmnParse, ActivitiListener activitiListener) {
  ExecutionListener executionListener = null;

  if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equalsIgnoreCase(activitiListener.getImplementationType())) {
    executionListener = bpmnParse.getListenerFactory().createClassDelegateExecutionListener(activitiListener);  
  } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equalsIgnoreCase(activitiListener.getImplementationType())) {
    executionListener = bpmnParse.getListenerFactory().createExpressionExecutionListener(activitiListener);
  } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equalsIgnoreCase(activitiListener.getImplementationType())) {
    executionListener = bpmnParse.getListenerFactory().createDelegateExpressionExecutionListener(activitiListener);
  }
  return executionListener;
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:13,代码来源:AbstractBpmnParseHandler.java


示例6: createTaskListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
protected TaskListener createTaskListener(BpmnParse bpmnParse, ActivitiListener activitiListener, String taskId) {
  TaskListener taskListener = null;

  if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equalsIgnoreCase(activitiListener.getImplementationType())) {
    taskListener = bpmnParse.getListenerFactory().createClassDelegateTaskListener(activitiListener); 
  } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equalsIgnoreCase(activitiListener.getImplementationType())) {
    taskListener = bpmnParse.getListenerFactory().createExpressionTaskListener(activitiListener);
  } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equalsIgnoreCase(activitiListener.getImplementationType())) {
    taskListener = bpmnParse.getListenerFactory().createDelegateExpressionTaskListener(activitiListener);
  } else {
    bpmnParse.getBpmnModel().addProblem("Element 'class', 'expression' or 'delegateExpression' is mandatory on taskListener for task", activitiListener);
  }
  return taskListener;
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:15,代码来源:UserTaskParseHandler.java


示例7: testStartEventWithExecutionListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public void testStartEventWithExecutionListener() throws Exception {
  BpmnModel bpmnModel = new BpmnModel();
  Process process = new Process();
  process.setId("simpleProcess");
  process.setName("Very simple process");
  bpmnModel.getProcesses().add(process);
  StartEvent startEvent = new StartEvent();
  startEvent.setId("startEvent1");
  TimerEventDefinition timerDef = new TimerEventDefinition();
  timerDef.setTimeDuration("PT5M");
  startEvent.getEventDefinitions().add(timerDef);
  ActivitiListener listener = new ActivitiListener();
  listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
  listener.setImplementation("${test}");
  listener.setEvent("end");
  startEvent.getExecutionListeners().add(listener);
  process.addFlowElement(startEvent);
  UserTask task = new UserTask();
  task.setId("reviewTask");
  task.setAssignee("kermit");
  process.addFlowElement(task);
  SequenceFlow flow1 = new SequenceFlow();
  flow1.setId("flow1");
  flow1.setSourceRef("startEvent1");
  flow1.setTargetRef("reviewTask");
  process.addFlowElement(flow1);
  EndEvent endEvent = new EndEvent();
  endEvent.setId("endEvent1");
  process.addFlowElement(endEvent);
  
  byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
  
  new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml)));
  
  Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy();
  repositoryService.deleteDeployment(deployment.getId());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:38,代码来源:EventJavaTest.java


示例8: createExpressionTaskListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
@Override
public TaskListener createExpressionTaskListener(ActivitiListener activitiListener) {
  return new TaskListener() {
    public void notify(DelegateTask delegateTask) {
      CustomListenerFactoryTest.COUNTER.addAndGet(100);
    }
  };
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:9,代码来源:CustomListenerFactory.java


示例9: writeListeners

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
private static boolean writeListeners(String xmlElementName, List<ActivitiListener> listenerList, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
  if (listenerList != null) {
    
    for (ActivitiListener listener : listenerList) {
      
      if (StringUtils.isNotEmpty(listener.getEvent())) {
        
        if (!didWriteExtensionStartElement) { 
          xtw.writeStartElement(ELEMENT_EXTENSIONS);
          didWriteExtensionStartElement = true;
        }
        
        xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, xmlElementName, ACTIVITI_EXTENSIONS_NAMESPACE);
        BpmnXMLUtil.writeDefaultAttribute(ATTRIBUTE_LISTENER_EVENT, listener.getEvent(), xtw);
        
        if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType())) {
          BpmnXMLUtil.writeDefaultAttribute(ATTRIBUTE_LISTENER_CLASS, listener.getImplementation(), xtw);
        } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType())) {
          BpmnXMLUtil.writeDefaultAttribute(ATTRIBUTE_LISTENER_EXPRESSION, listener.getImplementation(), xtw);
        } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(listener.getImplementationType())) {
          BpmnXMLUtil.writeDefaultAttribute(ATTRIBUTE_LISTENER_DELEGATEEXPRESSION, listener.getImplementation(), xtw);
        }
        
        FieldExtensionExport.writeFieldExtensions(listener.getFieldExtensions(), true, xtw);
        
        xtw.writeEndElement();
      }
    }
  }
  return didWriteExtensionStartElement;
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:32,代码来源:ActivitiListenerExport.java


示例10: validateModel

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
private void validateModel(BpmnModel model) {
  FlowElement flowElement = model.getMainProcess().getFlowElement("eventBasedGateway");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof EventGateway);
  
  EventGateway gateway = (EventGateway) flowElement;
  List<ActivitiListener> listeners = gateway.getExecutionListeners();
  assertEquals(1, listeners.size());
  ActivitiListener listener = (ActivitiListener) listeners.get(0);
  assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType()));
  assertEquals("org.test.TestClass", listener.getImplementation());
  assertEquals("start", listener.getEvent());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:14,代码来源:EventBasedGatewayConverterTest.java


示例11: validateModel

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
private void validateModel(BpmnModel model) {
  FlowElement flowElement = model.getMainProcess().getFlowElement("start1");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof StartEvent);
  assertEquals("start1", flowElement.getId());
  
  flowElement = model.getMainProcess().getFlowElement("userTask1");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof UserTask);
  assertEquals("userTask1", flowElement.getId());
  UserTask userTask = (UserTask) flowElement;
  assertTrue(userTask.getCandidateUsers().size() == 1);
  assertTrue(userTask.getCandidateGroups().size() == 1);
  assertTrue(userTask.getFormProperties().size() == 2);
  
  flowElement = model.getMainProcess().getFlowElement("subprocess1");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof SubProcess);
  assertEquals("subprocess1", flowElement.getId());
  SubProcess subProcess = (SubProcess) flowElement;
  assertTrue(subProcess.getFlowElements().size() == 5);
  
  flowElement = model.getMainProcess().getFlowElement("boundaryEvent1");
  assertNotNull(flowElement);
  assertTrue(flowElement instanceof BoundaryEvent);
  assertEquals("boundaryEvent1", flowElement.getId());
  BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
  assertNotNull(boundaryEvent.getAttachedToRef());
  assertEquals("subprocess1", boundaryEvent.getAttachedToRef().getId());
  assertEquals(1, boundaryEvent.getEventDefinitions().size());
  assertTrue(boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition);
  
  assertEquals(1, model.getMainProcess().getExecutionListeners().size());
  ActivitiListener listener = model.getMainProcess().getExecutionListeners().get(0);
  assertEquals("TestClass", listener.getImplementation());
  assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listener.getImplementationType());
  assertEquals("start", listener.getEvent());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:39,代码来源:SubProcessConverterTest.java


示例12: createClassDelegateTaskListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public TaskListener createClassDelegateTaskListener(ActivitiListener activitiListener) {
  return new ClassDelegate(activitiListener.getImplementation(), createFieldDeclarations(activitiListener.getFieldExtensions()));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultListenerFactory.java


示例13: createExpressionTaskListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public TaskListener createExpressionTaskListener(ActivitiListener activitiListener) {
  return new ExpressionTaskListener(expressionManager.createExpression(activitiListener.getImplementation()));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultListenerFactory.java


示例14: createDelegateExpressionTaskListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public TaskListener createDelegateExpressionTaskListener(ActivitiListener activitiListener) {
  return new DelegateExpressionTaskListener(expressionManager.createExpression(activitiListener.getImplementation()), 
          createFieldDeclarations(activitiListener.getFieldExtensions()));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:5,代码来源:DefaultListenerFactory.java


示例15: createClassDelegateExecutionListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public ExecutionListener createClassDelegateExecutionListener(ActivitiListener activitiListener) {
  return new ClassDelegate(activitiListener.getImplementation(), createFieldDeclarations(activitiListener.getFieldExtensions()));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultListenerFactory.java


示例16: createExpressionExecutionListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public ExecutionListener createExpressionExecutionListener(ActivitiListener activitiListener) {
  return new ExpressionExecutionListener(expressionManager.createExpression(activitiListener.getImplementation()));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultListenerFactory.java


示例17: createDelegateExpressionExecutionListener

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public ExecutionListener createDelegateExpressionExecutionListener(ActivitiListener activitiListener) {
  return new DelegateExpressionExecutionListener(expressionManager.createExpression(activitiListener.getImplementation()), 
          createFieldDeclarations(activitiListener.getFieldExtensions()));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:5,代码来源:DefaultListenerFactory.java


示例18: createExecutionListenersOnScope

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
protected void createExecutionListenersOnScope(BpmnParse bpmnParse, List<ActivitiListener> activitiListenerList, ScopeImpl scope) {
  for (ActivitiListener activitiListener : activitiListenerList) {
    scope.addExecutionListener(activitiListener.getEvent(), createExecutionListener(bpmnParse, activitiListener));
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:6,代码来源:AbstractBpmnParseHandler.java


示例19: createExecutionListenersOnTransition

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
protected void createExecutionListenersOnTransition(BpmnParse bpmnParse, List<ActivitiListener> activitiListenerList, TransitionImpl transition) {
  for (ActivitiListener activitiListener : activitiListenerList) {
    transition.addExecutionListener(createExecutionListener(bpmnParse, activitiListener));
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:6,代码来源:AbstractBpmnParseHandler.java


示例20: parseTaskDefinition

import org.activiti.bpmn.model.ActivitiListener; //导入依赖的package包/类
public TaskDefinition parseTaskDefinition(BpmnParse bpmnParse, UserTask userTask, String taskDefinitionKey, ProcessDefinitionEntity processDefinition) {
  TaskFormHandler taskFormHandler = new DefaultTaskFormHandler();
  taskFormHandler.parseConfiguration(userTask.getFormProperties(), userTask.getFormKey(), bpmnParse.getDeployment(), processDefinition);

  TaskDefinition taskDefinition = new TaskDefinition(taskFormHandler);

  taskDefinition.setKey(taskDefinitionKey);
  processDefinition.getTaskDefinitions().put(taskDefinitionKey, taskDefinition);
  ExpressionManager expressionManager = bpmnParse.getExpressionManager();

  if (StringUtils.isNotEmpty(userTask.getName())) {
    taskDefinition.setNameExpression(expressionManager.createExpression(userTask.getName()));
  }

  if (StringUtils.isNotEmpty(userTask.getDocumentation())) {
    taskDefinition.setDescriptionExpression(expressionManager.createExpression(userTask.getDocumentation()));
  }

  if (StringUtils.isNotEmpty(userTask.getAssignee())) {
    taskDefinition.setAssigneeExpression(expressionManager.createExpression(userTask.getAssignee()));
  }
  if (StringUtils.isNotEmpty(userTask.getOwner())) {
    taskDefinition.setOwnerExpression(expressionManager.createExpression(userTask.getOwner()));
  }
  for (String candidateUser : userTask.getCandidateUsers()) {
    taskDefinition.addCandidateUserIdExpression(expressionManager.createExpression(candidateUser));
  }
  for (String candidateGroup : userTask.getCandidateGroups()) {
    taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(candidateGroup));
  }
  
  // Activiti custom extension
  
  // Task listeners
  for (ActivitiListener taskListener : userTask.getTaskListeners()) {
    taskDefinition.addTaskListener(taskListener.getEvent(), createTaskListener(bpmnParse, taskListener, userTask.getId()));
  }

  // Due date
  if (StringUtils.isNotEmpty(userTask.getDueDate())) {
    taskDefinition.setDueDateExpression(expressionManager.createExpression(userTask.getDueDate()));
  }
  
  // Priority
  if (StringUtils.isNotEmpty(userTask.getPriority())) {
    taskDefinition.setPriorityExpression(expressionManager.createExpression(userTask.getPriority()));
  }

  return taskDefinition;
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:51,代码来源:UserTaskParseHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java FilePlayListAll类代码示例发布时间:2022-05-22
下一篇:
Java AndroidDisplayer类代码示例发布时间: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