private void addQuantity(ResourceTable theEntity, HashSet<ResourceIndexedSearchParamQuantity> retVal, String resourceName, Quantity nextValue) { if (!nextValue.getValueElement().isEmpty()) { BigDecimal nextValueValue = nextValue.getValueElement().getValue(); String nextValueString = nextValue.getSystemElement().getValueAsString(); String nextValueCode = nextValue.getCode(); ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValueValue, nextValueString, nextValueCode); nextEntity.setResource(theEntity); retVal.add(nextEntity); } }
private void checkQuantity(List<ValidationMessage> errors, String path, Element focus, Quantity fixed) { checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator", focus); checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units", focus); checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); }
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case 111972721: return getValueElement(); case -844673834: return getComparatorElement(); case 3594628: return getUnitElement(); case -887328209: return getSystemElement(); case 3059181: return getCodeElement(); default: return super.makeProperty(hash, name); } }
public SimpleQuantity castToSimpleQuantity(Base b) throws FHIRException { if (b instanceof SimpleQuantity) return (SimpleQuantity) b; else if (b instanceof Quantity) { Quantity q = (Quantity) b; SimpleQuantity sq = new SimpleQuantity(); sq.setValueElement(q.getValueElement()); sq.setComparatorElement(q.getComparatorElement()); sq.setUnitElement(q.getUnitElement()); sq.setSystemElement(q.getSystemElement()); sq.setCodeElement(q.getCodeElement()); return sq; } else throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an SimpleQuantity"); }
private void checkQuantity(List<ValidationMessage> errors, String path, Element focus, Quantity fixed) { checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator", focus); checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units", focus); checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); }