/** * Gets the first repetition for <b>content</b> (), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * The document and format referenced. There may be multiple content element repetitions, each with a different format. * </p> */ public Content getContentFirstRep() { if (getContent().isEmpty()) { return addContent(); } return getContent().get(0); }
/** * Gets the first repetition for <b>identifier</b> (id), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * Other identifiers associated with the document, including version independent identifiers * </p> */ public IdentifierDt getIdentifierFirstRep() { if (getIdentifier().isEmpty()) { return addIdentifier(); } return getIdentifier().get(0); }
/** * Gets the first repetition for <b>relatesTo</b> (), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * Relationships that this document has with other document references that already exist * </p> */ public RelatesTo getRelatesToFirstRep() { if (getRelatesTo().isEmpty()) { return addRelatesTo(); } return getRelatesTo().get(0); }
/** * Gets the first repetition for <b>securityLabel</b> (), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the \"reference\" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to * </p> */ public CodeableConceptDt getSecurityLabelFirstRep() { if (getSecurityLabel().isEmpty()) { return addSecurityLabel(); } return getSecurityLabel().get(0); }
public String getContentType() { return reference.getContentFirstRep().getContentType(); }
/** * Adds and returns a new value for <b>author</b> (who.author) * * <p> * <b>Definition:</b> * Identifies who is responsible for adding the information to the document * </p> */ public ResourceReferenceDt addAuthor() { ResourceReferenceDt newType = new ResourceReferenceDt(); getAuthor().add(newType); return newType; }
/** * Adds a given new value for <b>content</b> () * * <p> * <b>Definition:</b> * The document and format referenced. There may be multiple content element repetitions, each with a different format. * </p> * @param theValue The content to add (must not be <code>null</code>) */ public DocumentReference addContent(Content theValue) { if (theValue == null) { throw new NullPointerException("theValue must not be null"); } getContent().add(theValue); return this; }
public Date getDateTime() { return reference.getCreated(); }
/** * Gets the value(s) for <b>created</b> (when.done). * creating it if it does * not exist. This method may return <code>null</code>. * * <p> * <b>Definition:</b> * When the document was created * </p> */ public Date getCreated() { return getCreatedElement().getValue(); }
public String getLocationName() { Context ctx = reference.getContext(); CodeableConceptDt facilityType = ctx == null ? null : ctx.getFacilityType(); CodingDt coding = facilityType == null ? null : FhirUtil.getFirst(facilityType.getCoding()); return coding == null ? "" : coding.getDisplay().toString(); }
public byte[] getContent() { if (content == null) { content = reference.getContentFirstRep().getData(); if (content == null || content.length == 0) { Binary binary = ClientUtil.getFhirClient().read(Binary.class, reference.getContentFirstRep().getUrl()); content = binary.getContent(); } if (content == null) { content = EMPTY_CONTENT; } } return content; }
public String getAuthorName() { ResourceReferenceDt resource = FhirUtil.getFirst(reference.getAuthor()); return resource == null ? "" : resource.getDisplay().toString(); }
/** * Adds and returns a new value for <b>content</b> () * * <p> * <b>Definition:</b> * The document and format referenced. There may be multiple content element repetitions, each with a different format. * </p> */ public Content addContent() { Content newType = new Content(); getContent().add(newType); return newType; }
@Test public void test() throws URISyntaxException { IDomainFactory<BaseResource> factory = DomainFactory.getInstance(); Patient pat1 = factory.fetchObject(Patient.class, "1"); assertNotNull(pat1); for (ExtensionDt extension : pat1.getAllUndeclaredExtensions()) { System.out.println(extension.getUrlAsString() + "=" + extension.getValue()); } List<Patient> patients = factory.fetchObjects(Patient.class, PAT_IDS); assertNotNull(patients); assertEquals(2, patients.size()); DocumentReference dr = factory.fetchObject(DocumentReference.class, "1"); assertNotNull(dr); UriDt uri = dr.getContentFirstRep().getUrlElement(); IGenericClient client = ClientUtil.getFhirClient(); Binary result = (Binary) client.read(uri); assertNotNull(result); byte[] text = result.getContent(); System.out.println(new String(text)); Condition cond = factory.fetchObject(Condition.class, "1"); assertNotNull(cond); testException(client, ROOT + "Patient/309349993439"); }