use of org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory in project maven-plugins by apache.
the class TracDownloader method getIssueList.
public List<Issue> getIssueList() throws MalformedURLException, XmlRpcException {
// Create and configure an XML-RPC client
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
try {
config.setServerURL(new URL(getUrl() + "/login/xmlrpc"));
} catch (MalformedURLException e) {
throw new MalformedURLException("The Trac URL is incorrect.");
}
config.setBasicUserName(tracUser);
config.setBasicPassword(tracPassword);
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
client.setTransportFactory(new XmlRpcCommonsTransportFactory(client));
// Fetch issues
String qstr = "";
if (!StringUtils.isEmpty(query)) {
qstr = query;
}
Object[] params = new Object[] { qstr };
Object[] queryResult;
ArrayList<Issue> issueList = new ArrayList<Issue>();
try {
queryResult = (Object[]) client.execute("ticket.query", params);
for (Object aQueryResult : queryResult) {
params = new Object[] { aQueryResult };
Object[] ticketGetResult;
ticketGetResult = (Object[]) client.execute("ticket.get", params);
issueList.add(createIssue(ticketGetResult));
}
} catch (XmlRpcException e) {
throw new XmlRpcException("XmlRpc Error.", e);
}
return issueList;
}
Aggregations