本文整理了Java中org.camunda.bpm.engine.variable.Variables
类的一些代码示例,展示了Variables
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Variables
类的具体详情如下:
包路径:org.camunda.bpm.engine.variable.Variables
类名称:Variables
[英]This class is the entry point to the process engine's typed variables API. Users can import the methods provided by this class using a static import:import static org.camunda.bpm.engine.variable.Variables.*;
[中]此类是流程引擎的类型化变量API的入口点。用户可以使用静态导入导入此类提供的方法:import static org.camunda.bpm.engine.variable.Variables.*;
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a builder to create a new {@link ObjectValue} that encapsulates
* the given {@code value}.
*/
public static ObjectValueBuilder objectValue(Object value, boolean isTransient) {
return (ObjectValueBuilder) objectValue(value).setTransient(isTransient);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a builder to create a new {@link FileValue} with the given
* {@code filename}.
*/
public static FileValueBuilder fileValue(String filename) {
return fileValue(filename, false);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Shortcut for {@code Variables.serializedObjectValue().serializedValue(value)}
*/
public static SerializedObjectValueBuilder serializedObjectValue(String value) {
return serializedObjectValue().serializedValue(value);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Parameters(name = "{index}: variable = {0}")
public static Collection<Object[]> data() {
return Arrays
.asList(new Object[][] {
{ Variables.stringValue("a"), Variables.stringValue(null) },
{ Variables.booleanValue(true), Variables.booleanValue(null) },
{ Variables.integerValue(4), Variables.integerValue(null) },
{ Variables.shortValue((short) 2), Variables.shortValue(null) },
{ Variables.longValue(6L), Variables.longValue(null) },
{ Variables.doubleValue(4.2), Variables.doubleValue(null) },
{ Variables.dateValue(new Date()), Variables.dateValue(null) }
});
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"})
@Test
public void testSubmitTaskFormForCmmnHumanTask() {
caseService.createCaseInstanceByKey("oneTaskCase");
Task task = taskService.createTaskQuery().singleResult();
String stringValue = "some string";
String serializedValue = "some value";
formService.submitTaskForm(task.getId(), createVariables()
.putValueTyped("boolean", booleanValue(null))
.putValueTyped("string", stringValue(stringValue))
.putValueTyped("serializedObject", serializedObjectValue(serializedValue)
.objectTypeName(String.class.getName())
.serializationDataFormat(Variables.SerializationDataFormats.JAVA)
.create())
.putValueTyped("object", objectValue(serializedValue).create()));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = ONE_TASK_PROCESS)
public void testSerializeNullEncoding() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("oneTaskProcess",
Variables.createVariables().putValue("fileVar", Variables.fileValue("test.txt").mimeType("some mimetype").file("ABC".getBytes()).create()));
FileValue fileVar = runtimeService.getVariableTyped(pi.getId(), "fileVar");
assertNull(fileVar.getEncoding());
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected VariableMap getVariables(Object input) {
VariableMap variables = Variables.createVariables();
variables.put("input1", input);
return variables;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public static VariableMap createMockSerializedVariables() {
VariableMap variables = Variables.createVariables();
ObjectValue serializedVar = Variables.serializedObjectValue(EXAMPLE_VARIABLE_INSTANCE_SERIALIZED_VALUE)
.serializationDataFormat(FORMAT_APPLICATION_JSON)
.objectTypeName(ArrayList.class.getName())
.create();
ObjectValue deserializedVar = new ObjectValueImpl(EXAMPLE_VARIABLE_INSTANCE_DESERIALIZED_VALUE,
EXAMPLE_VARIABLE_INSTANCE_SERIALIZED_VALUE,
FORMAT_APPLICATION_JSON, Object.class.getName(), true);
variables.putValueTyped(EXAMPLE_VARIABLE_INSTANCE_NAME, serializedVar);
variables.putValueTyped(EXAMPLE_DESERIALIZED_VARIABLE_INSTANCE_NAME, deserializedVar);
return variables;
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public ProcessInstance call() throws Exception {
final XmlSerializable var = new XmlSerializable();
var.setProperty("jonny");
return runtimeService.startProcessInstanceByKey("processWithTimer", Variables.createVariables()
.putValueTyped("testObject", Variables.objectValue(var).serializationDataFormat(DataFormats.JSON_DATAFORMAT_NAME).create()));
}
代码示例来源:origin: camunda/camunda-bpm-platform
public QueryVariableValue(String name, Object value, QueryOperator operator, boolean local) {
this.name = name;
this.value = Variables.untypedValue(value);
this.operator = operator;
this.local = local;
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected void evaluateDecisionWithAuthenticatedUser(String userId) {
identityService.setAuthenticatedUserId(userId);
VariableMap variables = Variables.putValue("input1", "test");
decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY, variables);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Creates a new {@link BooleanValue} that encapsulates the given <code>booleanValue</code>
*/
public static BooleanValue booleanValue(Boolean booleanValue) {
return booleanValue(booleanValue, false);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
if (value instanceof Number) {
int intValue = transformNumber((Number) value);
return Variables.integerValue(intValue);
} else if (value instanceof String) {
int intValue = transformString((String) value);
return Variables.integerValue(intValue);
} else {
throw new IllegalArgumentException();
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Creates a new {@link LongValue} that encapsulates the given <code>longValue</code>
*/
public static LongValue longValue(Long longValue) {
return longValue(longValue, false);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Creates a new {@link DateValue} that encapsulates the given <code>date</code>
*/
public static DateValue dateValue(Date date) {
return dateValue(date, false);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = ONE_TASK_PROCESS)
public void testSerializeNullValue() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("oneTaskProcess",
Variables.createVariables().putValue("fileVar", Variables.fileValue("test.txt").create()));
FileValue fileVar = runtimeService.getVariableTyped(pi.getId(), "fileVar");
assertNull(fileVar.getMimeType());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void createInstanceByDefinitionKey(String definitionKey) {
decisionService.evaluateDecisionTableByKey(definitionKey)
.variables(Variables.createVariables().putValue("input", "john"))
.evaluate();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testJacksonBug146AsVariable() {
InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("org/camunda/bpm/integrationtest/functional/spin/jackson146.json");
String jackson146 = SpinIoUtil.inputStreamAsString(resourceAsStream);
ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", Variables.createVariables()
.putValue("jackson146", serializedObjectValue(jackson146).serializationDataFormat("application/json").objectTypeName(HashMap.class.getName())));
// file has 4000 characters in length a
// 20 characters per repeated JSON object
ObjectValue objectValue = runtimeService.getVariableTyped(pi.getId(), "jackson146", true);
HashMap<String, List<Object>> map = (HashMap<String, List<Object>>) objectValue.getValue();
assertEquals(200, map.get("abcdef").size());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment
@Test
public void testGetVariableInstancesFromVariableScope() {
VariableMap variables = createVariables()
.putValue("anIntegerVariable", 1234)
.putValue("anObjectValue", objectValue(new SimpleSerializableBean(10)).serializationDataFormat(Variables.SerializationDataFormats.JAVA))
.putValue("anUntypedObjectValue", new SimpleSerializableBean(30));
runtimeService.startProcessInstanceByKey("testProcess", variables);
// assertions are part of the java delegate AssertVariableInstancesDelegate
// only there we can access the VariableScope methods
}
代码示例来源:origin: camunda/camunda-bpm-platform
public QueryVariableValue(String name, Object value, QueryOperator operator, boolean local) {
this.name = name;
this.value = Variables.untypedValue(value);
this.operator = operator;
this.local = local;
}
内容来源于网络,如有侵权,请联系作者删除!