001/*-
002 * #%L
003 * HAPI FHIR Storage api
004 * %%
005 * Copyright (C) 2014 - 2023 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.api.model;
021
022import ca.uhn.fhir.interceptor.model.RequestPartitionId;
023import ca.uhn.fhir.jpa.batch.models.Batch2BaseJobParameters;
024import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions;
025
026import javax.annotation.Nonnull;
027import java.util.ArrayList;
028import java.util.Date;
029import java.util.List;
030
031public class BulkExportParameters extends Batch2BaseJobParameters {
032
033        /**
034         * List of resource types to export.
035         */
036        private List<String> myResourceTypes;
037
038        /**
039         * The earliest date from which to export resources.
040         */
041        private Date mySince;
042
043        /**
044         * Filters are used to narrow down the resources to export.
045         * Eg:
046         * Patient/123?group=a
047         * "group=a" is a filter
048         */
049        private List<String> myFilters;
050
051        /**
052         * URLs to be applied by the inMemoryMatcher after the SQL select
053         */
054        private List<String> myPostFetchFilterUrls;
055
056        /**
057         * Export style - Patient, Group or Everything
058         */
059        private BulkDataExportOptions.ExportStyle myExportStyle;
060
061        /**
062         * Group id
063         */
064        private String myGroupId;
065
066        /**
067         * Output format.
068         * Currently unsupported (all outputs are ndjson)
069         */
070        private String myOutputFormat;
071
072        /**
073         * For group export;
074         * whether or not to expand mdm
075         */
076        private boolean myExpandMdm;
077
078
079        /**
080         * Patient id(s)
081         */
082        private List<String> myPatientIds;
083
084        /**
085         * The request which originated the request.
086         */
087        private String myOriginalRequestUrl;
088        private String myExportIdentifier;
089
090
091
092        /**
093         * The partition for the request if applicable.
094         */
095        private RequestPartitionId myPartitionId;
096
097        public boolean isExpandMdm() {
098                return myExpandMdm;
099        }
100
101        public void setExpandMdm(boolean theExpandMdm) {
102                myExpandMdm = theExpandMdm;
103        }
104
105        public BulkExportParameters(@Nonnull String theJobDefinitionId) {
106                super(theJobDefinitionId);
107        }
108
109        public List<String> getResourceTypes() {
110                return myResourceTypes;
111        }
112
113        public void setExportIdentifier(String theExportIdentifier) {
114                myExportIdentifier = theExportIdentifier;
115        }
116        public String getExportIdentifier() {
117                return myExportIdentifier;
118        }
119
120        public void setResourceTypes(List<String> theResourceTypes) {
121                myResourceTypes = theResourceTypes;
122        }
123
124        public Date getSince() {
125                return mySince;
126        }
127
128        public void setSince(Date theSince) {
129                mySince = theSince;
130        }
131
132        public List<String> getFilters() {
133                if (myFilters == null) {
134                        myFilters = new ArrayList<>();
135                }
136                return myFilters;
137        }
138
139        public void setFilters(List<String> theFilters) {
140                myFilters = theFilters;
141        }
142
143        public List<String> getPostFetchFilterUrls() {
144                if (myPostFetchFilterUrls == null) {
145                        myPostFetchFilterUrls = new ArrayList<>();
146                }
147                return myPostFetchFilterUrls;
148        }
149
150        public void setPostFetchFilterUrls(List<String> thePostFetchFilterUrls) {
151                myPostFetchFilterUrls = thePostFetchFilterUrls;
152        }
153
154        public BulkDataExportOptions.ExportStyle getExportStyle() {
155                return myExportStyle;
156        }
157
158        public void setExportStyle(BulkDataExportOptions.ExportStyle theExportStyle) {
159                myExportStyle = theExportStyle;
160        }
161
162        public String getGroupId() {
163                return myGroupId;
164        }
165
166        public void setGroupId(String theGroupId) {
167                myGroupId = theGroupId;
168        }
169
170        public String getOutputFormat() {
171                return myOutputFormat;
172        }
173
174        public void setOutputFormat(String theOutputFormat) {
175                myOutputFormat = theOutputFormat;
176        }
177
178        public List<String> getPatientIds() {
179                return myPatientIds;
180        }
181
182        public void setPatientIds(List<String> thePatientIds) {
183                myPatientIds = thePatientIds;
184        }
185
186        public String getOriginalRequestUrl() {
187                return myOriginalRequestUrl;
188        }
189
190        public void setOriginalRequestUrl(String theOriginalRequestUrl) {
191                myOriginalRequestUrl = theOriginalRequestUrl;
192        }
193
194        public RequestPartitionId getPartitionId() {
195                return myPartitionId;
196        }
197
198        public void setPartitionId(RequestPartitionId thePartitionId) {
199                myPartitionId = thePartitionId;
200        }
201}