/** * Gets the value(s) for <b>partOf</b> (). * creating it if it does * not exist. Will not return <code>null</code>. * * <p> * <b>Definition:</b> * Another Location which this Location is physically part of * </p> */ public ResourceReferenceDt getPartOf() { if (myPartOf == null) { myPartOf = new ResourceReferenceDt(); } return myPartOf; }
/** * Returns a resource given a resource reference. If the resource has not been previously * fetched, it will be fetched from the server. * * @param reference A resource reference. * @return The corresponding resource. */ public static IBaseResource getResource(ResourceReferenceDt reference) { if (reference.isEmpty()) { return null; } if (reference.getResource() != null) { return reference.getResource(); } IdDt resourceId = reference.getReference(); if (resourceId == null) { throw new IllegalStateException("Reference has no resource ID defined"); } String resourceUrl = expandURL(resourceId.getValue()); IBaseResource resource = getFhirClient().read(new UriDt(resourceUrl)); reference.setResource(resource); return resource; }
@Override public IdDt getReferenceElement() { return getReference(); }
public static Practitioner getPractitioner(Participant participant) { if (participant == null) { return null; } ResourceReferenceDt resource = participant.getIndividual(); IBaseResource ele = resource.getResource(); return ele instanceof Practitioner ? (Practitioner) ele : null; }
public static void manualContained() { // START SNIPPET: manualContained // Create an organization, and give it a local ID Organization org = new Organization(); org.setId("#localOrganization"); org.getNameElement().setValue("Contained Test Organization"); // Create a patient Patient patient = new Patient(); patient.setId("Patient/1333"); patient.addIdentifier().setSystem("urn:mrns").setValue("253345"); // Set the reference, and manually add the contained resource patient.getManagingOrganization().setReference("#localOrganization"); patient.getContained().getContainedResources().add(org); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); System.out.println(encoded); // END SNIPPET: manualContained }
@Override public StringDt getDisplayElement() { return getDisplay(); }
@Search private List<IBaseResource> searchForPatients() { // Create an organization Organization org = new Organization(); org.setId("Organization/65546"); org.setName("Test Organization"); // Create a patient Patient patient = new Patient(); patient.setId("Patient/1333"); patient.addIdentifier().setSystem("urn:mrns").setValue("253345"); patient.getManagingOrganization().setResource(org); // Here we return only the patient object, which has links to other resources List<IBaseResource> retVal = new ArrayList<IBaseResource>(); retVal.add(patient); return retVal; } // END SNIPPET: addIncludes
@Override protected void validateResourceForStorage(QuestionnaireResponse theResource, ResourceTable theEntityToSave) { super.validateResourceForStorage(theResource, theEntityToSave); if (!myValidateResponses) { return; } QuestionnaireResponse qa = theResource; if (qa == null || qa.getQuestionnaire() == null || qa.getQuestionnaire().getReference() == null || qa.getQuestionnaire().getReference().isEmpty()) { return; } FhirValidator val = myRefImplCtx.newValidator(); val.setValidateAgainstStandardSchema(false); val.setValidateAgainstStandardSchematron(false); FhirQuestionnaireResponseValidator module = new FhirQuestionnaireResponseValidator(); module.setResourceLoader(new JpaResourceLoader()); module.setWorkerContext(new HapiWorkerContext(myRefImplCtx, myValidationSupport)); val.registerValidatorModule(module); ValidationResult result = val.validateWithResult(myRefImplCtx.newJsonParser().parseResource(getContext().newJsonParser().encodeResourceToString(qa))); if (!result.isSuccessful()) { IBaseOperationOutcome oo = getContext().newJsonParser().parseResource(OperationOutcome.class, myRefImplCtx.newJsonParser().encodeResourceToString(result.toOperationOutcome())); throw new UnprocessableEntityException(getContext(), oo); } }
/** * Returns the current participant from the shared context if it is a practitioner. * * @return Current practitioner. */ public static Participant getActivePractitioner() { Participant participant = getParticipantContext().getContextObject(false); return participant == null ? null : participant.getIndividual().getResource() instanceof Practitioner ? participant : null; }
/** * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute * URL) * * @param theResourceId * The reference itself */ public ResourceReferenceDt(IdDt theResourceId) { setReference(theResourceId); }
public String getAuthorName() { ResourceReferenceDt resource = FhirUtil.getFirst(reference.getAuthor()); return resource == null ? "" : resource.getDisplay().toString(); }
/** * Gets the value(s) for <b>source</b> (). * creating it if it does * not exist. Will not return <code>null</code>. * * <p> * <b>Definition:</b> * The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list * </p> */ public ResourceReferenceDt getSource() { if (mySource == null) { mySource = new ResourceReferenceDt(); } return mySource; }
public static String getParticipantId(Participant participant) { return participant == null ? null : participant.getIndividual().getReference().getIdPart(); }
public void onClick$btnAddNote() { String note = AddNoteController.execute(); if (note == null || note.isEmpty()) { return; } ProblemNote pn = new ProblemNote(); IUser user = UserContext.getActiveUser(); pn.setAuthor(user.getFullName()); pn.setFacility((Organization) PatientContext.getActivePatient().getManagingOrganization().getResource()); pn.setNumber("*"); pn.setNarrative(note); pn.setDateAdded(new FMDate(DateUtil.stripTime(new Date()))); changedNotes.add(pn); renderNote(pn); } }
/** * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute * URL) * * @param theResourceId * The reference itself */ public ResourceReferenceDt(IIdType theResourceId) { setReference(theResourceId); }
/** * Gets the value(s) for <b>partOf</b> (). * creating it if it does * not exist. Will not return <code>null</code>. * * <p> * <b>Definition:</b> * The organization of which this organization forms a part * </p> */ public ResourceReferenceDt getPartOf() { if (myPartOf == null) { myPartOf = new ResourceReferenceDt(); } return myPartOf; }
@Override public int compare(Participant p1, Participant p2) { if (p1.getIndividual().getReference().equals(p2.getIndividual().getReference())) { return 0; } String n1 = FhirUtil.formatName(EncounterUtil.getName(p1)); String n2 = FhirUtil.formatName(EncounterUtil.getName(p2)); int i = n1.compareToIgnoreCase(n2); return i == 0 ? 1 : i; }
Organization institution = (Organization) patient.getManagingOrganization().getResource(); String sNum = "1".equals(sRpc) ? "" : txtID.getValue(); // Pass only if changed
/** * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute * URL) * * @param theId * The reference itself */ public ResourceReferenceDt(String theId) { setReference(new IdDt(theId)); }
/** * Gets the value(s) for <b>assigner</b> (). * creating it if it does * not exist. Will not return <code>null</code>. * * <p> * <b>Definition:</b> * Organization that issued/manages the identifier * </p> */ public ResourceReferenceDt getAssigner() { if (myAssigner == null) { myAssigner = new ResourceReferenceDt(); } return myAssigner; }