001/*- 002 * #%L 003 * HAPI FHIR JPA Server - Batch2 Task Processor 004 * %% 005 * Copyright (C) 2014 - 2024 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.batch2.jobs.chunk; 021 022import ca.uhn.fhir.interceptor.model.RequestPartitionId; 023import ca.uhn.fhir.model.api.IModelJson; 024import ca.uhn.fhir.rest.server.util.JsonDateDeserializer; 025import ca.uhn.fhir.rest.server.util.JsonDateSerializer; 026import com.fasterxml.jackson.annotation.JsonProperty; 027import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 028import com.fasterxml.jackson.databind.annotation.JsonSerialize; 029import jakarta.annotation.Nonnull; 030import jakarta.annotation.Nullable; 031 032import java.util.Date; 033 034public class ChunkRangeJson implements IModelJson { 035 @JsonSerialize(using = JsonDateSerializer.class) 036 @JsonDeserialize(using = JsonDateDeserializer.class) 037 @JsonProperty("start") 038 @Nonnull 039 private Date myStart; 040 041 @JsonSerialize(using = JsonDateSerializer.class) 042 @JsonDeserialize(using = JsonDateDeserializer.class) 043 @JsonProperty("end") 044 @Nonnull 045 private Date myEnd; 046 047 @Nullable 048 @JsonProperty("url") 049 private String myUrl; 050 051 @JsonProperty("resourceType") 052 private String myResourceType; 053 054 @Nullable 055 @JsonProperty("partitionId") 056 private RequestPartitionId myPartitionId; 057 058 public ChunkRangeJson() {} 059 060 public ChunkRangeJson(@Nonnull Date theStart, @Nonnull Date theEnd) { 061 this.myStart = theStart; 062 this.myEnd = theEnd; 063 } 064 065 @Nonnull 066 public Date getStart() { 067 return myStart; 068 } 069 070 @Nonnull 071 public Date getEnd() { 072 return myEnd; 073 } 074 075 @Nullable 076 public String getUrl() { 077 return myUrl; 078 } 079 080 public ChunkRangeJson setUrl(@Nullable String theUrl) { 081 myUrl = theUrl; 082 return this; 083 } 084 085 @Nonnull 086 public String getResourceType() { 087 return myResourceType; 088 } 089 090 public ChunkRangeJson setResourceType(@Nullable String theResourceType) { 091 myResourceType = theResourceType; 092 return this; 093 } 094 095 @Nullable 096 public RequestPartitionId getPartitionId() { 097 return myPartitionId; 098 } 099 100 public ChunkRangeJson setPartitionId(@Nullable RequestPartitionId thePartitionId) { 101 myPartitionId = thePartitionId; 102 return this; 103 } 104}