use of com.emc.metalnx.core.domain.entity.DataGridGroupBookmark in project metalnx-web by irods-contrib.
the class GroupBookmarkDaoImpl method removeByParentPath.
@Override
public boolean removeByParentPath(String parentPath) {
logger.debug("Removing bookmarks by relative path: {} ", parentPath);
boolean removalSuccessful = false;
try {
Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserBookmark where path LIKE :path");
q.setString("path", parentPath + "%");
List<DataGridGroupBookmark> bookmarks = q.list();
Iterator<DataGridGroupBookmark> bookmarksIterator = bookmarks.iterator();
while (bookmarksIterator.hasNext()) {
DataGridGroupBookmark currBookmark = bookmarksIterator.next();
logger.debug("Removing relative bookmark {} from database", currBookmark.getPath());
delete(currBookmark);
}
} catch (Exception e) {
logger.error("Could not relative paths on bookmarks for path {} ", parentPath);
}
return removalSuccessful;
}
use of com.emc.metalnx.core.domain.entity.DataGridGroupBookmark in project metalnx-web by irods-contrib.
the class GroupBookmarkDaoImpl method removeByGroupAndPath.
@Override
public boolean removeByGroupAndPath(DataGridGroup group, String path) {
boolean madeModifications = false;
boolean operationResult = true;
logger.info("Attempting to remove bookmark on {} from group {}", path, group.getGroupname());
try {
Iterator<DataGridGroupBookmark> it = group.getGroupBookmarks().iterator();
while (it.hasNext()) {
DataGridGroupBookmark bk = it.next();
if (bk.getPath().compareTo(path) == 0) {
madeModifications = true;
it.remove();
}
}
if (madeModifications) {
logger.debug("Attempting to merge group entity [{}]", group.getId());
groupDao.merge(group);
logger.info("Successfully removed bookmark {} from group{}", path, group.getGroupname());
}
} catch (Exception e) {
operationResult = false;
logger.error("Could not remove bookmark on {} from group {}", path, group.getGroupname(), e);
}
return operationResult;
}
use of com.emc.metalnx.core.domain.entity.DataGridGroupBookmark in project metalnx-web by irods-contrib.
the class GroupBookmarkDaoImpl method removeByPath.
@Override
public boolean removeByPath(String path) {
logger.debug("Removing bookmarks by path: {} ", path);
boolean removalSuccessful = false;
try {
List<DataGridGroupBookmark> bookmarks = findBookmarksByPath(path);
Iterator<DataGridGroupBookmark> it = bookmarks.iterator();
while (it.hasNext()) {
DataGridGroupBookmark bookmark = it.next();
logger.debug("Removing bookmark {} from database", bookmark.getPath());
delete(bookmark);
}
removalSuccessful = true;
} catch (Exception e) {
logger.error("Could not remove bookmark for path {} ", path);
}
return removalSuccessful;
}
Aggregations