use of org.hl7.fhir.dstu3.model.Timing in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeDeviceUseRequest.
protected void composeDeviceUseRequest(Complex parent, String parentType, String name, DeviceUseRequest element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "DeviceUseRequest", name, element, index);
if (element.hasBodySite())
composeType(t, "DeviceUseRequest", "bodySite", element.getBodySite(), -1);
if (element.hasStatusElement())
composeEnum(t, "DeviceUseRequest", "status", element.getStatusElement(), -1);
if (element.hasDevice())
composeReference(t, "DeviceUseRequest", "device", element.getDevice(), -1);
if (element.hasEncounter())
composeReference(t, "DeviceUseRequest", "encounter", element.getEncounter(), -1);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "DeviceUseRequest", "identifier", element.getIdentifier().get(i), i);
for (int i = 0; i < element.getIndication().size(); i++) composeCodeableConcept(t, "DeviceUseRequest", "indication", element.getIndication().get(i), i);
for (int i = 0; i < element.getNotes().size(); i++) composeString(t, "DeviceUseRequest", "notes", element.getNotes().get(i), i);
for (int i = 0; i < element.getPrnReason().size(); i++) composeCodeableConcept(t, "DeviceUseRequest", "prnReason", element.getPrnReason().get(i), i);
if (element.hasOrderedOnElement())
composeDateTime(t, "DeviceUseRequest", "orderedOn", element.getOrderedOnElement(), -1);
if (element.hasRecordedOnElement())
composeDateTime(t, "DeviceUseRequest", "recordedOn", element.getRecordedOnElement(), -1);
if (element.hasSubject())
composeReference(t, "DeviceUseRequest", "subject", element.getSubject(), -1);
if (element.hasTiming())
composeType(t, "DeviceUseRequest", "timing", element.getTiming(), -1);
if (element.hasPriorityElement())
composeEnum(t, "DeviceUseRequest", "priority", element.getPriorityElement(), -1);
}
use of org.hl7.fhir.dstu3.model.Timing in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeTiming.
protected void composeTiming(Complex parent, String parentType, String name, Timing element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeElement(t, "Timing", name, element, index);
for (int i = 0; i < element.getEvent().size(); i++) composeDateTime(t, "Timing", "event", element.getEvent().get(i), i);
if (element.hasRepeat())
composeTimingTimingRepeatComponent(t, "Timing", "repeat", element.getRepeat(), -1);
if (element.hasCode())
composeCodeableConcept(t, "Timing", "code", element.getCode(), -1);
}
use of org.hl7.fhir.dstu3.model.Timing in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeRequestGroupRequestGroupActionComponent.
protected void composeRequestGroupRequestGroupActionComponent(Complex parent, String parentType, String name, RequestGroup.RequestGroupActionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "action", name, element, index);
if (element.hasLabelElement())
composeString(t, "RequestGroup", "label", element.getLabelElement(), -1);
if (element.hasTitleElement())
composeString(t, "RequestGroup", "title", element.getTitleElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "RequestGroup", "description", element.getDescriptionElement(), -1);
if (element.hasTextEquivalentElement())
composeString(t, "RequestGroup", "textEquivalent", element.getTextEquivalentElement(), -1);
for (int i = 0; i < element.getCode().size(); i++) composeCodeableConcept(t, "RequestGroup", "code", element.getCode().get(i), i);
for (int i = 0; i < element.getDocumentation().size(); i++) composeRelatedArtifact(t, "RequestGroup", "documentation", element.getDocumentation().get(i), i);
for (int i = 0; i < element.getCondition().size(); i++) composeRequestGroupRequestGroupActionConditionComponent(t, "RequestGroup", "condition", element.getCondition().get(i), i);
for (int i = 0; i < element.getRelatedAction().size(); i++) composeRequestGroupRequestGroupActionRelatedActionComponent(t, "RequestGroup", "relatedAction", element.getRelatedAction().get(i), i);
if (element.hasTiming())
composeType(t, "RequestGroup", "timing", element.getTiming(), -1);
for (int i = 0; i < element.getParticipant().size(); i++) composeReference(t, "RequestGroup", "participant", element.getParticipant().get(i), i);
if (element.hasType())
composeCoding(t, "RequestGroup", "type", element.getType(), -1);
if (element.hasGroupingBehaviorElement())
composeEnum(t, "RequestGroup", "groupingBehavior", element.getGroupingBehaviorElement(), -1);
if (element.hasSelectionBehaviorElement())
composeEnum(t, "RequestGroup", "selectionBehavior", element.getSelectionBehaviorElement(), -1);
if (element.hasRequiredBehaviorElement())
composeEnum(t, "RequestGroup", "requiredBehavior", element.getRequiredBehaviorElement(), -1);
if (element.hasPrecheckBehaviorElement())
composeEnum(t, "RequestGroup", "precheckBehavior", element.getPrecheckBehaviorElement(), -1);
if (element.hasCardinalityBehaviorElement())
composeEnum(t, "RequestGroup", "cardinalityBehavior", element.getCardinalityBehaviorElement(), -1);
if (element.hasResource())
composeReference(t, "RequestGroup", "resource", element.getResource(), -1);
for (int i = 0; i < element.getAction().size(); i++) composeRequestGroupRequestGroupActionComponent(t, "RequestGroup", "action", element.getAction().get(i), i);
}
use of org.hl7.fhir.dstu3.model.Timing in project org.hl7.fhir.core by hapifhir.
the class InstanceValidator method checkTiming.
private void checkTiming(List<ValidationMessage> errors, String path, Element focus, Timing fixed, String fixedSource, boolean pattern) {
checkFixedValue(errors, path + ".repeat", focus.getNamedChild("repeat"), fixed.getRepeat(), fixedSource, "value", focus, pattern);
List<Element> events = new ArrayList<Element>();
focus.getNamedChildren("event", events);
if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, events.size() == fixed.getEvent().size(), I18nConstants.BUNDLE_MSG_EVENT_COUNT, Integer.toString(fixed.getEvent().size()), Integer.toString(events.size()))) {
for (int i = 0; i < events.size(); i++) checkFixedValue(errors, path + ".event", events.get(i), fixed.getEvent().get(i), fixedSource, "event", focus, pattern);
}
}
use of org.hl7.fhir.dstu3.model.Timing in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method displayLeaf.
private boolean displayLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, String name, boolean showCodeDetails) throws FHIRException, UnsupportedEncodingException, IOException {
if (ew == null)
return false;
Base e = ew.getBase();
Map<String, String> displayHints = readDisplayHints(defn);
if (name.endsWith("[x]"))
name = name.substring(0, name.length() - 3);
if (!showCodeDetails && e instanceof PrimitiveType && isDefault(displayHints, ((PrimitiveType) e)))
return false;
if (e instanceof StringType) {
x.addText(name + ": " + ((StringType) e).getValue());
return true;
} else if (e instanceof CodeType) {
x.addText(name + ": " + ((CodeType) e).getValue());
return true;
} else if (e instanceof IdType) {
x.addText(name + ": " + ((IdType) e).getValue());
return true;
} else if (e instanceof DateTimeType) {
x.addText(name + ": " + ((DateTimeType) e).toHumanDisplay());
return true;
} else if (e instanceof InstantType) {
x.addText(name + ": " + ((InstantType) e).toHumanDisplay());
return true;
} else if (e instanceof Extension) {
x.addText("Extensions: todo");
return true;
} else if (e instanceof org.hl7.fhir.dstu2.model.DateType) {
x.addText(name + ": " + ((org.hl7.fhir.dstu2.model.DateType) e).toHumanDisplay());
return true;
} else if (e instanceof Enumeration) {
// todo: look up a display name if there is one
x.addText(((Enumeration<?>) e).getValue().toString());
return true;
} else if (e instanceof BooleanType) {
if (((BooleanType) e).getValue()) {
x.addText(name);
return true;
}
} else if (e instanceof CodeableConcept) {
renderCodeableConcept((CodeableConcept) e, x, showCodeDetails);
return true;
} else if (e instanceof Coding) {
renderCoding((Coding) e, x, showCodeDetails);
return true;
} else if (e instanceof Annotation) {
renderAnnotation((Annotation) e, x, showCodeDetails);
return true;
} else if (e instanceof org.hl7.fhir.dstu2.model.IntegerType) {
x.addText(Integer.toString(((org.hl7.fhir.dstu2.model.IntegerType) e).getValue()));
return true;
} else if (e instanceof org.hl7.fhir.dstu2.model.DecimalType) {
x.addText(((org.hl7.fhir.dstu2.model.DecimalType) e).getValue().toString());
return true;
} else if (e instanceof Identifier) {
renderIdentifier((Identifier) e, x);
return true;
} else if (e instanceof HumanName) {
renderHumanName((HumanName) e, x);
return true;
} else if (e instanceof SampledData) {
renderSampledData((SampledData) e, x);
return true;
} else if (e instanceof Address) {
renderAddress((Address) e, x);
return true;
} else if (e instanceof ContactPoint) {
renderContactPoint((ContactPoint) e, x);
return true;
} else if (e instanceof Timing) {
renderTiming((Timing) e, x);
return true;
} else if (e instanceof Quantity) {
renderQuantity((Quantity) e, x, showCodeDetails);
return true;
} else if (e instanceof Ratio) {
renderQuantity(((Ratio) e).getNumerator(), x, showCodeDetails);
x.addText("/");
renderQuantity(((Ratio) e).getDenominator(), x, showCodeDetails);
return true;
} else if (e instanceof Period) {
Period p = (Period) e;
x.addText(name + ": ");
x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay());
x.addText(" --> ");
x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
return true;
} else if (e instanceof Reference) {
Reference r = (Reference) e;
if (r.hasDisplayElement())
x.addText(r.getDisplay());
else if (r.hasReferenceElement()) {
ResourceWithReference tr = resolveReference(res, r.getReference());
// getDisplayForReference(tr.getReference()));
x.addText(tr == null ? r.getReference() : "????");
} else
x.addText("??");
return true;
} else if (e instanceof Narrative) {
return false;
} else if (e instanceof Resource) {
return false;
} else if (!(e instanceof Attachment))
throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
return false;
}
Aggregations