001/* 002 * Copyright 2020 Global Biodiversity Information Facility (GBIF) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.gbif.api.model.pipelines.ws; 017 018import java.time.OffsetDateTime; 019 020import java.io.Serializable; 021import java.util.Objects; 022import java.util.UUID; 023 024import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 025import com.fasterxml.jackson.databind.annotation.JsonSerialize; 026 027import org.gbif.api.jackson.OffsetDateTimeSerDe; 028 029/** Models a flat response of a pipeline process search. */ 030public class SearchResult implements Serializable { 031 032 private UUID datasetKey; 033 private int attempt; 034 private int executionKey; 035 private String rerunReason; 036 private String stepType; 037 private String stepState; 038 private String pipelinesVersion; 039 040 @JsonSerialize(using = OffsetDateTimeSerDe.OffsetDateTimeSerializer.class) 041 @JsonDeserialize(using = OffsetDateTimeSerDe.OffsetDateTimeDeserializer.class) 042 private OffsetDateTime stepStarted; 043 044 @JsonSerialize(using = OffsetDateTimeSerDe.OffsetDateTimeSerializer.class) 045 @JsonDeserialize(using = OffsetDateTimeSerDe.OffsetDateTimeDeserializer.class) 046 private OffsetDateTime stepFinished; 047 048 public UUID getDatasetKey() { 049 return datasetKey; 050 } 051 052 public void setDatasetKey(UUID datasetKey) { 053 this.datasetKey = datasetKey; 054 } 055 056 public int getAttempt() { 057 return attempt; 058 } 059 060 public void setAttempt(int attempt) { 061 this.attempt = attempt; 062 } 063 064 public int getExecutionKey() { 065 return executionKey; 066 } 067 068 public void setExecutionKey(int executionKey) { 069 this.executionKey = executionKey; 070 } 071 072 public String getRerunReason() { 073 return rerunReason; 074 } 075 076 public void setRerunReason(String rerunReason) { 077 this.rerunReason = rerunReason; 078 } 079 080 public String getStepType() { 081 return stepType; 082 } 083 084 public void setStepType(String stepType) { 085 this.stepType = stepType; 086 } 087 088 public String getStepState() { 089 return stepState; 090 } 091 092 public void setStepState(String stepState) { 093 this.stepState = stepState; 094 } 095 096 public String getPipelinesVersion() { 097 return pipelinesVersion; 098 } 099 100 public void setPipelinesVersion(String pipelinesVersion) { 101 this.pipelinesVersion = pipelinesVersion; 102 } 103 104 public OffsetDateTime getStepStarted() { 105 return stepStarted; 106 } 107 108 public void setStepStarted(OffsetDateTime stepStarted) { 109 this.stepStarted = stepStarted; 110 } 111 112 public OffsetDateTime getStepFinished() { 113 return stepFinished; 114 } 115 116 public void setStepFinished(OffsetDateTime stepFinished) { 117 this.stepFinished = stepFinished; 118 } 119 120 @Override 121 public boolean equals(Object o) { 122 if (this == o) { 123 return true; 124 } 125 if (o == null || getClass() != o.getClass()) { 126 return false; 127 } 128 SearchResult that = (SearchResult) o; 129 return attempt == that.attempt 130 && executionKey == that.executionKey 131 && Objects.equals(datasetKey, that.datasetKey) 132 && Objects.equals(rerunReason, that.rerunReason) 133 && Objects.equals(stepType, that.stepType) 134 && Objects.equals(stepState, that.stepState) 135 && Objects.equals(pipelinesVersion, that.pipelinesVersion) 136 && Objects.equals(stepStarted, that.stepStarted) 137 && Objects.equals(stepFinished, that.stepFinished); 138 } 139 140 @Override 141 public int hashCode() { 142 return Objects.hash( 143 datasetKey, 144 attempt, 145 executionKey, 146 rerunReason, 147 stepType, 148 stepState, 149 pipelinesVersion, 150 stepStarted, 151 stepFinished); 152 } 153}