logger.debug("Generating link to enclosed fragment");
}
}
String requestValue;
PageGenerationCache pageGenerationCache
= pageContext.getPageGenerationCache();
RuntimeDeviceLayout deviceLayout =
pageContext.getDeviceLayout();
String defaultFragmentName = deviceLayout.getDefaultFragmentName();
boolean isDefault = true;
if (defaultFragmentName == null
|| !fragmentName.equals(defaultFragmentName)) {
isDefault = false;
}
// If we are generating a link to the enclosing fragment and this is
// the top inclusion then we do not need to add a vfrag value to the
// URL.
if (toEnclosing && inclusionPath == null && isDefault) {
if (logger.isDebugEnabled()) {
logger.debug("Returning to default top level fragment");
}
requestValue = null;
} else {
// The change to apply to the fragmentation state.
FragmentationState.Change change;
// If the enclosing fragment is the default fragment for the layout
// then discard the information about it, this reduces the number
// of possible fragmentation states for a particular layout which
// reduces the memory usage.
change = new FragmentationState.FragmentChange(inclusionPath,
fragmentName,
toEnclosing,
isDefault);
if (logger.isDebugEnabled()) {
logger.debug("Change to be applied is " + change);
}
int changeIndex = pageGenerationCache.
getFragmentationStateChangeIndex(change);
requestValue = PageGenerationCache.
makeFragmentChangeSpecifier(currentKey, changeIndex);
}