Deleting

From Apache OpenOffice Wiki
Jump to: navigation, search



Executing the command "delete" on a UCB content destroys the resource it represents. This command takes a boolean parameter. If it is set to true, the resource is immediately, destroyed physically.

Documentation caution.png The command also destroys all existing sub-resources of the resource to be destroyed!

If false is passed to this command, the caller wants to delete the resource "logically". This means that the resource is restored or physically destroyed later. A soft-deleted content needs to support the command "undelete". This command brings it back to life. The implementation of the delete command can ignore the parameter and may opt to always destroy the resource physically.

Documentation note.png Currently we do not have a trash service that could be used by UCB clients to manage soft-deleted contents.

Deleting a resource:

  import com.sun.star.ucb.*;
 
  {
      XContent xContent = ...
 
      /////////////////////////////////////////////////////////////////////
      // Destroy a resource physically...
      /////////////////////////////////////////////////////////////////////
 
      try {
          Boolean bDeletePhysically = new Boolean(true);
 
          // Execute command "delete".
          // using helper method executeCommand (see [CHAPTER:UCB.Using.Commands])
          executeCommand(xContent, "delete", bDeletePhysically);
      }
      catch (com.sun.star.ucb.CommandAbortedException e) {
          ... error ...
      }
      catch (com.sun.star.uno.Exception e) {
          ... error ...
      }
  }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages