📄 value.java
字号:
package com.ebusiness.ebank.bean;/** * <p>Title: </p> * <p>Description: This is a super class, all of the eBank value beans * shall extends this class</p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: eBusiness Inc., All right reserved</p> * @author unascribed * @version 1.0 */import java.io.Serializable;import java.lang.Cloneable;import java.lang.CloneNotSupportedException;import java.sql.Timestamp;import java.text.SimpleDateFormat;public abstract class Value implements Serializable, Cloneable{ private long objectID; private String createUserID; private Timestamp createDate; private String updateUserID; private Timestamp updateDate; private Timestamp effectiveDate; private Timestamp expiryDate; private String action; private static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); private static Timestamp defaultEffectiveDate = Timestamp.valueOf("2000-01-01 00:00:00.000000000"); private static Timestamp defaultExpiryDate = Timestamp.valueOf("9999-12-31 00:00:00.000000000"); public Value() {} public Value(long oid) { this.objectID = oid; } public long getObjectID() { return this.objectID; } public void setObjectID(long objectID) { this.objectID = objectID; } public String getCreateUserID() { return this.createUserID; } public void setCreateUserID(String createUserID) { if (createUserID != null) this.createUserID = createUserID.toUpperCase(); } public Timestamp getCreateDate() { return this.createDate; } public void setCreateDate(Timestamp createDate) { this.createDate = createDate; } public String getUpdateUserID() { return this.updateUserID; } public void setUpdateUserID(String updateUserID) { if (updateUserID != null) this.updateUserID = updateUserID.toUpperCase(); } public Timestamp getUpdateDate() { return this.updateDate; } public void setUpdateDate(Timestamp updateDate) { this.updateDate = updateDate; } //Return default effective date if there is no effectivedate specified public Timestamp getEffectiveDate() { if (this.effectiveDate == null) return defaultEffectiveDate; return this.effectiveDate; } public void setEffectiveDate(Timestamp effectiveDate) { this.effectiveDate = effectiveDate; } public Timestamp getExpiryDate() { if (this.expiryDate == null) return defaultExpiryDate; return this.expiryDate; } public void setExpiryDate(Timestamp expiryDate) { this.expiryDate = expiryDate; } public String getAction() { return this.action; } public void setAction(String action) { this.action = action; } /** * @Return true if expiry date is before current date. False otherwise. */ public boolean isExpired() { return isExpired(new Timestamp(System.currentTimeMillis())); } /** * @Return true if expiry date is before the specified date. False otherwise. */ public boolean isExpired(Timestamp date) { if (expiryDate != null) { if (date == null) date = new Timestamp(System.currentTimeMillis()); //default to current date String compareDate = formatter.format(date); String expDate = formatter.format(expiryDate); if (expDate.compareTo(compareDate) < 0 ) return true; } return false; } /** * @Return true if current date is greater than or equal to effectiveDate and * if current date is less than or equal to expiryDate */ public boolean isActive() { return isActive(new Timestamp(System.currentTimeMillis())); } /** * @Return true if the specified date is greater than or equal to effectiveDate and * if current date is less than or equal to expiryDate */ public boolean isActive(Timestamp date) { if (date == null) date = new Timestamp(System.currentTimeMillis()); //default to current date if (!date.before(getEffectiveDate()) && !this.isExpired(date)) return true; return false; } public Object clone() { Object obj = null; try { obj = super.clone(); } catch (CloneNotSupportedException e) { //This should not occur since it implements Cloneable"); } return obj; } public String getValueType() { String className = this.getClass().getName(); return className.substring(className.lastIndexOf('.') + 1, className.indexOf("Value")); } protected String getEffExpiryDateAsString() { String effDate = (this.effectiveDate == null ? "" : ", EffectiveDate = " + formatter.format(this.effectiveDate)); String expDate = (this.expiryDate == null ? "" : ", ExpiryDate = " + formatter.format(this.expiryDate)); return effDate + expDate; } public abstract String toString();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -