org.hl7.fhir.exceptions.FHIRException Java Examples
The following examples show how to use
org.hl7.fhir.exceptions.FHIRException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RequestGroup40_50.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> convertActionConditionKind(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind> src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionConditionKindEnumFactory()); VersionConvertor_40_50.copyElement(src, tgt); switch(src.getValue()) { case APPLICABILITY: tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.APPLICABILITY); break; case START: tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.START); break; case STOP: tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.STOP); break; default: tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.NULL); break; } return tgt; }
Example #2
Source File: StructureMapUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public StructureDefinition getTargetType(StructureMap map) throws FHIRException { boolean found = false; StructureDefinition res = null; for (StructureMapStructureComponent uses : map.getStructure()) { if (uses.getMode() == StructureMapModelMode.TARGET) { if (found) throw new FHIRException("Multiple targets found in map "+map.getUrl()); found = true; res = worker.fetchResource(StructureDefinition.class, uses.getUrl()); if (res == null) throw new FHIRException("Unable to find "+uses.getUrl()+" referenced from map "+map.getUrl()); } } if (res == null) throw new FHIRException("No targets found in map "+map.getUrl()); return res; }
Example #3
Source File: VisionPrescription40_50.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.VisionPrescription.VisionBase> convertVisionBase(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.VisionPrescription.VisionBase> src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.VisionPrescription.VisionBase> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.VisionPrescription.VisionBaseEnumFactory()); VersionConvertor_40_50.copyElement(src, tgt); switch(src.getValue()) { case UP: tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.UP); break; case DOWN: tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.DOWN); break; case IN: tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.IN); break; case OUT: tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.OUT); break; default: tgt.setValue(org.hl7.fhir.r4.model.VisionPrescription.VisionBase.NULL); break; } return tgt; }
Example #4
Source File: DeviceMetric.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public Enumeration<DeviceMetricCategory> fromType(Base code) throws FHIRException { if (code == null) return null; if (code.isEmpty()) return new Enumeration<DeviceMetricCategory>(this); String codeString = ((PrimitiveType) code).asStringValue(); if (codeString == null || "".equals(codeString)) return null; if ("measurement".equals(codeString)) return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.MEASUREMENT); if ("setting".equals(codeString)) return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.SETTING); if ("calculation".equals(codeString)) return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.CALCULATION); if ("unspecified".equals(codeString)) return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.UNSPECIFIED); throw new FHIRException("Unknown DeviceMetricCategory code '"+codeString+"'"); }
Example #5
Source File: PlanDefinition30_40.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior> convertActionRequiredBehavior(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior> src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehaviorEnumFactory()); VersionConvertor_30_40.copyElement(src, tgt); switch(src.getValue()) { case MUST: tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST); break; case COULD: tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD); break; case MUSTUNLESSDOCUMENTED: tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED); break; default: tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL); break; } return tgt; }
Example #6
Source File: SupplyRequest.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public Enumeration<SupplyRequestStatus> fromType(Base code) throws FHIRException { if (code == null) return null; if (code.isEmpty()) return new Enumeration<SupplyRequestStatus>(this); String codeString = ((PrimitiveType) code).asStringValue(); if (codeString == null || "".equals(codeString)) return null; if ("draft".equals(codeString)) return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.DRAFT); if ("active".equals(codeString)) return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.ACTIVE); if ("suspended".equals(codeString)) return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.SUSPENDED); if ("cancelled".equals(codeString)) return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.CANCELLED); if ("completed".equals(codeString)) return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.COMPLETED); if ("entered-in-error".equals(codeString)) return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.ENTEREDINERROR); if ("unknown".equals(codeString)) return new Enumeration<SupplyRequestStatus>(this, SupplyRequestStatus.UNKNOWN); throw new FHIRException("Unknown SupplyRequestStatus code '"+codeString+"'"); }
Example #7
Source File: AuditEvent.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { switch (_hash) { case 3575610: /*type*/ return new Property("type", "Coding", "Identifier for a family of the event. For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function.", 0, 1, type); case -1867567750: /*subtype*/ return new Property("subtype", "Coding", "Identifier for the category of event.", 0, java.lang.Integer.MAX_VALUE, subtype); case -1422950858: /*action*/ return new Property("action", "code", "Indicator for type of action performed during the event that generated the audit.", 0, 1, action); case -799233872: /*recorded*/ return new Property("recorded", "instant", "The time when the event occurred on the source.", 0, 1, recorded); case -1106507950: /*outcome*/ return new Property("outcome", "code", "Indicates whether the event succeeded or failed.", 0, 1, outcome); case 1062502659: /*outcomeDesc*/ return new Property("outcomeDesc", "string", "A free text description of the outcome of the event.", 0, 1, outcomeDesc); case -341917691: /*purposeOfEvent*/ return new Property("purposeOfEvent", "CodeableConcept", "The purposeOfUse (reason) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, purposeOfEvent); case 92750597: /*agent*/ return new Property("agent", "", "An actor taking an active role in the event or activity that is logged.", 0, java.lang.Integer.MAX_VALUE, agent); case -896505829: /*source*/ return new Property("source", "", "The system that is reporting the event.", 0, 1, source); case -1298275357: /*entity*/ return new Property("entity", "", "Specific instances of data or objects that have been accessed.", 0, java.lang.Integer.MAX_VALUE, entity); default: return super.getNamedProperty(_hash, _name, _checkValid); } }
Example #8
Source File: Element.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public void setChildValue(String name, String value) { if (children == null) children = new ArrayList<Element>(); for (Element child : children) { if (name.equals(child.getName())) { if (!child.isPrimitive()) throw new Error("Cannot set a value of a non-primitive type ("+name+" on "+this.getName()+")"); child.setValue(value); } } try { setProperty(name.hashCode(), name, new StringType(value)); } catch (FHIRException e) { throw new Error(e); } }
Example #9
Source File: Communication40_50.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); copyElement(src, tgt); if (src.hasContent()) { if (src.getContent() instanceof StringType) { CodeableConcept tgtc = new CodeableConcept(); copyElement(src.getContent(), tgtc); tgtc.setText(src.getContentStringType().getValue()); tgt.setContent(tgtc); } else { if (src.hasContent()) tgt.setContent(convertType(src.getContent())); } } return tgt; }
Example #10
Source File: NUCCConvertor.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public void execute() throws IOException, FHIRException { CSVReader csv = new CSVReader(new FileInputStream("c:\\temp\\nucc.csv")); CodeSystem cs = new CodeSystem(); cs.setId("nucc-provider-taxonomy"); cs.setUrl("http://nucc.org/provider-taxonomy"); cs.setName("NUCC Provider Taxonomy"); cs.setDateElement(new DateTimeType()); cs.setDescription("The Health Care Provider Taxonomy code is a unique alphanumeric code, ten characters in length. The code set is structured into three distinct 'Levels' including Provider Type, Classification, and Area of Specialization"); cs.setCopyright("See NUCC copyright statement"); cs.setStatus(PublicationStatus.ACTIVE); cs.setContent(CodeSystemContentMode.COMPLETE); cs.setExperimental(false); cs.setValueSet("http://hl7.org/fhir/ValueSet/nucc-provider-taxonomy"); cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH); csv.parseLine(); while (csv.ready()) { String[] values = csv.parseLine(); processLine(cs, values); } csv.close(); new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\nucc.xml"), cs); }
Example #11
Source File: Bundle.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static BundleType fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) return null; if ("document".equals(codeString)) return DOCUMENT; if ("message".equals(codeString)) return MESSAGE; if ("transaction".equals(codeString)) return TRANSACTION; if ("transaction-response".equals(codeString)) return TRANSACTIONRESPONSE; if ("batch".equals(codeString)) return BATCH; if ("batch-response".equals(codeString)) return BATCHRESPONSE; if ("history".equals(codeString)) return HISTORY; if ("searchset".equals(codeString)) return SEARCHSET; if ("collection".equals(codeString)) return COLLECTION; throw new FHIRException("Unknown BundleType code '"+codeString+"'"); }
Example #12
Source File: Appointment.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public Enumeration<ParticipationStatus> fromType(Base code) throws FHIRException { if (code == null) return null; if (code.isEmpty()) return new Enumeration<ParticipationStatus>(this); String codeString = ((PrimitiveType) code).asStringValue(); if (codeString == null || "".equals(codeString)) return null; if ("accepted".equals(codeString)) return new Enumeration<ParticipationStatus>(this, ParticipationStatus.ACCEPTED); if ("declined".equals(codeString)) return new Enumeration<ParticipationStatus>(this, ParticipationStatus.DECLINED); if ("tentative".equals(codeString)) return new Enumeration<ParticipationStatus>(this, ParticipationStatus.TENTATIVE); if ("needs-action".equals(codeString)) return new Enumeration<ParticipationStatus>(this, ParticipationStatus.NEEDSACTION); throw new FHIRException("Unknown ParticipationStatus code '"+codeString+"'"); }
Example #13
Source File: Signature.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case 3575610: // type this.getType().add(castToCoding(value)); // Coding return value; case 3648314: // when this.when = castToInstant(value); // InstantType return value; case 117694: // who this.who = castToType(value); // Type return value; case -14402964: // onBehalfOf this.onBehalfOf = castToType(value); // Type return value; case -389131437: // contentType this.contentType = castToCode(value); // CodeType return value; case 3026845: // blob this.blob = castToBase64Binary(value); // Base64BinaryType return value; default: return super.setProperty(hash, name, value); } }
Example #14
Source File: MessageHeader.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public Base addChild(String name) throws FHIRException { if (name.equals("name")) { throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.name"); } else if (name.equals("software")) { throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.software"); } else if (name.equals("version")) { throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.version"); } else if (name.equals("contact")) { this.contact = new ContactPoint(); return this.contact; } else if (name.equals("endpoint")) { throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.endpoint"); } else return super.addChild(name); }
Example #15
Source File: CSVReader.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public String cell(String name) { int index = -1; for (int i = 0; i < cols.length; i++) { if (name.equals(cols[i].trim())) index = i; } if (index == -1) throw new FHIRException("no cell "+name); String s = cells.length >= index ? cells[index] : null; if (Utilities.noString(s)) return null; if (s.startsWith("\"") && s.endsWith("\"")) { return s.substring(1, s.length()-2); } else { return s; } }
Example #16
Source File: Dosage.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case 1349547969: return getSequenceElement(); case 3556653: return getTextElement(); case 1623641575: return addAdditionalInstruction(); case 737543241: return getPatientInstructionElement(); case -873664438: return getTiming(); case -544329575: return getAsNeeded(); case -1432923513: return getAsNeeded(); case 3530567: return getSite(); case 108704329: return getRoute(); case -1077554975: return getMethod(); case -611024774: return addDoseAndRate(); case 1506263709: return getMaxDosePerPeriod(); case 2004889914: return getMaxDosePerAdministration(); case 642099621: return getMaxDosePerLifetime(); default: return super.makeProperty(hash, name); } }
Example #17
Source File: SubstancePolymer.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case 299066663: // material this.material = castToCodeableConcept(value); // CodeableConcept return value; case 3575610: // type this.type = castToCodeableConcept(value); // CodeableConcept return value; case -141812990: // isDefining this.isDefining = castToBoolean(value); // BooleanType return value; case -1413853096: // amount this.amount = castToSubstanceAmount(value); // SubstanceAmount return value; default: return super.setProperty(hash, name, value); } }
Example #18
Source File: StructureMap14_50.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); VersionConvertor_14_50.copyElement(src, tgt); if (src.hasContext()) tgt.setContextElement(VersionConvertor_14_50.convertId(src.getContextElement())); if (src.hasContextType()) tgt.setContextTypeElement(convertStructureMapContextType(src.getContextTypeElement())); if (src.hasElement()) tgt.setElementElement(VersionConvertor_14_50.convertString(src.getElementElement())); if (src.hasVariable()) tgt.setVariableElement(VersionConvertor_14_50.convertId(src.getVariableElement())); tgt.setListMode(src.getListMode().stream() .map(StructureMap14_50::convertStructureMapTargetListMode) .collect(Collectors.toList())); if (src.hasListRuleId()) tgt.setListRuleIdElement(VersionConvertor_14_50.convertId(src.getListRuleIdElement())); if (src.hasTransform()) tgt.setTransformElement(convertStructureMapTransform(src.getTransformElement())); for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); return tgt; }
Example #19
Source File: Bundle40_50.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); copyElement(src, tgt); for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t)); if (src.hasFullUrl()) tgt.setFullUrlElement(convertUri(src.getFullUrlElement())); if (src.hasResource()) tgt.setResource(convertResource(src.getResource())); if (src.hasSearch()) tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); if (src.hasRequest()) tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); if (src.hasResponse()) tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); return tgt; }
Example #20
Source File: CommunicationRequest.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { switch (hash) { case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type default: return super.getProperty(hash, name, checkValid); } }
Example #21
Source File: MessageHeader.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case 3373707: return getNameElement(); case 1319330215: return getSoftwareElement(); case 351608024: return getVersionElement(); case 951526432: return getContact(); case 1741102485: return getEndpointElement(); default: return super.makeProperty(hash, name); } }
Example #22
Source File: SupplyRequest40_50.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus> convertSupplyRequestStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus> src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatusEnumFactory()); VersionConvertor_40_50.copyElement(src, tgt); switch(src.getValue()) { case DRAFT: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.DRAFT); break; case ACTIVE: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.ACTIVE); break; case SUSPENDED: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.SUSPENDED); break; case CANCELLED: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED); break; case COMPLETED: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.COMPLETED); break; case ENTEREDINERROR: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.ENTEREDINERROR); break; case UNKNOWN: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.UNKNOWN); break; default: tgt.setValue(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.NULL); break; } return tgt; }
Example #23
Source File: Address.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case 116103: // use value = new AddressUseEnumFactory().fromType(TypeConvertor.castToCode(value)); this.use = (Enumeration) value; // Enumeration<AddressUse> return value; case 3575610: // type value = new AddressTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); this.type = (Enumeration) value; // Enumeration<AddressType> return value; case 3556653: // text this.text = TypeConvertor.castToString(value); // StringType return value; case 3321844: // line this.getLine().add(TypeConvertor.castToString(value)); // StringType return value; case 3053931: // city this.city = TypeConvertor.castToString(value); // StringType return value; case 288961422: // district this.district = TypeConvertor.castToString(value); // StringType return value; case 109757585: // state this.state = TypeConvertor.castToString(value); // StringType return value; case 2011152728: // postalCode this.postalCode = TypeConvertor.castToString(value); // StringType return value; case 957831062: // country this.country = TypeConvertor.castToString(value); // StringType return value; case -991726143: // period this.period = TypeConvertor.castToPeriod(value); // Period return value; default: return super.setProperty(hash, name, value); } }
Example #24
Source File: QuestionnaireBuilder.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private void addSimpleQuantityQuestions(QuestionnaireItemComponent group, ElementDefinition element, String path, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups) throws FHIRException { ToolingExtensions.addFhirType(group, "Quantity"); addQuestion(group, QuestionnaireItemType.DECIMAL, path, "value", "value:", answerGroups); addQuestion(group, QuestionnaireItemType.STRING, path, "units", "units:", answerGroups); addQuestion(group, QuestionnaireItemType.STRING, path, "code", "coded units:", answerGroups); addQuestion(group, QuestionnaireItemType.STRING, path, "system", "units system:", answerGroups); }
Example #25
Source File: NamingSystem.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static NamingSystemType fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) return null; if ("codesystem".equals(codeString)) return CODESYSTEM; if ("identifier".equals(codeString)) return IDENTIFIER; if ("root".equals(codeString)) return ROOT; if (Configuration.isAcceptInvalidEnums()) return null; else throw new FHIRException("Unknown NamingSystemType code '"+codeString+"'"); }
Example #26
Source File: VerificationResult.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("target")) { this.getTarget().add(TypeConvertor.castToReference(value)); } else if (name.equals("targetLocation")) { this.getTargetLocation().add(TypeConvertor.castToString(value)); } else if (name.equals("need")) { this.need = TypeConvertor.castToCodeableConcept(value); // CodeableConcept } else if (name.equals("status")) { value = new StatusEnumFactory().fromType(TypeConvertor.castToCode(value)); this.status = (Enumeration) value; // Enumeration<Status> } else if (name.equals("statusDate")) { this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType } else if (name.equals("validationType")) { this.validationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept } else if (name.equals("validationProcess")) { this.getValidationProcess().add(TypeConvertor.castToCodeableConcept(value)); } else if (name.equals("frequency")) { this.frequency = TypeConvertor.castToTiming(value); // Timing } else if (name.equals("lastPerformed")) { this.lastPerformed = TypeConvertor.castToDateTime(value); // DateTimeType } else if (name.equals("nextScheduled")) { this.nextScheduled = TypeConvertor.castToDate(value); // DateType } else if (name.equals("failureAction")) { this.failureAction = TypeConvertor.castToCodeableConcept(value); // CodeableConcept } else if (name.equals("primarySource")) { this.getPrimarySource().add((VerificationResultPrimarySourceComponent) value); } else if (name.equals("attestation")) { this.attestation = (VerificationResultAttestationComponent) value; // VerificationResultAttestationComponent } else if (name.equals("validator")) { this.getValidator().add((VerificationResultValidatorComponent) value); } else return super.setProperty(name, value); return value; }
Example #27
Source File: Substance.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { switch (hash) { case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier case -1289159373: /*expiry*/ return this.expiry == null ? new Base[0] : new Base[] {this.expiry}; // DateTimeType case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity default: return super.getProperty(hash, name, checkValid); } }
Example #28
Source File: AllergyIntolerance.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static AllergyIntoleranceType fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) return null; if ("allergy".equals(codeString)) return ALLERGY; if ("intolerance".equals(codeString)) return INTOLERANCE; if (Configuration.isAcceptInvalidEnums()) return null; else throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'"); }
Example #29
Source File: Organization10_30.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); VersionConvertor_10_30.copyElement(src, tgt); if (src.hasPurpose()) tgt.setPurpose(VersionConvertor_10_30.convertCodeableConcept(src.getPurpose())); if (src.hasName()) tgt.setName(VersionConvertor_10_30.convertHumanName(src.getName())); for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_10_30.convertContactPoint(t)); if (src.hasAddress()) tgt.setAddress(VersionConvertor_10_30.convertAddress(src.getAddress())); return tgt; }
Example #30
Source File: ImplementationGuide.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * @return {@link #source} (Where this resource is found.) */ public Reference getSourceReference() throws FHIRException { if (this.source == null) return null; if (!(this.source instanceof Reference)) throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.source.getClass().getName()+" was encountered"); return (Reference) this.source; }