public class Trashcan extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Trashcan.CircularRefInfo
Helper class for holding information about a single
item, other items using it and other information that is
relevant for resolving circular references.
|
Modifier and Type | Field and Description |
---|---|
private static boolean |
isDebug |
private static org.slf4j.Logger |
log
Log trashcan events.
|
Constructor and Description |
---|
Trashcan() |
Modifier and Type | Method and Description |
---|---|
private static int |
breakCircularReferences(SessionControl sc,
Set<Identifiable> itemsToRemove) |
static int |
delete(SessionControl sc,
Collection<? extends Identifiable> items,
boolean ignoreFlag,
ProgressReporter progress)
Delete items permanently.
|
static int |
deleteAll(SessionControl sc,
ProgressReporter progress)
Delete all items in the trashcan of the logged in user.
|
static ResultList<Removable> |
getItems(DbControl dc,
Item itemType,
int firstItem,
int maxItems) |
static ResultList<Removable> |
getItems(DbControl dc,
Set<Item> itemTypes,
int firstItem,
int maxItems) |
static ResultList<Removable> |
getItems(DbControl dc,
Set<Item> itemTypes,
int firstItem,
int maxItems,
Restriction restriction)
Load all items flagged for deletion that are owned by or removed
by the logged in user.
|
private static final org.slf4j.Logger log
private static final boolean isDebug
public static ResultList<Removable> getItems(DbControl dc, Item itemType, int firstItem, int maxItems) throws BaseException
BaseException
getItems(DbControl, Set, int, int, Restriction)
public static ResultList<Removable> getItems(DbControl dc, Set<Item> itemTypes, int firstItem, int maxItems) throws BaseException
BaseException
getItems(DbControl, Set, int, int, Restriction)
public static ResultList<Removable> getItems(DbControl dc, Set<Item> itemTypes, int firstItem, int maxItems, Restriction restriction) throws BaseException
Restrictions.conditionalRestriction(Filter, Restriction, Restriction, boolean)
so that a restriction on, for example, the 'name' is only applied
to Nameable
items.dc
- The DbControl
to use for database accessitemTypes
- Limit the list to only return items of the types,
included in the set, use null or an empty set to return items of all typesfirstItem
- The index of the first item to return (0-based)maxItems
- The maximum number of items to return, or 0 to return all itemsrestriction
- A restriction to apply when loading itemsBaseException
- If there is an error of some kindpublic static int delete(SessionControl sc, Collection<? extends Identifiable> items, boolean ignoreFlag, ProgressReporter progress) throws BaseException
sc
- The session control to use for connecting to the database. To
avoid multithread-related problems the session control is cloned
before being used by this method.items
- The items to removeignoreFlag
- TRUE to also remove items that hasn't been flagged for removalprogress
- An optional progress reporterBaseException
- If an item can't be deleted.public static int deleteAll(SessionControl sc, ProgressReporter progress)
getItems(DbControl, Item, int, int)
to load all items
that have been flagged for removal and then
delete(SessionControl, Collection, boolean, ProgressReporter)
to remove those items. See the delete
for
more information about transactions.sc
- The session control to use for connecting to the databaseprogress
- An optional progress reporterprivate static int breakCircularReferences(SessionControl sc, Set<Identifiable> itemsToRemove)