本文整理汇总了Java中org.activiti.bpmn.model.ServiceTask类的典型用法代码示例。如果您正苦于以下问题:Java ServiceTask类的具体用法?Java ServiceTask怎么用?Java ServiceTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceTask类属于org.activiti.bpmn.model包,在下文中一共展示了ServiceTask类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDelegateSpringBeansNotPopulatedAgain
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
/**
* This method tests the scenario where a java delegate is not populated again with spring beans.
*/
@Test
public void testDelegateSpringBeansNotPopulatedAgain() throws Exception
{
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_WORKFLOW);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
serviceTask.setImplementation(MockJavaDelegate.class.getCanonicalName());
serviceTask.getFieldExtensions().clear();
// Define the job definition
jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));
// Executing the job twice so that the same JavaDelegate object is used and spring beans are not wired again.
jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
}
开发者ID:FINRAOS,项目名称:herd,代码行数:20,代码来源:ActivitiDelegateTest.java
示例2: testActivitiUnReportableError
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
/**
* This method tests the scenario when an workflow related error is throws while workflow is executing an Async type task like Timer. This error is logged
* as WARN.
*/
@Test(expected = ActivitiException.class)
public void testActivitiUnReportableError() throws Exception
{
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
serviceTask.setImplementation("${BeanNotAvailable}");
jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));
Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME, null));
org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
if (timer != null)
{
executeWithoutLogging(TimerExecuteNestedActivityJobHandler.class, () -> {
activitiManagementService.executeJob(timer.getId());
});
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:25,代码来源:ActivitiDelegateTest.java
示例3: testDelegateRuntimeError
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
/**
* This method tests the scenario where a RuntimeException occurs but not thrown by java delegate.
*/
@Test
public void testDelegateRuntimeError() throws Exception
{
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_WORKFLOW);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
serviceTask.setImplementation(MockJavaDelegate.class.getCanonicalName());
FieldExtension exceptionField = new FieldExtension();
exceptionField.setFieldName("exceptionToThrow");
exceptionField.setExpression("${exceptionToThrow}");
serviceTask.getFieldExtensions().clear();
serviceTask.getFieldExtensions().add(exceptionField);
List<Parameter> parameters = new ArrayList<>();
Parameter parameter = new Parameter("exceptionToThrow", MockJavaDelegate.EXCEPTION_RUNTIME);
parameters.add(parameter);
executeWithoutLogging(Arrays.asList(ActivitiRuntimeHelper.class, BaseJavaDelegate.class), () -> {
jobServiceTestHelper.createJobFromActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel), parameters);
});
}
开发者ID:FINRAOS,项目名称:herd,代码行数:28,代码来源:ActivitiDelegateTest.java
示例4: testDelegateWrongClass
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
/**
* This method tests when wrong class name is used in service task, the process instance is created.
*/
@Test
public void testDelegateWrongClass() throws Exception
{
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_WORKFLOW);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
serviceTask.setImplementation("ClassDoesNotExist");
serviceTask.getFieldExtensions().clear();
// Run a job with Activiti XML that will start cluster.
try
{
jobServiceTestHelper.createJobFromActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel), null);
fail();
}
catch (Exception e)
{
assertEquals(ActivitiException.class, e.getClass());
assertEquals("couldn't instantiate class ClassDoesNotExist", e.getMessage());
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:25,代码来源:ActivitiDelegateTest.java
示例5: writeAdditionalAttributes
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
@Override
protected void writeAdditionalAttributes(BaseElement element, XMLStreamWriter xtw) throws Exception {
ServiceTask serviceTask = (ServiceTask) element;
if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(serviceTask.getImplementationType())) {
writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_CLASS, serviceTask.getImplementation(), xtw);
} else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(serviceTask.getImplementationType())) {
writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_EXPRESSION, serviceTask.getImplementation(), xtw);
} else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(serviceTask.getImplementationType())) {
writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_DELEGATEEXPRESSION, serviceTask.getImplementation(), xtw);
}
if (StringUtils.isNotEmpty(serviceTask.getResultVariableName())) {
writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE, serviceTask.getResultVariableName(), xtw);
}
if (StringUtils.isNotEmpty(serviceTask.getType())) {
writeQualifiedAttribute(ATTRIBUTE_TYPE, serviceTask.getType(), xtw);
}
if (StringUtils.isNotEmpty(serviceTask.getExtensionId())) {
writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_EXTENSIONID, serviceTask.getExtensionId(), xtw);
}
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:24,代码来源:ServiceTaskXMLConverter.java
示例6: testActivitiReportableError
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
/**
* This method tests the scenario when an error that is not workflow related is throws while workflow is executing an Async type task like Timer. This error
* is logged as ERROR.
*/
@Test(expected = ActivitiException.class)
public void testActivitiReportableError() throws Exception
{
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
FieldExtension exceptionField = new FieldExtension();
exceptionField.setFieldName("exceptionToThrow");
exceptionField.setExpression("${exceptionToThrow}");
serviceTask.getFieldExtensions().add(exceptionField);
jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));
List<Parameter> parameters = new ArrayList<>();
Parameter parameter = new Parameter("exceptionToThrow", MockJavaDelegate.EXCEPTION_BPMN_ERROR);
parameters.add(parameter);
Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME, parameters));
org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
if (timer != null)
{
executeWithoutLogging(Arrays.asList(ActivitiRuntimeHelper.class, TimerExecuteNestedActivityJobHandler.class), () -> {
activitiManagementService.executeJob(timer.getId());
});
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:33,代码来源:ActivitiDelegateTest.java
示例7: buildActivitiXml
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
protected String buildActivitiXml(String implementation, List<FieldExtension> fieldExtensionList) throws Exception
{
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_TEST_SERVICE_TASK_WITH_CLASSPATH);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement(serviceTaskId);
serviceTask.setImplementation(implementation);
serviceTask.getFieldExtensions().addAll(fieldExtensionList);
return getActivitiXmlFromBpmnModel(bpmnModel);
}
开发者ID:FINRAOS,项目名称:herd,代码行数:12,代码来源:HerdActivitiServiceTaskTest.java
示例8: buildActivitiXml
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
private String buildActivitiXml(String implementation, List<FieldExtension> fieldExtensionList) throws Exception
{
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_ADD_EMR_STEPS_WITH_CLASSPATH);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("addStepServiceTask");
serviceTask.setImplementation(implementation);
serviceTask.getFieldExtensions().addAll(fieldExtensionList);
return getActivitiXmlFromBpmnModel(bpmnModel);
}
开发者ID:FINRAOS,项目名称:herd,代码行数:12,代码来源:AddEmrStepsTest.java
示例9: convertXMLToElement
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr) throws Exception {
ServiceTask serviceTask = new ServiceTask();
BpmnXMLUtil.addXMLLocation(serviceTask, xtr);
if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_CLASS))) {
serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
serviceTask.setImplementation(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_CLASS));
} else if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_EXPRESSION))) {
serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
serviceTask.setImplementation(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_EXPRESSION));
} else if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_DELEGATEEXPRESSION))) {
serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
serviceTask.setImplementation(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_DELEGATEEXPRESSION));
} else if ("##WebService".equals(xtr.getAttributeValue(null, ATTRIBUTE_TASK_IMPLEMENTATION))) {
serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE);
serviceTask.setOperationRef(parseOperationRef(xtr.getAttributeValue(null, ATTRIBUTE_TASK_OPERATION_REF), model));
}
serviceTask.setResultVariableName(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE));
if (StringUtils.isEmpty(serviceTask.getResultVariableName())) {
serviceTask.setResultVariableName(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, "resultVariable"));
}
if (StringUtils.isNotEmpty(serviceTask.getResultVariableName()) && (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(serviceTask.getImplementationType()) ||
ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(serviceTask.getImplementationType()))) {
model.addProblem("'resultVariableName' not supported for service tasks using 'class' or 'delegateExpression", xtr);
}
serviceTask.setType(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TYPE));
serviceTask.setExtensionId(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_EXTENSIONID));
parseChildElements(getXMLElementName(), serviceTask, xtr);
return serviceTask;
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:40,代码来源:ServiceTaskXMLConverter.java
示例10: writeExtensionChildElements
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
@Override
protected void writeExtensionChildElements(BaseElement element, XMLStreamWriter xtw) throws Exception {
ServiceTask serviceTask = (ServiceTask) element;
if (serviceTask.getCustomProperties().size() > 0) {
for (CustomProperty customProperty : serviceTask.getCustomProperties()) {
if (StringUtils.isEmpty(customProperty.getSimpleValue())) {
continue;
}
if (didWriteExtensionStartElement == false) {
xtw.writeStartElement(ELEMENT_EXTENSIONS);
didWriteExtensionStartElement = true;
}
xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FIELD, ACTIVITI_EXTENSIONS_NAMESPACE);
xtw.writeAttribute(ATTRIBUTE_FIELD_NAME, customProperty.getName());
if ((customProperty.getSimpleValue().contains("${") || customProperty.getSimpleValue().contains("#{")) &&
customProperty.getSimpleValue().contains("}")) {
xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ATTRIBUTE_FIELD_EXPRESSION, ACTIVITI_EXTENSIONS_NAMESPACE);
} else {
xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FIELD_STRING, ACTIVITI_EXTENSIONS_NAMESPACE);
}
xtw.writeCharacters(customProperty.getSimpleValue());
xtw.writeEndElement();
xtw.writeEndElement();
}
} else {
didWriteExtensionStartElement = FieldExtensionExport.writeFieldExtensions(serviceTask.getFieldExtensions(), didWriteExtensionStartElement, xtw);
}
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:33,代码来源:ServiceTaskXMLConverter.java
示例11: executeParse
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, ServiceTask serviceTask) {
super.executeParse(bpmnParse, serviceTask);
ActivityImpl activity = findActivity(bpmnParse, serviceTask.getId());
activity.setAsync(true);
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:7,代码来源:CustomServiceTaskBpmnParseHandler.java
示例12: getHandledType
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
@Override
protected Class<? extends BaseElement> getHandledType() {
return ServiceTask.class;
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:5,代码来源:ServiceTaskParseHandler.java
示例13: createClassDelegateServiceTask
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public ClassDelegate createClassDelegateServiceTask(ServiceTask serviceTask) {
return new ClassDelegate(serviceTask.getImplementation(), createFieldDeclarations(serviceTask.getFieldExtensions()));
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultActivityBehaviorFactory.java
示例14: createServiceTaskDelegateExpressionActivityBehavior
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public ServiceTaskDelegateExpressionActivityBehavior createServiceTaskDelegateExpressionActivityBehavior(ServiceTask serviceTask) {
Expression delegateExpression = expressionManager.createExpression(serviceTask.getImplementation());
return new ServiceTaskDelegateExpressionActivityBehavior(delegateExpression, createFieldDeclarations(serviceTask.getFieldExtensions()));
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:5,代码来源:DefaultActivityBehaviorFactory.java
示例15: createServiceTaskExpressionActivityBehavior
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public ServiceTaskExpressionActivityBehavior createServiceTaskExpressionActivityBehavior(ServiceTask serviceTask) {
Expression expression = expressionManager.createExpression(serviceTask.getImplementation());
return new ServiceTaskExpressionActivityBehavior(expression, serviceTask.getResultVariableName());
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:5,代码来源:DefaultActivityBehaviorFactory.java
示例16: createWebServiceActivityBehavior
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public WebServiceActivityBehavior createWebServiceActivityBehavior(ServiceTask serviceTask) {
return new WebServiceActivityBehavior();
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultActivityBehaviorFactory.java
示例17: createMailActivityBehavior
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public MailActivityBehavior createMailActivityBehavior(ServiceTask serviceTask) {
return createMailActivityBehavior(serviceTask.getId(), serviceTask.getFieldExtensions());
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultActivityBehaviorFactory.java
示例18: createMuleActivityBehavior
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public ActivityBehavior createMuleActivityBehavior(ServiceTask serviceTask, BpmnModel bpmnModel) {
return createMuleActivityBehavior(serviceTask, serviceTask.getFieldExtensions(), bpmnModel);
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultActivityBehaviorFactory.java
示例19: createCamelActivityBehavior
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public ActivityBehavior createCamelActivityBehavior(ServiceTask serviceTask, BpmnModel bpmnModel) {
return createCamelActivityBehavior(serviceTask, serviceTask.getFieldExtensions(), bpmnModel);
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:4,代码来源:DefaultActivityBehaviorFactory.java
示例20: createShellActivityBehavior
import org.activiti.bpmn.model.ServiceTask; //导入依赖的package包/类
public ShellActivityBehavior createShellActivityBehavior(ServiceTask serviceTask) {
List<FieldDeclaration> fieldDeclarations = createFieldDeclarations(serviceTask.getFieldExtensions());
return (ShellActivityBehavior) ClassDelegate.instantiateDelegate(ShellActivityBehavior.class, fieldDeclarations);
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:5,代码来源:DefaultActivityBehaviorFactory.java
注:本文中的org.activiti.bpmn.model.ServiceTask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论