org.camunda.bpm.engine.variable.Variables.booleanValue()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.camunda.bpm.engine.variable.Variables.booleanValue()方法的一些代码示例,展示了Variables.booleanValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Variables.booleanValue()方法的具体详情如下:
包路径:org.camunda.bpm.engine.variable.Variables
类名称:Variables
方法名:booleanValue

Variables.booleanValue介绍

[英]Creates a new BooleanValue that encapsulates the given booleanValue
[中]创建一个新的布尔值来封装给定的booleanValue

代码示例

代码示例来源: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 Boolean) {
  return Variables.booleanValue((Boolean) value);
 } else if (value instanceof String) {
  boolean booleanValue = transformString((String) value);
  return Variables.booleanValue(booleanValue);
 } else {
  throw new IllegalArgumentException();
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public BooleanValue readValue(ValueFields valueFields) {
 Boolean boolValue = null;
 Long longValue = valueFields.getLongValue();
 if(longValue != null) {
  boolValue = longValue.equals(TRUE);
 }
 return Variables.booleanValue(boolValue);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public BooleanValue readValue(ValueFields valueFields) {
 Boolean boolValue = null;
 Long longValue = valueFields.getLongValue();
 if(longValue != null) {
  boolValue = longValue.equals(TRUE);
 }
 return Variables.booleanValue(boolValue);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public TypedValue convertValue(TypedValue propertyValue) {
 if(propertyValue instanceof BooleanValue) {
  return propertyValue;
 }
 else {
  Object value = propertyValue.getValue();
  if(value == null) {
   return Variables.booleanValue(null, propertyValue.isTransient());
  }
  else if((value instanceof Boolean) || (value instanceof String)) {
   return Variables.booleanValue(new Boolean(value.toString()), propertyValue.isTransient());
  }
  else {
   throw new ProcessEngineException("Value '"+value+"' is not of type Boolean.");
  }
 }
}
// deprecated /////////////////////////////////////////////////

代码示例来源:origin: camunda/camunda-bpm-platform

public TypedValue convertValue(TypedValue propertyValue) {
 if(propertyValue instanceof BooleanValue) {
  return propertyValue;
 }
 else {
  Object value = propertyValue.getValue();
  if(value == null) {
   return Variables.booleanValue(null, propertyValue.isTransient());
  }
  else if((value instanceof Boolean) || (value instanceof String)) {
   return Variables.booleanValue(new Boolean(value.toString()), propertyValue.isTransient());
  }
  else {
   throw new ProcessEngineException("Value '"+value+"' is not of type Boolean.");
  }
 }
}
// deprecated /////////////////////////////////////////////////

代码示例来源:origin: camunda/camunda-bpm-platform

public BooleanValue convertToTypedValue(UntypedValueImpl untypedValue) {
 return Variables.booleanValue((Boolean) untypedValue.getValue(), untypedValue.isTransient());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public BooleanValue convertToTypedValue(UntypedValueImpl untypedValue) {
 return Variables.booleanValue((Boolean) untypedValue.getValue(), untypedValue.isTransient());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testCannotDownloadVariableOtherThanFile() {
 String variableKey = "aVariableKey";
 BooleanValue variableValue = Variables.booleanValue(true);
 when(taskServiceMock.getVariableTyped(eq(EXAMPLE_TASK_ID), eq(variableKey), anyBoolean())).thenReturn(variableValue);
 given()
  .pathParam("id", EXAMPLE_TASK_ID)
  .pathParam("varId", variableKey)
 .then().expect()
  .statusCode(Status.BAD_REQUEST.getStatusCode())
 .when().get(SINGLE_TASK_SINGLE_BINARY_VARIABLE_URL);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testCannotDownloadVariableOtherThanFile() {
 String variableKey = "aVariableKey";
 BooleanValue variableValue = Variables.booleanValue(true);
 when(caseServiceMock.getVariableLocalTyped(eq(EXAMPLE_TASK_ID), eq(variableKey), anyBoolean())).thenReturn(variableValue);
 given()
  .pathParam("id", EXAMPLE_TASK_ID)
  .pathParam("varId", variableKey)
 .then().expect()
  .statusCode(Status.BAD_REQUEST.getStatusCode())
 .when().get(SINGLE_CASE_INSTANCE_BINARY_VARIABLE_URL);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testCannotDownloadVariableOtherThanFile() {
 String variableKey = "aVariableKey";
 BooleanValue variableValue = Variables.booleanValue(true);
 when(taskServiceMock.getVariableLocalTyped(eq(EXAMPLE_TASK_ID), eq(variableKey), anyBoolean())).thenReturn(variableValue);
 given()
  .pathParam("id", EXAMPLE_TASK_ID)
  .pathParam("varId", variableKey)
 .then().expect()
  .statusCode(Status.BAD_REQUEST.getStatusCode())
 .when().get(SINGLE_TASK_SINGLE_BINARY_VARIABLE_URL);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testCannotDownloadVariableOtherThanFile() {
 String variableKey = "aVariableKey";
 BooleanValue variableValue = Variables.booleanValue(true);
 when(runtimeServiceMock.getVariableLocalTyped(eq(EXAMPLE_TASK_ID), eq(variableKey), anyBoolean())).thenReturn(variableValue);
 given()
  .pathParam("id", EXAMPLE_TASK_ID)
  .pathParam("varId", variableKey)
 .then().expect()
  .statusCode(Status.BAD_REQUEST.getStatusCode())
 .when().get(SINGLE_EXECUTION_LOCAL_BINARY_VARIABLE_URL);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testCannotDownloadVariableOtherThanFile() {
 String variableKey = "aVariableKey";
 BooleanValue variableValue = Variables.booleanValue(true);
 when(caseServiceMock.getVariableTyped(eq(MockProvider.EXAMPLE_CASE_INSTANCE_ID), eq(variableKey), anyBoolean()))
 .thenReturn(variableValue);
 given()
  .pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID)
  .pathParam("varId", variableKey)
 .then().expect()
  .statusCode(Status.BAD_REQUEST.getStatusCode())
  .contentType(MediaType.APPLICATION_JSON)
 .when().get(SINGLE_CASE_EXECUTION_LOCAL_BINARY_VARIABLE_URL);
}

代码示例来源: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

.putValue("b", Variables.booleanValue(true, true))
.putValue("c", Variables.byteArrayValue("test".getBytes(), true))
.putValue("d", Variables.dateValue(new Date(), true))
.putValue("i", Variables.objectValue(new Integer(100), true).create())
.putValue("j", Variables.untypedValue(null, true))
.putValue("k", Variables.untypedValue(Variables.booleanValue(true), true))
.putValue("l", Variables.fileValue(new File(this.getClass().getClassLoader()
  .getResource("org/camunda/bpm/engine/test/standalone/variables/simpleFile.txt").toURI()), true)));

代码示例来源:origin: camunda/camunda-bpm-platform

Variables.createVariables()
  .putValueTyped("a", Variables.stringValue("bar", true))
  .putValueTyped("b", Variables.booleanValue(true, true))
  .putValueTyped("c", Variables.byteArrayValue("test".getBytes(), true))
  .putValueTyped("d", Variables.dateValue(new Date(), true))
  .putValueTyped("i", Variables.objectValue(new Integer(100), true).create())
  .putValueTyped("j", Variables.untypedValue(null, true))
  .putValueTyped("k", Variables.untypedValue(Variables.booleanValue(true), true))
  .putValueTyped("l", Variables.fileValue(new File(this.getClass().getClassLoader()
    .getResource("org/camunda/bpm/engine/test/standalone/variables/simpleFile.txt").toURI()), true)));

代码示例来源:origin: camunda/camunda-bpm-platform

TypedValue processVariableValue2 = Variables.booleanValue(null);
runtimeService.setVariable(processInstanceId, variableName, processVariableValue);
runtimeService.setVariable(processInstanceId, variableName2, processVariableValue2);

代码示例来源: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

@Deployment(resources = {"org/camunda/bpm/engine/test/api/form/FormsProcess.bpmn20.xml"})
@Test
public void testSubmitStartFormDataTypedVariables() {
 String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
 String stringValue = "some string";
 String serializedValue = "some value";
 ProcessInstance processInstance = formService.submitStartForm(procDefId,
   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()));
 VariableMap variables = runtimeService.getVariablesTyped(processInstance.getId(), false);
 assertEquals(booleanValue(null), variables.getValueTyped("boolean"));
 assertEquals(stringValue(stringValue), variables.getValueTyped("string"));
 assertNotNull(variables.<ObjectValue>getValueTyped("serializedObject").getValueSerialized());
 assertNotNull(variables.<ObjectValue>getValueTyped("object").getValueSerialized());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources = {"org/camunda/bpm/engine/test/api/form/FormsProcess.bpmn20.xml"})
@Test
public void testSubmitTaskFormDataTypedVariables() {
 String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
 ProcessInstance processInstance = formService.submitStartForm(procDefId, createVariables());
 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()));
 VariableMap variables = runtimeService.getVariablesTyped(processInstance.getId(), false);
 assertEquals(booleanValue(null), variables.getValueTyped("boolean"));
 assertEquals(stringValue(stringValue), variables.getValueTyped("string"));
 assertNotNull(variables.<ObjectValue>getValueTyped("serializedObject").getValueSerialized());
 assertNotNull(variables.<ObjectValue>getValueTyped("object").getValueSerialized());
}

相关文章