use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class Questionnaire14_50 method convertQuestionnaire.
public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire();
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
if (src.hasUrl())
tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement()));
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier14_50.convertIdentifier(t));
if (src.hasVersion())
tgt.setVersionElement(String14_50.convertString(src.getVersionElement()));
if (src.hasStatus())
tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
if (src.hasDate())
tgt.setDateElement(DateTime14_50.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String14_50.convertString(src.getPublisherElement()));
for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(ContactPoint14_50.convertContactPoint(t1));
for (UsageContext t : src.getUseContext()) tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t.getValueCodeableConcept()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t));
if (src.hasTitle())
tgt.setTitleElement(String14_50.convertString(src.getTitleElement()));
for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addConcept(Coding14_50.convertCoding(t));
for (CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addItem(convertQuestionnaireItemComponent(t));
return tgt;
}
use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class ActivityDefinition30_40 method convertActivityDefinition.
public static org.hl7.fhir.r4.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.ActivityDefinition tgt = new org.hl7.fhir.r4.model.ActivityDefinition();
ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
if (src.hasUrl())
tgt.setUrlElement(Uri30_40.convertUri(src.getUrlElement()));
for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
if (src.hasVersion())
tgt.setVersionElement(String30_40.convertString(src.getVersionElement()));
if (src.hasName())
tgt.setNameElement(String30_40.convertString(src.getNameElement()));
if (src.hasTitle())
tgt.setTitleElement(String30_40.convertString(src.getTitleElement()));
if (src.hasStatus())
tgt.setStatusElement(Enumerations30_40.convertPublicationStatus(src.getStatusElement()));
if (src.hasExperimental())
tgt.setExperimentalElement(Boolean30_40.convertBoolean(src.getExperimentalElement()));
if (src.hasDateElement())
tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
if (src.hasDescription())
tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
if (src.hasPurpose())
tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
if (src.hasUsage())
tgt.setUsageElement(String30_40.convertString(src.getUsageElement()));
if (src.hasApprovalDate())
tgt.setApprovalDateElement(Date30_40.convertDate(src.getApprovalDateElement()));
if (src.hasLastReviewDate())
tgt.setLastReviewDateElement(Date30_40.convertDate(src.getLastReviewDateElement()));
if (src.hasEffectivePeriod())
tgt.setEffectivePeriod(Period30_40.convertPeriod(src.getEffectivePeriod()));
for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(Timing30_40.convertUsageContext(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(CodeableConcept30_40.convertCodeableConcept(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(CodeableConcept30_40.convertCodeableConcept(t));
for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) {
if (t.getType() == ContributorType.AUTHOR)
for (ContactDetail c : t.getContact()) tgt.addAuthor(ContactDetail30_40.convertContactDetail(c));
if (t.getType() == ContributorType.EDITOR)
for (ContactDetail c : t.getContact()) tgt.addEditor(ContactDetail30_40.convertContactDetail(c));
if (t.getType() == ContributorType.REVIEWER)
for (ContactDetail c : t.getContact()) tgt.addReviewer(ContactDetail30_40.convertContactDetail(c));
if (t.getType() == ContributorType.ENDORSER)
for (ContactDetail c : t.getContact()) tgt.addEndorser(ContactDetail30_40.convertContactDetail(c));
}
for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(ContactDetail30_40.convertContactDetail(t));
if (src.hasCopyright())
tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(RelatedArtifact30_40.convertRelatedArtifact(t));
for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(Reference30_40.convertReferenceToCanonical(t));
if (src.hasKind())
tgt.setKindElement(convertActivityDefinitionKind(src.getKindElement()));
if (src.hasCode())
tgt.setCode(CodeableConcept30_40.convertCodeableConcept(src.getCode()));
if (src.hasTiming())
tgt.setTiming(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getTiming()));
if (src.hasLocation())
tgt.setLocation(Reference30_40.convertReference(src.getLocation()));
for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
if (src.hasProduct())
tgt.setProduct(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getProduct()));
if (src.hasQuantity())
tgt.setQuantity(SimpleQuantity30_40.convertSimpleQuantity(src.getQuantity()));
for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage30_40.convertDosage(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(CodeableConcept30_40.convertCodeableConcept(t));
if (src.hasTransform())
tgt.setTransformElement(Reference30_40.convertReferenceToCanonical(src.getTransform()));
for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t));
return tgt;
}
use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class JsonParser method composeType.
protected void composeType(String prefix, DataType type) throws IOException {
if (type == null) {
;
} else if (type instanceof Address) {
composeAddress(prefix + "Address", (Address) type);
} else if (type instanceof Age) {
composeAge(prefix + "Age", (Age) type);
} else if (type instanceof Annotation) {
composeAnnotation(prefix + "Annotation", (Annotation) type);
} else if (type instanceof Attachment) {
composeAttachment(prefix + "Attachment", (Attachment) type);
} else if (type instanceof CodeableConcept) {
composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
} else if (type instanceof CodeableReference) {
composeCodeableReference(prefix + "CodeableReference", (CodeableReference) type);
} else if (type instanceof Coding) {
composeCoding(prefix + "Coding", (Coding) type);
} else if (type instanceof ContactDetail) {
composeContactDetail(prefix + "ContactDetail", (ContactDetail) type);
} else if (type instanceof ContactPoint) {
composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
} else if (type instanceof Contributor) {
composeContributor(prefix + "Contributor", (Contributor) type);
} else if (type instanceof Count) {
composeCount(prefix + "Count", (Count) type);
} else if (type instanceof DataRequirement) {
composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
} else if (type instanceof Distance) {
composeDistance(prefix + "Distance", (Distance) type);
} else if (type instanceof Dosage) {
composeDosage(prefix + "Dosage", (Dosage) type);
} else if (type instanceof Duration) {
composeDuration(prefix + "Duration", (Duration) type);
} else if (type instanceof ElementDefinition) {
composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
} else if (type instanceof Expression) {
composeExpression(prefix + "Expression", (Expression) type);
} else if (type instanceof Extension) {
composeExtension(prefix + "Extension", (Extension) type);
} else if (type instanceof HumanName) {
composeHumanName(prefix + "HumanName", (HumanName) type);
} else if (type instanceof Identifier) {
composeIdentifier(prefix + "Identifier", (Identifier) type);
} else if (type instanceof MarketingStatus) {
composeMarketingStatus(prefix + "MarketingStatus", (MarketingStatus) type);
} else if (type instanceof Meta) {
composeMeta(prefix + "Meta", (Meta) type);
} else if (type instanceof Money) {
composeMoney(prefix + "Money", (Money) type);
} else if (type instanceof Narrative) {
composeNarrative(prefix + "Narrative", (Narrative) type);
} else if (type instanceof ParameterDefinition) {
composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
} else if (type instanceof Period) {
composePeriod(prefix + "Period", (Period) type);
} else if (type instanceof Population) {
composePopulation(prefix + "Population", (Population) type);
} else if (type instanceof ProdCharacteristic) {
composeProdCharacteristic(prefix + "ProdCharacteristic", (ProdCharacteristic) type);
} else if (type instanceof ProductShelfLife) {
composeProductShelfLife(prefix + "ProductShelfLife", (ProductShelfLife) type);
} else if (type instanceof Quantity) {
composeQuantity(prefix + "Quantity", (Quantity) type);
} else if (type instanceof Range) {
composeRange(prefix + "Range", (Range) type);
} else if (type instanceof Ratio) {
composeRatio(prefix + "Ratio", (Ratio) type);
} else if (type instanceof RatioRange) {
composeRatioRange(prefix + "RatioRange", (RatioRange) type);
} else if (type instanceof Reference) {
composeReference(prefix + "Reference", (Reference) type);
} else if (type instanceof RelatedArtifact) {
composeRelatedArtifact(prefix + "RelatedArtifact", (RelatedArtifact) type);
} else if (type instanceof SampledData) {
composeSampledData(prefix + "SampledData", (SampledData) type);
} else if (type instanceof Signature) {
composeSignature(prefix + "Signature", (Signature) type);
} else if (type instanceof Timing) {
composeTiming(prefix + "Timing", (Timing) type);
} else if (type instanceof TriggerDefinition) {
composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
} else if (type instanceof UsageContext) {
composeUsageContext(prefix + "UsageContext", (UsageContext) type);
} else if (type instanceof CodeType) {
composeCodeCore(prefix + "Code", (CodeType) type, false);
composeCodeExtras(prefix + "Code", (CodeType) type, false);
} else if (type instanceof OidType) {
composeOidCore(prefix + "Oid", (OidType) type, false);
composeOidExtras(prefix + "Oid", (OidType) type, false);
} else if (type instanceof CanonicalType) {
composeCanonicalCore(prefix + "Canonical", (CanonicalType) type, false);
composeCanonicalExtras(prefix + "Canonical", (CanonicalType) type, false);
} else if (type instanceof UuidType) {
composeUuidCore(prefix + "Uuid", (UuidType) type, false);
composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
} else if (type instanceof UrlType) {
composeUrlCore(prefix + "Url", (UrlType) type, false);
composeUrlExtras(prefix + "Url", (UrlType) type, false);
} else if (type instanceof UnsignedIntType) {
composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
} else if (type instanceof MarkdownType) {
composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
} else if (type instanceof IdType) {
composeIdCore(prefix + "Id", (IdType) type, false);
composeIdExtras(prefix + "Id", (IdType) type, false);
} else if (type instanceof PositiveIntType) {
composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
} else if (type instanceof DateType) {
composeDateCore(prefix + "Date", (DateType) type, false);
composeDateExtras(prefix + "Date", (DateType) type, false);
} else if (type instanceof DateTimeType) {
composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
} else if (type instanceof StringType) {
composeStringCore(prefix + "String", (StringType) type, false);
composeStringExtras(prefix + "String", (StringType) type, false);
} else if (type instanceof IntegerType) {
composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
} else if (type instanceof Integer64Type) {
composeInteger64Core(prefix + "Integer64", (Integer64Type) type, false);
composeInteger64Extras(prefix + "Integer64", (Integer64Type) type, false);
} else if (type instanceof UriType) {
composeUriCore(prefix + "Uri", (UriType) type, false);
composeUriExtras(prefix + "Uri", (UriType) type, false);
} else if (type instanceof InstantType) {
composeInstantCore(prefix + "Instant", (InstantType) type, false);
composeInstantExtras(prefix + "Instant", (InstantType) type, false);
} else if (type instanceof BooleanType) {
composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
composeBooleanExtras(prefix + "Boolean", (BooleanType) 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 DecimalType) {
composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
} else
throw new Error("Unhandled type");
}
use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class NPMPackageGenerator method buildPackageJson.
private void buildPackageJson(String canonical, PackageType kind, String web, Date date, ImplementationGuide ig, List<String> fhirVersion, boolean notForPublication) throws FHIRException, IOException {
String dtHuman = new SimpleDateFormat("EEE, MMM d, yyyy HH:mmZ", new Locale("en", "US")).format(date);
String dt = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
if (!ig.hasPackageId()) {
b.append("packageId");
}
if (!ig.hasVersion()) {
b.append("version");
}
if (!ig.hasFhirVersion()) {
b.append("fhirVersion");
}
if (!ig.hasLicense()) {
b.append("license");
}
for (ImplementationGuideDependsOnComponent d : ig.getDependsOn()) {
if (!d.hasVersion()) {
b.append("dependsOn.version(" + d.getUri() + ")");
}
}
JsonObject npm = new JsonObject();
npm.addProperty("name", ig.getPackageId());
npm.addProperty("version", ig.getVersion());
igVersion = ig.getVersion();
npm.addProperty("tools-version", ToolsVersion.TOOLS_VERSION);
npm.addProperty("type", kind.getCode());
npm.addProperty("date", dt);
if (ig.hasLicense()) {
npm.addProperty("license", ig.getLicense().toCode());
}
npm.addProperty("canonical", canonical);
if (notForPublication) {
npm.addProperty("notForPublication", true);
}
npm.addProperty("url", web);
if (ig.hasTitle()) {
npm.addProperty("title", ig.getTitle());
}
if (ig.hasDescription()) {
npm.addProperty("description", ig.getDescription() + " (built " + dtHuman + timezone() + ")");
}
JsonArray vl = new JsonArray();
npm.add("fhirVersions", vl);
for (String v : fhirVersion) {
vl.add(new JsonPrimitive(v));
}
if (kind != PackageType.CORE) {
JsonObject dep = new JsonObject();
npm.add("dependencies", dep);
for (String v : fhirVersion) {
String vp = packageForVersion(v);
if (vp != null) {
dep.addProperty(vp, v);
}
}
for (ImplementationGuideDependsOnComponent d : ig.getDependsOn()) {
dep.addProperty(d.getPackageId(), d.getVersion());
}
}
if (ig.hasPublisher()) {
npm.addProperty("author", ig.getPublisher());
}
JsonArray m = new JsonArray();
for (ContactDetail t : ig.getContact()) {
String email = email(t.getTelecom());
String url = url(t.getTelecom());
if (t.hasName() & (email != null || url != null)) {
JsonObject md = new JsonObject();
m.add(md);
md.addProperty("name", t.getName());
if (email != null)
md.addProperty("email", email);
if (url != null)
md.addProperty("url", url);
}
}
if (m.size() > 0)
npm.add("maintainers", m);
if (ig.getManifest().hasRendering())
npm.addProperty("homepage", ig.getManifest().getRendering());
JsonObject dir = new JsonObject();
npm.add("directories", dir);
dir.addProperty("lib", "package");
dir.addProperty("example", "example");
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(npm);
try {
addFile(Category.RESOURCE, "package.json", json.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
}
packageJ = npm;
packageManifest = new JsonObject();
packageManifest.addProperty("version", ig.getVersion());
packageManifest.addProperty("fhirVersion", fhirVersion.toString());
packageManifest.addProperty("date", dt);
packageManifest.addProperty("name", ig.getPackageId());
}
use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method createProfile.
private PropertyWithType createProfile(StructureMap map, List<StructureDefinition> profiles, PropertyWithType prop, String sliceName, Base ctxt) throws DefinitionException {
if (prop.getBaseProperty().getDefinition().getPath().contains("."))
throw new DefinitionException("Unable to process entry point");
String type = prop.getBaseProperty().getDefinition().getPath();
String suffix = "";
if (ids.containsKey(type)) {
int id = ids.get(type);
id++;
ids.put(type, id);
suffix = "-" + Integer.toString(id);
} else
ids.put(type, 0);
StructureDefinition profile = new StructureDefinition();
profiles.add(profile);
profile.setDerivation(TypeDerivationRule.CONSTRAINT);
profile.setType(type);
profile.setBaseDefinition(prop.getBaseProperty().getStructure().getUrl());
profile.setName("Profile for " + profile.getType() + " for " + sliceName);
profile.setUrl(map.getUrl().replace("StructureMap", "StructureDefinition") + "-" + profile.getType() + suffix);
// then we can easily assign this profile url for validation later when we actually transform
ctxt.setUserData("profile", profile.getUrl());
profile.setId(map.getId() + "-" + profile.getType() + suffix);
profile.setStatus(map.getStatus());
profile.setExperimental(map.getExperimental());
profile.setDescription("Generated automatically from the mapping by the Java Reference Implementation");
for (ContactDetail c : map.getContact()) {
ContactDetail p = profile.addContact();
p.setName(c.getName());
for (ContactPoint cc : c.getTelecom()) p.addTelecom(cc);
}
profile.setDate(map.getDate());
profile.setCopyright(map.getCopyright());
profile.setFhirVersion(Constants.VERSION);
profile.setKind(prop.getBaseProperty().getStructure().getKind());
profile.setAbstract(false);
ElementDefinition ed = profile.getDifferential().addElement();
ed.setPath(profile.getType());
prop.profileProperty = new Property(worker, ed, profile);
return prop;
}
Aggregations