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