*/
public ContentPage newContentPage(BaseFragmentsElement pageOrTemplate, PageTemplate pageTemplate, Map fragmentDefinitions)
{
// generate content page
BaseConcretePageElement concretePage = ((pageOrTemplate instanceof BaseConcretePageElement) ? (BaseConcretePageElement)pageOrTemplate : null);
DynamicPage dynamicPage = ((pageOrTemplate instanceof DynamicPage) ? (DynamicPage)pageOrTemplate : null);
FragmentDefinition fragmentDefinition = (((concretePage == null) && (pageOrTemplate instanceof FragmentDefinition)) ? (FragmentDefinition)pageOrTemplate : null);
String contentPageId = pageOrTemplate.getId();
ContentPageImpl contentPageImpl = new ContentPageImpl(this, contentPageId, pageOrTemplate, pageTemplate, fragmentDefinitions);
// set/merge page attributes
mergeContentPageAttributes(contentPageImpl, pageOrTemplate);
contentPageImpl.setName(pageOrTemplate.getName());
contentPageImpl.setPath(pageOrTemplate.getPath());
contentPageImpl.setUrl(pageOrTemplate.getUrl());
contentPageImpl.setHidden(pageOrTemplate.isHidden());
// merge template attributes
mergeContentPageAttributes(contentPageImpl, pageTemplate);
// set effective default detectors from merged default
// decorators or inherit page effective default decorators
Map effectiveDefaultDecorators = null;
String effectiveLayoutDefaultDecorator = contentPageImpl.getDefaultDecorator(Fragment.LAYOUT);
if (effectiveLayoutDefaultDecorator == null)
{
if (concretePage != null)
{
effectiveLayoutDefaultDecorator = concretePage.getEffectiveDefaultDecorator(Fragment.LAYOUT);
}
else if (pageOrTemplate.getParent() != null)
{
effectiveLayoutDefaultDecorator = ((Folder)pageOrTemplate.getParent()).getEffectiveDefaultDecorator(Fragment.LAYOUT);
}
}
if (effectiveLayoutDefaultDecorator != null)
{
if (effectiveDefaultDecorators == null)
{
effectiveDefaultDecorators = new HashMap();
}
effectiveDefaultDecorators.put(Fragment.LAYOUT, effectiveLayoutDefaultDecorator);
}
String effectivePortletDefaultDecorator = contentPageImpl.getDefaultDecorator(Fragment.PORTLET);
if (effectivePortletDefaultDecorator == null)
{
if (concretePage != null)
{
effectivePortletDefaultDecorator = concretePage.getEffectiveDefaultDecorator(Fragment.PORTLET);
}
else if (pageOrTemplate.getParent() != null)
{
effectiveLayoutDefaultDecorator = ((Folder)pageOrTemplate.getParent()).getEffectiveDefaultDecorator(Fragment.PORTLET);
}
}
if (effectivePortletDefaultDecorator != null)
{
if (effectiveDefaultDecorators == null)
{
effectiveDefaultDecorators = new HashMap();
}
effectiveDefaultDecorators.put(Fragment.PORTLET, effectivePortletDefaultDecorator);
}
contentPageImpl.setEffectiveDefaultDecorators(effectiveDefaultDecorators);
if (dynamicPage != null)
{
contentPageImpl.setContentType(dynamicPage.getContentType());
contentPageImpl.setInheritable(dynamicPage.isInheritable());
}
if (fragmentDefinition != null)
{
contentPageImpl.setDefId(fragmentDefinition.getDefId());
}