use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class ProcessVariableTypedTest method testProcessVariableTypeAnnotation.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/annotation/CompleteTaskTest.bpmn20.xml")
public void testProcessVariableTypeAnnotation() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
VariableMap variables = Variables.createVariables().putValue("injectedValue", "camunda");
businessProcess.startProcessByKey("keyOfTheProcess", variables);
TypedValue value = getBeanInstance(DeclarativeProcessController.class).getInjectedValue();
assertNotNull(value);
assertTrue(value instanceof StringValue);
assertEquals(ValueType.STRING, value.getType());
assertEquals("camunda", value.getValue());
}
use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class ProcessVariableLocalTypedTest method testProcessVariableLocalTypeAnnotation.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/annotation/CompleteTaskTest.bpmn20.xml")
public void testProcessVariableLocalTypeAnnotation() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
VariableMap variables = Variables.createVariables().putValue("injectedLocalValue", "camunda");
businessProcess.startProcessByKey("keyOfTheProcess", variables);
TypedValue value = getBeanInstance(DeclarativeProcessController.class).getInjectedLocalValue();
assertNotNull(value);
assertTrue(value instanceof StringValue);
assertEquals(ValueType.STRING, value.getType());
assertEquals("camunda", value.getValue());
}
use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class BusinessProcessContext method get.
@Override
public <T> T get(Contextual<T> contextual) {
Bean<T> bean = (Bean<T>) contextual;
String variableName = bean.getName();
BusinessProcess businessProcess = getBusinessProcess();
Object variable = businessProcess.getVariable(variableName);
if (variable != null) {
if (logger.isLoggable(Level.FINE)) {
if (businessProcess.isAssociated()) {
logger.fine("Getting instance of bean '" + variableName + "' from Execution[" + businessProcess.getExecutionId() + "].");
} else {
logger.fine("Getting instance of bean '" + variableName + "' from transient bean store");
}
}
return (T) variable;
} else {
return null;
}
}
use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class BusinessProcessContext method get.
@Override
public <T> T get(Contextual<T> contextual, CreationalContext<T> arg1) {
Bean<T> bean = (Bean<T>) contextual;
String variableName = bean.getName();
BusinessProcess businessProcess = getBusinessProcess();
Object variable = businessProcess.getVariable(variableName);
if (variable != null) {
if (logger.isLoggable(Level.FINE)) {
if (businessProcess.isAssociated()) {
logger.fine("Getting instance of bean '" + variableName + "' from Execution[" + businessProcess.getExecutionId() + "].");
} else {
logger.fine("Getting instance of bean '" + variableName + "' from transient bean store");
}
}
return (T) variable;
} else {
if (logger.isLoggable(Level.FINE)) {
if (businessProcess.isAssociated()) {
logger.fine("Creating instance of bean '" + variableName + "' in business process context representing Execution[" + businessProcess.getExecutionId() + "].");
} else {
logger.fine("Creating instance of bean '" + variableName + "' in transient bean store");
}
}
T beanInstance = bean.create(arg1);
businessProcess.setVariable(variableName, beanInstance);
return beanInstance;
}
}
use of org.camunda.bpm.engine.cdi.BusinessProcess in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testParallelMultiInstanceServiceTasks.
@Test
@Deployment
public void testParallelMultiInstanceServiceTasks() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
businessProcess.setVariable("list", Arrays.asList(new String[] { "1", "2" }));
businessProcess.startProcessByKey("miParallelScriptTask");
}
Aggregations