Class RemovableUtil

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

public class RemovableUtil extends Object
Version:
2.0
Author:
Nicklas
Last modified
$Date: 2019-02-27 14:18:43 +0100 (ons, 27 feb. 2019) $
  • Constructor Details

    • RemovableUtil

      public RemovableUtil()
  • Method Details

    • 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)