private boolean linkingToSelf(final Link link, final ConversionContext conversionContext) { if (conversionContext == null) { return true; } if (isGlobalObject(conversionContext)) { return false; } final ResourceIdentifier resourceIdentifier = link.getDestinationResourceIdentifier(); // If linking to same page then the confluence macro linking mechanism does not // include a resourceIdentifier in the macroDefinition. There could still be a link // input via the storage format though, which is why we still do the checks. if (resourceIdentifier == null) { if (conversionContext.getProperty(MACRO_DEFINITION) != null) { String linkedPageName = ((MacroDefinition) conversionContext.getProperty(MACRO_DEFINITION)) .getDefaultParameterValue(); return isSamePageTitle(conversionContext, linkedPageName); } return true; } // Note that we check content type before we check if it's the same space // because the same space check relies on a page/blog post content type. return isSameContentType(conversionContext, resourceIdentifier) && isSamePageTitle(conversionContext, resourceIdentifier) && isSameSpace(conversionContext, resourceIdentifier) && isSamePostingDateForBlog(conversionContext, resourceIdentifier); }
final ContentEntityObject currentPage = context.getEntity(); final I18NBean i18NBean = i18NBeanFactory.getI18NBean(); final ResourceIdentifier resourceIdentifier = link.getDestinationResourceIdentifier(); final String location = getLocation(resourceIdentifier);