Examples of FailedToUpdateDocumentException


Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

                {
                    parent = (FolderImpl)getFolder(parentPath);
                }
                catch (FolderNotFoundException fnfe)
                {
                    throw new FailedToUpdateDocumentException("Missing parent folder: " + parentPath);
                }
               
                // check for edit access on parent folder; link
                // access not checked on create
                parent.checkAccess(JetspeedActions.EDIT);

                // update link and mark cache transaction
                link.setParent(parent);
                storeEntity(link, linkPath, true);

                // new link
                newLink = true;
            }
            else
            {
                // check for edit access on link and parent folder
                link.checkAccess(JetspeedActions.EDIT);

                // update link and mark cache transaction
                storeEntity(link, link.getPath(), false);
               
                // update link
                newLink = false;
            }

            // reset parent folder links cache in case
            // new or parent is holding an out of date copy
            // of this link that was removed from the cache
            // before this one was accessed
            parent.resetLinks(false);

            // notify page manager listeners
            if (newLink)
            {
                delegator.notifyNewNode(link);
            }
            else
            {
                delegator.notifyUpdatedNode(link);               
            }
        }
        catch (FailedToUpdateDocumentException fude)
        {
            throw fude;
        }
        catch (SecurityException se)
        {
            throw se;
        }
        catch (Exception e)
        {
            throw new FailedToUpdateDocumentException("Link " + link.getPath() + " not updated.", e);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

                {
                    parent = (FolderImpl)getFolder(parentPath);
                }
                catch (FolderNotFoundException fnfe)
                {
                    throw new FailedToUpdateDocumentException("Missing parent folder: " + parentPath);
                }

                // do not replace existing page security documents
                try
                {
                    parent.getPageSecurity();
                    throw new FailedToUpdateDocumentException("Parent folder page security exists: " + parentPath);
                }
                catch (DocumentNotFoundException dnfe)
                {
                    // check for edit access on parent folder; document
                    // access not checked on create
                    parent.checkAccess(JetspeedActions.EDIT);
                   
                    // update document and mark cache transaction
                    pageSecurity.setParent(parent);
                    storeEntity(pageSecurity, pageSecurityPath, true);

                    // new page security
                    newPageSecurity = true;
                }
                catch (Exception e)
                {
                    throw new FailedToUpdateDocumentException("Parent folder page security exists: " + parentPath);
                }
            }
            else
            {
                // check for edit access on document and parent folder
                pageSecurity.checkAccess(JetspeedActions.EDIT);

                // update document and mark cache transaction
                storeEntity(pageSecurity, pageSecurity.getPath(), false);

                // update page security
                newPageSecurity = false;
            }

            // reset parent folder page security cache if new or
            // in case parent is holding an out of date copy of
            // this page security that was removed from the cache
            // before this one was accessed
            parent.resetPageSecurity((PageSecurityImpl)pageSecurity, true);

            // reset all cached security constraints
            DatabasePageManagerCache.resetCachedSecurityConstraints();

            // notify page manager listeners
            if (newPageSecurity)
            {
                delegator.notifyNewNode(pageSecurity);               
            }
            else
            {
                delegator.notifyUpdatedNode(pageSecurity);
            }
        }
        catch (FailedToUpdateDocumentException fude)
        {
            throw fude;
        }
        catch (SecurityException se)
        {
            throw se;
        }
        catch (Exception e)
        {
            throw new FailedToUpdateDocumentException("Document " + pageSecurity.getPath() + " not updated.", e);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

                {
                    parent = (FolderImpl)getFolder(parentPath);
                }
                catch (FolderNotFoundException fnfe)
                {
                    throw new FailedToUpdateDocumentException("Missing parent folder: " + parentPath);
                }
               
                // check for edit access on parent folder; link
                // access not checked on create
                parent.checkAccess(JetspeedActions.EDIT);

                // update link and mark cache transaction
                link.setParent(parent);
                getPersistenceBrokerTemplate().store(link);
                DatabasePageManagerCache.addTransaction(new TransactionedOperation(link.getPath(), TransactionedOperation.ADD_OPERATION));

                // reset parent folder links cache
                if (parent != null)
                {
                    parent.resetLinks(false);
                }

                // notify page manager listeners
                delegator.notifyNewNode(link);
            }
            else
            {
                // check for edit access on link and parent folder
                link.checkAccess(JetspeedActions.EDIT);

                // update link and mark cache transaction
                getPersistenceBrokerTemplate().store(link);
                DatabasePageManagerCache.addTransaction(new TransactionedOperation(link.getPath(), TransactionedOperation.UPDATE_OPERATION));

                // reset parent folder links cache in case
                // parent is holding an out of date copy of
                // this link that was removed from the cache
                // before this one was accessed
                if (parent != null)
                {
                    parent.resetLinks(false);
                }

                // notify page manager listeners
                delegator.notifyUpdatedNode(link);
            }
        }
        catch (FailedToUpdateDocumentException fude)
        {
            throw fude;
        }
        catch (SecurityException se)
        {
            throw se;
        }
        catch (Exception e)
        {
            throw new FailedToUpdateDocumentException("Link " + link.getPath() + " not updated.", e);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

                {
                    parent = (FolderImpl)getFolder(parentPath);
                }
                catch (FolderNotFoundException fnfe)
                {
                    throw new FailedToUpdateDocumentException("Missing parent folder: " + parentPath);
                }

                // do not replace existing page security documents
                try
                {
                    parent.getPageSecurity();
                    throw new FailedToUpdateDocumentException("Parent folder page security exists: " + parentPath);
                }
                catch (DocumentNotFoundException dnfe)
                {
                    // check for edit access on parent folder; document
                    // access not checked on create
                    parent.checkAccess(JetspeedActions.EDIT);
                   
                    // update document and mark cache transaction
                    pageSecurity.setParent(parent);
                    getPersistenceBrokerTemplate().store(pageSecurity);
                    DatabasePageManagerCache.addTransaction(new TransactionedOperation(pageSecurity.getPath(), TransactionedOperation.ADD_OPERATION));

                    // reset parent folder page security cache
                    if (parent != null)
                    {                   
                        parent.resetPageSecurity((PageSecurityImpl)pageSecurity, true);
                    }
                }
                catch (Exception e)
                {
                    throw new FailedToUpdateDocumentException("Parent folder page security exists: " + parentPath);
                }

                // notify page manager listeners
                delegator.notifyNewNode(pageSecurity);
            }
            else
            {
                // check for edit access on document and parent folder
                pageSecurity.checkAccess(JetspeedActions.EDIT);

                // update document and mark cache transaction
                getPersistenceBrokerTemplate().store(pageSecurity);
                DatabasePageManagerCache.addTransaction(new TransactionedOperation(pageSecurity.getPath(), TransactionedOperation.UPDATE_OPERATION));

                // reset parent folder page security cache in case
                // parent is holding an out of date copy of this
                // page security that was removed from the cache
                // before this one was accessed
                if (parent != null)
                {               
                    parent.resetPageSecurity((PageSecurityImpl)pageSecurity, true);
                }

                // notify page manager listeners
                delegator.notifyUpdatedNode(pageSecurity);
            }

            // reset all cached security constraints
            DatabasePageManagerCache.resetCachedSecurityConstraints();
        }
        catch (FailedToUpdateDocumentException fude)
        {
            throw fude;
        }
        catch (SecurityException se)
        {
            throw se;
        }
        catch (Exception e)
        {
            throw new FailedToUpdateDocumentException("Document " + pageSecurity.getPath() + " not updated.", e);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

            marshaller.marshal(document);
        }
        catch (MarshalException e)
        {
            log.error("Could not marshal the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (ValidationException e)
        {
            log.error("Document " + f.getAbsolutePath() + " is not valid", e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (IOException e)
        {
            log.error("Could not save the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (Exception e)
        {
            log.error("Error while saving  " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        finally
        {
            if (systemUpdate){
              // restore permissions / constraints
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

            marshaller.marshal(document);
        }
        catch (MarshalException e)
        {
            log.error("Could not marshal the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (ValidationException e)
        {
            log.error("Document " + f.getAbsolutePath() + " is not valid", e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (IOException e)
        {
            log.error("Could not save the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (Exception e)
        {
            log.error("Error while saving  " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        finally
        {
            if (systemUpdate){
              // restore permissions / constraints
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

                    // JS2-903: fragments are getting stripped out on write if the current user does not have edit access to write to the file
                    document.checkAccess(JetspeedActions.EDIT);
                }
                catch (SecurityException se)
                {
                    throw new FailedToUpdateDocumentException("Insufficient Access: no edit access, cannot write.");
                }
                documentImpl.setPermissionsEnabled(false);
                documentImpl.setConstraintsEnabled(false);           
            }
            documentImpl.marshalling();
            // marshal page to disk
            String fileName = path;       
            if (!fileName.endsWith(this.documentType))
            {
                fileName = path + this.documentType;
            }
            File f = new File(this.documentRootDir, fileName);
            absolutePath = f.getAbsolutePath();
            // marshal: use SAX II handler to filter document XML for
            // page and folder menu definition menu elements ordered
            // polymorphic collection to strip artifical <menu-element>
            // tags enabling Castor XML binding; see JETSPEED-INF/castor/page-mapping.xml
            writer = new OutputStreamWriter(new FileOutputStream(f), PSML_DOCUMENT_ENCODING);
            XMLWriter xmlWriter = new XMLWriter(writer, this.format);
            final ContentHandler handler = xmlWriter;
           
            Marshaller marshaller = new Marshaller(new ContentHandler()
                {
                    private int menuDepth = 0;
                   
                    public void characters(char[] ch, int start, int length) throws SAXException
                    {
                        handler.characters(ch, start, length);
                    }

                    public void endDocument() throws SAXException
                    {
                        handler.endDocument();
                    }
                   
                    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
                    {
                        handler.ignorableWhitespace(ch, start, length);
                    }
                   
                    public void processingInstruction(String target, String data) throws SAXException
                    {
                        handler.processingInstruction(target, data);
                    }
                   
                    public void setDocumentLocator(Locator locator)
                    {
                        handler.setDocumentLocator(locator);
                    }
                   
                    public void startDocument() throws SAXException
                    {
                        handler.startDocument();
                    }
                   
          public void endElement(String uri, String localName, String qName) throws SAXException {
                        // track menu depth
                        if (qName.equals("menu"))
                        {
                            menuDepth--;
                        }

                        // filter menu-element noded within menu definition
                        if ((menuDepth == 0) || !qName.equals("menu-element"))
                        {
                            handler.endElement(uri, localName, qName);
                        }
          }

          public void endPrefixMapping(String prefix) throws SAXException {
          }

          public void skippedEntity(String name) throws SAXException {
            handler.skippedEntity(name);
          }

          public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
                        // filter menu-element noded within menu definition
                        if ((menuDepth == 0) || !qName.equals("menu-element"))
                        {
                            handler.startElement(uri,localName, qName, atts);
                        }

                        // track menu depth
                        if (qName.equals("menu"))
                        {
                            menuDepth++;
                        }
          }

          public void startPrefixMapping(String prefix, String uri) throws SAXException {
          }
                });
            marshaller.setResolver((XMLClassDescriptorResolver) classDescriptorResolver);
           
            marshaller.setValidation(false); // results in better performance
            marshaller.marshal(document);
        }
        catch (MarshalException e)
        {
            log.error("Could not marshal the file " + absolutePath, e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (ValidationException e)
        {
            log.error("Document " + absolutePath + " is not valid", e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (IOException e)
        {
            log.error("Could not save the file " + absolutePath, e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (Exception e)
        {
            log.error("Error while saving  " + absolutePath, e);
            throw new FailedToUpdateDocumentException(e);
        }
        finally
        {
          // restore permissions / constraints
          documentImpl.setPermissionsEnabled(handlerFactory.getPermissionsEnabled());
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

            marshaller.marshal(document);
        }
        catch (MarshalException e)
        {
            log.error("Could not marshal the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (MappingException e)
        {
            log.error("Could not marshal the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (ValidationException e)
        {
            log.error("Document " + f.getAbsolutePath() + " is not valid", e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (IOException e)
        {
            log.error("Could not save the file " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        catch (Exception e)
        {
            log.error("Error while saving  " + f.getAbsolutePath(), e);
            throw new FailedToUpdateDocumentException(e);
        }
        finally
        {
            try
            {
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

                {
                    parent = (FolderImpl)getFolder(parentPath);
                }
                catch (FolderNotFoundException fnfe)
                {
                    throw new FailedToUpdateDocumentException("Missing parent folder: " + parentPath);
                }
               
                // check for edit access on parent folder; link
                // access not checked on create
                parent.checkAccess(JetspeedActions.EDIT);

                // update link and mark cache transaction
                link.setParent(parent);
                getPersistenceBrokerTemplate().store(link);
                DatabasePageManagerCache.addTransaction(new TransactionedOperation(link.getPath(), TransactionedOperation.ADD_OPERATION));

                // reset parent folder links cache
                if (parent != null)
                {
                    parent.resetLinks(false);
                }

                // notify page manager listeners
                delegator.notifyNewNode(link);
            }
            else
            {
                // check for edit access on link and parent folder
                link.checkAccess(JetspeedActions.EDIT);

                // update link and mark cache transaction
                getPersistenceBrokerTemplate().store(link);
                DatabasePageManagerCache.addTransaction(new TransactionedOperation(link.getPath(), TransactionedOperation.UPDATE_OPERATION));

                // reset parent folder links cache in case
                // parent is holding an out of date copy of
                // this link that was removed from the cache
                // before this one was accessed
                if (parent != null)
                {
                    parent.resetLinks(false);
                }

                // notify page manager listeners
                delegator.notifyUpdatedNode(link);
            }
        }
        catch (FailedToUpdateDocumentException fude)
        {
            throw fude;
        }
        catch (SecurityException se)
        {
            throw se;
        }
        catch (Exception e)
        {
            throw new FailedToUpdateDocumentException("Link " + link.getPath() + " not updated.", e);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToUpdateDocumentException

                {
                    parent = (FolderImpl)getFolder(parentPath);
                }
                catch (FolderNotFoundException fnfe)
                {
                    throw new FailedToUpdateDocumentException("Missing parent folder: " + parentPath);
                }

                // do not replace existing page security documents
                try
                {
                    parent.getPageSecurity();
                    throw new FailedToUpdateDocumentException("Parent folder page security exists: " + parentPath);
                }
                catch (DocumentNotFoundException dnfe)
                {
                    // check for edit access on parent folder; document
                    // access not checked on create
                    parent.checkAccess(JetspeedActions.EDIT);
                   
                    // update document and mark cache transaction
                    pageSecurity.setParent(parent);
                    getPersistenceBrokerTemplate().store(pageSecurity);
                    DatabasePageManagerCache.addTransaction(new TransactionedOperation(pageSecurity.getPath(), TransactionedOperation.ADD_OPERATION));

                    // reset parent folder page security cache
                    if (parent != null)
                    {                   
                        parent.resetPageSecurity((PageSecurityImpl)pageSecurity, true);
                    }
                }
                catch (Exception e)
                {
                    throw new FailedToUpdateDocumentException("Parent folder page security exists: " + parentPath);
                }

                // notify page manager listeners
                delegator.notifyNewNode(pageSecurity);
            }
            else
            {
                // check for edit access on document and parent folder
                pageSecurity.checkAccess(JetspeedActions.EDIT);

                // update document and mark cache transaction
                getPersistenceBrokerTemplate().store(pageSecurity);
                DatabasePageManagerCache.addTransaction(new TransactionedOperation(pageSecurity.getPath(), TransactionedOperation.UPDATE_OPERATION));

                // reset parent folder page security cache in case
                // parent is holding an out of date copy of this
                // page security that was removed from the cache
                // before this one was accessed
                if (parent != null)
                {               
                    parent.resetPageSecurity((PageSecurityImpl)pageSecurity, true);
                }

                // notify page manager listeners
                delegator.notifyUpdatedNode(pageSecurity);
            }

            // reset all cached security constraints
            DatabasePageManagerCache.resetCachedSecurityConstraints();
        }
        catch (FailedToUpdateDocumentException fude)
        {
            throw fude;
        }
        catch (SecurityException se)
        {
            throw se;
        }
        catch (Exception e)
        {
            throw new FailedToUpdateDocumentException("Document " + pageSecurity.getPath() + " not updated.", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.