private boolean hasLink(String theLinkType, Bundle theBundle) { for (BundleLinkComponent next : theBundle.getLink()) { if (theLinkType.equals(next.getRelation())) { return true; } } return false; }
/** * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. * If no link is found which matches the given relation, returns <code>null</code>. If more than one * link is found which matches the given relation, returns the first matching BundleLinkComponent. * * @param theRelation * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. * @return Returns a matching BundleLinkComponent, or <code>null</code> * @see IBaseBundle#LINK_NEXT * @see IBaseBundle#LINK_PREV * @see IBaseBundle#LINK_SELF */ public BundleLinkComponent getLink(String theRelation) { org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); for (BundleLinkComponent next : getLink()) { if (theRelation.equals(next.getRelation())) { return next; } } return null; }
public static String getLink(Bundle feed, String rel) { for (BundleLinkComponent link : feed.getLink()) { if (link.getRelation().equals(rel)) return link.getUrl(); } return null; }
/** * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. * If no link is found which matches the given relation, creates a new BundleLinkComponent with the * given relation and adds it to this Bundle. If more than one * link is found which matches the given relation, returns the first matching BundleLinkComponent. * * @param theRelation * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. * @return Returns a matching BundleLinkComponent, or <code>null</code> * @see IBaseBundle#LINK_NEXT * @see IBaseBundle#LINK_PREV * @see IBaseBundle#LINK_SELF */ public BundleLinkComponent getLinkOrCreate(String theRelation) { org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); for (BundleLinkComponent next : getLink()) { if (theRelation.equals(next.getRelation())) { return next; } } BundleLinkComponent retVal = new BundleLinkComponent(); retVal.setRelation(theRelation); getLink().add(retVal); return retVal; } protected void listChildren(List<Property> children) {
private Base extractLink(String _name) throws FHIRException { for (BundleLinkComponent bl : bnd.getLink()) { if (bl.getRelation().equals(_name)) { Map<String, String> map = parseURL(bl.getUrl()); return new StringType(map.get("search-id")+':'+map.get("search-offset")); } } return null; }
public SearchWrapper(String type, Bundle bnd) throws FHIRException { this.type = type; this.bnd = bnd; for (BundleLinkComponent bl : bnd.getLink()) if (bl.getRelation().equals("self")) map = parseURL(bl.getUrl()); }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("identifier")) { this.identifier = castToIdentifier(value); // Identifier } else if (name.equals("type")) { value = new BundleTypeEnumFactory().fromType(castToCode(value)); this.type = (Enumeration) value; // Enumeration<BundleType> } else if (name.equals("timestamp")) { this.timestamp = castToInstant(value); // InstantType } else if (name.equals("total")) { this.total = castToUnsignedInt(value); // UnsignedIntType } else if (name.equals("link")) { this.getLink().add((BundleLinkComponent) value); } else if (name.equals("entry")) { this.getEntry().add((BundleEntryComponent) value); } else if (name.equals("signature")) { this.signature = castToSignature(value); // Signature } else return super.setProperty(name, value); return value; }
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case -1618432855: // identifier this.identifier = castToIdentifier(value); // Identifier return value; case 3575610: // type value = new BundleTypeEnumFactory().fromType(castToCode(value)); this.type = (Enumeration) value; // Enumeration<BundleType> return value; case 55126294: // timestamp this.timestamp = castToInstant(value); // InstantType return value; case 110549828: // total this.total = castToUnsignedInt(value); // UnsignedIntType return value; case 3321850: // link this.getLink().add((BundleLinkComponent) value); // BundleLinkComponent return value; case 96667762: // entry this.getEntry().add((BundleEntryComponent) value); // BundleEntryComponent return value; case 1073584312: // signature this.signature = castToSignature(value); // Signature return value; default: return super.setProperty(hash, name, value); } }
public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); copyResource(src, tgt); tgt.setType(convertBundleType(src.getType())); if (src.hasTotal()) tgt.setTotal(src.getTotal()); for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); tgt.setSignature(convertSignature(src.getSignature())); return tgt; }
private boolean hasLink(String theLinkType, Bundle theBundle) { for (BundleLinkComponent next : theBundle.getLink()) { if (theLinkType.equals(next.getRelation())) { return true; } } return false; }
public org.hl7.fhir.instance.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Bundle tgt = new org.hl7.fhir.instance.model.Bundle(); copyResource(src, tgt); tgt.setType(convertBundleType(src.getType())); if (src.hasTotal()) tgt.setTotal(src.getTotal()); for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); if (src.hasSignature()) tgt.setSignature(convertSignature(src.getSignature())); return tgt; }
/** * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. * If no link is found which matches the given relation, returns <code>null</code>. If more than one * link is found which matches the given relation, returns the first matching BundleLinkComponent. * * @param theRelation * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. * @return Returns a matching BundleLinkComponent, or <code>null</code> * @see IBaseBundle#LINK_NEXT * @see IBaseBundle#LINK_PREV * @see IBaseBundle#LINK_SELF */ public BundleLinkComponent getLink(String theRelation) { org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); for (BundleLinkComponent next : getLink()) { if (theRelation.equals(next.getRelation())) { return next; } } return null; }
public static String getLink(Bundle feed, String rel) { for (BundleLinkComponent link : feed.getLink()) { if (link.getRelation().equals(rel)) return link.getUrl(); } return null; }
private Base extractLink(String _name) throws FHIRException { for (BundleLinkComponent bl : bnd.getLink()) { if (bl.getRelation().equals(_name)) { Map<String, String> map = parseURL(bl.getUrl()); return new StringType(map.get("search-id")+':'+map.get("search-offset")); } } return null; }
public SearchWrapper(String type, Bundle bnd) throws FHIRException { this.type = type; this.bnd = bnd; for (BundleLinkComponent bl : bnd.getLink()) if (bl.getRelation().equals("self")) map = parseURL(bl.getUrl()); }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("identifier")) { this.identifier = castToIdentifier(value); // Identifier } else if (name.equals("type")) { value = new BundleTypeEnumFactory().fromType(castToCode(value)); this.type = (Enumeration) value; // Enumeration<BundleType> } else if (name.equals("timestamp")) { this.timestamp = castToInstant(value); // InstantType } else if (name.equals("total")) { this.total = castToUnsignedInt(value); // UnsignedIntType } else if (name.equals("link")) { this.getLink().add((BundleLinkComponent) value); } else if (name.equals("entry")) { this.getEntry().add((BundleEntryComponent) value); } else if (name.equals("signature")) { this.signature = castToSignature(value); // Signature } else return super.setProperty(name, value); return value; }
public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); copyResource(src, tgt); tgt.setType(convertBundleType(src.getType())); if (src.hasTotal()) tgt.setTotal(src.getTotal()); for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); tgt.setSignature(convertSignature(src.getSignature())); return tgt; }
public org.hl7.fhir.instance.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Bundle tgt = new org.hl7.fhir.instance.model.Bundle(); copyResource(src, tgt); tgt.setType(convertBundleType(src.getType())); if (src.hasTotal()) tgt.setTotal(src.getTotal()); for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) tgt.addEntry(convertBundleEntryComponent(t)); if (src.hasSignature()) tgt.setSignature(convertSignature(src.getSignature())); return tgt; }