001 /**
002 * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software
010 * distributed under the License is distributed on an "AS IS" BASIS,
011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 * See the License for the specific language governing permissions and
013 * limitations under the License. See accompanying LICENSE file.
014 */
015 package org.apache.oozie.client.rest;
016
017 import java.util.Date;
018
019 import javax.persistence.Basic;
020 import javax.persistence.Column;
021 import javax.persistence.DiscriminatorColumn;
022 import javax.persistence.DiscriminatorType;
023 import javax.persistence.Entity;
024 import javax.persistence.GeneratedValue;
025 import javax.persistence.GenerationType;
026 import javax.persistence.Id;
027 import javax.persistence.Lob;
028 import javax.persistence.SequenceGenerator;
029 import javax.persistence.Table;
030 import javax.persistence.Transient;
031
032 import org.apache.oozie.client.SLAEvent;
033 import org.json.simple.JSONObject;
034
035 @Entity
036 @Table(name = "SLA_EVENTS")
037 @DiscriminatorColumn(name = "bean_type", discriminatorType = DiscriminatorType.STRING)
038 public class JsonSLAEvent implements SLAEvent, JsonBean {
039 // Primary key
040 @Id
041 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EVENT_SEQ")
042 @SequenceGenerator(name = "EVENT_SEQ", sequenceName = "EVENT_SEQ", allocationSize = 50)
043 private long event_id;
044
045 @Basic
046 @Column(name = "sla_id")
047 private String slaId;
048
049 @Transient
050 private SlaAppType appType = null;
051
052 @Basic
053 @Column(name = "app_name")
054 private String appName = null;
055
056 @Basic
057 @Column(name = "user_name")
058 private String user = null;
059
060 @Basic
061 @Column(name = "group_name")
062 private String groupName = null;
063
064 @Basic
065 @Column(name = "parent_client_id")
066 private String parentClientId = null;
067
068 @Basic
069 @Column(name = "parent_sla_id")
070 private String parentSlaId = null;
071
072 @Transient
073 private Date expectedStart = null;
074
075 @Transient
076 private Date expectedEnd = null;
077
078 @Transient
079 private Date statusTimestamp = null;
080
081 @Column(name = "notification_msg")
082 @Lob
083 private String notificationMsg = null;
084
085 @Basic
086 @Column(name = "alert_contact")
087 private String alertContact = null;
088
089 @Basic
090 @Column(name = "dev_contact")
091 private String devContact = null;
092
093 @Basic
094 @Column(name = "qa_contact")
095 private String qaContact = null;
096
097 @Basic
098 @Column(name = "se_contact")
099 private String seContact = null;
100
101 @Basic
102 @Column(name = "alert_frequency")
103 private String alertFrequency = null;
104
105 @Basic
106 @Column(name = "alert_percentage")
107 private String alertPercentage = null;
108
109 @Column(name = "upstream_apps")
110 @Lob
111 private String upstreamApps = null;
112
113 @Transient
114 private Status jobStatus = null;
115
116 @Column(name = "job_data")
117 @Lob
118 private String jobData = null;
119
120 public long getEvent_id() {
121 return event_id;
122 }
123
124 public void setEvent_id(long id) {
125 this.event_id = id;
126 }
127
128 public String getSlaId() {
129 return slaId;
130 }
131
132 public void setSlaId(String slaId) {
133 this.slaId = slaId;
134 }
135
136 /*
137 * public String getClientId() { return clientId; }
138 *
139 * public void setClientId(String clientId) { this.clientId = clientId; }
140 */
141 public SlaAppType getAppType() {
142 return appType;
143 }
144
145 public void setAppType(SlaAppType appType) {
146 this.appType = appType;
147 }
148
149 public String getAppName() {
150 return appName;
151 }
152
153 public void setAppName(String appName) {
154 this.appName = appName;
155 }
156
157 public String getUser() {
158 return user;
159 }
160
161 public void setUser(String user) {
162 this.user = user;
163 }
164
165 public String getGroupName() {
166 return groupName;
167 }
168
169 public void setGroupName(String groupName) {
170 this.groupName = groupName;
171 }
172
173 public String getParentClientId() {
174 return parentClientId;
175 }
176
177 public void setParentClientId(String parentClientId) {
178 this.parentClientId = parentClientId;
179 }
180
181 public String getParentSlaId() {
182 return parentSlaId;
183 }
184
185 public void setParentSlaId(String parentSlaId) {
186 this.parentSlaId = parentSlaId;
187 }
188
189 public Date getExpectedStart() {
190 return expectedStart;
191 }
192
193 public void setExpectedStart(Date expectedStart) {
194 this.expectedStart = expectedStart;
195 }
196
197 public Date getExpectedEnd() {
198 return expectedEnd;
199 }
200
201 public void setExpectedEnd(Date expectedEnd) {
202 this.expectedEnd = expectedEnd;
203 }
204
205 public Date getStatusTimestamp() {
206 return statusTimestamp;
207 }
208
209 public void setStatusTimestamp(Date statusTimestamp) {
210 this.statusTimestamp = statusTimestamp;
211 }
212
213 public String getNotificationMsg() {
214 return notificationMsg;
215 }
216
217 public void setNotificationMsg(String notificationMsg) {
218 this.notificationMsg = notificationMsg;
219 }
220
221 public String getAlertContact() {
222 return alertContact;
223 }
224
225 public void setAlertContact(String alertContact) {
226 this.alertContact = alertContact;
227 }
228
229 public String getDevContact() {
230 return devContact;
231 }
232
233 public void setDevContact(String devContact) {
234 this.devContact = devContact;
235 }
236
237 public String getQaContact() {
238 return qaContact;
239 }
240
241 public void setQaContact(String qaContact) {
242 this.qaContact = qaContact;
243 }
244
245 public String getSeContact() {
246 return seContact;
247 }
248
249 public void setSeContact(String seContact) {
250 this.seContact = seContact;
251 }
252
253 public String getAlertFrequency() {
254 return alertFrequency;
255 }
256
257 public void setAlertFrequency(String alertFrequency) {
258 this.alertFrequency = alertFrequency;
259 }
260
261 public String getAlertPercentage() {
262 return alertPercentage;
263 }
264
265 public void setAlertPercentage(String alertPercentage) {
266 this.alertPercentage = alertPercentage;
267 }
268
269 public String getUpstreamApps() {
270 return upstreamApps;
271 }
272
273 public void setUpstreamApps(String upstreamApps) {
274 this.upstreamApps = upstreamApps;
275 }
276
277 public Status getJobStatus() {
278 return jobStatus;
279 }
280
281 public void setJobStatus(Status jobStatus) {
282 this.jobStatus = jobStatus;
283 }
284
285 public String getJobData() {
286 return jobData;
287 }
288
289 public void setJobData(String jobData) {
290 this.jobData = jobData;
291 }
292
293 @Override
294 public JSONObject toJSONObject() {
295 // TODO Auto-generated method stub
296 return null;
297 }
298
299 public JsonSLAEvent() {
300
301 }
302
303 @SuppressWarnings("unchecked")
304 public JsonSLAEvent(JSONObject json) {
305
306 }
307
308 }