/* * 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.Embeddable; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * */ @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(); } }