X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=mythtv%2Fmonitor%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fmythtv%2FRecordingPk.java;h=40ffd078796286a75db41eea6faa8cf6e7d290d8;hb=0cd2d53496b3819d5f8cccb38400481e2faeda03;hp=d47af6d70c772a43d93dd08ac770ff804e8307f8;hpb=5ac55ba349fd3c81d3d04e23528a609134db209a;p=utils diff --git a/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java b/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java index d47af6d7..40ffd078 100644 --- a/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java +++ b/mythtv/monitor/src/main/java/org/wamblee/mythtv/RecordingPk.java @@ -16,16 +16,91 @@ package org.wamblee.mythtv; +import java.io.Serializable; import java.util.Date; import javax.persistence.Column; +import javax.persistence.Embeddable; import javax.persistence.Id; import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; /** * + * + * @author Erik Brakkee */ -public class RecordingPk { +@Embeddable +public class RecordingPk implements Serializable { public Channel _channel; public Date _starttime; + + public RecordingPk() { + // Empty + } + + /** + * @return the channel + */ + @ManyToOne + @JoinColumn(name="chanid") + public Channel getChannel() { + return _channel; + } + + /** + * @param aChannel the channel to set + */ + public void setChannel(Channel aChannel) { + _channel = aChannel; + } + + /** + * @return the starttime + */ + @Column(name="starttime") + @Temporal(TemporalType.TIMESTAMP) + public Date getStartTime() { + return _starttime; + } + + /** + * @param aStarttime the starttime to set + */ + public void setStartTime(Date aStarttime) { + _starttime = aStarttime; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object aObj) { + if ( aObj == null ) { + return false; + } + if ( !(aObj instanceof RecordingPk)) { + return false; + } + RecordingPk pk = (RecordingPk) aObj; + return _channel.equals(pk._channel) && _starttime.equals(pk._starttime); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return _channel.hashCode() + _starttime.hashCode(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "pk(" + _channel + ", " + _starttime + ")"; + } }