* java.lang.String, boolean, java.lang.Object)
*/
public Topic lookupTopic(String virtualWiki, String topicName, boolean deleteOK, Object transactionObject) throws Exception {
String decodedName = null;
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
try {
decodedName = URLDecoder.decode(topicName, "utf-8");
} catch (UnsupportedEncodingException e) {
//
}
if (Tracing.isDebugEnabled(OlatWikiDataHandler.class)) {
Tracing.logDebug("page name not normalized: " + topicName, OlatWikiDataHandler.class);
Tracing.logDebug("page name normalized: " + FilterUtil.normalizeWikiLink(topicName), OlatWikiDataHandler.class);
try {
Tracing.logDebug("page name urldecoded name: " + URLDecoder.decode(topicName, "utf-8"), OlatWikiDataHandler.class);
Tracing.logDebug("page name urldecoded and normalized: " + FilterUtil.normalizeWikiLink(URLDecoder.decode(topicName, "utf-8")),
OlatWikiDataHandler.class);
Tracing.logDebug("page name urldecoded normalized and transformed to id: "
+ wiki.generatePageId(FilterUtil.normalizeWikiLink(decodedName)), OlatWikiDataHandler.class);
} catch (UnsupportedEncodingException e) {
//
}
}
Topic topic = new Topic();
if (decodedName.startsWith(IMAGE_NAMESPACE)) {
String imageName = topicName.substring(IMAGE_NAMESPACE.length());
if (!wiki.mediaFileExists(imageName)) return null;
topic.setName(imageName);
topic.setTopicType(Topic.TYPE_IMAGE);
return topic;
} else if (decodedName.startsWith(MEDIA_NAMESPACE)) {
String mediaName = topicName.substring(MEDIA_NAMESPACE.length(), topicName.length());
if (!wiki.mediaFileExists(mediaName)) return null;
topic.setName(mediaName);
topic.setTopicType(Topic.TYPE_FILE);
return topic;
}
if (wiki.pageExists(wiki.generatePageId(FilterUtil.normalizeWikiLink(decodedName)))) {
topic.setName(topicName);
return topic;
}
return null;
}