use of org.hl7.fhir.r5.model.ContactDetail in project kindling by HL7.
the class ProfileGenerator method makeSearchParam.
public SearchParameter makeSearchParam(StructureDefinition p, String id, String rn, SearchParameterDefn spd, ResourceDefn rd) throws Exception {
boolean shared;
boolean created = true;
SearchParameter sp;
if (definitions.getCommonSearchParameters().containsKey(rn + "::" + spd.getCode())) {
shared = true;
CommonSearchParameter csp = definitions.getCommonSearchParameters().get(rn + "::" + spd.getCode());
if (csp.getDefinition() == null) {
sp = new SearchParameter();
csp.setDefinition(sp);
sp.setId(csp.getId());
} else {
created = false;
sp = csp.getDefinition();
}
} else {
shared = false;
sp = new SearchParameter();
sp.setId(id.replace("[", "").replace("]", ""));
}
spd.setCommonId(sp.getId());
if (created) {
sp.setUrl("http://hl7.org/fhir/SearchParameter/" + sp.getId());
sp.setVersion(version.toCode());
if (context.getSearchParameter(sp.getUrl()) != null)
throw new Exception("Duplicated Search Parameter " + sp.getUrl());
context.cacheResource(sp);
spd.setResource(sp);
definitions.addNs(sp.getUrl(), "Search Parameter: " + sp.getName(), rn.toLowerCase() + ".html#search");
sp.setStatus(spd.getStandardsStatus() == StandardsStatus.NORMATIVE ? PublicationStatus.fromCode("active") : PublicationStatus.fromCode("draft"));
StandardsStatus sst = ToolingExtensions.getStandardsStatus(sp);
if (sst == null || (spd.getStandardsStatus() == null && spd.getStandardsStatus().isLowerThan(sst)))
ToolingExtensions.setStandardsStatus(sp, spd.getStandardsStatus(), spd.getNormativeVersion());
sp.setExperimental(p.getExperimental());
sp.setName(spd.getCode());
sp.setCode(spd.getCode());
sp.setDate(genDate.getTime());
sp.setPublisher(p.getPublisher());
for (ContactDetail tc : p.getContact()) {
ContactDetail t = sp.addContact();
if (tc.hasNameElement())
t.setNameElement(tc.getNameElement().copy());
for (ContactPoint ts : tc.getTelecom()) t.getTelecom().add(ts.copy());
}
if (!definitions.hasResource(p.getType()) && !p.getType().equals("Resource") && !p.getType().equals("DomainResource"))
throw new Exception("unknown resource type " + p.getType());
sp.setType(getSearchParamType(spd.getType()));
if (sp.getType() == SearchParamType.REFERENCE && spd.isHierarchy()) {
sp.addModifier(SearchParameter.SearchModifierCode.BELOW);
sp.addModifier(SearchParameter.SearchModifierCode.ABOVE);
}
if (shared) {
sp.setDescription("Multiple Resources: \r\n\r\n* [" + rn + "](" + rn.toLowerCase() + ".html): " + spd.getDescription() + "\r\n");
} else
sp.setDescription(preProcessMarkdown(spd.getDescription(), "Search Description"));
if (!Utilities.noString(spd.getExpression()))
sp.setExpression(spd.getExpression());
// addModifiers(sp);
addComparators(sp);
String xpath = Utilities.noString(spd.getXPath()) ? new XPathQueryGenerator(this.definitions, null, null).generateXpath(spd.getPaths(), rn) : spd.getXPath();
if (xpath != null) {
if (xpath.contains("[x]"))
xpath = convertToXpath(xpath);
sp.setXpath(xpath);
sp.setXpathUsage(spd.getxPathUsage());
}
if (sp.getType() == SearchParamType.COMPOSITE) {
for (CompositeDefinition cs : spd.getComposites()) {
SearchParameterDefn cspd = findSearchParameter(rd, cs.getDefinition());
if (cspd != null)
sp.addComponent().setExpression(cs.getExpression()).setDefinition(cspd.getUrl());
else
sp.addComponent().setExpression(cs.getExpression()).setDefinition("http://hl7.org/fhir/SearchParameter/" + rn + "-" + cs.getDefinition());
}
sp.setMultipleOr(false);
}
sp.addBase(p.getType());
} else {
if (sp.getType() != getSearchParamType(spd.getType()))
throw new FHIRException("Type mismatch on common parameter: expected " + sp.getType().toCode() + " but found " + getSearchParamType(spd.getType()).toCode());
if (!sp.getDescription().contains("[" + rn + "](" + rn.toLowerCase() + ".html)"))
sp.setDescription(sp.getDescription() + "* [" + rn + "](" + rn.toLowerCase() + ".html): " + spd.getDescription() + "\r\n");
// ext.addExtension("description", new MarkdownType(spd.getDescription()));
if (!Utilities.noString(spd.getExpression()) && !sp.getExpression().contains(spd.getExpression()))
sp.setExpression(sp.getExpression() + " | " + spd.getExpression());
String xpath = new XPathQueryGenerator(this.definitions, null, null).generateXpath(spd.getPaths(), rn);
if (xpath != null) {
if (xpath.contains("[x]"))
xpath = convertToXpath(xpath);
if (sp.getXpath() != null && !sp.getXpath().contains(xpath))
sp.setXpath(sp.getXpath() + " | " + xpath);
if (sp.getXpathUsage() != spd.getxPathUsage())
throw new FHIRException("Usage mismatch on common parameter: expected " + sp.getXpathUsage().toCode() + " but found " + spd.getxPathUsage().toCode());
}
boolean found = false;
for (CodeType ct : sp.getBase()) found = found || p.getType().equals(ct.asStringValue());
if (!found)
sp.addBase(p.getType());
}
spd.setUrl(sp.getUrl());
for (String target : spd.getWorkingTargets()) {
if ("Any".equals(target) == true) {
for (String resourceName : definitions.sortedResourceNames()) {
boolean found = false;
for (CodeType st : sp.getTarget()) found = found || st.asStringValue().equals(resourceName);
if (!found)
sp.addTarget(resourceName);
}
} else {
boolean found = false;
for (CodeType st : sp.getTarget()) found = found || st.asStringValue().equals(target);
if (!found)
sp.addTarget(target);
}
}
return sp;
}
use of org.hl7.fhir.r5.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class Questionnaire10_50 method convertQuestionnaire.
public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.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_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt);
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_50.convertIdentifier(t));
if (src.hasVersionElement())
tgt.setVersionElement(String10_50.convertString(src.getVersionElement()));
if (src.hasStatus())
tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
if (src.hasDate())
tgt.setDateElement(DateTime10_50.convertDateTime(src.getDateElement()));
if (src.hasPublisherElement())
tgt.setPublisherElement(String10_50.convertString(src.getPublisherElement()));
for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(ContactPoint10_50.convertContactPoint(t1));
org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup();
root.setTitle(src.getTitle());
for (org.hl7.fhir.r5.model.Coding t : src.getCode()) {
root.addConcept(Coding10_50.convertCoding(t));
}
for (CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP)
root.addGroup(convertQuestionnaireGroupComponent(t));
else
root.addQuestion(convertQuestionnaireQuestionComponent(t));
return tgt;
}
use of org.hl7.fhir.r5.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class ActivityDefinition30_50 method convertActivityDefinition.
public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition();
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.hasDate())
tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
if (src.hasDescription())
tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
if (src.hasPurpose())
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
if (src.hasUsage())
tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
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.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));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) tgt.addTopic(CodeableConcept30_50.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_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.ContactDetail t : src.getContact()) tgt.addContact(ContactDetail30_50.convertContactDetail(t));
if (src.hasCopyright())
tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) tgt.getLibrary().add(Reference30_50.convertReferenceToCanonical(t));
if (src.hasKind())
tgt.setKindElement(convertActivityDefinitionKind(src.getKindElement()));
if (src.hasCode())
tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
if (src.hasTiming())
tgt.setTiming(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTiming()));
if (src.hasLocation())
tgt.setLocation(new CodeableReference(Reference30_50.convertReference(src.getLocation())));
for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
if (src.hasProduct())
tgt.setProduct(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getProduct()));
if (src.hasQuantity())
tgt.setQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getQuantity()));
for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage30_50.convertDosage(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) tgt.addBodySite(CodeableConcept30_50.convertCodeableConcept(t));
if (src.hasTransform())
tgt.setTransformElement(Reference30_50.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.r5.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class Library30_40 method convertLibrary.
public static org.hl7.fhir.r4.model.Library convertLibrary(org.hl7.fhir.dstu3.model.Library src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.Library tgt = new org.hl7.fhir.r4.model.Library();
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.hasType())
tgt.setType(CodeableConcept30_40.convertCodeableConcept(src.getType()));
if (src.hasDateElement())
tgt.setDateElement(DateTime30_40.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String30_40.convertString(src.getPublisherElement()));
for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) tgt.addContact(ContactDetail30_40.convertContactDetail(t));
if (src.hasDescription())
tgt.setDescriptionElement(MarkDown30_40.convertMarkdown(src.getDescriptionElement()));
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));
if (src.hasPurpose())
tgt.setPurposeElement(MarkDown30_40.convertMarkdown(src.getPurposeElement()));
if (src.hasUsage())
tgt.setUsageElement(String30_40.convertString(src.getUsageElement()));
if (src.hasCopyright())
tgt.setCopyrightElement(MarkDown30_40.convertMarkdown(src.getCopyrightElement()));
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.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.RelatedArtifact t : src.getRelatedArtifact()) tgt.addRelatedArtifact(RelatedArtifact30_40.convertRelatedArtifact(t));
for (org.hl7.fhir.dstu3.model.ParameterDefinition t : src.getParameter()) tgt.addParameter(ParameterDefinition30_40.convertParameterDefinition(t));
for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getDataRequirement()) tgt.addDataRequirement(TriggerDefinition30_40.convertDataRequirement(t));
for (org.hl7.fhir.dstu3.model.Attachment t : src.getContent()) tgt.addContent(Attachment30_40.convertAttachment(t));
return tgt;
}
use of org.hl7.fhir.r5.model.ContactDetail in project org.hl7.fhir.core by hapifhir.
the class PlanDefinition30_40 method convertPlanDefinition.
public static org.hl7.fhir.r4.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.PlanDefinition tgt = new org.hl7.fhir.r4.model.PlanDefinition();
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.hasType())
tgt.setType(CodeableConcept30_40.convertCodeableConcept(src.getType()));
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));
for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) tgt.addGoal(convertPlanDefinitionGoalComponent(t));
for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) tgt.addAction(convertPlanDefinitionActionComponent(t));
return tgt;
}
Aggregations