View Javadoc

1   package org.rundeck.api.generator;
2   
3   import org.dom4j.DocumentFactory;
4   import org.dom4j.Element;
5   import org.rundeck.api.domain.ProjectConfig;
6   import org.rundeck.api.domain.RundeckProject;
7   
8   /**
9    * ProjectGenerator is ...
10   *
11   * @author greg
12   * @since 2014-02-27
13   */
14  public class ProjectGenerator extends BaseDocGenerator {
15      RundeckProject project;
16  
17      public ProjectGenerator(RundeckProject project) {
18          this.project = project;
19      }
20  
21      @Override
22      public Element generateXmlElement() {
23          Element rootElem = DocumentFactory.getInstance().createElement("project");
24          rootElem.addElement("name").setText(project.getName());
25          ProjectConfig configuration = project.getProjectConfig();
26          if (null != configuration) {
27              rootElem.add(new ProjectConfigGenerator(configuration).generateXmlElement());
28          }
29          return rootElem;
30      }
31  }