/* * 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.EmbeddedId; 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; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; /** * */ @Entity @Table(name="recorded") public class Recording implements Serializable { private RecordingPk _id; private String _basename; private Date _progstart; private String _title; private String _subtitle; private long _filesize; protected Recording() { // Empty } /** * @return the id */ @EmbeddedId public RecordingPk getId() { return _id; } /** * @param aId the id to set */ public void setId(RecordingPk aId) { _id = aId; } /** * @return the basename */ @Column(name="basename") public String getBasename() { return _basename; } /** * @param aBasename the basename to set */ public void setBasename(String aBasename) { _basename = aBasename; } /** * @return the progstart */ @Column(name="progstart") @Temporal(TemporalType.TIMESTAMP) public Date getProgstart() { return _progstart; } /** * @param aProgstart the progstart to set */ public void setProgstart(Date aProgstart) { _progstart = aProgstart; } @Transient public Channel getChannel() { return _id.getChannel(); } @Transient public Date getStarttime() { return _id.getStartTime(); } /** * @return the title */ @Column(name="title") public String getTitle() { return _title; } /** * @param aTitle the title to set */ public void setTitle(String aTitle) { _title = aTitle; } /** * @return the subtitle */ @Column(name="subtitle") public String getSubtitle() { return _subtitle; } /** * @param aSubtitle the subtitle to set */ public void setSubtitle(String aSubtitle) { _subtitle = aSubtitle; } /** * @return the filesize */ @Column(name="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(" + _id + "," + _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 _id.equals(recording._id); } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return _id.hashCode(); } }