throw new IllegalArgumentException("Parent content fragment and page not consistent or locked");
}
boolean contentFragmentIsReference = (contentFragmentImpl.getReference() != null);
// retrieve current page or template and fragment from page manager
BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentPageImpl.getPageOrTemplate().getPath());
String pageFragmentId = (contentFragmentIsReference ? contentFragmentImpl.getReference().getId() : contentFragmentImpl.getFragment().getId());
BaseFragmentElement fragment = pageOrTemplate.getFragmentById(pageFragmentId);
if (fragment == null)
{
throw new IllegalArgumentException("Remove fragmentId and page not consistent");
}
// check for edit permission
fragment.checkAccess(JetspeedActions.EDIT);
// remove fragment and update in page manager
boolean update = (pageOrTemplate.removeFragmentById(pageFragmentId) != null);
if (update)
{
updatePage(pageOrTemplate);
}