📄 timeentrydto.java
字号:
package com.wiley.compBooks.EJwithUML.Dtos;
import java.util.*;
import java.io.*;
import com.wiley.compBooks.EJwithUML.Base.DateUtil;
public class TimeEntryDTO implements Serializable
{
private String chargeCodeName;
private String projectName;
private String clientName;
private int hours;
private Date date;
private String id; //needed to find the corresponding Entity Bean for update
private boolean isUpdated = false; // for optimizing update operation
private boolean isNew = false; // for optimizing create operation
/** Creates a new Time Entry.*/
public TimeEntryDTO(String clientName, String chargeCodeName, String projectName, int hours, Date date)
{
this.chargeCodeName = chargeCodeName;
this.clientName = clientName;
this.hours = hours;
this.date = date;
this.projectName = projectName;
this.isNew = true;
}
/** Creates an existing Time Entry.*/
public TimeEntryDTO(String entryId, String clientName, String chargeCodeName,
String projectName, int hours, Date date)
{
this.clientName = clientName;
this.chargeCodeName = chargeCodeName;
this.hours = hours;
this.date = date;
this.projectName = projectName;
this.id = entryId;
}
public String getId()
{
return this.id;
}
public void setId(String id)
{
this.id = id;
}
public boolean isUpdated()
{
return this.isUpdated;
}
public boolean isNew()
{
return this.isNew;
}
public void setIsNew(boolean flag)
{
this.isNew = flag;
}
public Date getDate()
{
return this.date;
}
public void setDate(Date date)
{
this.date = date;
isUpdated = true;
}
public int getHours()
{
return this.hours;
}
public void setHours(int hours)
{
this.hours = hours;
isUpdated = true;
}
public String getClientName()
{
return this.clientName;
}
public void setClientName(String clientName)
{
this.clientName = clientName;
isUpdated = true;
}
public String getChargeCodeName()
{
return this.chargeCodeName;
}
public void setChargeCodeName(String chargeCodeName)
{
this.chargeCodeName = chargeCodeName;
isUpdated = true;
}
public String getProjectName()
{
return this.projectName;
}
public void setProjectName(String chargeCodeName)
{
this.projectName = projectName;
isUpdated = true;
}
public String toString()
{
return "date="+ DateUtil.toDateString(date)+ ",hours=" + hours + ",charge code name=" +
chargeCodeName + ",project name=" + projectName;
}
public int hashCode()
{
return (chargeCodeName.hashCode() ^ date.hashCode() ^ hours);
}
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
else
{
if (!obj.getClass().equals(this.getClass()))
{
return false;
}
else
{
TimeEntryDTO entry = (TimeEntryDTO)obj;
return (entry.chargeCodeName.equals(chargeCodeName) &&
(entry.hours == this.hours) &&
(entry.date.equals(this.date)));
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -