
001/*- 002 * #%L 003 * HAPI FHIR Storage api 004 * %% 005 * Copyright (C) 2014 - 2025 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.jpa.bulk.export.model; 021 022import ca.uhn.fhir.interceptor.model.RequestPartitionId; 023import ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters; 024import org.apache.commons.lang3.builder.ToStringBuilder; 025import org.apache.commons.lang3.builder.ToStringStyle; 026 027import java.util.ArrayList; 028import java.util.Date; 029import java.util.List; 030 031import static org.apache.commons.lang3.StringUtils.isBlank; 032 033public class ExportPIDIteratorParameters { 034 /** 035 * The primary resource type of interest 036 */ 037 private String myResourceType; 038 039 /** 040 * The earliest date from which to retrieve records 041 */ 042 private Date myStartDate; 043 044 /** 045 * The latest date to which to retrieve records 046 */ 047 private Date myEndDate; 048 049 /** 050 * List of filters to be applied to the search. 051 * Eg: 052 * Patient/123?group=1 053 * "group=1" would be the filter 054 */ 055 private List<String> myFilters; 056 057 /** 058 * The ID of the BatchJob. 059 * (Batch jobs are stored in Persistence, to keep track 060 * of results/status). 061 */ 062 private String myInstanceId; 063 064 private String myChunkId; 065 /** 066 * The export style 067 */ 068 private BulkExportJobParameters.ExportStyle myExportStyle; 069 /** 070 * the group id 071 */ 072 private String myGroupId; 073 /** 074 * For group export - whether or not to expand mdm 075 */ 076 private boolean myExpandMdm; 077 /** 078 * The patient id 079 */ 080 private List<String> myPatientIds; 081 /** 082 * The partition id 083 */ 084 private RequestPartitionId myPartitionId; 085 086 /** 087 * The list of resource types to recurse on. 088 * This should always have at least one resource in it (the resource being requested)! 089 */ 090 private List<String> myRequestedResourceTypes; 091 092 private boolean myIncludeHistory; 093 094 public String getChunkId() { 095 return myChunkId; 096 } 097 098 public void setChunkId(String theChunkId) { 099 myChunkId = theChunkId; 100 } 101 102 public String getResourceType() { 103 return myResourceType; 104 } 105 106 public void setResourceType(String theResourceType) { 107 myResourceType = theResourceType; 108 } 109 110 public Date getStartDate() { 111 return myStartDate; 112 } 113 114 public void setStartDate(Date theStartDate) { 115 myStartDate = theStartDate; 116 } 117 118 public Date getEndDate() { 119 return myEndDate; 120 } 121 122 public void setEndDate(Date theEndDate) { 123 myEndDate = theEndDate; 124 } 125 126 public List<String> getFilters() { 127 return myFilters; 128 } 129 130 public void setFilters(List<String> theFilters) { 131 myFilters = theFilters; 132 } 133 134 public String getInstanceId() { 135 return myInstanceId; 136 } 137 138 public void setInstanceId(String theInstanceId) { 139 myInstanceId = theInstanceId; 140 } 141 142 public BulkExportJobParameters.ExportStyle getExportStyle() { 143 return myExportStyle; 144 } 145 146 public void setExportStyle(BulkExportJobParameters.ExportStyle theExportStyle) { 147 myExportStyle = theExportStyle; 148 } 149 150 public String getGroupId() { 151 return myGroupId; 152 } 153 154 public void setGroupId(String theGroupId) { 155 myGroupId = theGroupId; 156 } 157 158 public boolean isExpandMdm() { 159 return myExpandMdm; 160 } 161 162 public void setExpandMdm(boolean theExpandMdm) { 163 myExpandMdm = theExpandMdm; 164 } 165 166 public List<String> getPatientIds() { 167 return myPatientIds; 168 } 169 170 public void setPatientIds(List<String> thePatientIds) { 171 myPatientIds = thePatientIds; 172 } 173 174 public RequestPartitionId getPartitionIdOrAllPartitions() { 175 if (myPartitionId != null) { 176 return myPartitionId; 177 } else { 178 return RequestPartitionId.allPartitions(); 179 } 180 } 181 182 public void setPartitionId(RequestPartitionId thePartitionId) { 183 myPartitionId = thePartitionId; 184 } 185 186 public List<String> getRequestedResourceTypes() { 187 if (myRequestedResourceTypes == null) { 188 myRequestedResourceTypes = new ArrayList<>(); 189 if (!isBlank(myResourceType)) { 190 myRequestedResourceTypes.add(myResourceType); 191 } 192 } 193 return myRequestedResourceTypes; 194 } 195 196 public void setRequestedResourceTypes(List<String> theRequestedResourceTypes) { 197 myRequestedResourceTypes = theRequestedResourceTypes; 198 } 199 200 public boolean isIncludeHistory() { 201 return myIncludeHistory; 202 } 203 204 public void setIncludeHistory(boolean theIncludeHistory) { 205 myIncludeHistory = theIncludeHistory; 206 } 207 208 @Override 209 public String toString() { 210 return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); 211 } 212}