|
| 1 | +package org.gitlab4j.api.webhook; |
| 2 | + |
| 3 | +import java.util.Date; |
| 4 | + |
| 5 | +import org.gitlab4j.api.models.User; |
| 6 | +import org.gitlab4j.api.utils.JacksonJson; |
| 7 | + |
| 8 | +/** |
| 9 | + * The documentation at: <a href="https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#job-events"> |
| 10 | + * Job Events</a> is incorrect, this class represents the actual content of the Job Hook event. |
| 11 | + */ |
| 12 | +public class BuildEvent extends AbstractEvent { |
| 13 | + |
| 14 | + public static final String JOB_HOOK_X_GITLAB_EVENT = "Job Hook"; |
| 15 | + public static final String OBJECT_KIND = "build"; |
| 16 | + |
| 17 | + private String ref; |
| 18 | + private Boolean tag; |
| 19 | + private String beforeSha; |
| 20 | + private String sha; |
| 21 | + private Integer buildId; |
| 22 | + private String buildName; |
| 23 | + private String buildStage; |
| 24 | + private String buildStatus; |
| 25 | + private Date buildStarted_at; |
| 26 | + private Date buildFinished_at; |
| 27 | + private Float buildDuration; |
| 28 | + private Boolean buildAllowFailure; |
| 29 | + private String buildFailureReason; |
| 30 | + private Integer projectId; |
| 31 | + private String projectName; |
| 32 | + private User user; |
| 33 | + private BuildCommit commit; |
| 34 | + private EventRepository repository; |
| 35 | + |
| 36 | + public String getObjectKind() { |
| 37 | + return (OBJECT_KIND); |
| 38 | + } |
| 39 | + |
| 40 | + public void setObjectKind(String objectKind) { |
| 41 | + if (!OBJECT_KIND.equals(objectKind)) |
| 42 | + throw new RuntimeException("Invalid object_kind (" + objectKind + "), must be '" + OBJECT_KIND + "'"); |
| 43 | + } |
| 44 | + |
| 45 | + public String getRef() { |
| 46 | + return ref; |
| 47 | + } |
| 48 | + |
| 49 | + public void setRef(String ref) { |
| 50 | + this.ref = ref; |
| 51 | + } |
| 52 | + |
| 53 | + public Boolean getTag() { |
| 54 | + return tag; |
| 55 | + } |
| 56 | + |
| 57 | + public void setTag(Boolean tag) { |
| 58 | + this.tag = tag; |
| 59 | + } |
| 60 | + |
| 61 | + public String getBeforeSha() { |
| 62 | + return beforeSha; |
| 63 | + } |
| 64 | + |
| 65 | + public void setBeforeSha(String beforeSha) { |
| 66 | + this.beforeSha = beforeSha; |
| 67 | + } |
| 68 | + |
| 69 | + public String getSha() { |
| 70 | + return sha; |
| 71 | + } |
| 72 | + |
| 73 | + public void setSha(String sha) { |
| 74 | + this.sha = sha; |
| 75 | + } |
| 76 | + |
| 77 | + public Integer getBuildId() { |
| 78 | + return buildId; |
| 79 | + } |
| 80 | + |
| 81 | + public void setBuildId(Integer buildId) { |
| 82 | + this.buildId = buildId; |
| 83 | + } |
| 84 | + |
| 85 | + public String getBuildName() { |
| 86 | + return buildName; |
| 87 | + } |
| 88 | + |
| 89 | + public void setBuildName(String buildName) { |
| 90 | + this.buildName = buildName; |
| 91 | + } |
| 92 | + |
| 93 | + public String getBuildStage() { |
| 94 | + return buildStage; |
| 95 | + } |
| 96 | + |
| 97 | + public void setBuildStage(String buildStage) { |
| 98 | + this.buildStage = buildStage; |
| 99 | + } |
| 100 | + |
| 101 | + public String getBuildStatus() { |
| 102 | + return buildStatus; |
| 103 | + } |
| 104 | + |
| 105 | + public void setBuildStatus(String buildStatus) { |
| 106 | + this.buildStatus = buildStatus; |
| 107 | + } |
| 108 | + |
| 109 | + public Date getBuildStarted_at() { |
| 110 | + return buildStarted_at; |
| 111 | + } |
| 112 | + |
| 113 | + public void setBuildStarted_at(Date buildStarted_at) { |
| 114 | + this.buildStarted_at = buildStarted_at; |
| 115 | + } |
| 116 | + |
| 117 | + public Date getBuildFinished_at() { |
| 118 | + return buildFinished_at; |
| 119 | + } |
| 120 | + |
| 121 | + public void setBuildFinished_at(Date buildFinished_at) { |
| 122 | + this.buildFinished_at = buildFinished_at; |
| 123 | + } |
| 124 | + |
| 125 | + public Float getBuildDuration() { |
| 126 | + return buildDuration; |
| 127 | + } |
| 128 | + |
| 129 | + public void setBuildDuration(Float buildDuration) { |
| 130 | + this.buildDuration = buildDuration; |
| 131 | + } |
| 132 | + |
| 133 | + public Boolean getBuildAllowFailure() { |
| 134 | + return buildAllowFailure; |
| 135 | + } |
| 136 | + |
| 137 | + public void setBuildAllowFailure(Boolean buildAllowFailure) { |
| 138 | + this.buildAllowFailure = buildAllowFailure; |
| 139 | + } |
| 140 | + |
| 141 | + public String getBuildFailureReason() { |
| 142 | + return buildFailureReason; |
| 143 | + } |
| 144 | + |
| 145 | + public void setBuildFailureReason(String buildFailureReason) { |
| 146 | + this.buildFailureReason = buildFailureReason; |
| 147 | + } |
| 148 | + |
| 149 | + public Integer getProjectId() { |
| 150 | + return projectId; |
| 151 | + } |
| 152 | + |
| 153 | + public void setProjectId(Integer projectId) { |
| 154 | + this.projectId = projectId; |
| 155 | + } |
| 156 | + |
| 157 | + public String getProjectName() { |
| 158 | + return projectName; |
| 159 | + } |
| 160 | + |
| 161 | + public void setProjectName(String projectName) { |
| 162 | + this.projectName = projectName; |
| 163 | + } |
| 164 | + |
| 165 | + public User getUser() { |
| 166 | + return user; |
| 167 | + } |
| 168 | + |
| 169 | + public void setUser(User user) { |
| 170 | + this.user = user; |
| 171 | + } |
| 172 | + |
| 173 | + public BuildCommit getCommit() { |
| 174 | + return commit; |
| 175 | + } |
| 176 | + |
| 177 | + public void setCommit(BuildCommit commit) { |
| 178 | + this.commit = commit; |
| 179 | + } |
| 180 | + |
| 181 | + public EventRepository getRepository() { |
| 182 | + return repository; |
| 183 | + } |
| 184 | + |
| 185 | + public void setRepository(EventRepository repository) { |
| 186 | + this.repository = repository; |
| 187 | + } |
| 188 | + |
| 189 | + @Override |
| 190 | + public String toString() { |
| 191 | + return (JacksonJson.toJsonString(this)); |
| 192 | + } |
| 193 | +} |
0 commit comments