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.ConfigProperty;
6   
7   /**
8    * ProjectConfigPropertyGenerator generates a {@literal <property/>} element representing a configuration property.
9    *
10   * @author greg
11   * @since 2014-03-07
12   */
13  public class ProjectConfigPropertyGenerator extends BaseDocGenerator {
14      private ConfigProperty property;
15  
16      public ProjectConfigPropertyGenerator(ConfigProperty property) {
17          this.property = property;
18      }
19  
20      @Override
21      public Element generateXmlElement() {
22          Element propElem = DocumentFactory.getInstance().createElement("property");
23          propElem.addAttribute("key", property.getKey());
24          propElem.addAttribute("value", property.getValue());
25  
26          return propElem;
27      }
28  }