try
{
// set parent
boolean newPageElement = false;
FolderImpl parentFolder = getNodeFolder(fragmentsElement.getPath());
if (fragmentsElement.getParent() == null)
{
fragmentsElement.setParent(parentFolder);
newPageElement = true;
}
// enable permissions/constraints
fragmentsElement.setPermissionsEnabled(handlerFactory.getPermissionsEnabled());
fragmentsElement.setConstraintsEnabled(handlerFactory.getConstraintsEnabled());
// check for edit/view access
fragmentsElement.checkAccess(checkEditAccess ? JetspeedActions.EDIT : JetspeedActions.VIEW);
// update fragments/page
handlerFactory.getDocumentHandler(documentType).updateDocument(fragmentsElement);
// update parent folder
if (parentFolder != null)
{
NodeSetImpl parentAllNodes = (NodeSetImpl)parentFolder.getAllNodes();
if (!parentAllNodes.contains(fragmentsElement))
{
// add new fragments/page element
parentAllNodes.add(fragmentsElement);
newPageElement = true;