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(); }
protected boolean shouldFetchValue(HistoricVariableInstanceEntity entity) { // do not fetch values for byte arrays eagerly (unless requested by the user) return isByteArrayFetchingEnabled || !AbstractTypedValueSerializer.BINARY_VALUE_TYPES.contains(entity.getSerializer().getType().getName()); }
@SuppressWarnings("unchecked") protected boolean isMutableValue(TypedValue value) { return((TypedValueSerializer<TypedValue>) getSerializer()).isMutableValue(value); }
if(type == null || serializer.getType().equals(type)) { if(serializer.canHandle(value)) { matchedSerializers.add(serializer); if(serializer.getType().isPrimitiveValueType()) { break; if(defaultSerializationFormat.equals(typedValueSerializer.getSerializationDataformat())) { return typedValueSerializer;
public DefaultVariableSerializers addSerializer(TypedValueSerializer<?> serializer, int index) { serializerList.add(index, serializer); serializerMap.put(serializer.getName(), serializer); return this; }
public TypedValue setValue(TypedValue value) { // determine serializer to use serializer = getSerializers().findSerializerForValue(value, Context.getProcessEngineConfiguration().getFallbackSerializerFactory()); serializerName = serializer.getName(); if(value instanceof UntypedValueImpl) { // type has been detected value = serializer.convertToTypedValue((UntypedValueImpl) value); } // set new value writeValue(value, valueFields); // cache the value cachedValue = value; // ensure that we serialize the object on command context flush // if it can be implicitly changed if (notifyOnImplicitUpdates && isMutableValue(cachedValue)) { Context.getCommandContext().registerCommandContextListener(this); } return value; }
@SuppressWarnings("unchecked") protected void writeValue(TypedValue value, ValueFields valueFields) { ((TypedValueSerializer<TypedValue>) getSerializer()).writeValue(value, valueFields); }
public TypedValue getTypedValue(boolean deserializeValue) { if (cachedValue != null && cachedValue instanceof SerializableValue && Context.getCommandContext() != null) { SerializableValue serializableValue = (SerializableValue) cachedValue; if(deserializeValue && !serializableValue.isDeserialized()) { // clear cached value in case it is not deserialized and user requests deserialized value cachedValue = null; } } if (cachedValue == null && errorMessage == null) { try { cachedValue = getSerializer().readValue(valueFields, deserializeValue); if (notifyOnImplicitUpdates && isMutableValue(cachedValue)) { Context.getCommandContext().registerCommandContextListener(this); } } catch (RuntimeException e) { // intercept the error message this.errorMessage = e.getMessage(); throw e; } } return cachedValue; }
/** * 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); } } } }
if(type == null || serializer.getType().equals(type)) { if(serializer.canHandle(value)) { matchedSerializers.add(serializer); if(serializer.getType().isPrimitiveValueType()) { break; if(defaultSerializationFormat.equals(typedValueSerializer.getSerializationDataformat())) { return typedValueSerializer;
public DefaultVariableSerializers addSerializer(TypedValueSerializer<?> serializer, int index) { serializerList.add(index, serializer); serializerMap.put(serializer.getName(), serializer); return this; }
public TypedValue setValue(TypedValue value) { // determine serializer to use serializer = getSerializers().findSerializerForValue(value, Context.getProcessEngineConfiguration().getFallbackSerializerFactory()); serializerName = serializer.getName(); if(value instanceof UntypedValueImpl) { // type has been detected value = serializer.convertToTypedValue((UntypedValueImpl) value); } // set new value writeValue(value, valueFields); // cache the value cachedValue = value; // ensure that we serialize the object on command context flush // if it can be implicitly changed if (notifyOnImplicitUpdates && isMutableValue(cachedValue)) { Context.getCommandContext().registerCommandContextListener(this); } return value; }
@SuppressWarnings("unchecked") protected void writeValue(TypedValue value, ValueFields valueFields) { ((TypedValueSerializer<TypedValue>) getSerializer()).writeValue(value, valueFields); }
public TypedValue getTypedValue(boolean deserializeValue) { if (cachedValue != null && cachedValue instanceof SerializableValue && Context.getCommandContext() != null) { SerializableValue serializableValue = (SerializableValue) cachedValue; if(deserializeValue && !serializableValue.isDeserialized()) { // clear cached value in case it is not deserialized and user requests deserialized value cachedValue = null; } } if (cachedValue == null && errorMessage == null) { try { cachedValue = getSerializer().readValue(valueFields, deserializeValue); if (notifyOnImplicitUpdates && isMutableValue(cachedValue)) { Context.getCommandContext().registerCommandContextListener(this); } } catch (RuntimeException e) { // intercept the error message this.errorMessage = e.getMessage(); throw e; } } return cachedValue; }
/** * 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); } } } }
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(); }
if(type == null || serializer.getType().equals(type)) { if(serializer.canHandle(value)) { matchedSerializers.add(serializer); if(serializer.getType().isPrimitiveValueType()) { break; if(defaultSerializationFormat.equals(typedValueSerializer.getSerializationDataformat())) { return typedValueSerializer;
protected boolean shouldFetchValue(HistoricDetailVariableInstanceUpdateEntity entity) { // do not fetch values for byte arrays eagerly (unless requested by the user) return isByteArrayFetchingEnabled || !AbstractTypedValueSerializer.BINARY_VALUE_TYPES.contains(entity.getSerializer().getType().getName()); }
public VariableSerializers removeSerializer(TypedValueSerializer<?> serializer) { serializerList.remove(serializer); serializerMap.remove(serializer.getName()); return this; }
public TypedValue setValue(TypedValue value) { // determine serializer to use serializer = getSerializers().findSerializerForValue(value, Context.getProcessEngineConfiguration().getFallbackSerializerFactory()); serializerName = serializer.getName(); if(value instanceof UntypedValueImpl) { // type has been detected value = serializer.convertToTypedValue((UntypedValueImpl) value); } // set new value writeValue(value, valueFields); // cache the value cachedValue = value; // ensure that we serialize the object on command context flush // if it can be implicitly changed if (notifyOnImplicitUpdates && isMutableValue(cachedValue)) { Context.getCommandContext().registerCommandContextListener(this); } return value; }