Hi

This is the code I made to delete documents.

/*
         * This method receives a specific path, where the document
that we want to delete is the last name in the path,
         * returns true if the document was deleted. The documents
that we can delete are: Sections, Templates, Folders,
         * Workspaces, Files and Domains . The method returns true
if the file was erased
         */
        public boolean deleteDocument(String documentPath)
        {
                boolean wasDeleted = false;
                boolean existPath = false;
                
        try 
        {
                        request= session.newRequest("Document.Delete");
                        request.setInput(new PathRef(documentPath)).execute();
                        wasDeleted = true;
                } 
        catch (Exception e) 
        {
                        
                System.out.println("Document was not deleted");
                existPath= checkPath(documentPath);
                if(!existPath)
                {
                        System.out.println("Document was not deleted,
because the path doesn't exist");
                }
                else
                {
                        System.out.println("Document was not deleted,
unknown reason ");
                }
                return wasDeleted;
                }
      
        System.out.println("Document was deleted");  
                
                return wasDeleted;
        }
---
Mailing list: [email protected]
Forum: http://forum.nuxeo.org/f/1/

Reply via email to