variableupdatelogimpl.java

来自「一个java工作流引擎」· Java 代码 · 共 68 行

JAVA
68
字号
package org.jbpm.model.log.impl;

import org.jbpm.model.execution.impl.*;
import org.jbpm.model.log.*;

public class VariableUpdateLogImpl extends ExecutionLogImpl implements VariableUpdateLog {

  private String oldValueText = null;
  private String newValueText = null;
  private VariableInstanceImpl variableInstance = null;
  private Object oldValue = null;
  private Object newValue = null;
  
  public VariableUpdateLogImpl() {}

  public VariableUpdateLogImpl( VariableInstanceImpl variableInstance, 
                                String oldValueText,
                                Object oldValue,
                                String newValueText,
                                Object newValue ) {
    this.variableInstance = variableInstance;
    this.oldValueText = oldValueText;
    this.oldValue = oldValue;
    this.newValueText = newValueText;
    this.newValue = newValue;
  }

  public String getOldValueText() { return this.oldValueText; }
  public void setOldValueText(String oldValueText) { 
    this.oldValueText = oldValueText;
    assemble();
  }

  public String getNewValueText() { return this.newValueText; }
  public void setNewValueText(String newValueText) { 
    this.newValueText = newValueText; 
    assemble();
  }

  public VariableInstanceImpl getVariableInstance() { return this.variableInstance; }
  public void setVariableInstance(VariableInstanceImpl variableInstance) { 
    this.variableInstance = variableInstance; 
    assemble();
  }
  
  public Object getOldValue() { return this.oldValue; }
  public Object getNewValue() { return this.newValue; }

  public String getVariableName() {
    return variableInstance.getName();
  }
  
  public void assemble() {
		if ( variableInstance != null ) {
		  if ( oldValueText != null ) oldValue = variableInstance.deserialize( oldValueText );
		  if ( newValueText != null ) newValue = variableInstance.deserialize( newValueText );
		}
  }
  
  public String toString() {
    return "[" + variableInstance.getName() + "]='" + newValueText + "'";
  }

	public void undo(ExecutionContextImpl executionContext) {
    variableInstance.setSerializedValue( oldValueText );
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?