&& ctx.getResourceDefinition((Class<? extends IBaseResource>) nextResource.getClass()).getName().equals("SearchParameter")) { 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.getRequest().setMethod(org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST); entry.setResource((org.hl7.fhir.r4.model.Resource) parsed);
entry.getRequest().getMethodElement().setValueAsString(httpVerb); if (id != null) { entry.getRequest().setUrl(id.getValue());
@Override public Base addChild(String name) throws FHIRException { if (name.equals("link")) { return addLink(); } else if (name.equals("fullUrl")) { throw new FHIRException("Cannot call addChild on a primitive type Bundle.fullUrl"); } else if (name.equals("resource")) { throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource"); } else if (name.equals("search")) { this.search = new BundleEntrySearchComponent(); return this.search; } else if (name.equals("request")) { this.request = new BundleEntryRequestComponent(); return this.request; } else if (name.equals("response")) { this.response = new BundleEntryResponseComponent(); return this.response; } else return super.addChild(name); }
entry.getRequest().getMethodElement().setValueAsString(httpVerb); if (id != null) { entry.getRequest().setUrl(id.getValue());
entry.getRequest().getMethodElement().setValueAsString(httpVerb); entry.getRequest().getUrlElement().setValue(next.getId());
nextEntry.getRequest().setMethod(HTTPVerb.POST); } else { nextEntry.getRequest().setMethod(HTTPVerb.PUT); if (next.getIdElement().isAbsolute()) { nextEntry.getRequest().setUrl(next.getId()); } else { String resourceType = myContext.getResourceDefinition(next).getName(); nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), next.getIdElement().getVersionIdPart()).getValue());
@Override public Base addChild(String name) throws FHIRException { if (name.equals("link")) { return addLink(); } else if (name.equals("fullUrl")) { throw new FHIRException("Cannot call addChild on a primitive type Bundle.fullUrl"); } else if (name.equals("resource")) { throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource"); } else if (name.equals("search")) { this.search = new BundleEntrySearchComponent(); return this.search; } else if (name.equals("request")) { this.request = new BundleEntryRequestComponent(); return this.request; } else if (name.equals("response")) { this.response = new BundleEntryResponseComponent(); return this.response; } else return super.addChild(name); }
/** * Converts a {@link Bundle} into a map grouped by the entry resources types * * @param bundle Bundle * @return map of entries grouped by their resource type */ public static Map<ResourceType, List<Bundle.BundleEntryComponent>> getBundleEntries(Bundle bundle) { return bundle.getEntry().stream() .collect(Collectors.groupingBy(entry -> { Bundle.BundleEntryRequestComponent request = entry.getRequest(); if (request == null || request.getUrl() == null) { throw unprocessableEntity( OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.INVALID, null, null, "Invalid bundle entry request element %s", entry); } return entry.getResource().getResourceType(); } , LinkedHashMap::new, Collectors.toList())); }
public static org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); copyElement(src, tgt); tgt.setMethod(convertHTTPVerb(src.getMethod())); tgt.setUrl(src.getUrl()); if (src.hasIfNoneMatch()) tgt.setIfNoneMatch(src.getIfNoneMatch()); if (src.hasIfModifiedSince()) tgt.setIfModifiedSince(src.getIfModifiedSince()); if (src.hasIfMatch()) tgt.setIfMatch(src.getIfMatch()); if (src.hasIfNoneExist()) tgt.setIfNoneExist(src.getIfNoneExist()); return tgt; }
public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); copyElement(src, tgt); tgt.setMethod(convertHTTPVerb(src.getMethod())); tgt.setUrl(src.getUrl()); if (src.hasIfNoneMatch()) tgt.setIfNoneMatch(src.getIfNoneMatch()); if (src.hasIfModifiedSince()) tgt.setIfModifiedSince(src.getIfModifiedSince()); if (src.hasIfMatch()) tgt.setIfMatch(src.getIfMatch()); if (src.hasIfNoneExist()) tgt.setIfNoneExist(src.getIfNoneExist()); return tgt; }
public boolean hasRequest() { return this.request != null && !this.request.isEmpty(); }
@Override public void setRequestVerb(Bundle.BundleEntryComponent theEntry, String theVerb) { theEntry.getRequest().setMethod(Bundle.HTTPVerb.fromCode(theVerb)); }
@Override public String getEntryIfNoneExist(Bundle.BundleEntryComponent theEntry) { return theEntry.getRequest().getIfNoneExist(); }
@Override public String getEntryRequestUrl(Bundle.BundleEntryComponent theEntry) { return theEntry.getRequest().getUrl(); }
@Override public void setRequestUrl(Bundle.BundleEntryComponent theEntry, String theUrl) { theEntry.getRequest().setUrl(theUrl); }
@Override public String getEntryRequestIfNoneExist(Bundle.BundleEntryComponent theEntry) { return theEntry.getRequest().getIfNoneExist(); }
@Override public String getEntryRequestIfNoneMatch(Bundle.BundleEntryComponent theEntry) { return theEntry.getRequest().getIfNoneMatch(); }
@Override public String getEntryRequestIfMatch(Bundle.BundleEntryComponent theEntry) { return theEntry.getRequest().getIfMatch(); }
public org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent(); copyElement(src, tgt); tgt.setMethod(convertHTTPVerb(src.getMethod())); tgt.setUrl(src.getUrl()); tgt.setIfNoneMatch(src.getIfNoneMatch()); tgt.setIfModifiedSince(src.getIfModifiedSince()); tgt.setIfMatch(src.getIfMatch()); tgt.setIfNoneExist(src.getIfNoneExist()); return tgt; }