Fix build

This commit is contained in:
James Agnew 2016-05-17 11:30:57 -04:00
parent ddb35d0faa
commit 6c3446dee1
5 changed files with 66 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
@ -85,6 +86,9 @@ class ConditionalParamBinder implements IParameter {
}
int questionMarkIndex = theRequest.getCompleteUrl().indexOf('?');
if (questionMarkIndex == -1) {
return null;
}
return theRequest.getResourceName() + theRequest.getCompleteUrl().substring(questionMarkIndex);
}

View File

@ -213,9 +213,9 @@ public class FhirResourceDaoCodeSystemDstu3 extends FhirResourceDaoDstu3<CodeSys
ResourceTable retVal = super.updateEntity(theResource, theEntity, theUpdateHistory, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theUpdateTime, theRequestDetails);
CodeSystem cs = (CodeSystem) theResource;
String codeSystemUrl = cs.getUrl();
if (isNotBlank(codeSystemUrl)) {
if (cs != null && isNotBlank(cs.getUrl())) {
String codeSystemUrl = cs.getUrl();
if (cs.getContent() == CodeSystemContentMode.COMPLETE) {
ourLog.info("CodeSystem {} has a status of {}, going to store concepts in terminology tables", retVal.getIdDt().getValue(), cs.getContent().toCode());
TermCodeSystemVersion persCs = new TermCodeSystemVersion();

View File

@ -57,6 +57,8 @@ import org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent;
import org.hl7.fhir.dstu3.model.Period;
import org.hl7.fhir.dstu3.model.Quantity;
import org.hl7.fhir.dstu3.model.Questionnaire;
import org.hl7.fhir.dstu3.model.Range;
import org.hl7.fhir.dstu3.model.SimpleQuantity;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.Timing;
import org.hl7.fhir.dstu3.model.UriType;
@ -432,6 +434,19 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen
if (nextContact.getValueElement().isEmpty() == false) {
addSearchTerm(theEntity, retVal, resourceName, nextContact.getValue());
}
} else if (nextObject instanceof Quantity) {
BigDecimal value = ((Quantity) nextObject).getValue();
if (value != null) {
addSearchTerm(theEntity, retVal, resourceName, value.toPlainString());
}
} else if (nextObject instanceof Range) {
SimpleQuantity low = ((Range) nextObject).getLow();
if (low != null) {
BigDecimal value = low.getValue();
if (value != null) {
addSearchTerm(theEntity, retVal, resourceName, value.toPlainString());
}
}
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + resourceName + " is of unexpected datatype: " + nextObject.getClass());

View File

@ -21,6 +21,7 @@ import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.CompartmentDefinition;
import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.Condition;
import org.hl7.fhir.dstu3.model.Device;
import org.hl7.fhir.dstu3.model.DiagnosticOrder;
import org.hl7.fhir.dstu3.model.DiagnosticReport;
@ -105,6 +106,9 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
@Qualifier("myCarePlanDaoDstu3")
protected IFhirResourceDao<CarePlan> myCarePlanDao;
@Autowired
@Qualifier("myConditionDaoDstu3")
protected IFhirResourceDao<Condition> myConditionDao;
@Autowired
@Qualifier("myCodeSystemDaoDstu3")
protected IFhirResourceDao<CodeSystem> myCodeSystemDao;
@Autowired

View File

@ -35,23 +35,27 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.hamcrest.Matchers;
import org.hamcrest.core.StringContains;
import org.hl7.fhir.dstu3.model.Age;
import org.hl7.fhir.dstu3.model.BaseResource;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu3.model.Bundle.BundleType;
import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb;
import org.hl7.fhir.dstu3.model.CarePlan;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeType;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.CompartmentDefinition;
import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.Condition;
import org.hl7.fhir.dstu3.model.DateTimeType;
import org.hl7.fhir.dstu3.model.DateType;
import org.hl7.fhir.dstu3.model.Device;
import org.hl7.fhir.dstu3.model.DiagnosticReport;
import org.hl7.fhir.dstu3.model.Encounter;
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.dstu3.model.Enumerations.ConformanceResourceStatus;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.dstu3.model.NamingSystem;
@ -66,7 +70,9 @@ import org.hl7.fhir.dstu3.model.Period;
import org.hl7.fhir.dstu3.model.Quantity;
import org.hl7.fhir.dstu3.model.Quantity.QuantityComparator;
import org.hl7.fhir.dstu3.model.Questionnaire;
import org.hl7.fhir.dstu3.model.Range;
import org.hl7.fhir.dstu3.model.Reference;
import org.hl7.fhir.dstu3.model.SimpleQuantity;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.model.Timing;
@ -134,6 +140,41 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
}
}
@Test
public void testCodeSystemCreateAndDelete() {
CodeSystem cs = new CodeSystem();
cs.setStatus(ConformanceResourceStatus.DRAFT);
IIdType id = myCodeSystemDao.create(cs, mySrd).getId().toUnqualifiedVersionless();
myCodeSystemDao.delete(id, mySrd);
assertGone(id.toUnqualifiedVersionless());
}
@Test
public void testIndexConditionWithAllOnsetTypes() {
// DateTimeType.class, Age.class, Period.class, Range.class, StringType.class
Condition c0 = new Condition();
c0.setOnset(new DateTimeType("2011-01-01"));
IIdType id0 = myConditionDao.create(c0, mySrd).getId().toUnqualifiedVersionless();
Condition c1 = new Condition();
c1.setOnset(new Age().setValue(100l).setCode("AGECODE"));
IIdType id1 = myConditionDao.create(c1, mySrd).getId().toUnqualifiedVersionless();
Condition c2 = new Condition();
c2.setOnset(new Period().setStart(new Date()).setEnd(new Date()));
IIdType id2 = myConditionDao.create(c2, mySrd).getId().toUnqualifiedVersionless();
Condition c3 = new Condition();
c3.setOnset(new Range().setLow((SimpleQuantity) new SimpleQuantity().setValue(200L)).setHigh((SimpleQuantity) new SimpleQuantity().setValue(300L)));
IIdType id3 = myConditionDao.create(c3, mySrd).getId().toUnqualifiedVersionless();
Condition c4 = new Condition();
c4.setOnset(new StringType("FOO"));
IIdType id4 = myConditionDao.create(c4, mySrd).getId().toUnqualifiedVersionless();
}
@Test
@Ignore