Exemple #1
0
 /**
  * Writes empty nodes child of an entity if there is a node state specified.
  *
  * @param serializer
  * @param entity
  * @throws IOException
  */
 private void writeEmptyNodes(XmlSerializer serializer, Entity entity) throws IOException {
   EntityDefinition defn = entity.getDefinition();
   List<NodeDefinition> childDefns = defn.getChildDefinitions();
   for (NodeDefinition childDefn : childDefns) {
     String childName = childDefn.getName();
     if (entity.getCount(childName) == 0) {
       State childState = entity.getChildState(childName);
       int childStateInt = childState.intValue();
       if (childStateInt > 0) {
         serializer.startTag(null, childName);
         serializer.attribute(null, STATE_ATTRIBUTE, Integer.toString(childStateInt));
         serializer.endTag(null, childName);
       }
     }
   }
 }