001/*
002 * Stallion Core: A Modern Web Framework
003 *
004 * Copyright (C) 2015 - 2016 Stallion Software LLC.
005 *
006 * This program is free software: you can redistribute it and/or modify it under the terms of the
007 * GNU General Public License as published by the Free Software Foundation, either version 2 of
008 * the License, or (at your option) any later version. This program is distributed in the hope that
009 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
011 * License for more details. You should have received a copy of the GNU General Public License
012 * along with this program.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
013 *
014 *
015 *
016 */
017
018package io.stallion.jobs;
019
020import io.stallion.dataAccess.AlternativeKey;
021import io.stallion.dataAccess.ModelBase;
022import io.stallion.dataAccess.UniqueKey;
023
024import javax.persistence.Column;
025import javax.persistence.Table;
026import java.time.ZonedDateTime;
027
028@Table(name="stallion_job_status")
029public class JobStatus extends ModelBase {
030    private String name = "";
031    private long startedAt = 0;
032    private long completedAt = 0;
033    private long failedAt = 0;
034    private String error = "";
035    private long shouldSucceedBy = 0;
036    private long lastDurationSeconds = 0;
037    private int failCount = 0;
038    private long lockedAt = 0;
039    private String lockGuid = "";
040    private String nextExecuteMinuteStamp = "";
041    private ZonedDateTime nextExecuteAt;
042
043
044    @UniqueKey
045    @Column
046    public String getName() {
047        return name;
048    }
049
050    public void setName(String name) {
051        this.name = name;
052    }
053
054
055
056    @Column
057    public long getStartedAt() {
058        return startedAt;
059    }
060
061    public void setStartedAt(long startedAt) {
062        this.startedAt = startedAt;
063    }
064
065
066    @Column
067    public long getCompletedAt() {
068        return completedAt;
069    }
070
071    public void setCompletedAt(long completedAt) {
072        this.completedAt = completedAt;
073    }
074
075
076    @Column
077    public long getFailedAt() {
078        return failedAt;
079    }
080
081    public void setFailedAt(long failedAt) {
082        this.failedAt = failedAt;
083    }
084
085
086    @Column
087    public String getError() {
088        return error;
089    }
090
091    public void setError(String error) {
092        this.error = error;
093    }
094
095
096
097    @Column
098    public long getShouldSucceedBy() {
099        return shouldSucceedBy;
100    }
101
102    public void setShouldSucceedBy(long shouldSucceedBy) {
103        this.shouldSucceedBy = shouldSucceedBy;
104    }
105
106
107
108    @Column
109    public long getLastDurationSeconds() {
110        return lastDurationSeconds;
111    }
112
113    public void setLastDurationSeconds(long lastDurationSeconds) {
114        this.lastDurationSeconds = lastDurationSeconds;
115    }
116
117    @Column
118    public int getFailCount() {
119        return failCount;
120    }
121
122    public JobStatus setFailCount(int failCount) {
123        this.failCount = failCount;
124        return this;
125    }
126
127    @Column(nullable = false)
128    public long getLockedAt() {
129        return lockedAt;
130    }
131
132    public JobStatus setLockedAt(long lockedAt) {
133        this.lockedAt = lockedAt;
134        return this;
135    }
136
137    @Column(nullable = false, length=50)
138    public String getLockGuid() {
139        return lockGuid;
140    }
141
142    public JobStatus setLockGuid(String lockGuid) {
143        this.lockGuid = lockGuid;
144        return this;
145    }
146
147    @AlternativeKey
148    @Column(nullable = false, length=12)
149    public String getNextExecuteMinuteStamp() {
150        return nextExecuteMinuteStamp;
151    }
152
153    public JobStatus setNextExecuteMinuteStamp(String nextExecuteMinuteStamp) {
154        this.nextExecuteMinuteStamp = nextExecuteMinuteStamp;
155        return this;
156    }
157
158    @Column(nullable = false)
159    public ZonedDateTime getNextExecuteAt() {
160        return nextExecuteAt;
161    }
162
163    public JobStatus setNextExecuteAt(ZonedDateTime nextExecuteAt) {
164        this.nextExecuteAt = nextExecuteAt;
165        return this;
166    }
167}