mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-02-17 02:15:22 +00:00
review feedback
This commit is contained in:
parent
08472c1e3f
commit
4a2ed62357
@ -96,11 +96,6 @@ public enum RestSearchParameterTypeEnum {
|
|||||||
*/
|
*/
|
||||||
SPECIAL("special", "http://hl7.org/fhir/search-param-type"),
|
SPECIAL("special", "http://hl7.org/fhir/search-param-type"),
|
||||||
|
|
||||||
/**
|
|
||||||
* _source parameter
|
|
||||||
*/
|
|
||||||
SOURCE("string", "http://hl7.org/fhir/search-param-type"),
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +119,7 @@ public enum RestSearchParameterTypeEnum {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
for (RestSearchParameterTypeEnum next : RestSearchParameterTypeEnum.values()) {
|
for (RestSearchParameterTypeEnum next : RestSearchParameterTypeEnum.values()) {
|
||||||
if (next == HAS || next == SOURCE) {
|
if (next == HAS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,10 +98,6 @@ public class ParameterUtil {
|
|||||||
binder = new QueryParameterAndBinder(HasAndListParam.class,
|
binder = new QueryParameterAndBinder(HasAndListParam.class,
|
||||||
Collections.<Class<? extends IQueryParameterType>>emptyList());
|
Collections.<Class<? extends IQueryParameterType>>emptyList());
|
||||||
break;
|
break;
|
||||||
case SOURCE:
|
|
||||||
binder = new QueryParameterAndBinder(SourceAndListParam.class,
|
|
||||||
Collections.<Class<? extends IQueryParameterType>>emptyList());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME null access
|
// FIXME null access
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
package ca.uhn.fhir.rest.param;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.util.CoverageIgnore;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* #%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%
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public class SourceAndListParam extends BaseAndListParam<SourceOrListParam> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
SourceOrListParam newInstance() {
|
|
||||||
return new SourceOrListParam();
|
|
||||||
}
|
|
||||||
|
|
||||||
@CoverageIgnore
|
|
||||||
@Override
|
|
||||||
public SourceAndListParam addAnd(SourceOrListParam theValue) {
|
|
||||||
addValue(theValue);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package ca.uhn.fhir.rest.param;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.util.CoverageIgnore;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* #%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%
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public class SourceOrListParam extends BaseOrListParam<SourceOrListParam, SourceParam> {
|
|
||||||
|
|
||||||
@CoverageIgnore
|
|
||||||
@Override
|
|
||||||
SourceParam newInstance() {
|
|
||||||
return new SourceParam();
|
|
||||||
}
|
|
||||||
|
|
||||||
@CoverageIgnore
|
|
||||||
@Override
|
|
||||||
public SourceOrListParam addOr(SourceParam theParameter) {
|
|
||||||
add(theParameter);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -39,6 +39,7 @@ import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
|
|||||||
import ca.uhn.fhir.jpa.searchparam.ResourceMetaParams;
|
import ca.uhn.fhir.jpa.searchparam.ResourceMetaParams;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
|
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
|
||||||
|
import ca.uhn.fhir.jpa.searchparam.util.SourceParam;
|
||||||
import ca.uhn.fhir.jpa.term.VersionIndependentConcept;
|
import ca.uhn.fhir.jpa.term.VersionIndependentConcept;
|
||||||
import ca.uhn.fhir.jpa.term.api.ITermReadSvc;
|
import ca.uhn.fhir.jpa.term.api.ITermReadSvc;
|
||||||
import ca.uhn.fhir.jpa.util.*;
|
import ca.uhn.fhir.jpa.util.*;
|
||||||
@ -1270,7 +1271,6 @@ public class SearchBuilder implements ISearchBuilder {
|
|||||||
retVal = createPredicateQuantity(leftValue, theResourceName, theParam.getName(), myBuilder, dateJoin);
|
retVal = createPredicateQuantity(leftValue, theResourceName, theParam.getName(), myBuilder, dateJoin);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SOURCE:
|
|
||||||
case COMPOSITE:
|
case COMPOSITE:
|
||||||
case HAS:
|
case HAS:
|
||||||
case NUMBER:
|
case NUMBER:
|
||||||
@ -2999,9 +2999,6 @@ public class SearchBuilder implements ISearchBuilder {
|
|||||||
case REFERENCE:
|
case REFERENCE:
|
||||||
qp = new ReferenceParam();
|
qp = new ReferenceParam();
|
||||||
break;
|
break;
|
||||||
case SOURCE:
|
|
||||||
qp = new SourceParam();
|
|
||||||
break;
|
|
||||||
case SPECIAL:
|
case SPECIAL:
|
||||||
case URI:
|
case URI:
|
||||||
case HAS:
|
case HAS:
|
||||||
|
@ -113,7 +113,7 @@ public class MatchUrlService {
|
|||||||
type.setValuesAsQueryTokens(myContext, nextParamName, (paramList));
|
type.setValuesAsQueryTokens(myContext, nextParamName, (paramList));
|
||||||
paramMap.add(nextParamName, type);
|
paramMap.add(nextParamName, type);
|
||||||
} else if (Constants.PARAM_SOURCE.equals(nextParamName)) {
|
} else if (Constants.PARAM_SOURCE.equals(nextParamName)) {
|
||||||
IQueryParameterAnd<?> param = ParameterUtil.parseQueryParams(myContext, RestSearchParameterTypeEnum.SOURCE, nextParamName, paramList);
|
IQueryParameterAnd<?> param = ParameterUtil.parseQueryParams(myContext, RestSearchParameterTypeEnum.TOKEN, nextParamName, paramList);
|
||||||
paramMap.add(nextParamName, param);
|
paramMap.add(nextParamName, param);
|
||||||
} else if (nextParamName.startsWith("_")) {
|
} else if (nextParamName.startsWith("_")) {
|
||||||
// ignore these since they aren't search params (e.g. _sort)
|
// ignore these since they aren't search params (e.g. _sort)
|
||||||
|
@ -27,10 +27,14 @@ import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
|
|||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
|
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
|
||||||
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
|
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
|
||||||
|
import ca.uhn.fhir.jpa.searchparam.util.SourceParam;
|
||||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
||||||
import ca.uhn.fhir.rest.param.*;
|
import ca.uhn.fhir.rest.param.BaseParamWithPrefix;
|
||||||
|
import ca.uhn.fhir.rest.param.ParamPrefixEnum;
|
||||||
|
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||||
|
import ca.uhn.fhir.rest.param.StringParam;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.util.MetaUtil;
|
import ca.uhn.fhir.util.MetaUtil;
|
||||||
import ca.uhn.fhir.util.UrlUtil;
|
import ca.uhn.fhir.util.UrlUtil;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package ca.uhn.fhir.rest.param;
|
package ca.uhn.fhir.jpa.searchparam.util;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.left;
|
import static org.apache.commons.lang3.StringUtils.left;
|
||||||
@ -27,22 +25,16 @@ import static org.apache.commons.lang3.StringUtils.left;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the _has method parameter
|
* Model of the _source parameter
|
||||||
*/
|
*/
|
||||||
public class SourceParam extends BaseParam implements IQueryParameterType {
|
public class SourceParam {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private String myParameterValue;
|
private final String myParameterValue;
|
||||||
private String mySourceUri;
|
private final String mySourceUri;
|
||||||
private String myRequestId;
|
private final String myRequestId;
|
||||||
|
|
||||||
public SourceParam() {}
|
|
||||||
|
|
||||||
public SourceParam(String theParameterValue) {
|
public SourceParam(String theParameterValue) {
|
||||||
setValue(theParameterValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setValue(String theParameterValue) {
|
|
||||||
myParameterValue = theParameterValue;
|
myParameterValue = theParameterValue;
|
||||||
String requestId;
|
String requestId;
|
||||||
int lastHashValueIndex = theParameterValue.lastIndexOf('#');
|
int lastHashValueIndex = theParameterValue.lastIndexOf('#');
|
||||||
@ -50,7 +42,9 @@ public class SourceParam extends BaseParam implements IQueryParameterType {
|
|||||||
mySourceUri = theParameterValue;
|
mySourceUri = theParameterValue;
|
||||||
requestId = null;
|
requestId = null;
|
||||||
} else {
|
} else {
|
||||||
if (lastHashValueIndex != 0) {
|
if (lastHashValueIndex == 0) {
|
||||||
|
mySourceUri = null;
|
||||||
|
} else {
|
||||||
mySourceUri = theParameterValue.substring(0, lastHashValueIndex);
|
mySourceUri = theParameterValue.substring(0, lastHashValueIndex);
|
||||||
}
|
}
|
||||||
requestId = theParameterValue.substring(lastHashValueIndex + 1);
|
requestId = theParameterValue.substring(lastHashValueIndex + 1);
|
||||||
@ -58,21 +52,6 @@ public class SourceParam extends BaseParam implements IQueryParameterType {
|
|||||||
myRequestId = left(requestId, Constants.REQUEST_ID_LENGTH);
|
myRequestId = left(requestId, Constants.REQUEST_ID_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
String doGetQueryParameterQualifier() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
String doGetValueAsQueryToken(FhirContext theContext) {
|
|
||||||
return myParameterValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
void doSetValueAsQueryToken(FhirContext theContext, String theParamName, String theQualifier, String theValue) {
|
|
||||||
setValue(theValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSourceUri() {
|
public String getSourceUri() {
|
||||||
return mySourceUri;
|
return mySourceUri;
|
||||||
}
|
}
|
@ -44,8 +44,7 @@ public class InMemoryResourceMatcherR5Test {
|
|||||||
private static final String TEST_SOURCE = SOURCE_URI + "#" + REQUEST_ID;
|
private static final String TEST_SOURCE = SOURCE_URI + "#" + REQUEST_ID;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private
|
private InMemoryResourceMatcher myInMemoryResourceMatcher;
|
||||||
InMemoryResourceMatcher myInMemoryResourceMatcher;
|
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
ISearchParamRegistry mySearchParamRegistry;
|
ISearchParamRegistry mySearchParamRegistry;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user