use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class BookmarkDaoTest method testGetWithInvalidId.
/**
* Ensures that if the id is invalid then no bookmark is returned.
*/
@Test
public void testGetWithInvalidId() {
Bookmark result = dao.get(Guid.newGuid());
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class BookmarkDaoTest method testSave.
/**
* Ensures that saving a bookmark works as expected.
*/
@Test
public void testSave() {
dao.save(new_bookmark);
Bookmark result = dao.getByName(new_bookmark.getName());
assertNotNull(result);
}
use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForBookmark.
@Test
public void testGetEntityNameByIdAndTypeForBookmark() {
Bookmark bookmark = bookmarkDao.get(BOOKMARK_ID);
assertNotNull(bookmark);
String name = bookmark.getName();
assertEquals(name, underTest.getEntityNameByIdAndType(BOOKMARK_ID, VdcObjectType.Bookmarks));
}
use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class BookmarkListModel method onSave.
public void onSave() {
BookmarkModel model = (BookmarkModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (!model.validate()) {
return;
}
org.ovirt.engine.core.common.businessentities.Bookmark tempVar = new org.ovirt.engine.core.common.businessentities.Bookmark();
tempVar.setId(model.getIsNew() ? Guid.Empty : ((org.ovirt.engine.core.common.businessentities.Bookmark) getSelectedItem()).getId());
tempVar.setName(model.getName().getEntity());
tempVar.setValue(model.getSearchString().getEntity());
org.ovirt.engine.core.common.businessentities.Bookmark bookmark = tempVar;
model.startProgress();
Frontend.getInstance().runAction(model.getIsNew() ? ActionType.AddBookmark : ActionType.UpdateBookmark, new BookmarksOperationParameters(bookmark), result -> {
BookmarkListModel localModel = (BookmarkListModel) result.getState();
localModel.postOnSave(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class SearchPanelPresenterWidget method bookmarkItemsChanged.
private void bookmarkItemsChanged() {
BookmarkListModel bookmarkListModel = bookmarkModelProvider.getModel();
if (bookmarkListModel.getItems() != null) {
getView().clearBookmarks();
List<Bookmark> items = new ArrayList<>(bookmarkListModel.getItems());
final String filterString = model.getDefaultSearchString();
List<Bookmark> result = items.stream().filter(bookmark -> bookmark.getValue().startsWith(filterString)).collect(Collectors.toList());
result.forEach(bookmark -> {
registerHandler(getView().addAvailableBookmarks(bookmark, e -> {
model.setSearchString(bookmark.getValue());
model.search();
}));
});
}
}
Aggregations