More work on operation support for DSTU2

This commit is contained in:
jamesagnew 2015-03-06 17:55:35 -05:00
parent 6732efc733
commit 06ea9a1453
21 changed files with 431 additions and 78 deletions

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.IBaseResource;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 interface IHistory extends IBaseOn<IHistoryUntyped> { public interface IHistory extends IBaseOn<IHistoryUntyped> {
} }

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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.Date; import java.util.Date;
import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.InstantDt;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseBundle;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 interface IOperation extends IBaseOn<IOperationUnnamed> { public interface IOperation extends IBaseOn<IOperationUnnamed> {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 interface IOperationOn extends IBaseOn<IOperationTyped> { public interface IOperationOn extends IBaseOn<IOperationTyped> {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 interface IOperationTyped { public interface IOperationTyped {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 interface IOperationUnnamed { public interface IOperationUnnamed {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IBaseParameters;
public interface IOperationUntyped { public interface IOperationUntyped {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.gclient; package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IBaseParameters;
public interface IOperationUntypedWithInput<T extends IBaseParameters> extends IClientExecutable<IOperationUntypedWithInput<T>, T> { public interface IOperationUntypedWithInput<T extends IBaseParameters> extends IClientExecutable<IOperationUntypedWithInput<T>, T> {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.method; package ca.uhn.fhir.rest.method;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.*;
import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IBaseParameters;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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.List; import java.util.List;
import org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.IBaseResource;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.IOException; import java.io.IOException;

View File

@ -1,5 +1,25 @@
package org.hl7.fhir.instance.model.api; package org.hl7.fhir.instance.model.api;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 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 org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.IBaseResource;
public interface IBaseParameters extends IBaseResource { public interface IBaseParameters extends IBaseResource {

View File

@ -411,13 +411,6 @@
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>

View File

@ -413,17 +413,13 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
throw new IllegalArgumentException("Invalid quantity type: " + params.getClass()); throw new IllegalArgumentException("Invalid quantity type: " + params.getClass());
} }
Predicate system; Predicate system = null;
if (isBlank(systemValue)) { if (!isBlank(systemValue)) {
system = builder.isNull(from.get("mySystem"));
} else {
system = builder.equal(from.get("mySystem"), systemValue); system = builder.equal(from.get("mySystem"), systemValue);
} }
Predicate code; Predicate code = null;
if (isBlank(unitsValue)) { if (!isBlank(unitsValue)) {
code = builder.isNull(from.get("myUnits"));
} else {
code = builder.equal(from.get("myUnits"), unitsValue); code = builder.equal(from.get("myUnits"), unitsValue);
} }
@ -458,9 +454,18 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
} }
} }
Predicate singleCode = builder.and(system, code, num); if (system == null && code == null) {
codePredicates.add(singleCode); codePredicates.add(num);
} else if (system == null) {
Predicate singleCode = builder.and(code, num);
codePredicates.add(singleCode);
} else if (code == null) {
Predicate singleCode = builder.and(system, num);
codePredicates.add(singleCode);
} else {
Predicate singleCode = builder.and(system, code, num);
codePredicates.add(singleCode);
}
} }
Predicate masterCodePredicate = builder.or(codePredicates.toArray(new Predicate[0])); Predicate masterCodePredicate = builder.or(codePredicates.toArray(new Predicate[0]));
@ -668,7 +673,7 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
myEntityManager.persist(newEntity); myEntityManager.persist(newEntity);
myEntityManager.merge(entity); myEntityManager.merge(entity);
notifyWriteCompleted(); notifyWriteCompleted();
ourLog.info("Processed addTag {}/{} on {} in {}ms", new Object[]{theScheme, theTerm, theId, w.getMillisAndRestart()}); ourLog.info("Processed addTag {}/{} on {} in {}ms", new Object[] { theScheme, theTerm, theId, w.getMillisAndRestart() });
} }
@Override @Override
@ -1190,7 +1195,7 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
myEntityManager.merge(entity); myEntityManager.merge(entity);
ourLog.info("Processed remove tag {}/{} on {} in {}ms", new Object[]{theScheme, theTerm, theId.getValue(), w.getMillisAndRestart()}); ourLog.info("Processed remove tag {}/{} on {} in {}ms", new Object[] { theScheme, theTerm, theId.getValue(), w.getMillisAndRestart() });
} }
@Override @Override
@ -1331,8 +1336,7 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
} }
retVal.addAll(resources); retVal.addAll(resources);
} }
} } while (includePids.size() > 0 && previouslyLoadedPids.size() < getConfig().getIncludeLimit());
while (includePids.size() > 0 && previouslyLoadedPids.size() < getConfig().getIncludeLimit());
if (previouslyLoadedPids.size() >= getConfig().getIncludeLimit()) { if (previouslyLoadedPids.size() >= getConfig().getIncludeLimit()) {
OperationOutcome oo = new OperationOutcome(); OperationOutcome oo = new OperationOutcome();
@ -1352,7 +1356,7 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
} }
}; };
ourLog.info("Processed search for {} on {} in {}ms", new Object[]{myResourceName, theParams, w.getMillisAndRestart()}); ourLog.info("Processed search for {} on {} in {}ms", new Object[] { myResourceName, theParams, w.getMillisAndRestart() });
return retVal; return retVal;
} }
@ -1437,62 +1441,62 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
RuntimeSearchParam nextParamDef = resourceDef.getSearchParam(nextParamName); RuntimeSearchParam nextParamDef = resourceDef.getSearchParam(nextParamName);
if (nextParamDef != null) { if (nextParamDef != null) {
switch (nextParamDef.getParamType()) { switch (nextParamDef.getParamType()) {
case DATE: case DATE:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) { for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
pids = addPredicateDate(nextParamName, pids, nextAnd); pids = addPredicateDate(nextParamName, pids, nextAnd);
if (pids.isEmpty()) { if (pids.isEmpty()) {
return new HashSet<Long>(); return new HashSet<Long>();
}
} }
break; }
case QUANTITY: break;
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) { case QUANTITY:
pids = addPredicateQuantity(nextParamName, pids, nextAnd); for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
if (pids.isEmpty()) { pids = addPredicateQuantity(nextParamName, pids, nextAnd);
return new HashSet<Long>(); if (pids.isEmpty()) {
} return new HashSet<Long>();
} }
break; }
case REFERENCE: break;
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) { case REFERENCE:
pids = addPredicateReference(nextParamName, pids, nextAnd); for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
if (pids.isEmpty()) { pids = addPredicateReference(nextParamName, pids, nextAnd);
return new HashSet<Long>(); if (pids.isEmpty()) {
} return new HashSet<Long>();
} }
break; }
case STRING: break;
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) { case STRING:
pids = addPredicateString(nextParamName, pids, nextAnd); for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
if (pids.isEmpty()) { pids = addPredicateString(nextParamName, pids, nextAnd);
return new HashSet<Long>(); if (pids.isEmpty()) {
} return new HashSet<Long>();
} }
break; }
case TOKEN: break;
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) { case TOKEN:
pids = addPredicateToken(nextParamName, pids, nextAnd); for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
if (pids.isEmpty()) { pids = addPredicateToken(nextParamName, pids, nextAnd);
return new HashSet<Long>(); if (pids.isEmpty()) {
} return new HashSet<Long>();
} }
break; }
case NUMBER: break;
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) { case NUMBER:
pids = addPredicateNumber(nextParamName, pids, nextAnd); for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
if (pids.isEmpty()) { pids = addPredicateNumber(nextParamName, pids, nextAnd);
return new HashSet<Long>(); if (pids.isEmpty()) {
} return new HashSet<Long>();
} }
break; }
case COMPOSITE: break;
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) { case COMPOSITE:
pids = addPredicateComposite(nextParamDef, pids, nextAnd); for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
if (pids.isEmpty()) { pids = addPredicateComposite(nextParamDef, pids, nextAnd);
return new HashSet<Long>(); if (pids.isEmpty()) {
} return new HashSet<Long>();
} }
break; }
break;
} }
} }
} }
@ -1598,6 +1602,9 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
} }
} else { } else {
resourceId = theResource.getId(); resourceId = theResource.getId();
if (resourceId == null || isBlank(resourceId.getIdPart())) {
throw new InvalidRequestException("Can not update a resource with no ID");
}
entity = readEntityLatestVersion(resourceId); entity = readEntityLatestVersion(resourceId);
} }

View File

@ -278,7 +278,7 @@ class SearchParamExtractorDstu2 implements ISearchParamExtractor {
continue; continue;
} }
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValue.getValueElement().getValue(), nextValue.getSystemElement().getValueAsString(), nextValue.getUnits()); ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValue.getValueElement().getValue(), nextValue.getSystemElement().getValueAsString(), nextValue.getCode());
nextEntity.setResource(theEntity); nextEntity.setResource(theEntity);
retVal.add(nextEntity); retVal.add(nextEntity);
} else { } else {

View File

@ -15,6 +15,7 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -89,6 +90,41 @@ public class FhirResourceDaoTest {
private static IFhirResourceDao<Organization> ourOrganizationDao; private static IFhirResourceDao<Organization> ourOrganizationDao;
private static IFhirResourceDao<Patient> ourPatientDao; private static IFhirResourceDao<Patient> ourPatientDao;
@Test
public void testSearchValueQuantity() {
String methodName = "testSearchValueQuantity";
QuantityParam param;
Set<Long> found;
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, null);
found = ourObservationDao.searchForIds("value-quantity", param);
int initialSize = found.size();
Observation o = new Observation();
o.getCode().addCoding().setSystem("urn:foo").setCode(methodName + "code");
QuantityDt q = new QuantityDt().setSystem("urn:bar:" + methodName).setCode(methodName + "units").setValue(100);
o.setValue(q);
ourObservationDao.create(o);
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, null);
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1 + initialSize, found.size());
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, methodName + "units");
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1, found.size());
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), "urn:bar:" + methodName, null);
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1, found.size());
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), "urn:bar:" + methodName, methodName + "units");
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1, found.size());
}
@Test @Test
public void testCreateDuplicateIdFails() { public void testCreateDuplicateIdFails() {
String methodName = "testCreateDuplocateIdFailsText"; String methodName = "testCreateDuplocateIdFailsText";
@ -135,7 +171,6 @@ public class FhirResourceDaoTest {
} }
@Test @Test
public void testCreateNumericIdFails() { public void testCreateNumericIdFails() {
Patient p = new Patient(); Patient p = new Patient();
@ -150,7 +185,6 @@ public class FhirResourceDaoTest {
} }
} }
@Test @Test
public void testDeleteWithMatchUrl() { public void testDeleteWithMatchUrl() {
String methodName = "testDeleteWithMatchUrl"; String methodName = "testDeleteWithMatchUrl";
@ -188,7 +222,6 @@ public class FhirResourceDaoTest {
} }
@Test @Test
public void testCreateWithIfNoneExist() { public void testCreateWithIfNoneExist() {
String methodName = "testCreateWithIfNoneExist"; String methodName = "testCreateWithIfNoneExist";
@ -265,7 +298,7 @@ public class FhirResourceDaoTest {
public void testChoiceParamQuantity() { public void testChoiceParamQuantity() {
Observation o3 = new Observation(); Observation o3 = new Observation();
o3.getCode().addCoding().setSystem("foo").setCode("testChoiceParam03"); o3.getCode().addCoding().setSystem("foo").setCode("testChoiceParam03");
o3.setValue(new QuantityDt(QuantityComparatorEnum.GREATERTHAN, 123.0, "foo", "bar")); o3.setValue(new QuantityDt(QuantityComparatorEnum.GREATERTHAN, 123.0, "foo", "bar").setCode("bar"));
IdDt id3 = ourObservationDao.create(o3).getId(); IdDt id3 = ourObservationDao.create(o3).getId();
{ {

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server.provider.dstu2; package ca.uhn.fhir.rest.server.provider.dstu2;
/*
* #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.4.0)
* %%
* Copyright (C) 2014 - 2015 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 static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.*;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -113,7 +113,7 @@
}); });
$("#outerForm").attr("action", "search").submit(); $("#outerForm").attr("action", "search").submit();
}); });
$('#search-btn').button('reset'); $('#search-btn').prop('disabled', false);
</script> </script>
<br clear="all"/> <br clear="all"/>