in src/main/java/com/atlassian/uwc/converters/jive/InternalLinkConverter.java [89:145]
protected String constructConfLink(String params, String alias) {
String titleParam = getParamValue(params, title);
if (alias == null || "".equals(alias)) {
if (titleParam != null) alias = titleParam;
}
if (alias == null) alias = "";
//default target is href param
String hrefParam = getParamValue(params, href);
String target = hrefParam;
//deal with links that use relative urls
String sourcedomain = getSourceDomain();
String jiveinternalParam = getParamValue(params, jiveinternal);
if (Boolean.parseBoolean(jiveinternalParam)) {
if (sourcedomain == null) {
log .error("Please configure the internaljivedomain property to be the http url of your source.");
sourcedomain = "";
}
if (target != null) {
if (!target.startsWith("http")) target = sourcedomain + target;
}
}
//deal with links that use defaultattr to identify target
String defaultattrParam = getParamValue(params, defaultattr);
String jivemacronameParam = getParamValue(params, jivemacroname);
if (defaultattrParam != null && jivemacronameParam != null) { //if we've migrated this particular title objid
target = getTitleFromMap(defaultattrParam, jivemacronameParam);
}
if ((target == null || "".equals(target)) && defaultattrParam != null) {
String uripart = getUriPart(jivemacronameParam);
target = sourcedomain + uripart + defaultattrParam;
}
if (hrefParam != null) {
Matcher linkidFinder = linkid.matcher(hrefParam);
if (hrefParam.startsWith("/") && linkidFinder.find()) {
String type = linkidFinder.group(1);
String id = linkidFinder.group(2);
String tmptarget = getTitleFromMap(id, type);
if (tmptarget != null) target = tmptarget;
}
}
//finish cleaning up alias
alias = alias.trim();
alias = removeHtmlTags(alias);
if (target == null && alias != null) target = alias; //this can happen!
if (alias.equals(target)) alias = "";
if (!"".equals(alias)) alias += "|"; //add alias delim
//build confluence link
String replacement = "[" + alias + target + "]";
log.debug("URLREPORT: fromhref='" + hrefParam + "'\tdefaultattr='" + defaultattrParam + "'\t" +
"tohref='" + target + "'\talias='" + alias + "'");
return replacement;
}