package com.vci.server.base.persistence.history; import java.io.Serializable; import java.text.DateFormat; import java.util.Date; import com.vci.common.objects.Historizable; public class HistoryEntry implements Serializable { /** * */ private static final long serialVersionUID = 8226744877750275782L; private String id; private Date timestamp; //操作时间 private OperationType operationType; //操作类型 private String module; //操作模块 private String entity;//操作对象 private String entityId; //操作对象ID private String description; //操作描述 private String property; //被操作的属性 private String previousValue; //操作前的值 private String newValue; //操作后的值 private String user; //操作用户名称 private String ip; //操作用户的及其IP地址 private String result; //操作的结果 public HistoryEntry() { } public String getUser() { return user; } public void setUser(String user) { this.user = user; } public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getEntity() { return entity; } public void setEntity(String entity) { this.entity = entity; } public String getEntityId() { return entityId; } public void setEntityId(String entityId) { this.entityId = entityId; } public String getNewValue() { return newValue; } public void setNewValue(String newValue) { this.newValue = newValue; } public OperationType getOperationType() { return operationType; } public void setOperationType(OperationType operationType) { this.operationType = operationType; } public String getPreviousValue() { return previousValue; } public void setPreviousValue(String previousValue) { this.previousValue = previousValue; } public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public Date getTimestamp() { return timestamp; } public void setTimestamp(Date timestamp) { this.timestamp = timestamp; } public void setHistorizableEntity(Historizable entity) { this.setEntity(entity.getClass().getSimpleName()); this.setEntityId(entity.getId()); this.setDescription(entity.toString()); } public String getModule() { return module; } public void setModule(String module) { this.module = module; } public String toString() { return "History[" + DateFormat.getDateTimeInstance().format(timestamp) + ", " + operationType + ", " + entity + "," + id + " " + property + "]"; } public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final HistoryEntry other = (HistoryEntry) obj; return this.getId().equals(other.getId()); } }