001package org.gbif.api.model.collections; 002 003import java.util.ArrayList; 004import java.util.Date; 005import java.util.List; 006 007import com.fasterxml.jackson.annotation.JsonIgnore; 008 009import io.swagger.v3.oas.annotations.Hidden; 010import io.swagger.v3.oas.annotations.media.Schema; 011import lombok.Data; 012 013/** A batch that can contain either institutions or collections to create or update them in bulk. */ 014@Data 015public class Batch { 016 017 @Schema(description = "Unique key for the batch.", accessMode = Schema.AccessMode.READ_ONLY) 018 private Integer key; 019 020 @Schema(description = "State that indicates if the batch is being processed, finished or failed.") 021 private State state; 022 023 @Schema(description = "Indicates if the batch is for institutions or for collections.") 024 private CollectionEntityType entityType; 025 026 @Hidden @JsonIgnore private String resultFilePath; 027 028 @Schema(description = "Errors found that made the batch fail.") 029 private List<String> errors = new ArrayList<>(); 030 031 @Schema( 032 description = "Timestamp of when the batch was created in the GBIF registry.", 033 accessMode = Schema.AccessMode.READ_ONLY) 034 private Date created; 035 036 @Schema( 037 description = "The GBIF username of the creator of the batch in the GBIF registry.", 038 accessMode = Schema.AccessMode.READ_ONLY) 039 private String createdBy; 040 041 public enum State { 042 IN_PROGRESS, 043 FAILED, 044 FINISHED; 045 } 046}