2.17.2: 2011-06-17

net.sf.basedb.util
Class RemovableUtil

java.lang.Object
  extended by net.sf.basedb.util.RemovableUtil

public class RemovableUtil
extends Object

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2009-06-26 13:43:01 +0200 (Fri, 26 Jun 2009) $

Constructor Summary
RemovableUtil()
           
 
Method Summary
static int delete(DbControl dc, Item itemType, Set<Integer> items)
           
private static int[] removeAnyToAnyLinkedTo(DbControl dc, ItemQuery<AnyToAny> any2AnyQuery, boolean removed)
           
private static int[] removeDependingItems(DbControl dc, Removable item, boolean removed)
          Sets the removed-flag for all subitems to a parent
private static int[] removeFileSetMembers(DbControl dc, FileStoreEnabled fileStore, boolean removed)
           
static int[] removeRecursively(DbControl dc, Item itemType, Set<Integer> items, boolean removed)
          Set the removed flag for selected items, including the subitems.
private static int[] restorePath(Directory parentDir)
          Restores the path to a directory
static int setRemoved(DbControl dc, Item itemType, Set<Integer> items, boolean removed)
           
private static boolean setRemovedFlag(Removable item, boolean removed)
           
private static int[] sumArrays(int[] baseArray, int[] newResult)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemovableUtil

public RemovableUtil()
Method Detail

setRemoved

public static int setRemoved(DbControl dc,
                             Item itemType,
                             Set<Integer> items,
                             boolean removed)
                      throws BaseException
Throws:
BaseException

removeRecursively

public static int[] removeRecursively(DbControl dc,
                                      Item itemType,
                                      Set<Integer> items,
                                      boolean removed)
                               throws BaseException
Set the removed flag for selected items, including the subitems.

Parameters:
dc - The database control to use when accessing the database
itemType - The itemType to delete
items - A set of ids from the items that shall be deleted.
removed - True if the items should be deleted. False if the items should be restored.
Returns:
An int[2] where [0] is the number of removed/restored items, including the parent and [1] is the total number of items that were included in the selection.
Throws:
BaseException - If there is an error

delete

public static int delete(DbControl dc,
                         Item itemType,
                         Set<Integer> items)
                  throws BaseException
Throws:
BaseException

restorePath

private static int[] restorePath(Directory parentDir)
Restores the path to a directory

Parameters:
parentDir - The Directory that is being restored
Returns:
An int[2] were [0] is the number of restored directories and [1] is the total number of directories.

removeDependingItems

private static int[] removeDependingItems(DbControl dc,
                                          Removable item,
                                          boolean removed)
                                   throws BaseException
Sets the removed-flag for all subitems to a parent

Parameters:
dc - The DbControl wich will be used for database access
item - Parent of the subitems that shall be removed
removed - True if the subitems should be flagged removed. False if the subitems should be restored
Returns:
An int[2] where [0] is the number of removed items and [1] is the total number of subitems.
Throws:
BaseException - If there is an error

setRemovedFlag

private static boolean setRemovedFlag(Removable item,
                                      boolean removed)

sumArrays

private static int[] sumArrays(int[] baseArray,
                               int[] newResult)

removeAnyToAnyLinkedTo

private static int[] removeAnyToAnyLinkedTo(DbControl dc,
                                            ItemQuery<AnyToAny> any2AnyQuery,
                                            boolean removed)

removeFileSetMembers

private static int[] removeFileSetMembers(DbControl dc,
                                          FileStoreEnabled fileStore,
                                          boolean removed)

2.17.2: 2011-06-17