moved socketproxy to https://wamblee.org/svn/public/socketproxy
[utils] / mythtv / monitor / src / main / java / org / wamblee / mythtv / RecordingPk.java
index d47af6d70c772a43d93dd08ac770ff804e8307f8..40ffd078796286a75db41eea6faa8cf6e7d290d8 100644 (file)
 
 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 + ")"; 
+    }
 }