getConfigcmd.add("getconfig");
Command.addServer(getConfigcmd, server);
getConfigcmd.add("-s");
getConfigcmd.add("-r");
getConfigcmd.add("settings.xml");
GetConfigWebURL webuiURL = null;
Map<String, GetConfigWebURL> webURL = null;
try {
webURL = AccurevLauncher.runCommand("Get config to fetch webURL",
launcher, getConfigcmd, null, scm.getOptionalLock(), accurevEnv, workspace, listener, logger,
XmlParserFactory.getFactory(), new ParseGetConfig(), null);
} catch (Exception e) {
// Error getting settings.xml file.
}
if( webURL == null || webURL.isEmpty() ) {
return;
}
webuiURL = webURL.get("webuiURL");
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = null;
try {
documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(changelogFile);
NodeList nodes = document.getElementsByTagName("transaction");
Element depotElement = document.createElement("depot");
if(nodes!=null && nodes.getLength()>0)
nodes.item(0).getParentNode().insertBefore(depotElement, nodes.item(0));
depotElement.appendChild(document.createTextNode(scm.getDepot()));
Element webuiElement = document.createElement("webuiURL");
if(nodes!=null && nodes.getLength()>0)
nodes.item(0).getParentNode().insertBefore(webuiElement, nodes.item(0));
if(webuiURL!=null)
webuiElement.appendChild(document.createTextNode((webuiURL.getWebURL().endsWith("/")?(webuiURL.getWebURL().substring(0, webuiURL.getWebURL().length()-1)):(webuiURL.getWebURL()))));
else
webuiElement.appendChild(document.createTextNode(""));
DOMSource source = new DOMSource(document);