当前位置: 首页>>代码示例>>Java>>正文


Java ActivitiListener类代码示例

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


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


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