Package net.sf.basedb.util
Class RemovableUtil
java.lang.Object
net.sf.basedb.util.RemovableUtil
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2019-02-27 14:18:43 +0100 (ons, 27 feb. 2019) $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
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 parentprivate 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 directorystatic 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)
-
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 databaseitemType
- The itemType to deleteitems
- 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
- Throws:
BaseException
-
restorePath
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
- TheDbControl
wich will be used for database accessitem
- Parent of the subitems that shall be removedremoved
- 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
-
sumArrays
private static int[] sumArrays(int[] baseArray, int[] newResult) -
removeAnyToAnyLinkedTo
-
removeFileSetMembers
private static int[] removeFileSetMembers(DbControl dc, FileStoreEnabled fileStore, boolean removed)
-