use of org.hl7.fhir.r4b.model.Address in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeOrganization.
protected void composeOrganization(Complex parent, String parentType, String name, Organization element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Organization", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Organization", "identifier", element.getIdentifier().get(i), i);
if (element.hasActiveElement())
composeBoolean(t, "Organization", "active", element.getActiveElement(), -1);
for (int i = 0; i < element.getType().size(); i++) composeCodeableConcept(t, "Organization", "type", element.getType().get(i), i);
if (element.hasNameElement())
composeString(t, "Organization", "name", element.getNameElement(), -1);
for (int i = 0; i < element.getAlias().size(); i++) composeString(t, "Organization", "alias", element.getAlias().get(i), i);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Organization", "telecom", element.getTelecom().get(i), i);
for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "Organization", "address", element.getAddress().get(i), i);
if (element.hasPartOf())
composeReference(t, "Organization", "partOf", element.getPartOf(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeOrganizationOrganizationContactComponent(t, "Organization", "contact", element.getContact().get(i), i);
for (int i = 0; i < element.getEndpoint().size(); i++) composeReference(t, "Organization", "endpoint", element.getEndpoint().get(i), i);
}
use of org.hl7.fhir.r4b.model.Address in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeRelatedPerson.
protected void composeRelatedPerson(Complex parent, String parentType, String name, RelatedPerson element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "RelatedPerson", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "RelatedPerson", "identifier", element.getIdentifier().get(i), i);
if (element.hasActiveElement())
composeBoolean(t, "RelatedPerson", "active", element.getActiveElement(), -1);
if (element.hasPatient())
composeReference(t, "RelatedPerson", "patient", element.getPatient(), -1);
if (element.hasRelationship())
composeCodeableConcept(t, "RelatedPerson", "relationship", element.getRelationship(), -1);
for (int i = 0; i < element.getName().size(); i++) composeHumanName(t, "RelatedPerson", "name", element.getName().get(i), i);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "RelatedPerson", "telecom", element.getTelecom().get(i), i);
if (element.hasGenderElement())
composeEnum(t, "RelatedPerson", "gender", element.getGenderElement(), -1);
if (element.hasBirthDateElement())
composeDate(t, "RelatedPerson", "birthDate", element.getBirthDateElement(), -1);
for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "RelatedPerson", "address", element.getAddress().get(i), i);
for (int i = 0; i < element.getPhoto().size(); i++) composeAttachment(t, "RelatedPerson", "photo", element.getPhoto().get(i), i);
if (element.hasPeriod())
composePeriod(t, "RelatedPerson", "period", element.getPeriod(), -1);
}
use of org.hl7.fhir.r4b.model.Address in project org.hl7.fhir.core by hapifhir.
the class JsonParser method composeType.
protected void composeType(String prefix, Type type) throws IOException {
if (type == null)
;
else if (type instanceof Age)
composeAge(prefix + "Age", (Age) type);
else if (type instanceof Count)
composeCount(prefix + "Count", (Count) type);
else if (type instanceof Money)
composeMoney(prefix + "Money", (Money) type);
else if (type instanceof Distance)
composeDistance(prefix + "Distance", (Distance) type);
else if (type instanceof Duration)
composeDuration(prefix + "Duration", (Duration) type);
else if (type instanceof SimpleQuantity)
composeSimpleQuantity(prefix + "SimpleQuantity", (SimpleQuantity) type);
else if (type instanceof Period)
composePeriod(prefix + "Period", (Period) type);
else if (type instanceof Coding)
composeCoding(prefix + "Coding", (Coding) type);
else if (type instanceof Range)
composeRange(prefix + "Range", (Range) type);
else if (type instanceof Quantity)
composeQuantity(prefix + "Quantity", (Quantity) type);
else if (type instanceof Attachment)
composeAttachment(prefix + "Attachment", (Attachment) type);
else if (type instanceof Ratio)
composeRatio(prefix + "Ratio", (Ratio) type);
else if (type instanceof Annotation)
composeAnnotation(prefix + "Annotation", (Annotation) type);
else if (type instanceof SampledData)
composeSampledData(prefix + "SampledData", (SampledData) type);
else if (type instanceof Reference)
composeReference(prefix + "Reference", (Reference) type);
else if (type instanceof CodeableConcept)
composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
else if (type instanceof Identifier)
composeIdentifier(prefix + "Identifier", (Identifier) type);
else if (type instanceof Signature)
composeSignature(prefix + "Signature", (Signature) type);
else if (type instanceof TriggerDefinition)
composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
else if (type instanceof ElementDefinition)
composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
else if (type instanceof Timing)
composeTiming(prefix + "Timing", (Timing) type);
else if (type instanceof ModuleMetadata)
composeModuleMetadata(prefix + "ModuleMetadata", (ModuleMetadata) type);
else if (type instanceof ActionDefinition)
composeActionDefinition(prefix + "ActionDefinition", (ActionDefinition) type);
else if (type instanceof Address)
composeAddress(prefix + "Address", (Address) type);
else if (type instanceof HumanName)
composeHumanName(prefix + "HumanName", (HumanName) type);
else if (type instanceof DataRequirement)
composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
else if (type instanceof Meta)
composeMeta(prefix + "Meta", (Meta) type);
else if (type instanceof ParameterDefinition)
composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
else if (type instanceof ContactPoint)
composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
else if (type instanceof MarkdownType) {
composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
} else if (type instanceof UnsignedIntType) {
composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
} else if (type instanceof CodeType) {
composeCodeCore(prefix + "Code", (CodeType) type, false);
composeCodeExtras(prefix + "Code", (CodeType) type, false);
} else if (type instanceof IdType) {
composeIdCore(prefix + "Id", (IdType) type, false);
composeIdExtras(prefix + "Id", (IdType) type, false);
} else if (type instanceof OidType) {
composeOidCore(prefix + "Oid", (OidType) type, false);
composeOidExtras(prefix + "Oid", (OidType) type, false);
} else if (type instanceof PositiveIntType) {
composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
} else if (type instanceof UuidType) {
composeUuidCore(prefix + "Uuid", (UuidType) type, false);
composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
} else if (type instanceof IntegerType) {
composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
} else if (type instanceof DateTimeType) {
composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
} else if (type instanceof DateType) {
composeDateCore(prefix + "Date", (DateType) type, false);
composeDateExtras(prefix + "Date", (DateType) type, false);
} else if (type instanceof DecimalType) {
composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
} else if (type instanceof UriType) {
composeUriCore(prefix + "Uri", (UriType) type, false);
composeUriExtras(prefix + "Uri", (UriType) type, false);
} else if (type instanceof Base64BinaryType) {
composeBase64BinaryCore(prefix + "Base64Binary", (Base64BinaryType) type, false);
composeBase64BinaryExtras(prefix + "Base64Binary", (Base64BinaryType) type, false);
} else if (type instanceof TimeType) {
composeTimeCore(prefix + "Time", (TimeType) type, false);
composeTimeExtras(prefix + "Time", (TimeType) type, false);
} else if (type instanceof StringType) {
composeStringCore(prefix + "String", (StringType) type, false);
composeStringExtras(prefix + "String", (StringType) type, false);
} else if (type instanceof BooleanType) {
composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
composeBooleanExtras(prefix + "Boolean", (BooleanType) type, false);
} else if (type instanceof InstantType) {
composeInstantCore(prefix + "Instant", (InstantType) type, false);
composeInstantExtras(prefix + "Instant", (InstantType) type, false);
} else
throw new Error("Unhandled type");
}
use of org.hl7.fhir.r4b.model.Address in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilitiesTests method testSlicingTask8742.
private void testSlicingTask8742() throws EOperationOutcome, Exception {
StructureDefinition focus = new StructureDefinition();
StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Organization").copy();
focus.setUrl(Utilities.makeUuidUrn());
focus.setBase(base.getUrl());
ElementDefinition id = focus.getDifferential().addElement();
id.setPath("Organization.address");
id.setMin(1);
id.setMax("1");
id.setMustSupport(true);
id = focus.getDifferential().addElement();
id.setPath("Organization.address.extension");
id.setName("USLabCountycodes");
id.getSlicing().setOrdered(false).setRules(SlicingRules.OPEN).addDiscriminator("url");
id.setShort("County/Parish FIPS codes");
id.setDefinition("County/Parish FIPS codes.");
id.setRequirements("County/Parish Code SHALL use FIPS 6-4 ( INCITS 31:2009).");
id.setMin(0);
id.setMax("1");
id.addType().setCode("Extension").addProfile("http://hl7.org/fhir/StructureDefinition/us-core-county");
id.setMustSupport(true);
id.getBinding().setStrength(BindingStrength.REQUIRED).setDescription("FIPS codes for US counties and county equivalent entities.").setValueSet(new Reference().setReference("http://hl7.org/fhir/ValueSet/fips-county"));
List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test");
// 14 for address with one sliced extension
boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 13;
if (!ok) {
compareXml(base, focus);
throw new FHIRException("Snap shot generation test 8742 failed");
} else
System.out.println("Snap shot generation test 8742 passed");
}
use of org.hl7.fhir.r4b.model.Address in project org.hl7.fhir.core by hapifhir.
the class ToolsHelper method generateSnapshots.
private void generateSnapshots(String[] args) throws IOException, FHIRException {
if (args.length == 1) {
System.out.println("tools.jar snapshot-maker [source] -defn [definitions]");
System.out.println("");
System.out.println("Generates a snapshot from a differential. The nominated profile must have a single struture that has a differential");
System.out.println("");
System.out.println("source - the profile to generate the snapshot for. Maybe a file name, or a URL reference to a server running FHIR RESTful API");
System.out.println("definitions - filename for local copy of the validation.zip file");
}
String address = args[1];
String definitions = args[3];
SimpleWorkerContext context = SimpleWorkerContext.fromDefinitions(getDefinitions(definitions));
// } else {
throw new NotImplementedException("generating snapshots not done yet (address = " + address + ")");
// }
}
Aggregations