List of usage examples for org.dom4j Element add
void add(Namespace namespace);
Namespace
to this element. From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
public void addAdminUser(String user) { Element adminNode = (Element) root().selectSingleNode("//security//admins"); Element userElement;//from ww w . j a va 2s . co m if (adminNode.selectSingleNode("user") != null) { userElement = new DefaultElement("user"); adminNode.add(userElement); } else { userElement = findOrCreateAt(adminNode, 0, "user"); } userElement.setText(user); }
From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
public void modifyPipeline(String pipelineName, String node, String attribute, String attrValue) { Element pipeline = pipelineElement(pipelineName); Element trackingTool = findOrCreateAt(pipeline, 0, node); Attribute linkAttr = trackingTool.attribute(attribute); if (linkAttr == null) { trackingTool.add(new DefaultAttribute(attribute, attrValue)); } else {/*from ww w. j a v a 2 s .c o m*/ linkAttr.setValue(attrValue); } }
From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
public void addParameter(String pipelineName, String parameterName, String value) { Element pipelineElement = pipelineElement(pipelineName); Element params = findOrCreateAt(pipelineElement, 0, "params"); params.add(paramElement(parameterName, value)); }
From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
public void addSecurityWithPasswordFile(String passwordFilePath, String adminUsers) { Element passwordFileTag = new DefaultElement("passwordFile"); passwordFileTag.addAttribute("path", passwordFilePath); Element adminsTag = new DefaultElement("admins"); String[] adminUserList = adminUsers.split(","); for (String adminUser : adminUserList) { adminsTag.add(new DefaultElement("user").addText(adminUser.trim())); }/* w w w .jav a2s . co m*/ Element securityTag = new DefaultElement("security"); securityTag.add(passwordFileTag); securityTag.add(adminsTag); serverTag().add(securityTag); }
From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
public void addSecurityWithPasswordFileOnly(String passwordFilePath) { Element passwordFileTag = new DefaultElement("passwordFile"); passwordFileTag.addAttribute("path", passwordFilePath); Element securityTag = new DefaultElement("security"); securityTag.add(passwordFileTag); serverTag().add(securityTag);/* w w w. j a va 2s .com*/ }
From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
public void createPipelineAsFirstPipelineInGroup(String pipelineName, String groupName) { Element groupContents = getGroup(groupName); ArrayList<Element> pipelines = new ArrayList<Element>(); while (groupContents.elementIterator().hasNext()) { Element pipelineElement = (Element) groupContents.elementIterator().next(); pipelines.add(pipelineElement);/* w w w . ja va 2s . c o m*/ groupContents.remove(pipelineElement); } createASimpleGitPipeline(pipelineName); for (Element e : pipelines) { groupContents.add(e); } }
From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
private Element customCommandWithArguments(String newCommand, String givenArguement) { Element command = null; Element arguement = new DefaultElement("arg"); arguement.setText(givenArguement);/* ww w. j a v a2 s .c o m*/ command = customCommand(newCommand); command.add(arguement); return command; }
From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java
License:Apache License
public void invertFileFilter(String pipelineName) { List<Element> materials = materialsForPipeline(pipelineName); for (Element material : materials) { Attribute invertFile = material.attribute("invertFilter"); if (invertFile == null) { material.add(new DefaultAttribute("invertFilter", "true")); } else {/*from w ww . j a v a 2 s . c o m*/ invertFile.setValue("true"); } } }
From source file:com.thoughtworks.go.helper.ConfigFileFixture.java
License:Apache License
private static String addLicense(Document document, String user, String license) { Element server = (Element) document.selectSingleNode("/cruise/server"); Node oldLicense = server.selectSingleNode("./license"); if (oldLicense != null) { server.remove(oldLicense);/* w w w .j av a2s.co m*/ } server.add(new DefaultElement("license").addAttribute("user", user).addText(license)); return document.asXML(); }
From source file:com.thoughtworks.go.server.domain.xml.UsersXmlViewModel.java
License:Apache License
private Element nodeWithChildren(Element parent, Element... children) { for (Element child : children) { parent.add(child); }//w w w .ja va 2 s . c o m return parent; }