@Read() public Patient readPatient(@IdParam IdType theId) { Patient retVal = new Patient(); // ..populate demographics, contact, or anything else you usually would.. // Populate some tags retVal.getMeta().addTag("http://animals", "Dog", "Canine Patient"); // TODO: more realistic example retVal.getMeta().addTag("http://personality", "Friendly", "Friendly"); // TODO: more realistic example return retVal; } //END SNIPPET: readTags
public void clientRead() { //START SNIPPET: clientReadTags IPatientClient client = FhirContext.forDstu2().newRestfulClient(IPatientClient.class, "http://foo/fhir"); Patient patient = client.readPatient(new IdType("1234")); // Access the tag list List<Coding> tagList = patient.getMeta().getTag(); for (Coding next : tagList) { // ..process the tags somehow.. } //END SNIPPET: clientReadTags //START SNIPPET: clientCreateTags Patient newPatient = new Patient(); // Populate the resource object newPatient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setValue("123"); newPatient.addName().setFamily("Jones").addGiven("Frank"); // Populate some tags newPatient.getMeta().addTag("http://animals", "Dog", "Canine Patient"); // TODO: more realistic example newPatient.getMeta().addTag("http://personality", "Friendly", "Friendly"); // TODO: more realistic example // ...invoke the create method on the client... //END SNIPPET: clientCreateTags }
public org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); copyElement(src, tgt); tgt.setVersionId(src.getVersionId()); tgt.setLastUpdated(src.getLastUpdated()); for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); for (org.hl7.fhir.instance.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); for (org.hl7.fhir.instance.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); return tgt; }
private Meta toMeta(Collection<TagDefinition> tagDefinitions) { Meta retVal = new Meta(); for (TagDefinition next : tagDefinitions) { switch (next.getTagType()) { case PROFILE: retVal.addProfile(next.getCode()); break; case SECURITY_LABEL: retVal.addSecurity().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; case TAG: retVal.addTag().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; } } return retVal; }
public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); copyElement(src, tgt); if (src.hasVersionId()) tgt.setVersionId(src.getVersionId()); if (src.hasLastUpdated()) tgt.setLastUpdated(src.getLastUpdated()); for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); return tgt; }
/** * @return The first repetition of repeating field {@link #tag}, creating it if it does not already exist */ public Coding getTagFirstRep() { if (getTag().isEmpty()) { addTag(); } return getTag().get(0); }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("versionId")) { throw new FHIRException("Cannot call addChild on a primitive type Meta.versionId"); } else if (name.equals("lastUpdated")) { throw new FHIRException("Cannot call addChild on a primitive type Meta.lastUpdated"); } else if (name.equals("profile")) { throw new FHIRException("Cannot call addChild on a primitive type Meta.profile"); } else if (name.equals("security")) { return addSecurity(); } else if (name.equals("tag")) { return addTag(); } else return super.addChild(name); }
/** * Convenience method which adds a tag * * @param theSystem The code system * @param theCode The code * @param theDisplay The display name * @return Returns a reference to <code>this</code> for easy chaining */ public Meta addTag(String theSystem, String theCode, String theDisplay) { addTag().setSystem(theSystem).setCode(theCode).setDisplay(theDisplay); return this; } /**
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case -1407102957: return getVersionIdElement(); case 1649733957: return getLastUpdatedElement(); case -309425751: return addProfileElement(); case 949122880: return addSecurity(); case 114586: return addTag(); default: return super.makeProperty(hash, name); } }
public org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); copyElement(src, tgt); tgt.setVersionId(src.getVersionId()); tgt.setLastUpdated(src.getLastUpdated()); for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); for (org.hl7.fhir.instance.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); for (org.hl7.fhir.instance.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); return tgt; }
public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); copyElement(src, tgt); if (src.hasVersionId()) tgt.setVersionId(src.getVersionId()); if (src.hasLastUpdated()) tgt.setLastUpdated(src.getLastUpdated()); for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) tgt.addProfile(t.getValue()); for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) tgt.addSecurity(convertCoding(t)); for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) tgt.addTag(convertCoding(t)); return tgt; }
private Meta toMeta(Collection<TagDefinition> tagDefinitions) { Meta retVal = new Meta(); for (TagDefinition next : tagDefinitions) { switch (next.getTagType()) { case PROFILE: retVal.addProfile(next.getCode()); break; case SECURITY_LABEL: retVal.addSecurity().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; case TAG: retVal.addTag().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; } } return retVal; }