Java tutorial
/* * Copyright(C) 2014 * NEC Corporation All rights reserved. * * No permission to use, copy, modify and distribute this software * and its documentation for any purpose is granted. * This software is provided under applicable license agreement only. */ package com.nec.harvest.model; import java.io.Serializable; import java.util.Calendar; import java.util.Date; import javax.persistence.Column; import javax.persistence.MappedSuperclass; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import org.apache.commons.lang.StringUtils; /** * * @author <a href="mailto:sondn@nec.vn">Ngoc Son Dang</a> * @version AbstractEntity.java * @since 2014/05/21 * */ @MappedSuperclass public class AbstractEntity implements EntityResolver, Serializable { private static final long serialVersionUID = -6485988828368244860L; /** * ??? */ String prdNoC; /** * ??? */ String trmNameC; /** * ??? */ String usrNameC; /** * ?MAC */ String macAddC; /** * ? yy/mm/dd hh:mm:ss */ Calendar timeC; /** * ?? */ String prdNoU; /** * ?? */ String trmNameU; /** * ?? */ String usrNameU; /** * MAC */ String macAddU; /** * yy/mm/dd hh:mm:ss */ Calendar timeU; /** * ID */ Date updID; /** * Check a string is empty or null * * @param text * @return */ @Transient protected static String value(String text) { return StringUtils.isEmpty(text) ? StringUtils.EMPTY : text; } public AbstractEntity() { super(); } public AbstractEntity(String prdNoC, String trmNameC, String usrNameC, String macAddC, Calendar timeC, String prdNoU, String trmNameU, String usrNameU, String macAddU, Calendar timeU, Date updID) { this.prdNoC = prdNoC; this.trmNameC = trmNameC; this.usrNameC = usrNameC; this.macAddC = macAddC; this.timeC = timeC; this.prdNoU = prdNoU; this.trmNameU = trmNameU; this.usrNameU = usrNameU; this.macAddU = macAddU; this.timeU = timeU; this.updID = updID; } @Column(name = "PrdNoC", length = 10) public String getPrdNoC() { return prdNoC; } public void setPrdNoC(String prdNoC) { this.prdNoC = value(prdNoC); } @Column(name = "TrmNameC", length = 40) public String getTrmNameC() { return trmNameC; } public void setTrmNameC(String trmNameC) { this.trmNameC = value(trmNameC); } @Column(name = "UsrNameC", length = 30) public String getUsrNameC() { return usrNameC; } public void setUsrNameC(String usrNameC) { this.usrNameC = value(usrNameC); } @Column(name = "MacAddC", length = 17) public String getMacAddC() { return macAddC; } public void setMacAddC(String macAddC) { this.macAddC = value(macAddC); } @Column(name = "TimeC") @Temporal(TemporalType.TIMESTAMP) public Calendar getTimeC() { return timeC; } public void setTimeC(Calendar timeC) { this.timeC = timeC; } @Column(name = "PrdNoU", length = 10) public String getPrdNoU() { return prdNoU; } public void setPrdNoU(String prdNoU) { this.prdNoU = value(prdNoU); } @Column(name = "TrmNameU", length = 40) public String getTrmNameU() { return trmNameU; } public void setTrmNameU(String trmNameU) { this.trmNameU = value(trmNameU); } @Column(name = "UsrNameU", length = 30) public String getUsrNameU() { return usrNameU; } public void setUsrNameU(String usrNameU) { this.usrNameU = value(usrNameU); } @Column(name = "MacAddU", length = 17) public String getMacAddU() { return macAddU; } public void setMacAddU(String macAddU) { this.macAddU = value(macAddU); } @Column(name = "TimeU") @Temporal(TemporalType.TIMESTAMP) public Calendar getTimeU() { return timeU; } public void setTimeU(Calendar timeU) { this.timeU = timeU; } @Column(name = "UpdID") @Temporal(TemporalType.TIMESTAMP) public Date getUpdID() { return updID; } public void setUpdID(Date updID) { this.updID = updID; } }