/* * Copyright 2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wamblee.mythtv; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.Table; /** * */ @Entity @Table(name="recorded") //@IdClass(RecordingPk.class) public class Recording implements Serializable { //@Id @ManyToOne(targetEntity=Channel.class) @JoinColumn(name="chanid") private Channel _channel; @Id @Column(name="starttime") private Date _starttime; @Column(name="basename") private String _basename; @Column(name="progstart") private Date _progstart; @Column(name="title") private String _title; @Column(name="subtitle") private String _subtitle; @Column(name="filesize") private long _filesize; protected Recording() { // Empty } /** * @return the channel */ public Channel getChannel() { return _channel; } /** * @return the basename */ public String getBasename() { return _basename; } /** * @return the progstart */ public Date getStartTime() { return _starttime; } /** * @return the progstart */ public Date getProgstart() { return _progstart; } /** * @return the title */ public String getTitle() { return _title; } /** * @return the subtitle */ public String getSubtitle() { return _subtitle; } /** * @return the filesize */ public long getFilesize() { return _filesize; } public void setFilesize(long aFilesize) { _filesize = aFilesize; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "Recording(" + _channel + "," + _basename + "," + _progstart + "," + _title + "," + _subtitle + ")"; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object aObj) { if ( !(aObj instanceof Recording)) { return false; } Recording recording = (Recording)aObj; return _channel.equals(recording._channel) && _starttime.equals(recording._starttime); } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return _channel.hashCode()*10 + ((int)_starttime.getTime() %10); } }