public org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); if (src.hasFamily()) tgt.addFamily(src.getFamily()); for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
@Override public void setProperty(String name, Base value) throws FHIRException { if (name.equals("use")) this.use = new NameUseEnumFactory().fromType(value); // Enumeration<NameUse> else if (name.equals("text")) this.text = castToString(value); // StringType else if (name.equals("family")) this.getFamily().add(castToString(value)); else if (name.equals("given")) this.getGiven().add(castToString(value)); else if (name.equals("prefix")) this.getPrefix().add(castToString(value)); else if (name.equals("suffix")) this.getSuffix().add(castToString(value)); else if (name.equals("period")) this.period = castToPeriod(value); // Period else super.setProperty(name, value); }
private void checkHumanName(List<ValidationMessage> errors, String path, WrapperElement focus, HumanName fixed) { checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); List<WrapperElement> parts = new ArrayList<WrapperElement>(); focus.getNamedChildren("family", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getFamily().size(), "Expected " + Integer.toString(fixed.getFamily().size()) + " but found " + Integer.toString(parts.size()) + " family elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".family", parts.get(i), fixed.getFamily().get(i), "family"); } focus.getNamedChildren("given", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getGiven().size(), "Expected " + Integer.toString(fixed.getGiven().size()) + " but found " + Integer.toString(parts.size()) + " given elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".given", parts.get(i), fixed.getGiven().get(i), "given"); } focus.getNamedChildren("prefix", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getPrefix().size(), "Expected " + Integer.toString(fixed.getPrefix().size()) + " but found " + Integer.toString(parts.size()) + " prefix elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".prefix", parts.get(i), fixed.getPrefix().get(i), "prefix"); } focus.getNamedChildren("suffix", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getSuffix().size(), "Expected " + Integer.toString(fixed.getSuffix().size()) + " but found " + Integer.toString(parts.size()) + " suffix elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".suffix", parts.get(i), fixed.getSuffix().get(i), "suffix"); } }
/** * @return {@link #name} (A name associated with the person.) */ // syntactic sugar public HumanName addName() { //3 HumanName t = new HumanName(); if (this.name == null) this.name = new ArrayList<HumanName>(); this.name.add(t); return t; }
public boolean hasName() { if (this.name == null) return false; for (HumanName item : this.name) if (!item.isEmpty()) return true; return false; }
public HumanName copy() { HumanName dst = new HumanName(); copyValues(dst); dst.use = use == null ? null : use.copy(); dst.text = text == null ? null : text.copy(); if (family != null) { dst.family = new ArrayList<StringType>(); for (StringType i : family) dst.family.add(i.copy()); }; if (given != null) { dst.given = new ArrayList<StringType>(); for (StringType i : given) dst.given.add(i.copy()); }; if (prefix != null) { dst.prefix = new ArrayList<StringType>(); for (StringType i : prefix) dst.prefix.add(i.copy()); }; if (suffix != null) { dst.suffix = new ArrayList<StringType>(); for (StringType i : suffix) dst.suffix.add(i.copy()); }; dst.period = period == null ? null : period.copy(); return dst; }
@Test public void testGetResource() { PdqPatient p = client.read() .resource(PdqPatient.class) .withId("4711") .execute(); assertEquals("Test", p.getName().get(0).getFamily().get(0).getValue()); assertEquals(String.format("http://localhost:%d/Patient/4711", DEMO_APP_PORT), p.getId()); AbstractMockedAuditMessageQueue sender = getAuditSender(); assertEquals(1, sender.getMessages().size()); AuditMessage event = sender.getMessages().get(0); // Patient ParticipantObjectIdentificationType patient = event.getParticipantObjectIdentifications().get(0); assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("Patient/4711", patient.getParticipantObjectID()); }
private void checkHumanName(List<ValidationMessage> errors, String path, WrapperElement focus, HumanName fixed) { checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); List<WrapperElement> parts = new ArrayList<WrapperElement>(); focus.getNamedChildren("family", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getFamily().size(), "Expected " + Integer.toString(fixed.getFamily().size()) + " but found " + Integer.toString(parts.size()) + " family elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".family", parts.get(i), fixed.getFamily().get(i), "family"); } focus.getNamedChildren("given", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getGiven().size(), "Expected " + Integer.toString(fixed.getGiven().size()) + " but found " + Integer.toString(parts.size()) + " given elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".given", parts.get(i), fixed.getGiven().get(i), "given"); } focus.getNamedChildren("prefix", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getPrefix().size(), "Expected " + Integer.toString(fixed.getPrefix().size()) + " but found " + Integer.toString(parts.size()) + " prefix elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".prefix", parts.get(i), fixed.getPrefix().get(i), "prefix"); } focus.getNamedChildren("suffix", parts); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getSuffix().size(), "Expected " + Integer.toString(fixed.getSuffix().size()) + " but found " + Integer.toString(parts.size()) + " suffix elements")) { for (int i = 0; i < parts.size(); i++) checkFixedValue(errors, path + ".suffix", parts.get(i), fixed.getSuffix().get(i), "suffix"); } }
@Override public void setProperty(String name, Base value) throws FHIRException { if (name.equals("use")) this.use = new NameUseEnumFactory().fromType(value); // Enumeration<NameUse> else if (name.equals("text")) this.text = castToString(value); // StringType else if (name.equals("family")) this.getFamily().add(castToString(value)); else if (name.equals("given")) this.getGiven().add(castToString(value)); else if (name.equals("prefix")) this.getPrefix().add(castToString(value)); else if (name.equals("suffix")) this.getSuffix().add(castToString(value)); else if (name.equals("period")) this.period = castToPeriod(value); // Period else super.setProperty(name, value); }
/** * @return {@link #name} (A name associated with the individual.) */ // syntactic sugar public HumanName addName() { //3 HumanName t = new HumanName(); if (this.name == null) this.name = new ArrayList<HumanName>(); this.name.add(t); return t; }
public boolean hasName() { if (this.name == null) return false; for (HumanName item : this.name) if (!item.isEmpty()) return true; return false; }
public HumanName copy() { HumanName dst = new HumanName(); copyValues(dst); dst.use = use == null ? null : use.copy(); dst.text = text == null ? null : text.copy(); if (family != null) { dst.family = new ArrayList<StringType>(); for (StringType i : family) dst.family.add(i.copy()); }; if (given != null) { dst.given = new ArrayList<StringType>(); for (StringType i : given) dst.given.add(i.copy()); }; if (prefix != null) { dst.prefix = new ArrayList<StringType>(); for (StringType i : prefix) dst.prefix.add(i.copy()); }; if (suffix != null) { dst.suffix = new ArrayList<StringType>(); for (StringType i : suffix) dst.suffix.add(i.copy()); }; dst.period = period == null ? null : period.copy(); return dst; }
assertEquals("Test", p.getName().get(0).getFamily().get(0).getValue()); assertEquals("http://localhost:8999/Patient/4711", p.getId());
public org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); if (src.hasFamily()) tgt.addFamily(src.getFamily()); for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
/** * @return {@link #name} (A name associated with the person.) */ public HumanName getName() { if (this.name == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create Practitioner.name"); else if (Configuration.doAutoCreate()) this.name = new HumanName(); // cc return this.name; }
public boolean hasName() { return this.name != null && !this.name.isEmpty(); }
public org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); if (src.hasFamily()) tgt.addFamily(src.getFamily()); for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }