public Object construct() {
setText(GT._("Retrieving MediaWiki API"));
API api = APIFactory.getAPI();
// Updating page contents
QueryResult queryResult = null;
try {
setText(GT._("Updating page contents"));
queryResult = api.updatePage(
getWikipedia(), page, text,
getWikipedia().createUpdatePageComment(comment, null, false),
forceWatch);
} catch (APIException e) {
return e;
}
// Take contributions into account
if ((contributions != null) &&
(getWikipedia().getContributions() != null)) {
getWikipedia().getContributions().increaseContributions(contributions);
}
// Updating disambiguation warning
if (updateDabWarning) {
try {
UpdateDabWarningTools dabWarningTools = new UpdateDabWarningTools(
getWikipedia(), this, createDabWarning, false);
PageAnalysis pageAnalysis = page.getAnalysis(text, true);
dabWarningTools.updateWarning(
pageAnalysis, queryResult.getPageNewRevId(),
null, null, null, null, null);
} catch (APIException e) {
return e;
}
}
// Updating ISBN warning
if (updateISBNWarning) {
try {
UpdateISBNWarningTools isbnWarningTools = new UpdateISBNWarningTools(
getWikipedia(), this, createISBNWarning, false);
PageAnalysis pageAnalysis = page.getAnalysis(text, true);
isbnWarningTools.updateWarning(
pageAnalysis, queryResult.getPageNewRevId(),
null, null, null, null, null);
} catch (APIException e) {
return e;
}
}