001/*-
002 * #%L
003 * HAPI FHIR - Server Framework
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.rest.api.server.bulk;
021
022import org.hl7.fhir.instance.model.api.IIdType;
023
024import javax.annotation.Nonnull;
025import java.util.ArrayList;
026import java.util.Date;
027import java.util.List;
028import java.util.Set;
029
030// TODO: JA in next ticket - We have 3 more or less identical classes representing
031// bulk data job parameters: BulkDataExportOptions, BulkExportJobParameters, and BulkExportParameters
032// They don't seem to serve any distinct purpose so they should be collapsed into 1
033public class BulkDataExportOptions {
034
035
036        public enum ExportStyle {
037                PATIENT,
038                GROUP,
039                SYSTEM
040        }
041
042        private String myOutputFormat;
043        private Set<String> myResourceTypes;
044        private Date mySince;
045        private Set<String> myFilters;
046        private Set<String> myPostFetchFilterUrls;
047        private ExportStyle myExportStyle;
048        private boolean myExpandMdm;
049        private IIdType myGroupId;
050        private Set<IIdType> myPatientIds;
051
052        private String myExportIdentifier;
053
054        public void setOutputFormat(String theOutputFormat) {
055                myOutputFormat = theOutputFormat;
056        }
057
058        public void setResourceTypes(Set<String> theResourceTypes) {
059                myResourceTypes = theResourceTypes;
060        }
061
062        public void setSince(Date theSince) {
063                mySince = theSince;
064        }
065
066        public void setFilters(Set<String> theFilters) {
067                myFilters = theFilters;
068        }
069
070        public ExportStyle getExportStyle() {
071                return myExportStyle;
072        }
073
074        public void setExportStyle(ExportStyle theExportStyle) {
075                myExportStyle = theExportStyle;
076        }
077
078        public String getOutputFormat() {
079                return myOutputFormat;
080        }
081
082        @Nonnull
083        public Set<String> getResourceTypes() {
084                if (myResourceTypes == null) {
085                        myResourceTypes = Set.of();
086                }
087                return myResourceTypes;
088        }
089
090        public Date getSince() {
091                return mySince;
092        }
093
094        @Nonnull
095        public Set<String> getFilters() {
096                if (myFilters == null) {
097                        myFilters = Set.of();
098                }
099                return myFilters;
100        }
101
102        @Nonnull
103        public Set<String> getPostFetchFilterUrls() {
104                if (myPostFetchFilterUrls == null) {
105                        myPostFetchFilterUrls = Set.of();
106                }
107                return myPostFetchFilterUrls;
108        }
109
110        public void setPostFetchFilterUrls(Set<String> thePostFetchFilterUrls) {
111                myPostFetchFilterUrls = thePostFetchFilterUrls;
112        }
113
114        public boolean isExpandMdm() {
115                return myExpandMdm;
116        }
117
118        public void setExpandMdm(boolean theExpandMdm) {
119                myExpandMdm = theExpandMdm;
120        }
121
122        public IIdType getGroupId() {
123                return myGroupId;
124        }
125
126        public void setGroupId(IIdType theGroupId) {
127                myGroupId = theGroupId;
128        }
129
130        public Set<IIdType> getPatientIds() {
131                return myPatientIds;
132        }
133
134        public void setPatientIds(Set<IIdType> thePatientIds) {
135                myPatientIds = thePatientIds;
136        }
137
138        public String getExportIdentifier() {
139                return myExportIdentifier;
140        }
141
142        public void setExportIdentifier(String theExportIdentifier) {
143                myExportIdentifier = theExportIdentifier;
144        }
145}