private static void LoadZipFile(String server, String file, IParser p, int size, int start, int end) throws IOException, Exception { System.out.println("Load Zip file "+file); Bundle b = new Bundle(); b.setType(BundleType.COLLECTION); b.setId(UUID.randomUUID().toString().toLowerCase()); ZipInputStream zip = new ZipInputStream(new FileInputStream(file)); ZipEntry entry; while((entry = zip.getNextEntry())!=null) { try { Resource r = p.parse(zip); b.addEntry().setResource(r); } catch (Exception e) { throw new Exception("Error parsing "+entry.getName()+": "+e.getMessage(), e); } } loadBundle(server, b, size, start, end); }
for (int i = c; i < Math.min(b.getEntry().size(), c+size); i++) { BundleEntryComponent be = bt.addEntry(); be.setResource(b.getEntry().get(i).getResource()); be.getRequest().setMethod(HTTPVerb.PUT); be.getRequest().setUrl(be.getResource().getResourceType().toString()+"/"+be.getResource().getId());
org.hl7.fhir.r4.model.Bundle.BundleEntryComponent entry = bundle.addEntry(); entry.getRequest().setMethod(org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST); entry.setResource((org.hl7.fhir.r4.model.Resource) nextResource); entry.setResource((org.hl7.fhir.r4.model.Resource) parsed);
BundleEntryComponent entry = myBundle.addEntry().setResource(next); if (next.getIdElement().hasBaseUrl()) { entry.setFullUrl(next.getId()); entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); if (next.getIdElement().hasBaseUrl()) { entry.setFullUrl(next.getIdElement().getValue());
Bundle bundle = new Bundle().setType(Bundle.BundleType.DOCUMENT); for (IBaseResource resource : resourceList) { bundle.addEntry(new Bundle.BundleEntryComponent().setResource((Resource) resource));
BundleEntryComponent nextEntry = myBundle.addEntry(); nextEntry.setResource(next); if (next.getIdElement().isEmpty()) { nextEntry.getRequest().setMethod(HTTPVerb.POST);
for (int i = c; i < Math.min(b.getEntry().size(), c+size); i++) { BundleEntryComponent be = bt.addEntry(); be.setResource(b.getEntry().get(i).getResource()); be.getRequest().setMethod(HTTPVerb.PUT); be.getRequest().setUrl(be.getResource().getResourceType().toString()+"/"+be.getResource().getId());
private static void LoadZipFile(String server, String file, IParser p, int size, int start, int end) throws IOException, Exception { System.out.println("Load Zip file "+file); Bundle b = new Bundle(); b.setType(BundleType.COLLECTION); b.setId(UUID.randomUUID().toString().toLowerCase()); ZipInputStream zip = new ZipInputStream(new FileInputStream(file)); ZipEntry entry; while((entry = zip.getNextEntry())!=null) { try { Resource r = p.parse(zip); b.addEntry().setResource(r); } catch (Exception e) { throw new Exception("Error parsing "+entry.getName()+": "+e.getMessage(), e); } } loadBundle(server, b, size, start, end); }
/** * Returns a bundle containing all resources in the dataset. This should be used * with caution for large datasets, since the returned bundle will include all data. * * @param dataset a dataset of FHIR resoruces * @return a bundle containing those resources. */ public static Bundle toBundle(Dataset<? extends Resource> dataset) { List<Resource> resources = (List<Resource>) dataset.collectAsList(); Bundle bundle = new Bundle(); for (Resource resource : resources) { bundle.addEntry().setResource(resource); } return bundle; }
/** * Returns a bundle containing all resources in the dataset. This should be used * with caution for large datasets, since the returned bundle will include all data. * * @param dataset a dataset of FHIR resoruces * @return a bundle containing those resources. */ public static Bundle toBundle(Dataset<? extends Resource> dataset) { List<Resource> resources = (List<Resource>) dataset.collectAsList(); Bundle bundle = new Bundle(); for (Resource resource : resources) { bundle.addEntry().setResource(resource); } return bundle; }
public org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); copyElement(src, tgt); for (org.hl7.fhir.instance.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); tgt.setFullUrl(src.getFullUrl()); tgt.setResource(convertResource(src.getResource())); tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); return tgt; }
@Override public void setResource(Bundle.BundleEntryComponent theBundleEntry, IBaseResource theResource) { theBundleEntry.setResource((Resource) theResource); }
public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); copyElement(src, tgt); for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); if (src.hasFullUrl()) tgt.setFullUrl(src.getFullUrl()); tgt.setResource(convertResource(src.getResource())); tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); return tgt; }
BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); Resource nextAsResource = (Resource) next; IIdType id = populateBundleEntryFullUrl(next, entry); entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); populateBundleEntryFullUrl(next, entry);
BundleEntryComponent entry = myBundle.addEntry().setResource(next); if (next.getIdElement().hasBaseUrl()) { entry.setFullUrl(next.getId()); entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); if (next.getIdElement().hasBaseUrl()) { entry.setFullUrl(next.getIdElement().getValue());
Bundle bundle = new Bundle().setType(Bundle.BundleType.DOCUMENT); for (IBaseResource resource : resourceList) { bundle.addEntry(new Bundle.BundleEntryComponent().setResource((Resource) resource));
BundleEntryComponent nextEntry = myBundle.addEntry(); nextEntry.setResource(next); if (next.getIdElement().isEmpty()) { nextEntry.getRequest().setMethod(HTTPVerb.POST);
public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); copyElement(src, tgt); for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); if (src.hasFullUrl()) tgt.setFullUrl(src.getFullUrl()); tgt.setResource(convertResource(src.getResource())); tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); return tgt; }
public org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); copyElement(src, tgt); for (org.hl7.fhir.instance.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); tgt.setFullUrl(src.getFullUrl()); tgt.setResource(convertResource(src.getResource())); tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); return tgt; }
@Override public void setResource(Bundle.BundleEntryComponent theBundleEntry, IBaseResource theResource) { theBundleEntry.setResource((Resource) theResource); }