001package ball.tv.epg.entity;
002/*-
003 * ##########################################################################
004 * TV H/W, EPGs, and Recording
005 * $Id: Schedule.java 5285 2020-02-05 04:23:21Z ball $
006 * $HeadURL: svn+ssh://svn.hcf.dev/var/spool/scm/repository.svn/ball-tv/trunk/src/main/java/ball/tv/epg/entity/Schedule.java $
007 * %%
008 * Copyright (C) 2013 - 2020 Allen D. Ball
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the "License");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 *
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 *
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an "AS IS" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * ##########################################################################
022 */
023import ball.databind.JSONBean;
024import ball.databind.UNIXTimeStampDeserializer;
025import ball.databind.UNIXTimeStampSerializer;
026import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
027import com.fasterxml.jackson.databind.annotation.JsonSerialize;
028import javax.persistence.Column;
029import javax.persistence.Entity;
030import javax.persistence.Id;
031import javax.persistence.IdClass;
032import javax.persistence.Table;
033import lombok.EqualsAndHashCode;
034import lombok.Getter;
035import lombok.NoArgsConstructor;
036import lombok.Setter;
037
038/**
039 * {@link Schedule} {@link Entity}.
040 *
041 * {@bean.info}
042 *
043 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball}
044 * @version $Revision: 5285 $
045 */
046@Entity
047@Table(catalog = "epg", name = "schedules")
048@IdClass(Schedule.PK.class)
049@NoArgsConstructor @EqualsAndHashCode(callSuper = false)
050public class Schedule extends AbstractEntity {
051    private static final long serialVersionUID = 7844809076792281407L;
052
053    /** @serial */
054    @Id @Column(nullable = false)
055    @Getter @Setter
056    private int stationID = -1;
057
058    /** @serial */
059    @Id @Column(nullable = false)
060    @JsonDeserialize(using = UNIXTimeStampDeserializer.class)
061    @JsonSerialize(using = UNIXTimeStampSerializer.class)
062    @Getter @Setter
063    private long airDateTime = -1;
064
065    /** @serial */
066    @Column(length = 16, nullable = false)
067    @Getter @Setter
068    private String programID = null;
069
070    /** @serial */
071    @Column(nullable = false)
072    @Getter @Setter
073    private int duration = -1;
074
075    /** @serial */
076    @Column(length = 24, nullable = false)
077    @Getter @Setter
078    private String md5 = null;
079
080    @NoArgsConstructor @EqualsAndHashCode(callSuper = false)
081    public static class PK extends JSONBean {
082        private static final long serialVersionUID = -2869338070805361110L;
083
084        /** @serial */ @Getter @Setter private int stationID = -1;
085        /** @serial */ @Getter @Setter private long airDateTime = -1;
086    }
087}