Get all of the tests passing again

This commit is contained in:
jamesagnew 2014-05-20 18:28:13 -04:00
parent 5675237f40
commit f52ed02fa4
52 changed files with 561 additions and 173 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -286,6 +286,11 @@
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-linkcheck-plugin</artifactId>
<version>1.1</version>
</plugin>
</plugins>
</reporting>

View File

@ -1,6 +1,5 @@
package ca.uhn.fhir.model.api;
import ca.uhn.fhir.context.FhirContext;
/*
* #%L
@ -55,8 +54,7 @@ public interface IQueryParameterType {
* This method is generally only called by HAPI itself, and should not need to be called from user code.
*
* This method will return any qualifier that should be appended to the parameter name (e.g ":exact")
* @param theContext TODO
*/
public String getQueryParameterQualifier(FhirContext theContext);
public String getQueryParameterQualifier();
}

View File

@ -38,7 +38,6 @@ package ca.uhn.fhir.model.dstu.composite;
import java.util.List;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.BaseElement;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IElement;
@ -429,7 +428,7 @@ public class CodingDt
}
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}

View File

@ -38,7 +38,6 @@ package ca.uhn.fhir.model.dstu.composite;
import java.util.List;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.BaseElement;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IElement;
@ -436,7 +435,7 @@ public class IdentifierDt
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.BaseElement;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IElement;
@ -434,7 +433,7 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype, IQuer
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}

View File

@ -22,7 +22,6 @@ package ca.uhn.fhir.model.primitive;
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.BasePrimitive;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
@ -131,7 +130,7 @@ public class StringDt extends BasePrimitive<String> implements IQueryParameterTy
}
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}

View File

@ -27,9 +27,58 @@ package ca.uhn.fhir.rest.api;
public class SortSpec {
private SortSpec myChain;
private String myFieldName;
private String myParamName;
private SortOrderEnum myOrder;
/**
* Constructor
*/
public SortSpec() {
}
/**
* Constructor
*
* @param theParamName
* The search name to sort on. See {@link #setParamName(String)} for more information.
*/
public SortSpec(String theParamName) {
super();
myParamName = theParamName;
}
/**
* Constructor
*
* @param theParamName
* The search name to sort on. See {@link #setParamName(String)} for more information.
* @param theOrder
* The order, or <code>null</code>. See {@link #setOrder(SortOrderEnum)} for more information.
*/
public SortSpec(String theParamName, SortOrderEnum theOrder) {
super();
myParamName = theParamName;
myOrder = theOrder;
}
/**
* Constructor
*
* @param theParamName
* The search name to sort on. See {@link #setParamName(String)} for more information.
* @param theOrder
* The order, or <code>null</code>. See {@link #setOrder(SortOrderEnum)} for more information.
* @param theChain
* The next sorting spec, to be applied only when this spec makes two entries equal. See
* {@link #setChain(SortSpec)} for more information.
*/
public SortSpec(String theParamName, SortOrderEnum theOrder, SortSpec theChain) {
super();
myParamName = theParamName;
myOrder = theOrder;
myChain = theChain;
}
/**
* Gets the chained sort specification, or <code>null</code> if none. If multiple sort parameters are chained
* (indicating a sub-sort), the second level sort is chained via this property.
@ -39,14 +88,14 @@ public class SortSpec {
}
/**
* Returns the actual name of the field to sort by
* Returns the actual name of the search param to sort by
*/
public String getFieldName() {
return myFieldName;
public String getParamName() {
return myParamName;
}
/**
* Returns the sort order specified by this parameter, or <code>null</code> if none is explicitly defined (which
* Returns the sort order specified by this parameter, or <code>null</code> if none is explicitly provided (which
* means {@link SortOrderEnum#ASC} according to the <a
* href="http://hl7.org/implement/standards/fhir/search.html#sort">FHIR specification</a>)
*/
@ -59,19 +108,22 @@ public class SortSpec {
* (indicating a sub-sort), the second level sort is chained via this property.
*/
public void setChain(SortSpec theChain) {
if (theChain == this) {
throw new IllegalArgumentException("Can not chain this to itself");
}
myChain = theChain;
}
/**
* Sets the actual name of the field to sort by
* Sets the actual name of the search param to sort by
*/
public void setFieldName(String theFieldName) {
myFieldName = theFieldName;
public void setParamName(String theFieldName) {
myParamName = theFieldName;
}
/**
* Sets the sort order specified by this parameter, or <code>null</code> if none is explicitly defined (which means
* {@link SortOrderEnum#ASC} according to the <a
* Sets the sort order specified by this parameter, or <code>null</code> if none should be explicitly defined (which
* means {@link SortOrderEnum#ASC} according to the <a
* href="http://hl7.org/implement/standards/fhir/search.html#sort">FHIR specification</a>)
*/
public void setOrder(SortOrderEnum theOrder) {

View File

@ -176,7 +176,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
String qualifier = null;
for (IQueryParameterType nextValue : nextEntry.getValue()) {
valueList.add(nextValue.getValueAsQueryToken());
qualifier = nextValue.getQueryParameterQualifier(myContext);
qualifier = nextValue.getQueryParameterQualifier();
}
qualifier = StringUtils.defaultString(qualifier);
params.put(nextEntry.getKey()+qualifier, valueList);

View File

@ -44,7 +44,7 @@ public class QualifiedParamList extends ArrayList<String> {
public QualifiedParamList(FhirContext theContext, IQueryParameterOr theNextOr) {
for (IQueryParameterType next : theNextOr.getValuesAsQueryTokens()) {
if (myQualifier==null) {
myQualifier=next.getQueryParameterQualifier(theContext);
myQualifier=next.getQueryParameterQualifier();
}
add(next.getValueAsQueryToken());
}

View File

@ -50,7 +50,7 @@ public class DateRangeParam implements IQueryParameterAnd {
* @param theLowerBound
* A qualified date param representing the lower date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
* @param theLowerBound
* @param theUpperBound
* A qualified date param representing the upper date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
*/
@ -98,7 +98,7 @@ public class DateRangeParam implements IQueryParameterAnd {
* @param theLowerBound
* A qualified date param representing the lower date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00"
* @param theLowerBound
* @param theUpperBound
* A qualified date param representing the upper date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00"
*/
@ -179,7 +179,7 @@ public class DateRangeParam implements IQueryParameterAnd {
* @param theLowerBound
* A qualified date param representing the lower date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
* @param theLowerBound
* @param theUpperBound
* A qualified date param representing the upper date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
*/
@ -195,7 +195,7 @@ public class DateRangeParam implements IQueryParameterAnd {
* @param theLowerBound
* A qualified date param representing the lower date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
* @param theLowerBound
* @param theUpperBound
* A qualified date param representing the upper date bound (optionally may include time), e.g.
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
*/

View File

@ -22,7 +22,6 @@ package ca.uhn.fhir.rest.param;
import java.util.Date;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
import ca.uhn.fhir.model.primitive.DateTimeDt;
@ -127,7 +126,7 @@ public class QualifiedDateParam extends DateTimeDt implements IQueryParameterTyp
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}

View File

@ -54,7 +54,7 @@ public class ReferenceParam implements IQueryParameterType {
}
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
StringBuilder b = new StringBuilder();
if (isNotBlank(myResourceType)) {
b.append(':');

View File

@ -44,25 +44,24 @@ public class SortParameter implements IParameter {
@Override
public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, BaseClientInvocation theClientInvocation) throws InternalErrorException {
SortSpec ss = (SortSpec) theSourceClientArgument;
if (ss == null) {
return;
}
String name;
if (ss.getOrder() == null) {
name = Constants.PARAM_SORT;
} else if (ss.getOrder() == SortOrderEnum.ASC) {
name = Constants.PARAM_SORT_ASC;
} else {
name = Constants.PARAM_SORT_DESC;
}
if (ss.getFieldName() != null) {
if (!theTargetQueryArguments.containsKey(name)) {
theTargetQueryArguments.put(name, new ArrayList<String>());
while (ss != null) {
String name;
if (ss.getOrder() == null) {
name = Constants.PARAM_SORT;
} else if (ss.getOrder() == SortOrderEnum.ASC) {
name = Constants.PARAM_SORT_ASC;
} else {
name = Constants.PARAM_SORT_DESC;
}
theTargetQueryArguments.get(name).add(ss.getFieldName());
}
if (ss.getParamName() != null) {
if (!theTargetQueryArguments.containsKey(name)) {
theTargetQueryArguments.put(name, new ArrayList<String>());
}
theTargetQueryArguments.get(name).add(ss.getParamName());
}
ss = ss.getChain();
}
}
@Override
@ -95,7 +94,7 @@ public class SortParameter implements IParameter {
if (isNotBlank(nextValue)) {
SortSpec spec = new SortSpec();
spec.setOrder(order);
spec.setFieldName(nextValue);
spec.setParamName(nextValue);
if (innerSpec == null) {
outerSpec = spec;
innerSpec = spec;
@ -113,11 +112,11 @@ public class SortParameter implements IParameter {
@Override
public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) {
if (theOuterCollectionType != null || theInnerCollectionType!=null) {
throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" +theMethod.getDeclaringClass().getCanonicalName()+ "' is annotated with @" + Sort.class.getName() + " but can not be of collection type");
if (theOuterCollectionType != null || theInnerCollectionType != null) {
throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + Sort.class.getName() + " but can not be of collection type");
}
if (!theParameterType.equals(SortSpec.class)) {
throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '"+theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + Sort.class.getName() + " but is an invalid type, must be: " + SortSpec.class.getCanonicalName());
throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + Sort.class.getName() + " but is an invalid type, must be: " + SortSpec.class.getCanonicalName());
}
}

View File

@ -20,7 +20,6 @@ package ca.uhn.fhir.rest.param;
* #L%
*/
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.server.Constants;
@ -51,7 +50,7 @@ public class StringParam extends StringDt {
}
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
if (isExact()) {
return Constants.PARAMQUALIFIER_STRING_EXACT;
} else {

View File

@ -49,10 +49,13 @@ import ca.uhn.fhir.rest.annotation.RequiredParam;
import ca.uhn.fhir.rest.annotation.ResourceParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.annotation.Since;
import ca.uhn.fhir.rest.annotation.Sort;
import ca.uhn.fhir.rest.annotation.Update;
import ca.uhn.fhir.rest.annotation.Validate;
import ca.uhn.fhir.rest.annotation.VersionIdParam;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.SortOrderEnum;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.client.ITestClient;
import ca.uhn.fhir.rest.client.api.IBasicClient;
import ca.uhn.fhir.rest.client.api.IRestfulClient;
@ -80,6 +83,32 @@ public List<Organization> getAllOrganizations() {
}
//END SNIPPET: searchAll
//START SNIPPET: sort
@Search
public List<Patient> findPatients(
@RequiredParam(name=Patient.SP_IDENTIFIER) StringParam theParameter,
@Sort SortSpec theSort) {
List<Patient> retVal=new ArrayList<Patient>(); // populate this
// theSort is null unless a _sort parameter is actually provided
if (theSort != null) {
// The name of the param to sort by
String param = theSort.getParamName();
// The sort order, or null
SortOrderEnum order = theSort.getOrder();
// This will be populated if a second _sort was specified
SortSpec subSort = theSort.getChain();
// ...apply the sort...
}
return retVal;
}
//END SNIPPET: sort
//START SNIPPET: underlyingReq
@Search
public List<Patient> findPatients(
@ -259,6 +288,21 @@ List<Patient> response = client.getPatientByDob(param);
//END SNIPPET: dateClient
}
//START SNIPPET: dateRange
@Search()
public List<Observation> searchByDateRange(
@RequiredParam(name=Observation.SP_DATE) DateRangeParam theRange ) {
Date from = theRange.getLowerBoundAsInstant();
Date to = theRange.getUpperBoundAsInstant();
List<Observation> retVal = new ArrayList<Observation>();
// ...populate...
return retVal;
}
//END SNIPPET: dateRange
private ITestClient provideTc() {
return null;
}

View File

@ -915,6 +915,43 @@
</subsection>
<subsection name="Sorting (_sort)">
<p>
FHIR supports
<a href="http://www.hl7.org/implement/standards/fhir/search.html#sort">sorting</a>
according to a specific set of rules.
</p>
<p>
According to the specification, sorting is requested by the client using a
search param as the sort key. For example, when searching Patient resources,
a sort key of "given" requests the "given" search param as the sort key. That
param maps to the values in the field "Patient.name.given".
</p>
<p>
Sort specifications can be passed into handler methods by adding a parameter
of type
SortSpec,
which has been annotated with the
@Sort
annotation, as shown in the following example:
</p>
<macro name="snippet">
<param name="id" value="sort" />
<param name="file" value="src/site/example/java/example/RestfulPatientResourceProviderMore.java" />
</macro>
<p>
Example URL to invoke this method:
<br />
<code>http://fhir.example.com/Patient?_identifier=urn:foo|123&amp;_sort=given</code>
</p>
</subsection>
<a name="type_validate" />
</section>

View File

@ -303,7 +303,7 @@ public class GenericClientTest {
client.search().forResource(Patient.class).execute();
fail();
} catch (InternalErrorException e) {
assertEquals(e.getMessage(), "INTERNAL ERRORS");
assertEquals(e.getMessage(), "HTTP 500 INTERNAL ERRORS: Server Issues!");
assertEquals(e.getResponseBody(), "Server Issues!");
}

View File

@ -0,0 +1,101 @@
package ca.uhn.fhir.rest.client;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.StringReader;
import java.nio.charset.Charset;
import java.util.List;
import org.apache.commons.io.input.ReaderInputStream;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.rest.annotation.RequiredParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.annotation.Sort;
import ca.uhn.fhir.rest.api.SortOrderEnum;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.client.api.IBasicClient;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.server.Constants;
public class SortClientTest {
private FhirContext ctx;
private HttpClient httpClient;
private HttpResponse httpResponse;
// atom-document-large.xml
@Before
public void before() {
ctx = new FhirContext(Patient.class, Conformance.class);
httpClient = mock(HttpClient.class, new ReturnsDeepStubs());
ctx.getRestfulClientFactory().setHttpClient(httpClient);
httpResponse = mock(HttpResponse.class, new ReturnsDeepStubs());
}
@Test
public void testSort() throws Exception {
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(createBundle()), Charset.forName("UTF-8")));
IClient client = ctx.newRestfulClient(IClient.class, "http://foo");
client.searchWithParam(new StringParam("hello"), new SortSpec("given"));
assertEquals(HttpGet.class, capt.getValue().getClass());
HttpGet get = (HttpGet) capt.getValue();
assertEquals("http://foo/Patient?name=hello&_sort=given", get.getURI().toString());
}
@Test
public void testSortWithChain() throws Exception {
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(createBundle()), Charset.forName("UTF-8")));
IClient client = ctx.newRestfulClient(IClient.class, "http://foo");
client.searchWithParam(new StringParam("hello"), new SortSpec("given", SortOrderEnum.DESC, new SortSpec("family", SortOrderEnum.ASC)));
assertEquals(HttpGet.class, capt.getValue().getClass());
HttpGet get = (HttpGet) capt.getValue();
assertEquals("http://foo/Patient?name=hello&_sort%3Adesc=given&_sort%3Aasc=family", get.getURI().toString());
}
private String createBundle() {
return ctx.newXmlParser().encodeBundleToString(new Bundle());
}
private interface IClient extends IBasicClient {
@Search(type=Patient.class)
public List<Patient> searchWithParam(@RequiredParam(name=Patient.SP_NAME) StringParam theString, @Sort SortSpec theSort);
}
}

View File

@ -354,7 +354,11 @@ public class ResfulServerMethodTest {
IParser p = ourCtx.newXmlParser().setPrettyPrint(true);
String enc = p.encodeResourceToString(bundle);
ourLog.info("Response:\n{}", enc);
assertTrue(enc.contains(ExtensionConstants.CONF_ADDITIONAL_PARAM));
p = ourCtx.newXmlParser().setPrettyPrint(false);
enc = p.encodeResourceToString(bundle);
ourLog.info("Response:\n{}", enc);
assertThat(enc, StringContains.containsString("<searchParam><name value=\"quantityParam\"/><type value=\"quantity\"/></searchParam>"));
}
// {
// IParser p = ourCtx.newJsonParser().setPrettyPrint(true);
@ -536,14 +540,14 @@ public class ResfulServerMethodTest {
String responseContent = IOUtils.toString(status.getEntity().getContent());
ourLog.info("Response was:\n{}", responseContent);
assertEquals(Constants.STATUS_HTTP_404_NOT_FOUND, status.getStatusLine().getStatusCode());
assertEquals(Constants.STATUS_HTTP_400_BAD_REQUEST, status.getStatusLine().getStatusCode());
}
@Test
public void testSearchAll() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient");
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/AdverseReaction");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
@ -554,7 +558,7 @@ public class ResfulServerMethodTest {
assertEquals(2, bundle.getEntries().size());
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/_search");
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/AdverseReaction/_search");
status = ourClient.execute(httpPost);
responseContent = IOUtils.toString(status.getEntity().getContent());
@ -1205,6 +1209,15 @@ public class ResfulServerMethodTest {
IdDt version = new IdDt(thePatient.getIdentifier().get(1).getValue().getValue());
return new MethodOutcome(id, version);
}
@Search()
public Collection<AdverseReaction> getAllResources() {
ArrayList<AdverseReaction> retVal = new ArrayList<AdverseReaction>();
retVal.add(new AdverseReaction());
retVal.add(new AdverseReaction());
return retVal;
}
@Override
public Class<? extends IResource> getResourceType() {
@ -1501,11 +1514,6 @@ public class ResfulServerMethodTest {
return retVal;
}
@Search()
public Collection<Patient> getResources() {
return getIdToPatient().values();
}
@Override
public Class<Patient> getResourceType() {
return Patient.class;

View File

@ -85,7 +85,8 @@ public class ServerConformanceProviderTest {
String conf = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
ourLog.info(conf);
assertThat(conf, containsString("<documentation value=\"The patient's identifier (MRN or other card number)\"/>"));
assertThat(conf, containsString("<documentation value=\"The patient's identifier\"/>"));
assertThat(conf, containsString("<documentation value=\"The patient's name\"/>"));
assertThat(conf, containsString("<type value=\"token\"/>"));
}

View File

@ -53,47 +53,47 @@ public class SortTest {
assertEquals(1, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
}
@Test
public void testSingleSort() throws Exception {
{
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort=given");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort=given");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(2, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|null", p.getName().get(1).getFamilyFirstRep().getValue());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(2, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|null", p.getName().get(1).getFamilyFirstRep().getValue());
}
{
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort:asc=given");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort:asc=given");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(2, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|ASC", p.getName().get(1).getFamilyFirstRep().getValue());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(2, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|ASC", p.getName().get(1).getFamilyFirstRep().getValue());
}
{
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort:desc=given");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort:desc=given");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(2, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|DESC", p.getName().get(1).getFamilyFirstRep().getValue());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(2, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|DESC", p.getName().get(1).getFamilyFirstRep().getValue());
}
}
@ -101,23 +101,23 @@ public class SortTest {
@Test
public void testSortChain() throws Exception {
{
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort=given&_sort=family&_sort=name");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_sort=given&_sort=family&_sort=name");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.size());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(4, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|null", p.getName().get(1).getFamilyFirstRep().getValue());
assertEquals("family|null", p.getName().get(2).getFamilyFirstRep().getValue());
assertEquals("name|null", p.getName().get(3).getFamilyFirstRep().getValue());
Patient p = bundle.getResources(Patient.class).get(0);
assertEquals(4, p.getName().size());
assertEquals("Hello", p.getNameFirstRep().getFamilyFirstRep().getValue());
assertEquals("given|null", p.getName().get(1).getFamilyFirstRep().getValue());
assertEquals("family|null", p.getName().get(2).getFamilyFirstRep().getValue());
assertEquals("name|null", p.getName().get(3).getFamilyFirstRep().getValue());
}
}
@AfterClass
public static void afterClass() throws Exception {
ourServer.stop();
@ -158,7 +158,7 @@ public class SortTest {
p.addName().addFamily().setValue(theName.getValue());
SortSpec sort = theSort;
while (sort != null) {
p.addName().addFamily().setValue(sort.getFieldName() + "|" + sort.getOrder());
p.addName().addFamily().setValue(sort.getParamName() + "|" + sort.getOrder());
sort = sort.getChain();
}

View File

@ -18,7 +18,6 @@ package ca.uhn.fhir.testmodel;
import java.util.List;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.BaseElement;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IElement;
@ -399,7 +398,7 @@ public class IdentifierDt
}
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -24,7 +24,7 @@ import ca.uhn.fhir.model.primitive.IdDt;
@Entity
@Table(name = "BASE_RES", uniqueConstraints = {})
@Inheritance(strategy = InheritanceType.JOINED)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "SVCVER_TYPE", length = 20, discriminatorType = DiscriminatorType.STRING)
public abstract class BaseResourceTable<T extends IResource> extends BaseHasResource {

View File

@ -13,7 +13,7 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name = "SPIDX_DATE", indexes= {@Index(name="IDX_SP_DATE", columnList="myValueLow,myValueHigh")})
@Table(name = "SPIDX_DATE", indexes= {@Index(name="IDX_SP_DATE", columnList="SP_VALUE_LOW,SP_VALUE_HIGH")})
public class ResourceIndexedSearchParamDate extends BaseResourceIndexedSearchParam {
private static final long serialVersionUID = 1L;

View File

@ -11,7 +11,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "SPIDX_NUMBER", indexes= {@Index(name="IDX_SP_NUMBER", columnList="myValue")})
@Table(name = "SPIDX_NUMBER", indexes= {@Index(name="IDX_SP_NUMBER", columnList="SP_VALUE")})
public class ResourceIndexedSearchParamNumber extends BaseResourceIndexedSearchParam {
private static final long serialVersionUID = 1L;

View File

@ -10,7 +10,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "SPIDX_STRING", indexes= {@Index(name="IDX_SP_STRING", columnList="myValueNormalized")})
@Table(name = "SPIDX_STRING", indexes= {@Index(name="IDX_SP_STRING", columnList="SP_VALUE_NORMALIZED")})
public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchParam {
private static final long serialVersionUID = 1L;

View File

@ -9,7 +9,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "SPIDX_TOKEN", indexes= {@Index(name="IDX_SP_STRING", columnList="mySystem,myValue")})
@Table(name = "SPIDX_TOKEN", indexes= {@Index(name="IDX_SP_STRING", columnList="SP_SYSTEM,SP_VALUE")})
public class ResourceIndexedSearchParamToken extends BaseResourceIndexedSearchParam {
private static final long serialVersionUID = 1L;

View File

@ -227,7 +227,7 @@ public class FhirResourceDaoTest {
Map<String, IQueryParameterType> params = new HashMap<>();
List<Patient> patients = ourPatientDao.search(params);
assertEquals(2, patients.size());
assertTrue(patients.size() >= 2);
}
@Test

View File

@ -4,6 +4,7 @@
<classpathentry kind="src" path="target/generated-sources/tinder"/>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar" sourcepath="M2_REPO/javax/activation/activation/1.1/activation-1.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/json/javax.json-api/1.0/javax.json-api-1.0.jar" sourcepath="M2_REPO/javax/json/javax.json-api/1.0/javax.json-api-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/mail/javax.mail-api/1.5.0/javax.mail-api-1.5.0.jar" sourcepath="M2_REPO/javax/mail/javax.mail-api/1.5.0/javax.mail-api-1.5.0-sources.jar">

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
</dependency>
<dependency>
@ -83,7 +83,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<executions>
<execution>
<id>buildclient</id>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -19,7 +19,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
</dependency>
</dependencies>
@ -28,7 +28,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<executions>
<execution>
<goals>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="src" path="target/gen"/>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="var" path="M2_REPO/javax/json/javax.json-api/1.0/javax.json-api-1.0.jar" sourcepath="M2_REPO/javax/json/javax.json-api/1.0/javax.json-api-1.0-sources.jar"/>

View File

@ -1,14 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hapi-tinder-plugin</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<name>hapi-tinder-plugin</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -1,12 +1,12 @@
#Mon Mar 03 15:01:12 EST 2014
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -20,7 +20,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -195,7 +195,7 @@ public class TinderStructuresMojo extends AbstractMojo {
// dtp.writeAll(dtOutputDir);
//
ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet();
rp.setBaseResourceNames(Arrays.asList("observation"));
rp.setBaseResourceNames(Arrays.asList("list"));
rp.parse();
// rp.bindValueSets(vsp);

View File

@ -84,7 +84,8 @@ public abstract class BaseStructureParser {
}
}
private ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter findAnnotation(Class<?> theBase, Annotation[] theAnnotations, Class<ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter> theClass) {
private ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter findAnnotation(Class<?> theBase, Annotation[] theAnnotations,
Class<ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter> theClass) {
for (Annotation next : theAnnotations) {
if (theClass.equals(next.annotationType())) {
return (ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter) next;
@ -279,6 +280,7 @@ public abstract class BaseStructureParser {
} else {
ctx.put("className", (theResource.getName()));
} // HumanName}
ctx.put("elementName", theResource.getElementName());
ctx.put("classNameComplete", (theResource.getName()) + getFilenameSuffix()); // HumanNameDt
ctx.put("shortName", defaultString(theResource.getShortName()));
ctx.put("definition", defaultString(theResource.getDefinition()));
@ -337,7 +339,8 @@ public abstract class BaseStructureParser {
// File f = new File(theOutputDirectory, (next.getDeclaringClassNameComplete()) /*+ getFilenameSuffix()*/ +
// ".java");
File f = new File(theOutputDirectory, (next.getElementName()) + getFilenameSuffix() + ".java");
String elementName = translateClassName(next.getElementName());
File f = new File(theOutputDirectory, elementName + getFilenameSuffix() + ".java");
try {
write(next, f, thePackageBase);
} catch (IOException e) {
@ -346,16 +349,16 @@ public abstract class BaseStructureParser {
}
}
// private String translateClassName(String theName) {
// if ("List".equals(theName)) {
// return "ListResource";
// }
// return theName;
// }
private String translateClassName(String theName) {
if ("List".equals(theName)) {
return "ListResource";
}
return theName;
}
/**
* Example: Encounter has an internal block class named "Location", but it also has a reference to the Location
* resource type, so we need to use the fully qualified name for that resource reference
* Example: Encounter has an internal block class named "Location", but it also has a reference to the Location resource type, so we need to use the fully qualified name for that resource
* reference
*/
private void fixResourceReferenceClassNames(BaseElement theNext, String thePackageBase) {
for (BaseElement next : theNext.getChildren()) {

View File

@ -2,6 +2,8 @@
package ${packageBase}.composite;
import java.math.BigDecimal;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.api.annotation.*;
@ -153,6 +155,71 @@ public class ${className}
setSystem(theSystem);
setUnits(theUnits);
}
@Override
public void setValueAsQueryToken(String theQualifier, String theValue) {
setComparator((BoundCodeDt<QuantityCompararatorEnum>) null);
setCode((CodeDt) null);
setSystem((UriDt) null);
setUnits((StringDt) null);
setValue((DecimalDt) null);
if (theValue == null) {
return;
}
String[] parts = theValue.split("\\|");
if (parts.length > 0 && StringUtils.isNotBlank(parts[0])) {
if (parts[0].startsWith("<=")) {
setComparator(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS);
setValue(new BigDecimal(parts[0].substring(2)));
} else if (parts[0].startsWith("<")) {
setComparator(QuantityCompararatorEnum.LESSTHAN);
setValue(new BigDecimal(parts[0].substring(1)));
} else if (parts[0].startsWith(">=")) {
setComparator(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS);
setValue(new BigDecimal(parts[0].substring(2)));
} else if (parts[0].startsWith(">")) {
setComparator(QuantityCompararatorEnum.GREATERTHAN);
setValue(new BigDecimal(parts[0].substring(1)));
} else {
setValue(new BigDecimal(parts[0]));
}
}
if (parts.length > 1 && StringUtils.isNotBlank(parts[1])) {
setSystem(parts[1]);
}
if (parts.length > 2 && StringUtils.isNotBlank(parts[2])) {
setUnits(parts[2]);
}
}
@Override
public String getValueAsQueryToken() {
StringBuilder b= new StringBuilder();
if (getComparator() != null) {
b.append(getComparator().getValue());
}
if (!getValue().isEmpty()) {
b.append(getValue().getValueAsString());
}
b.append('|');
if (!getSystem().isEmpty()) {
b.append(getSystem().getValueAsString());
}
b.append('|');
if (!getUnits().isEmpty()) {
b.append(getUnits().getValueAsString());
}
return b.toString();
}
@Override
public String getQueryParameterQualifier() {
return null;
}
#end
#if ( ${className} == "ResourceReferenceDt" )
/**
@ -171,7 +238,7 @@ public class ${className}
* @param theResourceType The resource type
* @param theResourceId The resource ID
*/
public ResourceReferenceDt(Class<? extends IResource> theResourceType, IdDt theResourceId) {
public ResourceReferenceDt(Class<? extends IResource> theResourceType, ca.uhn.fhir.model.primitive.IdDt theResourceId) {
super(theResourceType, theResourceId);
}
@ -231,7 +298,7 @@ public class ${className}
* {@inheritDoc}
*/
@Override
public void setValueAsQueryToken(String theParameter) {
public void setValueAsQueryToken(String theQualifier, String theParameter) {
int barIndex = theParameter.indexOf('|');
if (barIndex != -1) {
setSystem(new UriDt(theParameter.substring(0, barIndex)));
@ -242,7 +309,7 @@ public class ${className}
}
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}
#end
@ -312,7 +379,7 @@ public class ${className}
* {@inheritDoc}
*/
@Override
public void setValueAsQueryToken(String theParameter) {
public void setValueAsQueryToken(String theQualifier, String theParameter) {
int barIndex = theParameter.indexOf('|');
if (barIndex != -1) {
setSystem(new UriDt(theParameter.substring(0, barIndex)));
@ -323,7 +390,7 @@ public class ${className}
}
@Override
public String getQueryParameterQualifier(FhirContext theContext) {
public String getQueryParameterQualifier() {
return null;
}
#end

View File

@ -16,7 +16,7 @@ import ${import};
##import ${packageBase}.valueset.*;
/**
* HAPI/FHIR <b>${className}</b> Resource
* HAPI/FHIR <b>${elementName}</b> Resource
* (${shortName})
*
* <p>
@ -37,7 +37,7 @@ import ${import};
*
#end
*/
@ResourceDef(name="${className}", profile="${profile}", id="${id}")
@ResourceDef(name="${elementName}", profile="${profile}", id="${id}")
public class ${className} extends BaseResource implements IResource {
#foreach ( $param in $searchParams )

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
</dependency>
<dependency>
@ -41,7 +41,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<executions>
<execution>
<id>custom-structs</id>

View File

@ -11,7 +11,7 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
<name>HAPI</name>
<url>http://hl7api.sourceforge.net/hapi-fhir/</url>

View File

@ -14,7 +14,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.3</version>
<version>0.4-SNAPSHOT</version>
</dependency>
<!-- HAPI-FHIR uses Logback for logging support. The logback library is included automatically by Maven as a part of the hapi-fhir-base dependency, but you also need to include a

View File

@ -0,0 +1,62 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.example</groupId>
<artifactId>restful-server-example</artifactId>
<version>0.3</version>
<packaging>war</packaging>
<name>Sample RESTful Server (HAPI-FHIR)</name>
<dependencies>
<!-- This dependency includes all neccesary HAPI FHIR classes -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.3</version>
</dependency>
<!-- HAPI-FHIR uses Logback for logging support. The logback library is included automatically by Maven as a part of the hapi-fhir-base dependency, but you also need to include a
logging library. Logback is used here, but log4j would also be fine. -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Needed for JEE/Servlet support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>