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

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

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

Variables.stringValue介绍

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

代码示例

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

/**
 * Creates a new {@link StringValue} that encapsulates the given <code>stringValue</code>
 */
public static StringValue stringValue(String stringValue) {
 return stringValue(stringValue, false);
}

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

@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
 String stringValue = String.valueOf(value);
 return Variables.stringValue(stringValue);
}

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

public TypedValue convertToFormValue(TypedValue modelValue) {
 if(modelValue.getValue() == null) {
  return Variables.stringValue(null, modelValue.isTransient());
 } else if(modelValue.getType() == ValueType.DATE) {
  return Variables.stringValue(dateFormat.format(modelValue.getValue()), modelValue.isTransient());
 }
 else {
  throw new ProcessEngineException("Expected value to be of type '"+ValueType.DATE+"' but got '"+modelValue.getType()+"'.");
 }
}

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

public TypedValue convertValue(TypedValue propertyValue) {
 Object value = propertyValue.getValue();
 if(value == null || String.class.isInstance(value)) {
  validateValue(value);
  return Variables.stringValue((String) value, propertyValue.isTransient());
 }
 else {
  throw new ProcessEngineException("Value '"+value+"' is not of type String.");
 }
}

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

public TypedValue convertToFormValue(TypedValue modelValue) {
 if(modelValue.getValue() == null) {
  return Variables.stringValue(null, modelValue.isTransient());
 } else if(modelValue.getType() == ValueType.DATE) {
  return Variables.stringValue(dateFormat.format(modelValue.getValue()), modelValue.isTransient());
 }
 else {
  throw new ProcessEngineException("Expected value to be of type '"+ValueType.DATE+"' but got '"+modelValue.getType()+"'.");
 }
}

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

@Test
public void testSameNamesDifferentScopes() {
 testRule.deploy(ProcessModels.SUBPROCESS_PROCESS);
 runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValue("foo", Variables.stringValue("bar")));
 Execution execution = runtimeService.createExecutionQuery().activityId(USER_TASK_ID).singleResult();
 try {
  runtimeService.setVariable(execution.getId(), "foo", Variables.stringValue("xyz", true));
 } catch (ProcessEngineException e) {
  assertThat(e.getMessage(), containsString("Cannot set transient variable with name foo"));
 }
}

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

@Deployment(resources = { TEST_PROCESS, TEST_DECISION})
public void testMultipleEntries() {
 startTestProcess("multiple entries");
 DmnDecisionResultEntries firstOutput = results.get(0);
 assertEquals("foo", firstOutput.get("result1"));
 assertEquals("bar", firstOutput.get("result2"));
 assertEquals(Variables.stringValue("foo"), firstOutput.getEntryTyped("result1"));
 assertEquals(Variables.stringValue("bar"), firstOutput.getEntryTyped("result2"));
}

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

@Deployment(resources = { TEST_CASE, TEST_DECISION})
public void testMultipleEntries() {
 startTestCase("multiple entries");
 DmnDecisionResultEntries firstOutput = results.get(0);
 assertEquals("foo", firstOutput.get("result1"));
 assertEquals("bar", firstOutput.get("result2"));
 assertEquals(Variables.stringValue("foo"), firstOutput.getEntryTyped("result1"));
 assertEquals(Variables.stringValue("bar"), firstOutput.getEntryTyped("result2"));
}

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

@Test
public void setVariableTransientForCase() {
 // given
 testRule.deploy("org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn");
 // when
 engineRule.getCaseService().withCaseDefinitionByKey("oneTaskCase")
   .setVariable("foo", Variables.stringValue("bar", true)).create();
 // then
 List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list();
 assertEquals(0, variables.size());
}

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

@Deployment(resources = { TEST_PROCESS, TEST_DECISION})
public void testSingleEntry() {
 startTestProcess("single entry");
 DmnDecisionResultEntries firstOutput = results.get(0);
 assertEquals("foo", firstOutput.getFirstEntry());
 assertEquals(Variables.stringValue("foo"), firstOutput.getFirstEntryTyped());
}

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

@Deployment(resources = { TEST_PROCESS, TEST_DECISION})
public void testMultipleEntriesList() {
 startTestProcess("multiple entries list");
 assertEquals(2, results.size());
 for (DmnDecisionResultEntries output : results) {
  assertEquals(2, output.size());
  assertEquals("foo", output.get("result1"));
  assertEquals("bar", output.get("result2"));
  assertEquals(Variables.stringValue("foo"), output.getEntryTyped("result1"));
  assertEquals(Variables.stringValue("bar"), output.getEntryTyped("result2"));
 }
}

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

@Deployment(resources = { TEST_CASE, TEST_DECISION})
public void testSingleEntry() {
 startTestCase("single entry");
 DmnDecisionResultEntries firstOutput = results.get(0);
 assertEquals("foo", firstOutput.getFirstEntry());
 assertEquals(Variables.stringValue("foo"), firstOutput.getFirstEntryTyped());
}

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

@Deployment(resources = { TEST_CASE, TEST_DECISION})
public void testMultipleEntriesList() {
 startTestCase("multiple entries list");
 assertEquals(2, results.size());
 for (DmnDecisionResultEntries output : results) {
  assertEquals(2, output.size());
  assertEquals("foo", output.get("result1"));
  assertEquals("bar", output.get("result2"));
  assertEquals(Variables.stringValue("foo"), output.getEntryTyped("result1"));
  assertEquals(Variables.stringValue("bar"), output.getEntryTyped("result2"));
 }
}

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

@Deployment(resources = {CUSTOM_MAPPING_BPMN, TEST_DECISION })
public void testCustomOutputMapping() {
 ProcessInstance processInstance = startTestProcess("multiple entries");
 assertEquals("foo", runtimeService.getVariable(processInstance.getId(), "result1"));
 assertEquals(Variables.stringValue("foo"), runtimeService.getVariableTyped(processInstance.getId(), "result1"));
 assertEquals("bar", runtimeService.getVariable(processInstance.getId(), "result2"));
 assertEquals(Variables.stringValue("bar"), runtimeService.getVariableTyped(processInstance.getId(), "result2"));
}

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

@Test
public void setVariableTransientInRunningProcessInstance() {
 // given
 testRule.deploy(ProcessModels.ONE_TASK_PROCESS);
 // when
 runtimeService.startProcessInstanceByKey(ProcessModels.PROCESS_KEY);
 Execution execution = runtimeService.createExecutionQuery().singleResult();
 runtimeService.setVariable(execution.getId(), "foo", Variables.stringValue("bar", true));
 // then
 List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().list();
 assertEquals(0, variables.size());
}

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

@Test
public void testTransientVariableOvewritesPersistedVariableInSameScope() {
 testRule.deploy(ProcessModels.ONE_TASK_PROCESS);
 runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValue("foo", "bar"));
 Execution execution = runtimeService.createExecutionQuery().singleResult();
 try {
  runtimeService.setVariable(execution.getId(), "foo", Variables.stringValue("xyz", true));
 } catch (ProcessEngineException e) {
  assertThat(e.getMessage(), containsString("Cannot set transient variable with name foo"));
 }
}

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

@Deployment(resources = { TEST_PROCESS, TEST_DECISION})
public void testSingleEntryList() {
 startTestProcess("single entry list");
 assertEquals(2, results.size());
 for (DmnDecisionResultEntries output : results) {
  assertEquals("foo", output.getFirstEntry());
  assertEquals(Variables.stringValue("foo"), output.getFirstEntryTyped());
 }
}

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

@Deployment(resources = { SINGLE_ENTRY_BPMN, TEST_DECISION})
public void testSingleEntryMapping() {
 ProcessInstance processInstance = startTestProcess("single entry");
 assertEquals("foo", runtimeService.getVariable(processInstance.getId(), "result"));
 assertEquals(Variables.stringValue("foo"), runtimeService.getVariableTyped(processInstance.getId(), "result"));
}

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

@Deployment(resources = { TEST_CASE, TEST_DECISION})
public void testSingleEntryList() {
 startTestCase("single entry list");
 assertEquals(2, results.size());
 for (DmnDecisionResultEntries output : results) {
  assertEquals("foo", output.getFirstEntry());
  assertEquals(Variables.stringValue("foo"), output.getFirstEntryTyped());
 }
}

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

@Deployment(resources = { SINGLE_ENTRY_MAPPING_CMMN, TEST_DECISION })
public void testSingleEntryMapping() {
 CaseInstance caseInstance = createTestCase("single entry");
 assertEquals("foo", caseService.getVariable(caseInstance.getId(), "result"));
 assertEquals(Variables.stringValue("foo"), caseService.getVariableTyped(caseInstance.getId(), "result"));
}

相关文章