Add a few tests and remove some dead code
This commit is contained in:
parent
b5e7e305c1
commit
db668d96b9
|
@ -1,64 +0,0 @@
|
|||
package ca.uhn.fhir.model.api;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2019 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 ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.util.ElementUtil;
|
||||
|
||||
public class BaseBundle extends BaseElement /*implements IElement*/ {
|
||||
|
||||
private static final long serialVersionUID = 3349586533271409727L;
|
||||
private StringDt myAuthorName;
|
||||
private StringDt myAuthorUri;
|
||||
private IdDt myId;
|
||||
|
||||
public StringDt getAuthorName() {
|
||||
if (myAuthorName == null) {
|
||||
myAuthorName = new StringDt();
|
||||
}
|
||||
return myAuthorName;
|
||||
}
|
||||
|
||||
public StringDt getAuthorUri() {
|
||||
if (myAuthorUri == null) {
|
||||
myAuthorUri = new StringDt();
|
||||
}
|
||||
return myAuthorUri;
|
||||
}
|
||||
|
||||
public IdDt getId() {
|
||||
if (myId==null) {
|
||||
myId=new IdDt();
|
||||
}
|
||||
return myId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return ElementUtil.isEmpty(myAuthorName, myAuthorUri);
|
||||
}
|
||||
|
||||
public void setId(IdDt theId) {
|
||||
myId = theId;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2019 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 ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
||||
@DatatypeDef(name = "idref")
|
||||
public class IdrefDt extends StringDt {
|
||||
|
||||
private IElement myTarget;
|
||||
|
||||
public IElement getTarget() {
|
||||
return myTarget;
|
||||
}
|
||||
|
||||
public void setTarget(IElement theTarget) {
|
||||
myTarget = theTarget;
|
||||
}
|
||||
}
|
|
@ -145,14 +145,6 @@ public class FhirResourceDaoValueSetR4 extends FhirResourceDaoR4<ValueSet> imple
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private void validateIncludes(String name, List<ConceptSetComponent> listToValidate) {
|
||||
for (ConceptSetComponent nextExclude : listToValidate) {
|
||||
if (isBlank(nextExclude.getSystem()) && !ElementUtil.isEmpty(nextExclude.getConcept(), nextExclude.getFilter())) {
|
||||
throw new InvalidRequestException("ValueSet contains " + name + " criteria with no system defined");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expandByIdentifier(String theUri, String theFilter) {
|
||||
if (isBlank(theUri)) {
|
||||
|
|
|
@ -151,14 +151,6 @@ public class FhirResourceDaoValueSetR5 extends FhirResourceDaoR5<ValueSet> imple
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private void validateIncludes(String name, List<ConceptSetComponent> listToValidate) {
|
||||
for (ConceptSetComponent nextExclude : listToValidate) {
|
||||
if (isBlank(nextExclude.getSystem()) && !ElementUtil.isEmpty(nextExclude.getConcept(), nextExclude.getFilter())) {
|
||||
throw new InvalidRequestException("ValueSet contains " + name + " criteria with no system defined");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueSet expandByIdentifier(String theUri, String theFilter) {
|
||||
if (isBlank(theUri)) {
|
||||
|
|
|
@ -58,7 +58,6 @@ public class JpaConformanceProviderR5 extends org.hl7.fhir.r5.hapi.rest.server.S
|
|||
@CoverageIgnore
|
||||
public JpaConformanceProviderR5(){
|
||||
super();
|
||||
super.setCache(false);
|
||||
setIncludeResourceCounts(true);
|
||||
}
|
||||
|
||||
|
@ -66,11 +65,10 @@ public class JpaConformanceProviderR5 extends org.hl7.fhir.r5.hapi.rest.server.S
|
|||
* Constructor
|
||||
*/
|
||||
public JpaConformanceProviderR5(RestfulServer theRestfulServer, IFhirSystemDao<Bundle, Meta> theSystemDao, DaoConfig theDaoConfig) {
|
||||
super(theRestfulServer);
|
||||
super();
|
||||
myRestfulServer = theRestfulServer;
|
||||
mySystemDao = theSystemDao;
|
||||
myDaoConfig = theDaoConfig;
|
||||
super.setCache(false);
|
||||
setIncludeResourceCounts(true);
|
||||
setSearchParamRegistry(theSystemDao.getSearchParamRegistry());
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -573,15 +573,6 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
// ignore
|
||||
}
|
||||
|
||||
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<RuntimeSearchParam>() {
|
||||
@Override
|
||||
public int compare(RuntimeSearchParam theO1, RuntimeSearchParam theO2) {
|
||||
return theO1.getName().compareTo(theO2.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sortSearchParameters(List<SearchParameter> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<SearchParameter>() {
|
||||
@Override
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.hl7.fhir.r5.hapi.rest.server.ServerProfileProvider;
|
|||
public class FhirServerR5 implements IFhirVersionServer {
|
||||
@Override
|
||||
public ServerCapabilityStatementProvider createServerConformanceProvider(RestfulServer theServer) {
|
||||
return new ServerCapabilityStatementProvider(theServer);
|
||||
return new ServerCapabilityStatementProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,8 +15,8 @@ import ca.uhn.fhir.rest.server.RestfulServer;
|
|||
import ca.uhn.fhir.rest.server.RestfulServerConfiguration;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.rest.server.method.*;
|
||||
import ca.uhn.fhir.rest.server.method.OperationMethodBinding.ReturnType;
|
||||
import ca.uhn.fhir.rest.server.method.SearchParameter;
|
||||
import ca.uhn.fhir.rest.server.method.OperationMethodBinding.ReturnType;
|
||||
import ca.uhn.fhir.rest.server.util.BaseServerCapabilityStatementProvider;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
@ -77,16 +77,6 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @deprecated Use no-args constructor instead. Deprecated in 4.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
public ServerCapabilityStatementProvider(RestfulServer theRestfulServer) {
|
||||
this();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor - This is intended only for JAX-RS server
|
||||
*/
|
||||
|
@ -558,34 +548,12 @@ public class ServerCapabilityStatementProvider extends BaseServerCapabilityState
|
|||
return op;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cache property (default is true). If set to true, the same response will be returned for each invocation.
|
||||
* <p>
|
||||
* See the class documentation for an important note if you are extending this class
|
||||
* </p>
|
||||
*
|
||||
* @deprecated Since 4.0.0 - This method no longer does anything
|
||||
*/
|
||||
@Deprecated
|
||||
public ServerCapabilityStatementProvider setCache(boolean theCache) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRestfulServer(RestfulServer theRestfulServer) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<RuntimeSearchParam>() {
|
||||
@Override
|
||||
public int compare(RuntimeSearchParam theO1, RuntimeSearchParam theO2) {
|
||||
return theO1.getName().compareTo(theO2.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sortSearchParameters(List<SearchParameter> searchParameters) {
|
||||
private void sortSearchParameters(List<SearchParameter> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<SearchParameter>() {
|
||||
@Override
|
||||
public int compare(SearchParameter theO1, SearchParameter theO2) {
|
||||
|
|
|
@ -0,0 +1,183 @@
|
|||
|
||||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.rest.annotation.*;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
import ca.uhn.fhir.rest.api.SortSpec;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.param.*;
|
||||
import org.hl7.fhir.r5.model.Organization;
|
||||
import org.hl7.fhir.r5.model.Patient;
|
||||
import org.hl7.fhir.r5.model.Practitioner;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
// import ca.uhn.fhir.model.dstu.resource.Binary;
|
||||
// import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
// import ca.uhn.fhir.model.api.Bundle;
|
||||
|
||||
|
||||
public class PatientResourceProvider implements IResourceProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public Class<Patient> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Search()
|
||||
public IBundleProvider search(
|
||||
javax.servlet.http.HttpServletRequest theServletRequest,
|
||||
|
||||
@Description(shortDefinition="The resource identity")
|
||||
@OptionalParam(name="_id")
|
||||
StringAndListParam theId,
|
||||
|
||||
@Description(shortDefinition="The resource language")
|
||||
@OptionalParam(name="_language")
|
||||
StringAndListParam theResourceLanguage,
|
||||
|
||||
@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
|
||||
@OptionalParam(name=Constants.PARAM_CONTENT)
|
||||
StringAndListParam theFtContent,
|
||||
|
||||
@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
|
||||
@OptionalParam(name=Constants.PARAM_TEXT)
|
||||
StringAndListParam theFtText,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given tag")
|
||||
@OptionalParam(name=Constants.PARAM_TAG)
|
||||
TokenAndListParam theSearchForTag,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given security labels")
|
||||
@OptionalParam(name=Constants.PARAM_SECURITY)
|
||||
TokenAndListParam theSearchForSecurity,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given profile")
|
||||
@OptionalParam(name=Constants.PARAM_PROFILE)
|
||||
UriAndListParam theSearchForProfile,
|
||||
|
||||
|
||||
@Description(shortDefinition="A patient identifier")
|
||||
@OptionalParam(name="identifier")
|
||||
TokenAndListParam theIdentifier,
|
||||
|
||||
@Description(shortDefinition="A portion of either family or given name of the patient")
|
||||
@OptionalParam(name="name")
|
||||
StringAndListParam theName,
|
||||
|
||||
@Description(shortDefinition="A portion of the family name of the patient")
|
||||
@OptionalParam(name="family")
|
||||
StringAndListParam theFamily,
|
||||
|
||||
@Description(shortDefinition="A portion of the given name of the patient")
|
||||
@OptionalParam(name="given")
|
||||
StringAndListParam theGiven,
|
||||
|
||||
@Description(shortDefinition="A portion of either family or given name using some kind of phonetic matching algorithm")
|
||||
@OptionalParam(name="phonetic")
|
||||
StringAndListParam thePhonetic,
|
||||
|
||||
@Description(shortDefinition="The value in any kind of telecom details of the patient")
|
||||
@OptionalParam(name="telecom")
|
||||
TokenAndListParam theTelecom,
|
||||
|
||||
@Description(shortDefinition="A value in a phone contact")
|
||||
@OptionalParam(name="phone")
|
||||
TokenAndListParam thePhone,
|
||||
|
||||
@Description(shortDefinition="A value in an email contact")
|
||||
@OptionalParam(name="email")
|
||||
TokenAndListParam theEmail,
|
||||
|
||||
@Description(shortDefinition="An address in any kind of address/part of the patient")
|
||||
@OptionalParam(name="address")
|
||||
StringAndListParam theAddress,
|
||||
|
||||
@Description(shortDefinition="A city specified in an address")
|
||||
@OptionalParam(name="address-city")
|
||||
StringAndListParam theAddress_city,
|
||||
|
||||
@Description(shortDefinition="A state specified in an address")
|
||||
@OptionalParam(name="address-state")
|
||||
StringAndListParam theAddress_state,
|
||||
|
||||
@Description(shortDefinition="A postalCode specified in an address")
|
||||
@OptionalParam(name="address-postalcode")
|
||||
StringAndListParam theAddress_postalcode,
|
||||
|
||||
@Description(shortDefinition="A country specified in an address")
|
||||
@OptionalParam(name="address-country")
|
||||
StringAndListParam theAddress_country,
|
||||
|
||||
@Description(shortDefinition="A use code specified in an address")
|
||||
@OptionalParam(name="address-use")
|
||||
TokenAndListParam theAddress_use,
|
||||
|
||||
@Description(shortDefinition="Gender of the patient")
|
||||
@OptionalParam(name="gender")
|
||||
TokenAndListParam theGender,
|
||||
|
||||
@Description(shortDefinition="Language code (irrespective of use value)")
|
||||
@OptionalParam(name="language")
|
||||
TokenAndListParam theLanguage,
|
||||
|
||||
@Description(shortDefinition="The patient's date of birth")
|
||||
@OptionalParam(name="birthdate")
|
||||
DateRangeParam theBirthdate,
|
||||
|
||||
@Description(shortDefinition="The organization at which this person is a patient")
|
||||
@OptionalParam(name="organization", targetTypes={ Organization.class } )
|
||||
ReferenceAndListParam theOrganization,
|
||||
|
||||
@Description(shortDefinition="Patient's nominated care provider, could be a care manager, not the organization that manages the record")
|
||||
@OptionalParam(name="careprovider", targetTypes={ Organization.class , Practitioner.class } )
|
||||
ReferenceAndListParam theCareprovider,
|
||||
|
||||
@Description(shortDefinition="Whether the patient record is active")
|
||||
@OptionalParam(name="active")
|
||||
TokenAndListParam theActive,
|
||||
|
||||
@Description(shortDefinition="The species for animal patients")
|
||||
@OptionalParam(name="animal-species")
|
||||
TokenAndListParam theAnimal_species,
|
||||
|
||||
@Description(shortDefinition="The breed for animal patients")
|
||||
@OptionalParam(name="animal-breed")
|
||||
TokenAndListParam theAnimal_breed,
|
||||
|
||||
@Description(shortDefinition="All patients linked to the given patient")
|
||||
@OptionalParam(name="link", targetTypes={ Patient.class } )
|
||||
ReferenceAndListParam theLink,
|
||||
|
||||
@Description(shortDefinition="This patient has been marked as deceased, or as a death date entered")
|
||||
@OptionalParam(name="deceased")
|
||||
TokenAndListParam theDeceased,
|
||||
|
||||
@Description(shortDefinition="The date of death has been provided and satisfies this search value")
|
||||
@OptionalParam(name="deathdate")
|
||||
DateRangeParam theDeathdate,
|
||||
|
||||
@IncludeParam(reverse=true)
|
||||
Set<Include> theRevIncludes,
|
||||
@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
|
||||
@OptionalParam(name="_lastUpdated")
|
||||
DateRangeParam theLastUpdated,
|
||||
|
||||
@IncludeParam(allow= {
|
||||
"Patient:careprovider" , "Patient:link" , "Patient:organization" , "Patient:careprovider" , "Patient:link" , "Patient:organization" , "Patient:careprovider" , "Patient:link" , "Patient:organization" , "*"
|
||||
})
|
||||
Set<Include> theIncludes,
|
||||
|
||||
@Sort
|
||||
SortSpec theSort,
|
||||
|
||||
@Count
|
||||
Integer theCount
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -151,7 +151,6 @@ datatype.date=ca.uhn.fhir.model.primitive.DateDt
|
|||
datatype.dateTime=ca.uhn.fhir.model.primitive.DateTimeDt
|
||||
datatype.decimal=ca.uhn.fhir.model.primitive.DecimalDt
|
||||
datatype.id=ca.uhn.fhir.model.primitive.IdDt
|
||||
datatype.idref=ca.uhn.fhir.model.primitive.IdrefDt
|
||||
datatype.instant=ca.uhn.fhir.model.primitive.InstantDt
|
||||
datatype.integer=ca.uhn.fhir.model.primitive.IntegerDt
|
||||
datatype.markdown=ca.uhn.fhir.model.primitive.MarkdownDt
|
||||
|
|
|
@ -146,7 +146,6 @@ datatype.date=ca.uhn.fhir.model.primitive.DateDt
|
|||
datatype.dateTime=ca.uhn.fhir.model.primitive.DateTimeDt
|
||||
datatype.decimal=ca.uhn.fhir.model.primitive.DecimalDt
|
||||
datatype.id=ca.uhn.fhir.model.primitive.IdDt
|
||||
datatype.idref=ca.uhn.fhir.model.primitive.IdrefDt
|
||||
datatype.instant=ca.uhn.fhir.model.primitive.InstantDt
|
||||
datatype.integer=ca.uhn.fhir.model.primitive.IntegerDt
|
||||
datatype.markdown=ca.uhn.fhir.model.primitive.MarkdownDt
|
||||
|
|
Loading…
Reference in New Issue