Search in sources :

Example 1 with UntypedValueImpl

use of org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl in project camunda-bpm-platform by camunda.

the class SingleQueryVariableValueCondition method initializeValue.

public void initializeValue(VariableSerializers serializers, TypedValue typedValue) {
    TypedValueSerializer serializer = determineSerializer(serializers, typedValue);
    if (typedValue instanceof UntypedValueImpl) {
        // type has been detected
        typedValue = serializer.convertToTypedValue((UntypedValueImpl) typedValue);
    }
    serializer.writeValue(typedValue, this);
    this.type = serializer.getName();
}
Also used : UntypedValueImpl(org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl) TypedValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer)

Example 2 with UntypedValueImpl

use of org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl in project camunda-bpm-platform by camunda.

the class AbstractSerializableValueSerializer method canWriteValue.

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 || canSerializeValue(typedValue.getValue());
            return canSerialize && (requestedDataFormat == null || serializationDataFormat.equals(requestedDataFormat));
        }
    } else {
        return typedValue.getValue() == null || canSerializeValue(typedValue.getValue());
    }
}
Also used : UntypedValueImpl(org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl) SerializableValue(org.camunda.bpm.engine.variable.value.SerializableValue)

Aggregations

UntypedValueImpl (org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl)2 TypedValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer)1 SerializableValue (org.camunda.bpm.engine.variable.value.SerializableValue)1