@PreUpdate
public void update() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
boolean variablesChanged = false;
try {
MarshallerWriteContext context = new MarshallerWriteContext( baos,
null,
null,
null,
null );
String processType = ((ProcessInstanceImpl) processInstance).getProcess().getType();
saveProcessInstanceType( context,
processInstance,
processType );
ProcessInstanceMarshaller marshaller = ProcessMarshallerRegistry.INSTANCE.getMarshaller( processType );
externalVariables = VariablePersistenceStrategyFactory.getVariablePersistenceStrategy().isEnabled();
marshaller.writeProcessInstance( context,
processInstance,
!externalVariables );
if ( externalVariables ) {
variablesChanged = persistVariables();
}
context.close();
} catch ( IOException e ) {
throw new IllegalArgumentException( "IOException while storing process instance " + processInstance.getId() + ": " + e.getMessage() );
}
byte[] newByteArray = baos.toByteArray();
if ( variablesChanged || !Arrays.equals( newByteArray,