/** {@inheritDoc} */ public SC toXml(Sc input) throws DtoTransformException { ST st = STTransformer.INSTANCE.toXml(input); if (st == null) { return null; } SC sc = new SC(); sc.setValue(st.getValue()); sc.setNullFlavor(st.getNullFlavor()); sc.setCode(CDTransformer.INSTANCE.toXml(input.getCode())); if (sc.getNullFlavor() == null && sc.getValue() == null && sc.getCode() != null) { throw new IllegalArgumentException("Any non-null SC must have text if code is set."); } return sc; }
/** {@inheritDoc} */ public DSetCd toXml(DSet<Cd> input) throws DtoTransformException { DSetCd x = new DSetCd(); if (input != null && input.getItem() != null) { Set<Cd> sItem = input.getItem(); List<org.iso._21090.CD> tItem = x.getItems(); for (Cd cd : sItem) { org.iso._21090.CD cur = CDTransformer.INSTANCE.toXml(cd); // XSD rule: all elements of set must be non-null if (!(cur == null || cur.getNullFlavor() != null)) { tItem.add(cur); } } } if (x.getItems().isEmpty()) { x.setNullFlavor(NullFlavor.NI); } return x; }