Java Code Examples for org.camunda.bpm.engine.variable.value.TypedValue#getValue()
The following examples show how to use
org.camunda.bpm.engine.variable.value.TypedValue#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractCollectNumberHitPolicyHandler.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected List<Integer> convertValuesToInteger(List<TypedValue> typedValues) throws IllegalArgumentException { List<Integer> intValues = new ArrayList<Integer>(); for (TypedValue typedValue : typedValues) { if (ValueType.INTEGER.equals(typedValue.getType())) { intValues.add((Integer) typedValue.getValue()); } else if (typedValue.getType() == null) { // check if it is an integer Object value = typedValue.getValue(); if (value instanceof Integer) { intValues.add((Integer) value); } else { throw new IllegalArgumentException(); } } else { // reject other typed values throw new IllegalArgumentException(); } } return intValues; }
Example 2
Source File: ObjectValueMapper.java From camunda-external-task-client-java with Apache License 2.0 | 6 votes |
@Override protected boolean canWriteValue(TypedValue typedValue) { if (!(typedValue instanceof SerializableValue) && !(typedValue instanceof UntypedValueImpl)) { return false; } if (typedValue instanceof SerializableValue) { SerializableValue serializableValue = (SerializableValue) typedValue; String requestedDataFormat = serializableValue.getSerializationDataFormat(); if (!serializableValue.isDeserialized()) { // serialized object => dataformat must match return serializationDataFormat.equals(requestedDataFormat); } else { final boolean canSerialize = typedValue.getValue() == null || dataFormat.canMap(typedValue.getValue()); return canSerialize && (requestedDataFormat == null || serializationDataFormat.equals(requestedDataFormat)); } } else { return typedValue.getValue() == null || dataFormat.canMap(typedValue.getValue()); } }
Example 3
Source File: EqualsNullValue.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public boolean matches(Object argument) { if (argument == null || !TypedValue.class.isAssignableFrom(argument.getClass())) { return false; } TypedValue typedValue = (TypedValue) argument; if (typedValue.getType() != ValueType.NULL) { return false; } if (typedValue.getValue() != null) { return false; } return true; }
Example 4
Source File: DateFormType.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public TypedValue convertToModelValue(TypedValue propertyValue) { Object value = propertyValue.getValue(); if(value == null) { return Variables.dateValue(null, propertyValue.isTransient()); } else if(value instanceof Date) { return Variables.dateValue((Date) value, propertyValue.isTransient()); } else if(value instanceof String) { String strValue = ((String) value).trim(); if (strValue.isEmpty()) { return Variables.dateValue(null, propertyValue.isTransient()); } try { return Variables.dateValue((Date) dateFormat.parseObject(strValue), propertyValue.isTransient()); } catch (ParseException e) { throw new ProcessEngineException("Could not parse value '"+value+"' as date using date format '"+datePattern+"'."); } } else { throw new ProcessEngineException("Value '"+value+"' cannot be transformed into a Date."); } }
Example 5
Source File: DmnDecisionResultEntriesImpl.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
@Override public Object get(Object key) { TypedValue typedValue = outputValues.get(key); if (typedValue != null) { return typedValue.getValue(); } else { return null; } }
Example 6
Source File: VariableMapImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Object remove(Object key) { TypedValue prevValue = variables.remove(key); if(prevValue != null) { return prevValue.getValue(); } else { return null; } }
Example 7
Source File: DmnDecisionRuleResultImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public Object get(Object key) { TypedValue typedValue = outputValues.get(key); if (typedValue != null) { return typedValue.getValue(); } else { return null; } }
Example 8
Source File: BusinessProcess.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * @param variableName * the name of the local process variable for which the value is to be * retrieved * @return the value of the provided local process variable or 'null' if no such * variable is set */ @SuppressWarnings("unchecked") public <T> T getVariableLocal(String variableName) { TypedValue variable = getVariableLocalTyped(variableName); if (variable != null) { Object value = variable.getValue(); if (value != null) { return (T) value; } } return null; }
Example 9
Source File: AbstractVariableScope.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected Object getValueFromVariableInstance(boolean deserializeObjectValue, CoreVariableInstance variableInstance) { if(variableInstance != null) { TypedValue typedValue = variableInstance.getTypedValue(deserializeObjectValue); if (typedValue != null) { return typedValue.getValue(); } } return null; }
Example 10
Source File: VariableResponseProvider.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * Creates a response for a variable of type {@link ValueType#BYTES}. */ protected Response responseForByteVariable(TypedValue variableInstance) { byte[] valueBytes = (byte[]) variableInstance.getValue(); if (valueBytes == null) { valueBytes = new byte[0]; } return Response.ok(new ByteArrayInputStream(valueBytes), MediaType.APPLICATION_OCTET_STREAM).build(); }
Example 11
Source File: VariableMapImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Object get(Object key) { TypedValue typedValue = variables.get(key); if(typedValue != null) { return typedValue.getValue(); } else { return null; } }
Example 12
Source File: VariableValue.java From camunda-external-task-client-java with Apache License 2.0 | 5 votes |
public Object getValue() { TypedValue typedValue = getTypedValue(); if (typedValue != null) { return typedValue.getValue(); } else { return null; } }
Example 13
Source File: AbstractCollectNumberHitPolicyHandler.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
protected List<Double> convertValuesToDouble(List<TypedValue> typedValues) throws IllegalArgumentException { List<Double> doubleValues = new ArrayList<Double>(); for (TypedValue typedValue : typedValues) { if (ValueType.DOUBLE.equals(typedValue.getType())) { doubleValues.add((Double) typedValue.getValue()); } else if (typedValue.getType() == null) { // check if it is a double or a string of a decimal number Object value = typedValue.getValue(); if (value instanceof Double) { doubleValues.add((Double) value); } else { Double doubleValue = Double.valueOf(value.toString()); doubleValues.add(doubleValue); } } else { // reject other typed values throw new IllegalArgumentException(); } } return doubleValues; }
Example 14
Source File: UpdateValueDelegate.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void execute(DelegateExecution execution) throws Exception { TypedValue typedValue = execution.getVariableTyped("listVar"); List<JsonSerializable> var = (List<JsonSerializable>) typedValue.getValue(); JsonSerializable newElement = new JsonSerializable(); newElement.setStringProperty(STRING_PROPERTY); // implicit update of the list, so no execution.setVariable call var.add(newElement); }
Example 15
Source File: StringFormType.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TypedValue convertValue(TypedValue propertyValue) { if(propertyValue instanceof StringValue) { return propertyValue; } else { Object value = propertyValue.getValue(); if(value == null) { return Variables.stringValue(null, propertyValue.isTransient()); } else { return Variables.stringValue(value.toString(), propertyValue.isTransient()); } } }
Example 16
Source File: TypedValueField.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Object getValue() { TypedValue typedValue = getTypedValue(false); if (typedValue != null) { return typedValue.getValue(); } else { return null; } }
Example 17
Source File: VariableContextElResolver.java From camunda-engine-dmn with Apache License 2.0 | 4 votes |
protected Object unpack(TypedValue typedValue) { if(typedValue != null) { return typedValue.getValue(); } return null; }
Example 18
Source File: ByteArrayValueSerializer.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Override protected boolean canWriteValue(TypedValue typedValue) { return super.canWriteValue(typedValue) || typedValue.getValue() instanceof InputStream; }
Example 19
Source File: VariableContextElResolver.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected Object unpack(TypedValue typedValue) { if(typedValue != null) { return typedValue.getValue(); } return null; }
Example 20
Source File: PrimitiveValueSerializer.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected boolean canWriteValue(TypedValue typedValue) { Object value = typedValue.getValue(); Class<?> javaType = getType().getJavaType(); return value == null || javaType.isAssignableFrom(value.getClass()); }