/** {@inheritDoc} */ public DSet<Cd> toDto(DSetCd input) throws DtoTransformException { if (input == null || input.getNullFlavor() != null) { return null; } DSet<Cd> x = new DSet<Cd>(); x.setItem(new HashSet<Cd>()); List<org.iso._21090.CD> sItem = input.getItems(); Set<Cd> tItem = x.getItem(); for (org.iso._21090.CD cd : sItem) { tItem.add(CDTransformer.INSTANCE.toDto(cd)); } return x; }
/** {@inheritDoc} */ public Sc toDto(SC input) throws DtoTransformException { St st = STTransformer.INSTANCE.toDto(input); if (st == null) { return null; } Sc sc = new Sc(); sc.setValue(st.getValue()); sc.setNullFlavor(st.getNullFlavor()); sc.setCode(CDTransformer.INSTANCE.toDto(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; }