001/*- 002 * #%L 003 * HAPI FHIR - Core Library 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.param; 021 022import java.util.Collections; 023import java.util.Map; 024 025public class HistorySearchDateRangeParam extends DateRangeParam { 026 /** 027 * Constructor 028 * 029 * @since 8.0.0 030 */ 031 public HistorySearchDateRangeParam() { 032 this(Collections.emptyMap(), new DateRangeParam(), null); 033 } 034 035 /** 036 * Constructor 037 */ 038 public HistorySearchDateRangeParam( 039 Map<String, String[]> theParameters, DateRangeParam theDateRange, Integer theOffset) { 040 super(theDateRange); 041 this.myOffset = theOffset; 042 043 this.myHistorySearchType = theParameters == null 044 ? null 045 : theParameters.keySet().stream() 046 .map(key -> HistorySearchStyleEnum.parse(key)) 047 .filter(type -> type != null) 048 .findAny() 049 .orElse(null); 050 } 051 052 private HistorySearchStyleEnum myHistorySearchType; 053 054 private Integer myOffset; 055 056 public HistorySearchStyleEnum getHistorySearchType() { 057 return myHistorySearchType; 058 } 059 060 public Integer getOffset() { 061 return myOffset; 062 } 063}