Ejemplo n.º 1
0
 public Element toXml() {
   Element root = new Element(ROOT_ELEMENT);
   root.setAttribute(ATTR_VERSION, Integer.toString(DEPENDENCIES_VERSION));
   if (myModelHash != null) {
     root.setAttribute(ATTR_MODEL_HASH, myModelHash);
   }
   if (myParametersHash != null) {
     root.setAttribute(ATTR_PARAMS_HASH, myParametersHash);
   }
   String[] models = myUsedModelsHashes.keySet().toArray(new String[myUsedModelsHashes.size()]);
   Arrays.sort(models);
   for (String model : models) {
     Element e = new Element(NODE_MODEL);
     e.setAttribute(ATTR_MODEL_ID, model);
     String hash = myUsedModelsHashes.get(model);
     if (hash != null) {
       e.setAttribute(ATTR_HASH, hash);
     }
     root.addContent(e);
   }
   if (myRootDependencies != null) {
     for (GenerationRootDependencies data : myRootDependencies) {
       Element e = new Element(data.getRootId() != null ? NODE_ROOT : NODE_COMMON);
       data.saveTo(e);
       root.addContent(e);
     }
   }
   return root;
 }