Search in sources :

Example 1 with TypedValueSerializer

use of org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer in project camunda-bpm-platform by camunda.

the class SpinProcessEnginePlugin method registerSerializers.

protected void registerSerializers(ProcessEngineConfigurationImpl processEngineConfiguration) {
    List<TypedValueSerializer<?>> spinDataFormatSerializers = lookupSpinSerializers();
    VariableSerializers variableSerializers = processEngineConfiguration.getVariableSerializers();
    int javaObjectSerializerIdx = variableSerializers.getSerializerIndexByName(JavaObjectSerializer.NAME);
    for (TypedValueSerializer<?> spinSerializer : spinDataFormatSerializers) {
        // add before java object serializer
        variableSerializers.addSerializer(spinSerializer, javaObjectSerializerIdx);
    }
}
Also used : VariableSerializers(org.camunda.bpm.engine.impl.variable.serializer.VariableSerializers) TypedValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer)

Example 2 with TypedValueSerializer

use of org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer in project camunda-bpm-platform by camunda.

the class SpinProcessEnginePlugin method lookupSpinSerializers.

protected List<TypedValueSerializer<?>> lookupSpinSerializers() {
    DataFormats globalFormats = DataFormats.getInstance();
    List<TypedValueSerializer<?>> serializers = SpinVariableSerializers.createObjectValueSerializers(globalFormats);
    serializers.addAll(SpinVariableSerializers.createSpinValueSerializers(globalFormats));
    return serializers;
}
Also used : TypedValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer) DataFormats(org.camunda.spin.DataFormats)

Example 3 with TypedValueSerializer

use of org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer 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 4 with TypedValueSerializer

use of org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer in project camunda-bpm-platform by camunda.

the class AbstractVariableScope method checkJavaSerialization.

/**
 * Checks, if Java serialization will be used and if it is allowed to be used.
 * @param variableName
 * @param value
 */
protected void checkJavaSerialization(String variableName, TypedValue value) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) {
        SerializableValue serializableValue = (SerializableValue) value;
        // if Java serialization is prohibited
        if (!serializableValue.isDeserialized()) {
            String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName();
            String requestedDataFormat = serializableValue.getSerializationDataFormat();
            if (requestedDataFormat == null) {
                // check if Java serializer will be used
                final TypedValueSerializer serializerForValue = TypedValueField.getSerializers().findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory());
                if (serializerForValue != null) {
                    requestedDataFormat = serializerForValue.getSerializationDataformat();
                }
            }
            if (javaSerializationDataFormat.equals(requestedDataFormat)) {
                throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName);
            }
        }
    }
}
Also used : SerializableValue(org.camunda.bpm.engine.variable.value.SerializableValue) TypedValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Aggregations

TypedValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer)4 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 VariableSerializers (org.camunda.bpm.engine.impl.variable.serializer.VariableSerializers)1 UntypedValueImpl (org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl)1 SerializableValue (org.camunda.bpm.engine.variable.value.SerializableValue)1 DataFormats (org.camunda.spin.DataFormats)1