Search in sources :

Example 11 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project quality-measure-and-cohort-service by Alvearie.

the class R4TranslatingLibraryLoaderTest method withContent.

private void withContent(Library library, String resourcePath, String contentType) throws IOException {
    Attachment attachment = new Attachment();
    attachment.setContentType(contentType);
    attachment.setData(IOUtils.resourceToByteArray(resourcePath));
    library.addContent(attachment);
}
Also used : Attachment(org.hl7.fhir.r4.model.Attachment)

Example 12 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project summary-care-record-api by NHSDigital.

the class GetScrService method buildDocumentReferenceContent.

private DocumentReferenceContentComponent buildDocumentReferenceContent(String nhsNumber, String scrId) {
    DocumentReferenceContentComponent content = new DocumentReferenceContentComponent();
    String attachmentUrl = String.format(ATTACHMENT_URL, getScrUrl(), scrId, nhsNumber);
    content.setAttachment(new Attachment().setUrl(attachmentUrl));
    return content;
}
Also used : Attachment(org.hl7.fhir.r4.model.Attachment) DocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent)

Example 13 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project Gravity-SDOH-Exchange-RI by FHIR.

the class PersonalCharacteristicsService method retrieveDerivedFrom.

public AttachmentDto retrieveDerivedFrom(String id) {
    Observation obs = observationRepository.getWithDocumentReference(id);
    if (obs == null) {
        throw new ResourceNotFoundException(new IdType(Observation.class.getSimpleName(), id));
    }
    IBaseResource ref = obs.getDerivedFromFirstRep().getResource();
    if (ref == null || !(ref instanceof DocumentReference)) {
        throw new IllegalStateException("Observation with id " + id + " does not have a derived-from field set to a Document Reference resource.");
    }
    DocumentReference docRef = (DocumentReference) ref;
    Attachment attachment = docRef.getContentFirstRep().getAttachment();
    if (attachment == null) {
        throw new IllegalStateException("DocumentReference with id " + docRef.getIdElement().getIdPart() + " does not have an attachment.");
    }
    return AttachmentDto.builder().content(attachment.getData()).contentType(attachment.getContentType()).title(attachment.getTitle()).build();
}
Also used : Observation(org.hl7.fhir.r4.model.Observation) Attachment(org.hl7.fhir.r4.model.Attachment) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) IdType(org.hl7.fhir.r4.model.IdType)

Example 14 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project Gravity-SDOH-Exchange-RI by FHIR.

the class ConsentService method retrieveAttachmentInfo.

public AttachmentDto retrieveAttachmentInfo(String id) {
    Optional<Consent> foundConsent = consentRepository.find(id);
    if (!foundConsent.isPresent()) {
        throw new ResourceNotFoundException(String.format("Consent with id '%s' was not found.", id));
    }
    Consent consent = foundConsent.get();
    Attachment attachment = consent.getSourceAttachment();
    return AttachmentDto.builder().content(attachment.getData()).contentType(attachment.getContentType()).title(attachment.getTitle()).build();
}
Also used : Consent(org.hl7.fhir.r4.model.Consent) Attachment(org.hl7.fhir.r4.model.Attachment) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)

Example 15 with Attachment

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment in project Gravity-SDOH-Exchange-RI by FHIR.

the class RecordedSexGenderBundleFactory method onBundleCreated.

@Override
protected void onBundleCreated(Bundle bundle) {
    Observation obs = (Observation) bundle.getEntry().get(0).getResource();
    DocumentReference docRef = new DocumentReference().setStatus(Enumerations.DocumentReferenceStatus.CURRENT).setDate(new Date());
    docRef.addAuthor(new Reference(new IdType(SmartOnFhirContext.get().getFhirUser()).toUnqualifiedVersionless()));
    docRef.addContent().setAttachment(new Attachment().setTitle(derivedFromFileName).setContentType(MediaType.APPLICATION_PDF_VALUE).setData(derivedFromFile));
    docRef.setId(IdType.newRandomUuid());
    Bundle.BundleEntryComponent postEntry = FhirUtil.createPostEntry(docRef);
    obs.addDerivedFrom(FhirUtil.toReference(DocumentReference.class, docRef.getIdElement().getIdPart()));
    bundle.addEntry(postEntry);
}
Also used : DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Reference(org.hl7.fhir.r4.model.Reference) Bundle(org.hl7.fhir.r4.model.Bundle) Observation(org.hl7.fhir.r4.model.Observation) Attachment(org.hl7.fhir.r4.model.Attachment) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Date(java.util.Date) IdType(org.hl7.fhir.r4.model.IdType)

Aggregations

Attachment (org.hl7.fhir.r4.model.Attachment)33 ArrayList (java.util.ArrayList)23 Attachment (com.ibm.cloud.cloudant.v1.model.Attachment)17 Test (org.testng.annotations.Test)17 DocumentRevisionStatus (com.ibm.cloud.cloudant.v1.model.DocumentRevisionStatus)16 Revisions (com.ibm.cloud.cloudant.v1.model.Revisions)16 Reference (org.hl7.fhir.r4.model.Reference)15 Document (com.ibm.cloud.cloudant.v1.model.Document)10 HashMap (java.util.HashMap)9 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)8 Observation (org.hl7.fhir.r4.model.Observation)8 DesignDocument (com.ibm.cloud.cloudant.v1.model.DesignDocument)7 ReplicationDocument (com.ibm.cloud.cloudant.v1.model.ReplicationDocument)7 Coding (org.hl7.fhir.r4.model.Coding)7 Resource (org.hl7.fhir.r4.model.Resource)7 DocumentResult (com.ibm.cloud.cloudant.v1.model.DocumentResult)6 MockResponse (okhttp3.mockwebserver.MockResponse)6 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)6 NotImplementedException (org.apache.commons.lang3.NotImplementedException)6 DiagnosticReport (org.hl7.fhir.r4.model.DiagnosticReport)6