private ValueSet getValueSet(QuestionnaireResponse theResponse, Reference theQuestionnaireRef) { ValueSet retVal; if (theQuestionnaireRef.getReferenceElement().isLocal()) { retVal = (ValueSet) theQuestionnaireRef.getResource(); if (retVal == null) { for (Resource next : theResponse.getContained()) { if (theQuestionnaireRef.getReferenceElement().getValue().equals(next.getId())) { retVal = (ValueSet) next; } } } } else { retVal = myWorkerCtx.fetchResource(ValueSet.class, theQuestionnaireRef.getReferenceElement().getValue()); } return retVal; }
private Questionnaire getQuestionnaire(QuestionnaireResponse theAnswers, Reference theQuestionnaireRef) { Questionnaire retVal; String value = theQuestionnaireRef.getReferenceElement().getValue(); if (theQuestionnaireRef.getReferenceElement().isLocal()) { retVal = (Questionnaire) theQuestionnaireRef.getResource(); if (retVal == null) { for (Resource next : theAnswers.getContained()) { if (value.equals(next.getId())) { retVal = (Questionnaire) next; } } } } else { retVal = myWorkerCtx.fetchResource(Questionnaire.class, value); } return retVal; }
@Search() public List<DiagnosticReport> getDiagnosticReport( @RequiredParam(name=DiagnosticReport.SP_IDENTIFIER) TokenParam theIdentifier, @IncludeParam(allow= {"DiagnosticReport:subject"}) String theInclude ) { List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>(); // Assume this method exists and loads the report from the DB DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier); // If the client has asked for the subject to be included: if ("DiagnosticReport:subject".equals(theInclude)) { // The resource reference should contain the ID of the patient IIdType subjectId = report.getSubject().getReferenceElement(); // So load the patient ID and return it Patient subject = loadSomePatientFromDatabase(subjectId); report.getSubject().setResource(subject); } retVal.add(report); return retVal; } //END SNIPPET: pathSpecSimple
@Search() public List<DiagnosticReport> getDiagnosticReport( @RequiredParam(name=DiagnosticReport.SP_IDENTIFIER) TokenParam theIdentifier, @IncludeParam(allow= {"DiagnosticReport:subject"}) Set<Include> theIncludes ) { List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>(); // Assume this method exists and loads the report from the DB DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier); // If the client has asked for the subject to be included: if (theIncludes.contains(new Include("DiagnosticReport:subject"))) { // The resource reference should contain the ID of the patient IIdType subjectId = report.getSubject().getReferenceElement(); // So load the patient ID and return it Patient subject = loadSomePatientFromDatabase(subjectId); report.getSubject().setResource(subject); } retVal.add(report); return retVal; } //END SNIPPET: pathSpec
private ValueSet getValueSet(QuestionnaireResponse theResponse, Reference theQuestionnaireRef) { ValueSet retVal; if (theQuestionnaireRef.getReferenceElement().isLocal()) { retVal = (ValueSet) theQuestionnaireRef.getResource(); if (retVal == null) { for (Resource next : theResponse.getContained()) { if (theQuestionnaireRef.getReferenceElement().getValue().equals(next.getId())) { retVal = (ValueSet) next; } } } } else { retVal = myWorkerCtx.fetchResource(ValueSet.class, theQuestionnaireRef.getReferenceElement().getValue()); } return retVal; }
private Questionnaire getQuestionnaire(QuestionnaireResponse theAnswers, Reference theQuestionnaireRef) { Questionnaire retVal; String value = theQuestionnaireRef.getReferenceElement().getValue(); if (theQuestionnaireRef.getReferenceElement().isLocal()) { retVal = (Questionnaire) theQuestionnaireRef.getResource(); if (retVal == null) { for (Resource next : theAnswers.getContained()) { if (value.equals(next.getId())) { retVal = (Questionnaire) next; } } } } else { retVal = myWorkerCtx.fetchResource(Questionnaire.class, value); } return retVal; }