Example #1
0
 /** {@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;
 }
 private boolean compareValue7(DsetCdDataType actual, DsetCdDataType result) {
   DSet<Cd> aVal = actual.getValue7();
   assertNotNull(aVal);
   DSet<Cd> rVal = result.getValue7();
   // XSD rule: all elements of set must be non-null
   if (aVal.getNullFlavor() != null || checkAllNullItems(aVal)) {
     assertNull(rVal);
     return true;
   } else {
     assertNotNull(rVal);
     return aVal.equals(rVal);
   }
 }
Example #3
0
 /** {@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;
 }
 private boolean checkAllNullItems(DSet<Cd> rVal) {
   Set<Cd> item = rVal.getItem();
   if (item != null) {
     Iterator<Cd> list = item.iterator();
     while (list.hasNext()) {
       Cd cd = list.next();
       if (cd.getNullFlavor() == null) return false;
     }
   }
   return true;
 }