String templateNS = getTemplateNamespace() + ":";
String name = articleName;
if (namespace.equals(getTemplateNamespace())) {
String content = null;
try {
TopicData topicData = fWikiDB.selectTopic(templateNS + name);
if (topicData != null) {
content = topicData.getContent();
content = getRedirectedWikiContent(content, templateParameters);
if (content != null) {
return content.length() == 0 ? null : content;
} else {
return null;
}
}
String[] listOfTitleStrings = { templateNS + name };
fUser.login();
List<Page> listOfPages = fUser.queryContent(listOfTitleStrings);
if (listOfPages.size() > 0) {
Page page = listOfPages.get(0);
content = page.getCurrentContent();
if (content != null) {
// System.out.println(name);
// System.out.println(content);
// System.out.println("-----------------------");
topicData = new TopicData(templateNS + name, content);
fWikiDB.insertTopic(topicData);
content = getRedirectedWikiContent(content, templateParameters);
if (content != null) {
content = content.length() == 0 ? null : content;
}