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


Java JavaDelegate类代码示例

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


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

示例1: notify

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
public void notify(DelegateExecution execution) throws Exception {
  // Note: we can't cache the result of the expression, because the
  // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}'
  Object delegate = expression.getValue(execution);
  applyFieldDeclaration(fieldDeclarations, delegate);

  if (delegate instanceof ExecutionListener) {
    Context.getProcessEngineConfiguration()
      .getDelegateInterceptor()
      .handleInvocation(new ExecutionListenerInvocation((ExecutionListener) delegate, execution));
  } else if (delegate instanceof JavaDelegate) {
    Context.getProcessEngineConfiguration()
      .getDelegateInterceptor()
      .handleInvocation(new JavaDelegateInvocation((JavaDelegate) delegate, execution));
  } else {
    throw LOG.resolveDelegateExpressionException(expression, ExecutionListener.class, JavaDelegate.class);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:DelegateExpressionExecutionListener.java

示例2: ermittleVersicherungsschutz

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
public void ermittleVersicherungsschutz() throws Exception {
  JavaDelegate mock = DelegateExpressions.registerJavaDelegateMock(VersicherungsschutzErmittelnDelegate.NAME).getMock();
  Mockito.doAnswer(new JavaDelegateAnswer(mock) {

    @Override
    protected void answer(DelegateExecution execution) throws Exception {
      List<Leistung> leistungen = (List<Leistung>) execution.getVariable(VARIABLES.LEISTUNGEN);
      for (final Leistung leistung : leistungen) {
        if (leistung.isGebuehrenrechtlichOk()) {
          switch (leistung.getBezeichnung()) {
            case L1:
              leistung.setTarif("T1");
              break;
            case L2:
              leistung.setTarif("T2");
              break;
            case L3:
              leistung.setTarif("T3");
              break;
          }
        }
      }
      execution.setVariable(VARIABLES.LEISTUNGEN, leistungen);
    }

  }).when(mock).execute(Matchers.any(DelegateExecution.class));
}
 
开发者ID:holisticon,项目名称:skill-based-routing,代码行数:28,代码来源:LeistungsabrechnungProcessTest.java

示例3: onExecutionSetVariables

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Override
public void onExecutionSetVariables(final VariableMap variables) {
  doAnswer(new JavaDelegate() {

    @Override
    public void execute(final DelegateExecution execution) throws Exception {
      setVariables(execution, variables);
    }
  });
}
 
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:11,代码来源:FluentJavaDelegateMock.java

示例4: onExecutionThrowBpmnError

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Override
public void onExecutionThrowBpmnError(final BpmnError bpmnError) {
  doAnswer(new JavaDelegate() {

    @Override
    public void execute(final DelegateExecution execution) throws Exception {
      throw bpmnError;
    }
  });
}
 
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:11,代码来源:FluentJavaDelegateMock.java

示例5: onExecutionThrowException

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Override
public void onExecutionThrowException(final Exception exception) {
  doAnswer(new JavaDelegate() {
    @Override
    public void execute(DelegateExecution execution) throws Exception {
      throw exception;
    }
  });
}
 
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:10,代码来源:FluentJavaDelegateMock.java

示例6: doAnswer

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
private void doAnswer(final JavaDelegate javaDelegate) {
  try {
    Mockito.doAnswer(new JavaDelegateAnswer(javaDelegate)).when(mock).execute(any());
  } catch (final Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:8,代码来源:FluentJavaDelegateMock.java

示例7: exportJavaDelegate

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Test(timeout = 35000L)
public void exportJavaDelegate() throws InterruptedException {
  Hashtable<String, String> properties = new Hashtable<String, String>();
  properties.put("osgi.service.blueprint.compname", "testDelegate");
  ctx.registerService(JavaDelegate.class.getName(), new TestDelegate(), properties);
  // wait a little bit
  ProcessDefinition definition = null;
  do {
    Thread.sleep(500L);
    definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("Process_1").singleResult();
  } while (definition == null);
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(definition.getKey());
  assertThat(processInstance.isEnded(), is(true));
  assertThat(delegateVisited, is(true));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:16,代码来源:BlueprintIntegrationTest.java

示例8: runProcess

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Test
public void runProcess() throws Exception {
	JustAnotherJavaDelegate service = new JustAnotherJavaDelegate();
	ctx.registerService(JavaDelegate.class, service, null);
	ProcessInstance processInstance = processEngine.getRuntimeService()
			.startProcessInstanceByKey("delegate");
	assertThat(service.called, is(true));
	assertThat(processInstance.isEnded(), is(true));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:10,代码来源:OSGiELResolverDelegateIntegrationTest.java

示例9: runProcess

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Test
public void runProcess() throws Exception {
	Hashtable<String, String> properties = new Hashtable<String, String>();
	properties.put("processExpression", "thisIsAReallyNeatFeature");
	JustAnotherJavaDelegate service = new JustAnotherJavaDelegate();
	ctx.registerService(JavaDelegate.class, service, properties);
	ProcessInstance processInstance = processEngine.getRuntimeService()
			.startProcessInstanceByKey("ldap");
	assertThat(service.called, is(true));
	assertThat(processInstance.isEnded(), is(true));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:12,代码来源:OSGiELResolverLdapMethodCallWithParamIntegrationTest.java

示例10: runProcess

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Test
public void runProcess() throws Exception {
  Hashtable<String, String> properties = new Hashtable<String, String>();
  properties.put("processExpression", "thisIsAReallyNeatFeature");
  JustAnotherJavaDelegate service = new JustAnotherJavaDelegate();
  ctx.registerService(JavaDelegate.class, service, properties);
  ProcessInstance processInstance = processEngine.getRuntimeService().startProcessInstanceByKey("ldap");
  assertThat(service.called, is(true));
  assertThat(processInstance.isEnded(), is(true));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:11,代码来源:OSGiELResolverLdapMethodCallIntegrationTest.java

示例11: getValueForSingleJavaDelegate

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@Test
public void getValueForSingleJavaDelegate() throws InvalidSyntaxException {
  String lookupName = "testJavaDelegate";
  JavaDelegate serviceObject = new TestJavaDelegate();
  ServiceReference<JavaDelegate> reference = mockService(serviceObject);
  registerServiceRefsAtContext(JavaDelegate.class, null, reference);
  JavaDelegate value = (JavaDelegate) resolver.getValue(elContext, null, lookupName);
  assertThat(value, is(sameInstance(serviceObject)));
  wasPropertyResolved();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:11,代码来源:OSGiELResolverTest.java

示例12: getValueForTwoJavaDelegates

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void getValueForTwoJavaDelegates() throws InvalidSyntaxException {
  String lookupName = "testJavaDelegate";
  JavaDelegate serviceObject = new TestJavaDelegate();
  JavaDelegate anotherServiceObject = mock(JavaDelegate.class);
  ServiceReference<JavaDelegate> reference1 = mockService(serviceObject);
  ServiceReference<JavaDelegate> reference2 = mockService(anotherServiceObject);
  registerServiceRefsAtContext(JavaDelegate.class, null, reference1, reference2);
  JavaDelegate value = (JavaDelegate) resolver.getValue(elContext, null, lookupName);
  assertThat(value, is(sameInstance(serviceObject)));
  wasPropertyResolved();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:14,代码来源:OSGiELResolverTest.java

示例13: getValueForTwoJavaDelegatesWithSameName

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = RuntimeException.class)
public void getValueForTwoJavaDelegatesWithSameName() throws InvalidSyntaxException {
  String lookupName = "testJavaDelegate";
  ServiceReference<JavaDelegate> reference1 = mockService((JavaDelegate) new TestJavaDelegate());
  ServiceReference<JavaDelegate> reference2 = mockService((JavaDelegate) new TestJavaDelegate());
  registerServiceRefsAtContext(JavaDelegate.class, null, reference1, reference2);
  resolver.getValue(elContext, null, lookupName);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:10,代码来源:OSGiELResolverTest.java

示例14: unbindService

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
/**
  * @param delegate the delegate, necessary parameter because of Blueprint 
  */
public void unbindService(JavaDelegate delegate, Map<?, ?> props) {
	String name = (String) props.get("osgi.service.blueprint.compname");
	if (delegateMap.containsKey(name)) {
		delegateMap.remove(name);
	}
	LOGGER.info("removed service from delegate cache " + name);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:11,代码来源:BlueprintELResolver.java

示例15: getExecutionListenerInstance

import org.camunda.bpm.engine.delegate.JavaDelegate; //导入依赖的package包/类
protected ExecutionListener getExecutionListenerInstance() {
  Object delegateInstance = instantiateDelegate(className, fieldDeclarations);
  if (delegateInstance instanceof ExecutionListener) {
    return (ExecutionListener) delegateInstance;

  } else if (delegateInstance instanceof JavaDelegate) {
    return new ServiceTaskJavaDelegateActivityBehavior((JavaDelegate) delegateInstance);

  } else {
    throw LOG.missingDelegateParentClassException(delegateInstance.getClass().getName(),
      ExecutionListener.class.getName(), JavaDelegate.class.getName());
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:ClassDelegateExecutionListener.java


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