001/*- 002 * #%L 003 * HAPI FHIR - Server Framework 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.rest.api.server.bulk; 021 022import ca.uhn.fhir.interceptor.model.RequestPartitionId; 023import ca.uhn.fhir.model.api.BaseBatchJobParameters; 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; 029 030import java.util.ArrayList; 031import java.util.Collection; 032import java.util.Date; 033import java.util.List; 034 035public class BulkExportJobParameters extends BaseBatchJobParameters { 036 037 /** 038 * List of resource types to export. 039 */ 040 @JsonProperty("resourceTypes") 041 private List<String> myResourceTypes; 042 043 /** 044 * The start date from when we should start doing the export. 045 */ 046 @JsonSerialize(using = JsonDateSerializer.class) 047 @JsonDeserialize(using = JsonDateDeserializer.class) 048 @JsonProperty("since") 049 private Date mySince; 050 051 /** 052 * The end date to which we should stop doing the export. 053 */ 054 @JsonSerialize(using = JsonDateSerializer.class) 055 @JsonDeserialize(using = JsonDateDeserializer.class) 056 @JsonProperty("until") 057 private Date myUntil; 058 059 @JsonProperty("exportId") 060 private String myExportId; 061 062 /** 063 * Filters are used to narrow down the resources to export. 064 * Eg: 065 * Patient/123?group=a 066 * "group=a" is a filter 067 */ 068 @JsonProperty("filters") 069 private List<String> myFilters; 070 071 /** 072 * URLs to be applied by the inMemoryMatcher after the SQL select 073 */ 074 @JsonProperty("postFetchFilterUrls") 075 private List<String> myPostFetchFilterUrls; 076 077 /** 078 * Output format. 079 * Currently unsupported (all outputs are ndjson) 080 */ 081 @JsonProperty("outputFormat") 082 private String myOutputFormat; 083 084 /** 085 * Export style - Patient, Group or Everything 086 */ 087 @JsonProperty("exportStyle") 088 private ExportStyle myExportStyle; 089 090 /** 091 * Patient id(s) 092 */ 093 @JsonProperty("patientIds") 094 private List<String> myPatientIds = new ArrayList<>(); 095 096 /** 097 * The request which originated the request. 098 */ 099 @JsonProperty("originalRequestUrl") 100 private String myOriginalRequestUrl; 101 102 /** 103 * The group id 104 */ 105 @JsonProperty("groupId") 106 private String myGroupId; 107 108 /** 109 * For group export; 110 * whether or not to expand mdm 111 */ 112 @JsonProperty("expandMdm") 113 private boolean myExpandMdm; 114 115 /** 116 * The partition for the request if applicable. 117 */ 118 @JsonProperty("partitionId") 119 private RequestPartitionId myPartitionId; 120 121 @JsonProperty("binarySecurityContextIdentifierSystem") 122 private String myBinarySecurityContextIdentifierSystem; 123 124 @JsonProperty("binarySecurityContextIdentifierValue") 125 private String myBinarySecurityContextIdentifierValue; 126 127 public String getExportIdentifier() { 128 return myExportId; 129 } 130 131 public void setExportIdentifier(String theExportId) { 132 myExportId = theExportId; 133 } 134 135 public List<String> getResourceTypes() { 136 if (myResourceTypes == null) { 137 myResourceTypes = new ArrayList<>(); 138 } 139 return myResourceTypes; 140 } 141 142 public void setResourceTypes(Collection<String> theResourceTypes) { 143 getResourceTypes().clear(); 144 if (theResourceTypes != null) { 145 getResourceTypes().addAll(theResourceTypes); 146 } 147 } 148 149 public Date getSince() { 150 return mySince; 151 } 152 153 public void setSince(Date theSince) { 154 mySince = theSince; 155 } 156 157 public Date getUntil() { 158 return myUntil; 159 } 160 161 public void setUntil(Date theUntil) { 162 myUntil = theUntil; 163 } 164 165 public List<String> getFilters() { 166 if (myFilters == null) { 167 myFilters = new ArrayList<>(); 168 } 169 return myFilters; 170 } 171 172 public void setFilters(Collection<String> theFilters) { 173 getFilters().clear(); 174 if (theFilters != null) { 175 getFilters().addAll(theFilters); 176 } 177 } 178 179 public List<String> getPostFetchFilterUrls() { 180 if (myPostFetchFilterUrls == null) { 181 myPostFetchFilterUrls = new ArrayList<>(); 182 } 183 return myPostFetchFilterUrls; 184 } 185 186 public void setPostFetchFilterUrls(Collection<String> thePostFetchFilterUrls) { 187 getPostFetchFilterUrls().clear(); 188 if (thePostFetchFilterUrls != null) { 189 getPostFetchFilterUrls().addAll(thePostFetchFilterUrls); 190 } 191 } 192 193 public String getOutputFormat() { 194 return myOutputFormat; 195 } 196 197 public void setOutputFormat(String theOutputFormat) { 198 myOutputFormat = theOutputFormat; 199 } 200 201 public ExportStyle getExportStyle() { 202 return myExportStyle; 203 } 204 205 public void setExportStyle(ExportStyle theExportStyle) { 206 myExportStyle = theExportStyle; 207 } 208 209 public List<String> getPatientIds() { 210 if (myPatientIds == null) { 211 myPatientIds = new ArrayList<>(); 212 } 213 return myPatientIds; 214 } 215 216 public void setPatientIds(Collection<String> thePatientIds) { 217 getPatientIds().clear(); 218 if (thePatientIds != null) { 219 getPatientIds().addAll(thePatientIds); 220 } 221 } 222 223 public String getGroupId() { 224 return myGroupId; 225 } 226 227 public void setGroupId(String theGroupId) { 228 myGroupId = theGroupId; 229 } 230 231 public boolean isExpandMdm() { 232 return myExpandMdm; 233 } 234 235 public void setExpandMdm(boolean theExpandMdm) { 236 myExpandMdm = theExpandMdm; 237 } 238 239 public String getOriginalRequestUrl() { 240 return myOriginalRequestUrl; 241 } 242 243 public void setOriginalRequestUrl(String theOriginalRequestUrl) { 244 this.myOriginalRequestUrl = theOriginalRequestUrl; 245 } 246 247 public RequestPartitionId getPartitionId() { 248 return myPartitionId; 249 } 250 251 public void setPartitionId(RequestPartitionId thePartitionId) { 252 this.myPartitionId = thePartitionId; 253 } 254 255 /** 256 * Sets a value to place in the generated Binary resource's 257 * Binary.securityContext.identifier 258 */ 259 public void setBinarySecurityContextIdentifierSystem(String theBinarySecurityContextIdentifierSystem) { 260 myBinarySecurityContextIdentifierSystem = theBinarySecurityContextIdentifierSystem; 261 } 262 263 /** 264 * Sets a value to place in the generated Binary resource's 265 * Binary.securityContext.identifier 266 */ 267 public String getBinarySecurityContextIdentifierSystem() { 268 return myBinarySecurityContextIdentifierSystem; 269 } 270 271 /** 272 * Sets a value to place in the generated Binary resource's 273 * Binary.securityContext.identifier 274 */ 275 public void setBinarySecurityContextIdentifierValue(String theBinarySecurityContextIdentifierValue) { 276 myBinarySecurityContextIdentifierValue = theBinarySecurityContextIdentifierValue; 277 } 278 279 /** 280 * Sets a value to place in the generated Binary resource's 281 * Binary.securityContext.identifier 282 */ 283 public String getBinarySecurityContextIdentifierValue() { 284 return myBinarySecurityContextIdentifierValue; 285 } 286 287 public enum ExportStyle { 288 PATIENT, 289 GROUP, 290 SYSTEM 291 } 292}