public CDvQuantity copy() { return new CDvQuantity(path(), getOccurrences(), getNodeId(), getParent(), list, property, getDefaultValue(), getAssumedValue()); }
@Override public CDvOrdinal copy() { return new CDvOrdinal(path(), getOccurrences(), getNodeId(), getParent(), list, getDefaultValue(), getAssumedValue()); }
DvQuantity createDvQuantity(CDvQuantity cdq) throws Exception { if(cdq.getList() == null || cdq.getList().isEmpty()) { return new DvQuantity(0.0); } // TODO take the first item CDvQuantityItem item = cdq.getList().get(0); // TODO take the lower limit as magnitude or zero double magnitude; if(item.getMagnitude() != null) { magnitude = item.getMagnitude().getLower(); } else { magnitude = 0; } return new DvQuantity(item.getUnits(), magnitude, measurementService); }
protected void printCDvOrdinal(CDvOrdinal cordinal, Element out) { Element children = new Element("children", defaultNamespace); out.getChildren().add(children); children.setAttribute("type", "C_DV_ORDINAL", xsiNamespace); printCObjectElements(cordinal, children); if (cordinal.hasAssumedValue()) { Ordinal assumedValue = cordinal.getAssumedValue(); Element assumedValueEl = new Element("assumed_value", defaultNamespace); children.getChildren().add(assumedValueEl); printString("value", String.valueOf(assumedValue.getValue()), assumedValueEl); printSymbolOfOrdinal(assumedValue, assumedValueEl); } if(cordinal.getList() != null) { final List<Ordinal> ordinals = cordinal.getList(); Ordinal ordinal; for (Iterator<Ordinal> it = ordinals.iterator(); it.hasNext();) { ordinal = it.next(); Element list = new Element("list", defaultNamespace); children.getChildren().add(list); printString("value", String.valueOf(ordinal.getValue()), list); printSymbolOfOrdinal(ordinal, list); } } }
public void checkArchetypeUnitsValidity(CDvQuantity cDvQuantity, List<ValidationError> errors) { List<CDvQuantityItem> qis = cDvQuantity.getList(); if (qis != null && qis.size() > 0) { MeasurementService sms = SimpleMeasurementService.getInstance(); for (CDvQuantityItem qi : qis) { if (!sms.isValidUnitsString(qi.getUnits())) { ValidationError error = new ValidationError(ErrorType.VUI, null, qi.getUnits()); errors.add(error); } } } }
private void printMagnitudePrecisionUnitsOfCDVQuantityItem(CDvQuantityItem item, Element lst) { if(item.getMagnitude() != null) { Element magnitude = new Element("magnitude", defaultNamespace); lst.getChildren().add(magnitude); printInterval(item.getMagnitude(), magnitude); } if(item.getPrecision() != null) { Element precision = new Element("precision", defaultNamespace); lst.getChildren().add(precision); printInterval(item.getPrecision(), precision); } printString("units", item.getUnits(), lst); }
protected void printOrdinal(Ordinal ordinal, Writer out) throws IOException { CodePhrase symbol = ordinal.getSymbol(); out.write(Integer.toString(ordinal.getValue())); out.write("|["); out.write(symbol.getTerminologyId().getValue()); out.write("::"); out.write(symbol.getCodeString()); out.write("]"); }
@Override public boolean validValue(DvQuantity value) { if(list == null) { return true; } for(CDvQuantityItem item : list) { if( ! item.getUnits().equals(value.getUnits())) { continue; } if(item.getMagnitude() != null && !item.getMagnitude().has(value.getMagnitude())) { continue; } // TODO precision check return true; } return false; }
private void printSymbolOfOrdinal(Ordinal ordinal, Element list) { Element symbol = new Element("symbol", defaultNamespace); list.getChildren().add(symbol); printString("value", null, symbol); // this is the mandatory(!) value of a DV_CODED_TEXT symbol. Element definingCode = new Element("defining_code", defaultNamespace); symbol.getChildren().add(definingCode); printCodePhrase(ordinal.getSymbol(), definingCode); }
{if (true) return new CDvQuantityItem(value, precision, units);} throw new Error("Missing return statement in function");
/** * Create a CDvQuantity that would allow any DV_QUANTITY value * @param path * @return */ public static CDvQuantity anyAllowed(String path) { Interval<Integer> occurrences = new Interval<Integer>(1,1); return new CDvQuantity(path, occurrences, null); }
final public org.openehr.am.openehrprofile.datatypes.quantity.Ordinal ordinal() throws ParseException { Token t; int value; CodePhrase code; value = integer_value(); jj_consume_token(SYM_INTERVAL_DELIM); code = code_phrase(); {if (true) return new org.openehr.am.openehrprofile.datatypes.quantity.Ordinal( value, code);} throw new Error("Missing return statement in function"); }
@Override public CDvOrdinal copy() { return new CDvOrdinal(path(), getOccurrences(), getNodeId(), getParent(), list, getDefaultValue(), getAssumedValue()); }
private static void loadUnits( String templateId, String idElement, CObject childCObject, Collection<UnitVO> unitVOs) { if (childCObject instanceof CDvQuantity) { CDvQuantity consDvQuantity = (CDvQuantity) childCObject; if (consDvQuantity.getList() != null) { for (CDvQuantityItem consDvQuantityItem : consDvQuantity.getList()) { unitVOs.add(UnitVO.builder() .idTemplate(templateId) .idElement(idElement) .unit(consDvQuantityItem.getUnits()) .build()); } ; } } }
public CDvQuantity copy() { return new CDvQuantity(path(), getOccurrences(), getNodeId(), getParent(), list, property, getDefaultValue(), getAssumedValue()); }
protected void printOrdinal(Ordinal ordinal, Writer out) throws IOException { CodePhrase symbol = ordinal.getSymbol(); out.write(Integer.toString(ordinal.getValue())); out.write("|["); out.write(symbol.getTerminologyId().getValue()); out.write("::"); out.write(symbol.getCodeString()); out.write("]"); }
@Override public boolean validValue(DvQuantity value) { if(list == null) { return true; } for(CDvQuantityItem item : list) { if( ! item.getUnits().equals(value.getUnits())) { continue; } if(item.getMagnitude() != null && !item.getMagnitude().has(value.getMagnitude())) { continue; } // TODO precision check return true; } return false; }
{if (true) return new CDvQuantityItem(value, precision, units);} throw new Error("Missing return statement in function");
/** * Create a CDvQuantity that would allow any DV_QUANTITY value * @param path * @return */ public static CDvQuantity anyAllowed(String path) { Interval<Integer> occurrences = new Interval<Integer>(1,1); return new CDvQuantity(path, occurrences, null); }
final public org.openehr.am.openehrprofile.datatypes.quantity.Ordinal ordinal() throws ParseException { Token t; int value; CodePhrase code; value = integer_value(); jj_consume_token(SYM_INTERVAL_DELIM); code = code_phrase(); {if (true) return new org.openehr.am.openehrprofile.datatypes.quantity.Ordinal( value, code);} throw new Error("Missing return statement in function"); }