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

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

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

Variables.longValue介绍

[英]Creates a new LongValue that encapsulates the given longValue
[中]创建一个新的LongValue来封装给定的longValue

代码示例

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

@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
 if (value instanceof Number) {
  long longValue = transformNumber((Number) value);
  return Variables.longValue(longValue);
 } else if (value instanceof String) {
  long longValue = transformString((String) value);
  return Variables.longValue(longValue);
 } else {
  throw new IllegalArgumentException();
 }
}

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

public LongValue createValue(Object value, Map<String, Object> valueInfo) {
 return Variables.longValue((Long) value, isTransient(valueInfo));
}

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

public LongValue readValue(ValueFields valueFields) {
 return Variables.longValue(valueFields.getLongValue());
}

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

public LongValue readValue(ValueFields valueFields) {
 return Variables.longValue(valueFields.getLongValue());
}

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

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

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

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

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

public LongValue convertToTypedValue(UntypedValueImpl untypedValue) {
 return Variables.longValue((Long) untypedValue.getValue(), untypedValue.isTransient());
}

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

public LongValue convertToTypedValue(UntypedValueImpl untypedValue) {
 return Variables.longValue((Long) untypedValue.getValue(), untypedValue.isTransient());
}

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

@Override
 public LongValue convertFromTypedValue(TypedValue typedValue) {
  if (typedValue.getType() != ValueType.NUMBER) {
   throw unsupportedConversion(typedValue.getType());
  }
  LongValueImpl longvalue = null;
  NumberValue numberValue = (NumberValue) typedValue;
  if (numberValue.getValue() != null) {
   longvalue = (LongValueImpl) Variables.longValue(numberValue.getValue().longValue());
  } else {
   longvalue =  (LongValueImpl) Variables.longValue(null);
  }
  longvalue.setTransient(numberValue.isTransient());
  return longvalue;
 }
}

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

@Test
public void testCannotDownloadVariableOtherThanFile() {
 String variableKey = "aVariableKey";
 LongValue variableValue = Variables.longValue(123L);
 when(runtimeServiceMock.getVariableTyped(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID), eq(variableKey), anyBoolean()))
 .thenReturn(variableValue);
 given()
 .pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)
 .pathParam("varId", variableKey)
.then().expect()
  .statusCode(Status.BAD_REQUEST.getStatusCode())
  .contentType(MediaType.APPLICATION_JSON)
 .and()
 .when().get(SINGLE_PROCESS_INSTANCE_BINARY_VARIABLE_URL);
}

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

@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
public void testProcessVariableValueNumberComparison() throws Exception {
 // long
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", 123L));
 // non-matching long
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", 12345L));
 // short
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", (short) 123));
 // double
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", 123.0d));
 // integer
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", 123));
 // untyped null
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", null));
 // typed null
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", Variables.longValue(null)));
 runtimeService.startProcessInstanceByKey("oneTaskProcess",
   Collections.<String, Object>singletonMap("var", "123"));
 assertEquals(4, runtimeService.createExecutionQuery().processVariableValueNotEquals("var", Variables.numberValue(123)).count());
}

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

protected TypedValue aggregateNumberValues(List<TypedValue> values) {
 try {
  List<Integer> intValues = convertValuesToInteger(values);
  return Variables.integerValue(aggregateIntegerValues(intValues));
 }
 catch (IllegalArgumentException e) {
  // ignore
 }
 try {
  List<Long> longValues = convertValuesToLong(values);
  return Variables.longValue(aggregateLongValues(longValues));
 }
 catch (IllegalArgumentException e) {
  // ignore
 }
 try {
  List<Double> doubleValues = convertValuesToDouble(values);
  return Variables.doubleValue(aggregateDoubleValues(doubleValues));
 }
 catch (IllegalArgumentException e) {
  // ignore
 }
 throw LOG.unableToConvertValuesToAggregatableTypes(values, Integer.class, Long.class, Double.class);
}

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

.putValue("e", Variables.doubleValue(20., true))
.putValue("f", Variables.integerValue(10, true))
.putValue("g", Variables.longValue((long) 10, true))
.putValue("h", Variables.shortValue((short) 10, true))
.putValue("i", Variables.objectValue(new Integer(100), true).create())

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

Collections.<String, Object>singletonMap("var", Variables.longValue(null)));

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

Collections.<String, Object>singletonMap("var", Variables.longValue(null)));

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

@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
public void testTaskVariableValueEqualsNumber() throws Exception {
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 List<Task> tasks = taskService.createTaskQuery().processDefinitionKey("oneTaskProcess").list();
 assertEquals(8, tasks.size());
 taskService.setVariableLocal(tasks.get(0).getId(), "var", 123L);
 taskService.setVariableLocal(tasks.get(1).getId(), "var", 12345L);
 taskService.setVariableLocal(tasks.get(2).getId(), "var", (short) 123);
 taskService.setVariableLocal(tasks.get(3).getId(), "var", 123.0d);
 taskService.setVariableLocal(tasks.get(4).getId(), "var", 123);
 taskService.setVariableLocal(tasks.get(5).getId(), "var", null);
 taskService.setVariableLocal(tasks.get(6).getId(), "var", Variables.longValue(null));
 taskService.setVariableLocal(tasks.get(7).getId(), "var", "123");
 assertEquals(4, historyService.createHistoricTaskInstanceQuery().taskVariableValueEquals("var", Variables.numberValue(123)).count());
 assertEquals(4, historyService.createHistoricTaskInstanceQuery().taskVariableValueEquals("var", Variables.numberValue(123L)).count());
 assertEquals(4, historyService.createHistoricTaskInstanceQuery().taskVariableValueEquals("var", Variables.numberValue(123.0d)).count());
 assertEquals(4, historyService.createHistoricTaskInstanceQuery().taskVariableValueEquals("var", Variables.numberValue((short) 123)).count());
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskVariableValueEquals("var", Variables.numberValue(null)).count());
}

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

@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
public void testTaskVariableValueEqualsNumber() throws Exception {
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 runtimeService.startProcessInstanceByKey("oneTaskProcess");
 List<Task> tasks = taskService.createTaskQuery().processDefinitionKey("oneTaskProcess").list();
 assertEquals(8, tasks.size());
 taskService.setVariableLocal(tasks.get(0).getId(), "var", 123L);
 taskService.setVariableLocal(tasks.get(1).getId(), "var", 12345L);
 taskService.setVariableLocal(tasks.get(2).getId(), "var", (short) 123);
 taskService.setVariableLocal(tasks.get(3).getId(), "var", 123.0d);
 taskService.setVariableLocal(tasks.get(4).getId(), "var", 123);
 taskService.setVariableLocal(tasks.get(5).getId(), "var", null);
 taskService.setVariableLocal(tasks.get(6).getId(), "var", Variables.longValue(null));
 taskService.setVariableLocal(tasks.get(7).getId(), "var", "123");
 assertEquals(4, taskService.createTaskQuery().taskVariableValueEquals("var", Variables.numberValue(123)).count());
 assertEquals(4, taskService.createTaskQuery().taskVariableValueEquals("var", Variables.numberValue(123L)).count());
 assertEquals(4, taskService.createTaskQuery().taskVariableValueEquals("var", Variables.numberValue(123.0d)).count());
 assertEquals(4, taskService.createTaskQuery().taskVariableValueEquals("var", Variables.numberValue((short) 123)).count());
 assertEquals(1, taskService.createTaskQuery().taskVariableValueEquals("var", Variables.numberValue(null)).count());
}

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

String variableName3 = "theThirdVariable";
TypedValue variableValue = Variables.stringValue("abc");
TypedValue variableValue2 = Variables.longValue(null);

相关文章