Difference between revisions of "Documentation/DevGuide/UCB/Deleting"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
 
(2 intermediate revisions by one other user not shown)
Line 10: Line 10:
 
Executing the command "<code>delete</code>" 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.  
 
Executing the command "<code>delete</code>" 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|The command also destroys all existing sub-resources of the resource to be destroyed!}}
+
{{Warn|The command also destroys all existing sub-resources of the resource to be destroyed!}}
  
 
If <code>false</code> 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 "<code>undelete</code>". 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.
 
If <code>false</code> 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 "<code>undelete</code>". 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|Currently we do not have a trash service that could be used by UCB clients to manage soft-deleted contents.}}
+
{{Note|Currently we do not have a trash service that could be used by UCB clients to manage soft-deleted contents.}}
  
 
Deleting a resource:  
 
Deleting a resource:  
 
<!--[SOURCE:UCB/ResourceRemover.java]-->
 
<!--[SOURCE:UCB/ResourceRemover.java]-->
  <source lang="java">
+
<syntaxhighlight lang="java">
 
   import com.sun.star.ucb.*;
 
   import com.sun.star.ucb.*;
 
    
 
    
Line 42: Line 42:
 
       }
 
       }
 
   }
 
   }
  </source>
+
</syntaxhighlight>
 
{{PDL1}}
 
{{PDL1}}
  
 
[[Category:Documentation/Developer's Guide/Universal Content Broker]]
 
[[Category:Documentation/Developer's Guide/Universal Content Broker]]

Latest revision as of 16:43, 21 December 2020



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