use of org.irods.jargon.core.pub.TrashOperationsAO in project metalnx-web by irods-contrib.
the class FileOperationServiceImpl method emptyTrash.
@Override
public boolean emptyTrash(DataGridUser user, String collectionPath) throws DataGridConnectionRefusedException, JargonException {
logger.info("emptyTrash()");
if (user == null || collectionPath == null || collectionPath.isEmpty()) {
return false;
}
logger.info("user:{}", user);
logger.info("collectionPath:{}", collectionPath);
boolean itemsDeleted = false;
try {
TrashOperationsAO trashOperationsAO = irodsServices.getTrashOperationsAO();
/*
* if (user.isAdmin()) { logger.info("delete as admin");
* trashOperationsAO.emptyAllTrashAsAdmin(irodsServices.getCurrentUserZone(),
* 0); // trashOperationsAO.emptyTrashAtPathAdminMode(collectionPath, "", //
* irodsServices.getCurrentUserZone(), 0); itemsDeleted = true; } else {
*/
logger.info("delete as user");
trashOperationsAO.emptyTrashAtPathForLoggedInUser(collectionPath, irodsServices.getCurrentUserZone(), 0);
itemsDeleted = true;
/* } */
} catch (JargonException je) {
logger.error("jargon exception emptying trash", je);
throw je;
}
return itemsDeleted;
}
Aggregations