use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class Questionnaire10_30 method convertQuestionnaire.
public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire();
ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
if (src.hasVersionElement())
tgt.setVersionElement(String10_30.convertString(src.getVersionElement()));
if (src.hasStatus())
tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
if (src.hasDate())
tgt.setDateElement(DateTime10_30.convertDateTime(src.getDateElement()));
if (src.hasPublisherElement())
tgt.setPublisherElement(String10_30.convertString(src.getPublisherElement()));
for (ContactDetail t : src.getContact()) for (org.hl7.fhir.dstu3.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(ContactPoint10_30.convertContactPoint(t1));
org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup();
root.setTitle(src.getTitle());
for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) {
root.addConcept(Coding10_30.convertCoding(t));
}
for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP)
root.addGroup(convertQuestionnaireGroupComponent(t));
else
root.addQuestion(convertQuestionnaireQuestionComponent(t));
return tgt;
}
use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class Questionnaire14_40 method convertQuestionnaire.
public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.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_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt);
if (src.hasUrl())
tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement()));
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier14_40.convertIdentifier(t));
if (src.hasVersion())
tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
if (src.hasStatus())
tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
if (src.hasDate())
tgt.setDateElement(DateTime14_40.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String14_40.convertString(src.getPublisherElement()));
for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(ContactPoint14_40.convertContactPoint(t1));
for (UsageContext t : src.getUseContext()) tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t.getValueCodeableConcept()));
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t));
if (src.hasTitle())
tgt.setTitleElement(String14_40.convertString(src.getTitleElement()));
for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(Coding14_40.convertCoding(t));
for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
for (org.hl7.fhir.r4.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 Library30_50 method convertLibrary.
public static org.hl7.fhir.r5.model.Library convertLibrary(org.hl7.fhir.dstu3.model.Library src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.Library tgt = new org.hl7.fhir.r5.model.Library();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
if (src.hasUrl())
tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
if (src.hasVersion())
tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
if (src.hasName())
tgt.setNameElement(String30_50.convertString(src.getNameElement()));
if (src.hasTitle())
tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
if (src.hasStatus())
tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
if (src.hasExperimental())
tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
if (src.hasType())
tgt.setType(CodeableConcept30_50.convertCodeableConcept(src.getType()));
if (src.hasDate())
tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(ContactDetail30_50.convertContactDetail(t));
if (src.hasDescription())
tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
if (src.hasPurpose())
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
if (src.hasUsage())
tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
if (src.hasCopyright())
tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
if (src.hasApprovalDate())
tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
if (src.hasLastReviewDate())
tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
if (src.hasEffectivePeriod())
tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) {
if (t.getType() == ContributorType.AUTHOR)
for (ContactDetail c : t.getContact()) tgt.addAuthor(ContactDetail30_50.convertContactDetail(c));
if (t.getType() == ContributorType.EDITOR)
for (ContactDetail c : t.getContact()) tgt.addEditor(ContactDetail30_50.convertContactDetail(c));
if (t.getType() == ContributorType.REVIEWER)
for (ContactDetail c : t.getContact()) tgt.addReviewer(ContactDetail30_50.convertContactDetail(c));
if (t.getType() == ContributorType.ENDORSER)
for (ContactDetail c : t.getContact()) tgt.addEndorser(ContactDetail30_50.convertContactDetail(c));
}
for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
for (org.hl7.fhir.dstu3.model.ParameterDefinition t : src.getParameter()) tgt.addParameter(ParameterDefinition30_50.convertParameterDefinition(t));
for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getDataRequirement()) tgt.addDataRequirement(DataRequirement30_50.convertDataRequirement(t));
for (org.hl7.fhir.dstu3.model.Attachment t : src.getContent()) tgt.addContent(Attachment30_50.convertAttachment(t));
return tgt;
}
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, String genDate, ImplementationGuide ig, List<String> fhirVersion) throws FHIRException, IOException {
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());
npm.addProperty("tools-version", ToolsVersion.TOOLS_VERSION);
npm.addProperty("type", kind.getCode());
if (ig.hasLicense())
npm.addProperty("license", ig.getLicense().toCode());
npm.addProperty("canonical", canonical);
npm.addProperty("url", web);
if (ig.hasTitle())
npm.addProperty("title", ig.getTitle());
if (ig.hasDescription())
npm.addProperty("description", ig.getDescription() + " (built " + genDate + timezone() + ")");
if (kind != PackageType.CORE) {
JsonObject dep = new JsonObject();
npm.add("dependencies", dep);
for (String v : fhirVersion) {
// TODO: fix for multiple versions
dep.addProperty("hl7.fhir.core", 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;
}
use of org.hl7.fhir.r4b.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeContactDetail.
protected void composeContactDetail(Complex parent, String parentType, String name, ContactDetail element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeElement(t, "ContactDetail", name, element, index);
if (element.hasNameElement())
composeString(t, "ContactDetail", "name", element.getNameElement(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "ContactDetail", "telecom", element.getTelecom().get(i), i);
}
Aggregations