001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *      http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.oozie;
019
020import java.io.DataInput;
021import java.io.DataOutput;
022import java.io.IOException;
023import java.sql.Timestamp;
024import java.util.Date;
025
026import javax.persistence.Basic;
027import javax.persistence.Column;
028import javax.persistence.Entity;
029import javax.persistence.Lob;
030import javax.persistence.NamedQueries;
031import javax.persistence.NamedQuery;
032
033import org.apache.hadoop.io.Writable;
034import org.apache.oozie.client.CoordinatorJob;
035import org.apache.oozie.client.rest.JsonCoordinatorJob;
036import org.apache.oozie.util.DateUtils;
037import org.apache.oozie.util.WritableUtils;
038import org.apache.openjpa.persistence.jdbc.Index;
039
040@Entity
041@NamedQueries( {
042        @NamedQuery(name = "UPDATE_COORD_JOB", query = "update CoordinatorJobBean w set w.appName = :appName, w.appPath = :appPath,w.concurrency = :concurrency, w.conf = :conf, w.externalId = :externalId, w.frequency = :frequency, w.lastActionNumber = :lastActionNumber, w.timeOut = :timeOut, w.timeZone = :timeZone, w.createdTimestamp = :createdTime, w.endTimestamp = :endTime, w.execution = :execution, w.jobXml = :jobXml, w.lastActionTimestamp = :lastAction, w.lastModifiedTimestamp = :lastModifiedTime, w.nextMaterializedTimestamp = :nextMaterializedTime, w.origJobXml = :origJobXml, w.slaXml=:slaXml, w.startTimestamp = :startTime, w.status = :status, w.timeUnitStr = :timeUnit where w.id = :id"),
043
044        @NamedQuery(name = "UPDATE_COORD_JOB_STATUS", query = "update CoordinatorJobBean w set w.status = :status, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
045
046        @NamedQuery(name = "UPDATE_COORD_JOB_PENDING", query = "update CoordinatorJobBean w set w.pending = :pending, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
047
048        @NamedQuery(name = "DELETE_COORD_JOB", query = "delete from CoordinatorJobBean w where w.id = :id"),
049
050        @NamedQuery(name = "GET_COORD_JOBS", query = "select OBJECT(w) from CoordinatorJobBean w"),
051
052        @NamedQuery(name = "GET_COORD_JOB", query = "select OBJECT(w) from CoordinatorJobBean w where w.id = :id"),
053
054        @NamedQuery(name = "GET_COORD_JOBS_PENDING", query = "select OBJECT(w) from CoordinatorJobBean w where w.pending = 1 order by w.lastModifiedTimestamp"),
055
056        @NamedQuery(name = "GET_COORD_JOBS_CHANGED", query = "select w.id from CoordinatorJobBean w where w.pending = 1 AND w.doneMaterialization = 1 AND w.lastModifiedTimestamp >= :lastModifiedTime"),
057
058        @NamedQuery(name = "GET_COORD_JOBS_COUNT", query = "select count(w) from CoordinatorJobBean w"),
059
060        @NamedQuery(name = "GET_COORD_JOBS_COLUMNS", query = "select w.id, w.appName, w.status, w.user, w.group, w.startTimestamp, w.endTimestamp, w.appPath, w.concurrency, w.frequency, w.lastActionTimestamp, w.nextMaterializedTimestamp, w.createdTimestamp, w.timeUnitStr, w.timeZone, w.timeOut from CoordinatorJobBean w order by w.createdTimestamp desc"),
061
062        @NamedQuery(name = "GET_COORD_JOBS_OLDER_THAN", query = "select OBJECT(w) from CoordinatorJobBean w where w.startTimestamp <= :matTime AND (w.status = 'PREP' OR w.status = 'RUNNING' or w.status = 'RUNNINGWITHERROR') AND (w.nextMaterializedTimestamp < :matTime OR w.nextMaterializedTimestamp IS NULL) AND (w.nextMaterializedTimestamp IS NULL OR (w.endTimestamp > w.nextMaterializedTimestamp AND (w.pauseTimestamp IS NULL OR w.pauseTimestamp > w.nextMaterializedTimestamp))) order by w.lastModifiedTimestamp"),
063
064        @NamedQuery(name = "GET_COORD_JOBS_OLDER_THAN_STATUS", query = "select OBJECT(w) from CoordinatorJobBean w where w.status = :status AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
065
066        @NamedQuery(name = "GET_COMPLETED_COORD_JOBS_OLDER_THAN_STATUS", query = "select OBJECT(w) from CoordinatorJobBean w where ( w.status = 'SUCCEEDED' OR w.status = 'FAILED' or w.status = 'KILLED') AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
067
068        @NamedQuery(name = "GET_COMPLETED_COORD_JOBS_WITH_NO_PARENT_OLDER_THAN_STATUS", query = "select w.id from CoordinatorJobBean w where ( w.status = 'SUCCEEDED' OR w.status = 'FAILED' or w.status = 'KILLED' or w.status = 'DONEWITHERROR') AND w.lastModifiedTimestamp <= :lastModTime and w.bundleId is null order by w.lastModifiedTimestamp"),
069
070        @NamedQuery(name = "GET_COORD_JOBS_UNPAUSED", query = "select OBJECT(w) from CoordinatorJobBean w where w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' OR w.status = 'PREP' order by w.lastModifiedTimestamp"),
071
072        @NamedQuery(name = "GET_COORD_JOBS_PAUSED", query = "select OBJECT(w) from CoordinatorJobBean w where w.status = 'PAUSED' OR w.status = 'PAUSEDWITHERROR' OR w.status = 'PREPPAUSED' order by w.lastModifiedTimestamp"),
073
074        @NamedQuery(name = "GET_COORD_JOBS_FOR_BUNDLE", query = "select OBJECT(w) from CoordinatorJobBean w where w.bundleId = :bundleId order by w.lastModifiedTimestamp"),
075
076        @NamedQuery(name = "GET_COORD_JOBS_WITH_PARENT_ID", query = "select w.id from CoordinatorJobBean w where w.bundleId = :parentId"),
077
078        @NamedQuery(name = "GET_COORD_COUNT_WITH_PARENT_ID_NOT_READY_FOR_PURGE", query = "select count(w) from CoordinatorJobBean w where w.bundleId = :parentId and (w.status NOT IN ('SUCCEEDED', 'FAILED', 'KILLED', 'DONEWITHERROR') OR w.lastModifiedTimestamp >= :lastModTime)"),
079
080        @NamedQuery(name = "GET_COORD_JOB_FOR_USER_APPNAME", query = "select w.user, w.appName from CoordinatorJobBean w where w.id = :id"),
081
082        @NamedQuery(name = "GET_COORD_JOB_FOR_USER", query = "select w.user from CoordinatorJobBean w where w.id = :id")
083
084})
085public class CoordinatorJobBean extends JsonCoordinatorJob implements Writable {
086
087    @Basic
088    @Index
089    @Column(name = "status")
090    private String status = CoordinatorJob.Status.PREP.toString();
091
092    @Basic
093    @Column(name = "start_time")
094    private java.sql.Timestamp startTimestamp = null;
095
096    @Basic
097    @Column(name = "end_time")
098    private java.sql.Timestamp endTimestamp = null;
099
100    @Basic
101    @Column(name = "pause_time")
102    private java.sql.Timestamp pauseTimestamp = null;
103
104    @Basic
105    @Index
106    @Column(name = "created_time")
107    private java.sql.Timestamp createdTimestamp = null;
108
109    @Basic
110    @Column(name = "time_unit")
111    private String timeUnitStr = CoordinatorJob.Timeunit.NONE.toString();
112
113    @Basic
114    @Column(name = "execution")
115    private String execution = CoordinatorJob.Execution.FIFO.toString();
116
117    @Basic
118    @Column(name = "last_action")
119    private java.sql.Timestamp lastActionTimestamp = null;
120
121    @Basic
122    @Index
123    @Column(name = "next_matd_time")
124    private java.sql.Timestamp nextMaterializedTimestamp = null;
125
126    @Basic
127    @Index
128    @Column(name = "last_modified_time")
129    private java.sql.Timestamp lastModifiedTimestamp = null;
130
131    @Basic
132    @Index
133    @Column(name = "suspended_time")
134    private java.sql.Timestamp suspendedTimestamp = null;
135
136    @Column(name = "job_xml")
137    @Lob
138    private String jobXml = null;
139
140    @Column(name = "orig_job_xml")
141    @Lob
142    private String origJobXml = null;
143
144
145    @Column(name = "sla_xml")
146    @Lob
147    private String slaXml = null;
148
149    @Basic
150    @Column(name = "pending")
151    private int pending = 0;
152
153    @Basic
154    @Column(name = "done_materialization")
155    private int doneMaterialization = 0;
156
157    @Basic
158    @Column(name = "app_namespace")
159    private String appNamespace = null;
160
161    /**
162     * Get start timestamp
163     *
164     * @return start timestamp
165     */
166    public java.sql.Timestamp getStartTimestamp() {
167        return startTimestamp;
168    }
169
170    /**
171     * Set start timestamp
172     *
173     * @param startTimestamp start timestamp
174     */
175    public void setStartTimestamp(java.sql.Timestamp startTimestamp) {
176        super.setStartTime(DateUtils.toDate(startTimestamp));
177        this.startTimestamp = startTimestamp;
178    }
179
180    /**
181     * Get end timestamp
182     *
183     * @return end timestamp
184     */
185    public java.sql.Timestamp getEndTimestamp() {
186        return endTimestamp;
187    }
188
189    /**
190     * Set end timestamp
191     *
192     * @param endTimestamp end timestamp
193     */
194    public void setEndTimestamp(java.sql.Timestamp endTimestamp) {
195        super.setEndTime(DateUtils.toDate(endTimestamp));
196        this.endTimestamp = endTimestamp;
197    }
198
199    /**
200     * Get next materialized timestamp
201     *
202     * @return next materialized timestamp
203     */
204    public Timestamp getNextMaterializedTimestamp() {
205        return nextMaterializedTimestamp;
206    }
207
208    /**
209     * Set next materialized timestamp
210     *
211     * @param nextMaterializedTimestamp next materialized timestamp
212     */
213    public void setNextMaterializedTimestamp(java.sql.Timestamp nextMaterializedTimestamp) {
214        super.setNextMaterializedTime(DateUtils.toDate(nextMaterializedTimestamp));
215        this.nextMaterializedTimestamp = nextMaterializedTimestamp;
216    }
217
218    /**
219     * Get last modified timestamp
220     *
221     * @return last modified timestamp
222     */
223    public Timestamp getLastModifiedTimestamp() {
224        return lastModifiedTimestamp;
225    }
226
227    /**
228     * Set last modified timestamp
229     *
230     * @param lastModifiedTimestamp last modified timestamp
231     */
232    public void setLastModifiedTimestamp(java.sql.Timestamp lastModifiedTimestamp) {
233        this.lastModifiedTimestamp = lastModifiedTimestamp;
234    }
235
236    /**
237     * Get suspended timestamp
238     *
239     * @return suspended timestamp
240     */
241    public Timestamp getSuspendedTimestamp() {
242        return suspendedTimestamp;
243    }
244
245    /**
246     * Set suspended timestamp
247     *
248     * @param suspendedTimestamp suspended timestamp
249     */
250    public void setSuspendedTimestamp(java.sql.Timestamp suspendedTimestamp) {
251        this.suspendedTimestamp = suspendedTimestamp;
252    }
253
254    /**
255     * Get job xml
256     *
257     * @return job xml
258     */
259    public String getJobXml() {
260        return jobXml;
261    }
262
263    /**
264     * Set job xml
265     *
266     * @param jobXml job xml
267     */
268    public void setJobXml(String jobXml) {
269        this.jobXml = jobXml;
270    }
271
272    /**
273     * Get original job xml
274     *
275     * @return original job xml
276     */
277    public String getOrigJobXml() {
278        return origJobXml;
279    }
280
281    /**
282     * Set original job xml
283     *
284     * @param origJobXml
285     */
286    public void setOrigJobXml(String origJobXml) {
287        this.origJobXml = origJobXml;
288    }
289
290    /**
291     * Get sla xml
292     *
293     * @return sla xml
294     */
295    public String getSlaXml() {
296        return slaXml;
297    }
298
299    /**
300     * Set sla xml
301     *
302     * @param slaXml sla xml
303     */
304    public void setSlaXml(String slaXml) {
305        this.slaXml = slaXml;
306    }
307
308    /* (non-Javadoc)
309     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#setTimeUnit(org.apache.oozie.client.CoordinatorJob.Timeunit)
310     */
311    @Override
312    public void setTimeUnit(Timeunit timeUnit) {
313        super.setTimeUnit(timeUnit);
314        this.timeUnitStr = timeUnit.toString();
315    }
316
317    /**
318     * Set last action timestamp
319     *
320     * @param lastActionTimestamp last action timestamp
321     */
322    public void setLastActionTimestamp(java.sql.Timestamp lastActionTimestamp) {
323        super.setLastActionTime(DateUtils.toDate(lastActionTimestamp));
324        this.lastActionTimestamp = lastActionTimestamp;
325    }
326
327    /**
328     * Set pending to true
329     */
330    @Override
331    public void setPending() {
332        super.setPending();
333        this.pending = 1;
334    }
335
336    /**
337     * Set pending to false
338     */
339    @Override
340    public void resetPending() {
341        super.resetPending();
342        this.pending = 0;
343    }
344
345    /**
346     * Return if the action is pending.
347     *
348     * @return if the action is pending.
349     */
350    public boolean isPending() {
351        return pending == 1 ? true : false;
352    }
353
354    /**
355     * Set doneMaterialization to true
356     */
357    public void setDoneMaterialization() {
358        this.doneMaterialization = 1;
359    }
360
361    /**
362     * Set doneMaterialization to false
363     */
364    public void resetDoneMaterialization() {
365        this.doneMaterialization = 0;
366    }
367
368    /**
369     * Return if the action is done with materialization
370     *
371     * @return if the action is done with materialization
372     */
373    public boolean isDoneMaterialization() {
374        return doneMaterialization == 1 ? true : false;
375    }
376
377
378    /**
379     * Get app namespce
380     *
381     * @return app namespce
382     */
383    public String getAppNamespace() {
384        return appNamespace;
385    }
386
387    /**
388     * Set app namespce
389     *
390     * @param appNamespace the app namespce to set
391     */
392    public void setAppNamespace(String appNamespace) {
393        this.appNamespace = appNamespace;
394    }
395
396    public CoordinatorJobBean() {
397    }
398
399    /*
400     * Serialize the coordinator bean to a data output. @param dataOutput data
401     * output. @throws IOException thrown if the coordinator bean could not be
402     * serialized.
403     */
404    public void write(DataOutput dataOutput) throws IOException {
405        WritableUtils.writeStr(dataOutput, getAppPath());
406        WritableUtils.writeStr(dataOutput, getAppName());
407        WritableUtils.writeStr(dataOutput, getId());
408        WritableUtils.writeStr(dataOutput, getConf());
409        WritableUtils.writeStr(dataOutput, getStatusStr());
410        WritableUtils.writeStr(dataOutput, getFrequency());
411        WritableUtils.writeStr(dataOutput, getTimeUnit().toString());
412        WritableUtils.writeStr(dataOutput, getTimeZone());
413        dataOutput.writeInt(getConcurrency());
414        WritableUtils.writeStr(dataOutput, getExecutionOrder().toString());
415        dataOutput.writeLong((getLastActionTime() != null) ? getLastActionTime().getTime() : -1);
416        dataOutput.writeLong((getNextMaterializedTime() != null) ? getNextMaterializedTime().getTime() : -1);
417        dataOutput.writeLong((getStartTime() != null) ? getStartTime().getTime() : -1);
418        dataOutput.writeLong((getEndTime() != null) ? getEndTime().getTime() : -1);
419        WritableUtils.writeStr(dataOutput, getUser());
420        WritableUtils.writeStr(dataOutput, getGroup());
421        WritableUtils.writeStr(dataOutput, getExternalId());
422        dataOutput.writeInt(getTimeout());
423        dataOutput.writeInt(getMatThrottling());
424        if (isPending()) {
425            dataOutput.writeInt(1);
426        } else {
427            dataOutput.writeInt(0);
428        }
429        if (isDoneMaterialization()) {
430            dataOutput.writeInt(1);
431        } else {
432            dataOutput.writeInt(0);
433        }
434        WritableUtils.writeStr(dataOutput, getAppNamespace());
435    }
436
437    /**
438     * Deserialize a coordinator bean from a data input.
439     *
440     * @param dataInput data input.
441     * @throws IOException thrown if the workflow bean could not be deserialized.
442     */
443    public void readFields(DataInput dataInput) throws IOException {
444        setAppPath(WritableUtils.readStr(dataInput));
445        setAppName(WritableUtils.readStr(dataInput));
446        setId(WritableUtils.readStr(dataInput));
447        setConf(WritableUtils.readStr(dataInput));
448        setStatus(CoordinatorJob.Status.valueOf(WritableUtils.readStr(dataInput)));
449        setFrequency(WritableUtils.readStr(dataInput));
450        setTimeUnit(CoordinatorJob.Timeunit.valueOf(WritableUtils.readStr(dataInput)));
451        setTimeZone(WritableUtils.readStr(dataInput));
452        setConcurrency(dataInput.readInt());
453        setExecution(Execution.valueOf(WritableUtils.readStr(dataInput)));
454
455        long d = dataInput.readLong();
456        if (d != -1) {
457            setLastActionTime(new Date(d));
458        }
459        d = dataInput.readLong();
460        if (d != -1) {
461            setNextMaterializedTime(new Date(d));
462        }
463        d = dataInput.readLong();
464        if (d != -1) {
465            setStartTime(new Date(d));
466        }
467
468        d = dataInput.readLong();
469        if (d != -1) {
470            setEndTime(new Date(d));
471        }
472        setUser(WritableUtils.readStr(dataInput));
473        setGroup(WritableUtils.readStr(dataInput));
474        setExternalId(WritableUtils.readStr(dataInput));
475        setTimeout(dataInput.readInt());
476        setMatThrottling(dataInput.readInt());
477
478        d = dataInput.readInt();
479        if (d == 1) {
480            setPending();
481        }
482
483        d = dataInput.readInt();
484        if (d == 1) {
485            setDoneMaterialization();
486        }
487
488        setAppNamespace(WritableUtils.readStr(dataInput));
489    }
490
491    /* (non-Javadoc)
492     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getStatus()
493     */
494    @Override
495    public Status getStatus() {
496        return Status.valueOf(this.status);
497    }
498
499    /**
500     * Get status
501     *
502     * @return status
503     */
504    public String getStatusStr() {
505        return status;
506    }
507
508    /* (non-Javadoc)
509     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#setStatus(org.apache.oozie.client.Job.Status)
510     */
511    @Override
512    public void setStatus(Status val) {
513        super.setStatus(val);
514        this.status = val.toString();
515    }
516
517    /**
518     * Get time unit
519     *
520     * @return time unit
521     */
522    public String getTimeUnitStr() {
523        return timeUnitStr;
524    }
525
526    /* (non-Javadoc)
527     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getTimeUnit()
528     */
529    @Override
530    public Timeunit getTimeUnit() {
531        return Timeunit.valueOf(this.timeUnitStr);
532    }
533
534    /**
535     * Set order
536     *
537     * @param order
538     */
539    public void setExecution(Execution order) {
540        this.execution = order.toString();
541        super.setExecutionOrder(order);
542    }
543
544    /* (non-Javadoc)
545     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getExecutionOrder()
546     */
547    @Override
548    public Execution getExecutionOrder() {
549        return Execution.valueOf(this.execution);
550    }
551
552    /**
553     * Get execution
554     *
555     * @return execution
556     */
557    public String getExecution() {
558        return execution;
559    }
560
561    /* (non-Javadoc)
562     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#setLastActionTime(java.util.Date)
563     */
564    @Override
565    public void setLastActionTime(Date lastAction) {
566        this.lastActionTimestamp = DateUtils.convertDateToTimestamp(lastAction);
567        super.setLastActionTime(lastAction);
568    }
569
570    /* (non-Javadoc)
571     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getLastActionTime()
572     */
573    @Override
574    public Date getLastActionTime() {
575        return DateUtils.toDate(lastActionTimestamp);
576    }
577
578    /**
579     * Get last action timestamp
580     *
581     * @return last action timestamp
582     */
583    public Timestamp getLastActionTimestamp() {
584        return lastActionTimestamp;
585    }
586
587    /* (non-Javadoc)
588     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#setNextMaterializedTime(java.util.Date)
589     */
590    @Override
591    public void setNextMaterializedTime(Date nextMaterializedTime) {
592        super.setNextMaterializedTime(nextMaterializedTime);
593        this.nextMaterializedTimestamp = DateUtils.convertDateToTimestamp(nextMaterializedTime);
594    }
595
596    /* (non-Javadoc)
597     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getNextMaterializedTime()
598     */
599    @Override
600    public Date getNextMaterializedTime() {
601        return DateUtils.toDate(nextMaterializedTimestamp);
602    }
603
604    /**
605     * Set last modified time
606     *
607     * @param lastModifiedTime last modified time
608     */
609    public void setLastModifiedTime(Date lastModifiedTime) {
610        this.lastModifiedTimestamp = DateUtils.convertDateToTimestamp(lastModifiedTime);
611    }
612
613    /**
614     * Get last modified time
615     *
616     * @return last modified time
617     */
618    public Date getLastModifiedTime() {
619        return DateUtils.toDate(lastModifiedTimestamp);
620    }
621
622    /**
623     * Set suspended time
624     *
625     * @param suspendedTime suspended time
626     */
627    public void setSuspendedTime(Date suspendedTime) {
628        this.suspendedTimestamp = DateUtils.convertDateToTimestamp(suspendedTime);
629    }
630
631    /**
632     * Get suspended time
633     *
634     * @return suspended time
635     */
636    public Date getSuspendedTime() {
637        return DateUtils.toDate(suspendedTimestamp);
638    }
639
640    /* (non-Javadoc)
641     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#setStartTime(java.util.Date)
642     */
643    @Override
644    public void setStartTime(Date startTime) {
645        super.setStartTime(startTime);
646        this.startTimestamp = DateUtils.convertDateToTimestamp(startTime);
647    }
648
649    /* (non-Javadoc)
650     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getStartTime()
651     */
652    @Override
653    public Date getStartTime() {
654        return DateUtils.toDate(startTimestamp);
655    }
656
657    /* (non-Javadoc)
658     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#setEndTime(java.util.Date)
659     */
660    @Override
661    public void setEndTime(Date endTime) {
662        super.setEndTime(endTime);
663        this.endTimestamp = DateUtils.convertDateToTimestamp(endTime);
664    }
665
666    /* (non-Javadoc)
667     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#setPauseTime(java.util.Date)
668     */
669    @Override
670    public void setPauseTime(Date pauseTime) {
671        super.setPauseTime(pauseTime);
672        this.pauseTimestamp = DateUtils.convertDateToTimestamp(pauseTime);
673    }
674
675    /* (non-Javadoc)
676     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getEndTime()
677     */
678    @Override
679    public Date getEndTime() {
680        return DateUtils.toDate(endTimestamp);
681    }
682
683    /* (non-Javadoc)
684     * @see org.apache.oozie.client.rest.JsonCoordinatorJob#getPauseTime()
685     */
686    @Override
687    public Date getPauseTime() {
688        return DateUtils.toDate(pauseTimestamp);
689    }
690
691    /**
692     * Set created time
693     *
694     * @param createTime created time
695     */
696    public void setCreatedTime(Date createTime) {
697        this.createdTimestamp = DateUtils.convertDateToTimestamp(createTime);
698    }
699
700    /**
701     * Get created time
702     *
703     * @return created time
704     */
705    public Date getCreatedTime() {
706        return DateUtils.toDate(createdTimestamp);
707    }
708
709    /**
710     * Get created timestamp
711     *
712     * @return created timestamp
713     */
714    public Timestamp getCreatedTimestamp() {
715        return createdTimestamp;
716    }
717
718}