All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.uhn.fhir.rest.server.SearchParameterMap Maven / Gradle / Ivy

There is a newer version: 7.6.1
Show newest version
package ca.uhn.fhir.rest.server;

/*
 * #%L
 * HAPI FHIR - Core Library
 * %%
 * Copyright (C) 2014 - 2016 University Health Network
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import java.util.LinkedHashMap;

import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.param.BaseAndListParam;
import ca.uhn.fhir.rest.param.CompositeAndListParam;
import ca.uhn.fhir.rest.param.CompositeOrListParam;
import ca.uhn.fhir.rest.param.DateAndListParam;
import ca.uhn.fhir.rest.param.DateOrListParam;
import ca.uhn.fhir.rest.param.NumberAndListParam;
import ca.uhn.fhir.rest.param.NumberOrListParam;
import ca.uhn.fhir.rest.param.QuantityAndListParam;
import ca.uhn.fhir.rest.param.QuantityOrListParam;
import ca.uhn.fhir.rest.param.ReferenceAndListParam;
import ca.uhn.fhir.rest.param.ReferenceOrListParam;
import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringOrListParam;
import ca.uhn.fhir.rest.param.TokenAndListParam;
import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.param.UriAndListParam;
import ca.uhn.fhir.rest.param.UriOrListParam;

public class SearchParameterMap extends LinkedHashMap> {

	private static final long serialVersionUID = 1L;

	public  void add(String theName, CompositeOrListParam theCompositeOrListParam) {
		@SuppressWarnings("unchecked")
		CompositeAndListParam andList = (CompositeAndListParam) get(theName);
		if (andList == null) {
			andList = new CompositeAndListParam(theCompositeOrListParam.getLeftType(), theCompositeOrListParam.getRightType());
			put(theName, andList);
		}
		andList.addValue(theCompositeOrListParam);
	}

	public void add(String theName, DateOrListParam theOrListParam) {
		DateAndListParam andList = (DateAndListParam) get(theName);
		if (andList == null) {
			andList = new DateAndListParam();
			put(theName, andList);
		}
		andList.addValue(theOrListParam);
	}

	public void add(String theName, NumberOrListParam theOrListParam) {
		NumberAndListParam andList = (NumberAndListParam) get(theName);
		if (andList == null) {
			andList = new NumberAndListParam();
			put(theName, andList);
		}
		andList.addValue(theOrListParam);
	}

	public void add(String theName, QuantityOrListParam theOrListParam) {
		QuantityAndListParam andList = (QuantityAndListParam) get(theName);
		if (andList == null) {
			andList = new QuantityAndListParam();
			put(theName, andList);
		}
		andList.addValue(theOrListParam);
	}

	public void add(String theName, ReferenceOrListParam theOrListParam) {
		ReferenceAndListParam andList = (ReferenceAndListParam) get(theName);
		if (andList == null) {
			andList = new ReferenceAndListParam();
			put(theName, andList);
		}
		andList.addValue(theOrListParam);
	}

	public void add(String theName, StringOrListParam theOrListParam) {
		StringAndListParam andList = (StringAndListParam) get(theName);
		if (andList == null) {
			andList = new StringAndListParam();
			put(theName, andList);
		}
		andList.addValue(theOrListParam);
	}

	public void add(String theName, TokenOrListParam theOrListParam) {
		TokenAndListParam andList = (TokenAndListParam) get(theName);
		if (andList == null) {
			andList = new TokenAndListParam();
			put(theName, andList);
		}
		andList.addValue(theOrListParam);
	}

	public void add(String theName, UriOrListParam theOrListParam) {
		UriAndListParam andList = (UriAndListParam) get(theName);
		if (andList == null) {
			andList = new UriAndListParam();
			put(theName, andList);
		}
		andList.addValue(theOrListParam);
	}

	// public void add(String theName, IQueryParameterOr theOr) {
	// if (theOr == null) {
	// return;
	// }
	//
	// switch (theOr.getClass()) {
	//
	// }
	//
	// if (!containsKey(theName)) {
	// put(theName, new ArrayList>());
	// }
	//
	// StringAndListParam
	//
	// IQueryParameterAnd> and = get(theName);
	// and.add(theOr);
	// }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy