View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  package org.opencastproject.scheduler.impl.persistence;
22  
23  import java.util.Date;
24  
25  import javax.persistence.Column;
26  import javax.persistence.Entity;
27  import javax.persistence.Id;
28  import javax.persistence.IdClass;
29  import javax.persistence.Index;
30  import javax.persistence.Lob;
31  import javax.persistence.NamedQueries;
32  import javax.persistence.NamedQuery;
33  import javax.persistence.Table;
34  import javax.persistence.Temporal;
35  import javax.persistence.TemporalType;
36  
37  /**
38   * Entity object for storing extended scheduled event information in persistence storage.
39   */
40  @IdClass(EventIdPK.class)
41  @Entity(name = "ExtendedEvent")
42  @NamedQueries({
43      @NamedQuery(name = "ExtendedEvent.findAll", query = "SELECT e FROM ExtendedEvent e WHERE e.organization = :org"),
44      @NamedQuery(name = "ExtendedEvent.countAll", query = "SELECT COUNT(e) FROM ExtendedEvent e"),
45      @NamedQuery(name = "ExtendedEvent.findEvents", query = "SELECT e.mediaPackageId FROM ExtendedEvent e WHERE e.organization = :org AND e.captureAgentId = :ca AND e.startDate < :end AND e.endDate > :start ORDER BY e.startDate ASC"),
46      @NamedQuery(name = "ExtendedEvent.searchEventsCA", query = "SELECT e FROM ExtendedEvent e WHERE e.organization = :org AND e.captureAgentId = :ca AND e.startDate >= :startFrom AND e.startDate < :startTo AND e.endDate >= :endFrom AND e.endDate < :endTo ORDER BY e.startDate ASC"),
47      @NamedQuery(name = "ExtendedEvent.searchEvents", query = "SELECT e FROM ExtendedEvent e WHERE e.organization = :org AND e.startDate >= :startFrom AND e.startDate < :startTo AND e.endDate >= :endFrom AND e.endDate < :endTo ORDER BY e.startDate ASC"),
48      @NamedQuery(name = "ExtendedEvent.knownRecordings", query = "SELECT e FROM ExtendedEvent e WHERE e.organization = :org AND e.recordingState IS NOT NULL AND e.recordingLastHeard IS NOT NULL")
49  })
50  @Table(name = "oc_scheduled_extended_event", indexes = {
51      @Index(name = "IX_oc_scheduled_extended_event_organization", columnList = ("organization")),
52      @Index(name = "IX_oc_scheduled_extended_event_capture_agent_id", columnList = ("capture_agent_id")),
53      @Index(name = "IX_oc_scheduled_extended_event_dates", columnList = ("start_date, end_date"))
54  })
55  public class ExtendedEventDto {
56  
57    /** Event ID, primary key */
58    @Id
59    @Column(name = "mediapackage_id", length = 128)
60    private String mediaPackageId;
61  
62    /** Organization id, primary key */
63    @Id
64    @Column(name = "organization", length = 128)
65    private String organization;
66  
67    /** Capture agent id */
68    @Column(name = "capture_agent_id", nullable = false, length = 128)
69    private String captureAgentId;
70  
71    /** recording start date */
72    @Column(name = "start_date", nullable = false)
73    @Temporal(TemporalType.TIMESTAMP)
74    private Date startDate;
75  
76    /** recording end date */
77    @Column(name = "end_date", nullable = false)
78    @Temporal(TemporalType.TIMESTAMP)
79    private Date endDate;
80  
81    /** source */
82    @Column(name = "source")
83    private String source;
84  
85    /** recording state */
86    @Column(name = "recording_state")
87    private String recordingState;
88  
89    /** recording last heard */
90    @Column(name = "recording_last_heard")
91    private Long recordingLastHeard;
92  
93    /** presenters */
94    @Lob
95    @Column(name = "presenters")
96    private String presenters;
97  
98    /** last modified date */
99    @Column(name = "last_modified_date")
100   @Temporal(TemporalType.TIMESTAMP)
101   private Date lastModifiedDate;
102 
103   /** capture agent properties */
104   @Lob
105   @Column(name = "capture_agent_properties")
106   private String captureAgentProperties;
107 
108   /** workflow properties */
109   @Lob
110   @Column(name = "workflow_properties")
111   private String workflowProperties;
112 
113   @Column(name = "checksum", length = 64)
114   private String checksum;
115 
116   /**
117    * Default constructor without any import.
118    */
119   public ExtendedEventDto() {
120   }
121 
122   public String getMediaPackageId() {
123     return mediaPackageId;
124   }
125 
126   public void setMediaPackageId(String mediaPackageId) {
127     this.mediaPackageId = mediaPackageId;
128   }
129 
130   public String getOrganization() {
131     return organization;
132   }
133 
134   public void setOrganization(String organization) {
135     this.organization = organization;
136   }
137 
138   public String getCaptureAgentId() {
139     return captureAgentId;
140   }
141 
142   public void setCaptureAgentId(String captureAgentId) {
143     this.captureAgentId = captureAgentId;
144   }
145 
146   public Date getStartDate() {
147     return startDate;
148   }
149 
150   public void setStartDate(Date startDate) {
151     this.startDate = startDate;
152   }
153 
154   public Date getEndDate() {
155     return endDate;
156   }
157 
158   public void setEndDate(Date endDate) {
159     this.endDate = endDate;
160   }
161 
162   public String getSource() {
163     return source;
164   }
165 
166   public void setSource(String source) {
167     this.source = source;
168   }
169 
170   public String getRecordingState() {
171     return recordingState;
172   }
173 
174   public void setRecordingState(String recordingState) {
175     this.recordingState = recordingState;
176   }
177 
178   public Long getRecordingLastHeard() {
179     return recordingLastHeard;
180   }
181 
182   public void setRecordingLastHeard(Long recordingLastHeard) {
183     this.recordingLastHeard = recordingLastHeard;
184   }
185 
186   public String getPresenters() {
187     return presenters;
188   }
189 
190   public void setPresenters(String presenters) {
191     this.presenters = presenters;
192   }
193 
194   public Date getLastModifiedDate() {
195     return lastModifiedDate;
196   }
197 
198   public void setLastModifiedDate(Date lastModifiedDate) {
199     this.lastModifiedDate = lastModifiedDate;
200   }
201 
202   public String getChecksum() {
203     return checksum;
204   }
205 
206   public void setChecksum(String checksum) {
207     this.checksum = checksum;
208   }
209 
210   public String getCaptureAgentProperties() {
211     return captureAgentProperties;
212   }
213 
214   public void setCaptureAgentProperties(String captureAgentProperties) {
215     this.captureAgentProperties = captureAgentProperties;
216   }
217 
218   public String getWorkflowProperties() {
219     return workflowProperties;
220   }
221 
222   public void setWorkflowProperties(String workflowProperties) {
223     this.workflowProperties = workflowProperties;
224   }
225 }