- public interface TrashService¶
The TrashService provides methods related with the module trash mode (by default the mode is active and it can be turned off by the user).
- Collection getInstancesFromTrash(String entityName, QueryParams queryParams)¶
Returns the collection of instances from trash of a certain entity. Returned collection contains only instances that are on the current schema version.
- entityName – Instances of what entity should be looked for
- queryParams – Query parameters such as page number, size of page and sort direction. If null method will return all records in trash.
Collection of instances on the current schema version in trash
- boolean isTrashMode()¶
Checks if trash mode is active. This method should be used before executing the moveToTrash(Object,Long) method to resolve whether the given instance should be moved to trash or removed permanently.
Returns: true if delete mode is equal to org.motechproject.mds.config.DeleteMode.TRASH; false otherwise.
- void scheduleEmptyTrashJob()¶
Sets the repeating schedule job that will be executed from time to time. Execution time depends on the value of time value and time unit (defined in org.motechproject.mds.util.Constants.Config.MODULE_FILE).
Before scheduling new job, the old one should be unscheduled to prevent the errors.