use of de.djuelg.neuronizer.domain.model.todolist.TodoListItem in project Neuronizer by djuelg.
the class DisplayTodoListPresenterImpl method createSubItemList.
private List<TodoListItemViewModel> createSubItemList(TodoListHeaderViewModel headerVM, List<TodoListItem> items) {
Collections.sort(items, new PositionComparator());
List<TodoListItemViewModel> itemVMs = new ArrayList<>();
for (TodoListItem item : items) {
itemVMs.add(new TodoListItemViewModel(headerVM, item));
}
return itemVMs;
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListItem in project Neuronizer by djuelg.
the class DisplayTodoListPresenterImpl method syncSubItems.
private void syncSubItems(List<ISectionable> subItems) {
List<ISectionable> reversedItems = Lists.reverse(Optional.fromNullable(subItems).or(new ArrayList<ISectionable>(0)));
for (ISectionable vm : reversedItems) {
TodoListItem item = ((TodoListItemViewModel) vm).getItem();
EditItemInteractor interactor = new EditItemInteractorImpl(mExecutor, mMainThread, this, repository, item.getUuid(), item.getTitle(), reversedItems.indexOf(vm), item.isImportant(), item.getDetails(), item.isDone(), ((TodoListItemViewModel) vm).getHeader().getHeader().getUuid());
interactor.execute();
}
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListItem in project Neuronizer by djuelg.
the class TodoListRepositoryImplTest method testDeleteItemNotExisting.
@Test
public void testDeleteItemNotExisting() {
TodoListItem item = createItem();
repository.delete(item);
Optional<TodoListItem> fromDb = repository.getItemById(item.getUuid());
assertFalse(fromDb.isPresent());
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListItem in project Neuronizer by djuelg.
the class TodoListRepositoryImplTest method testUpdateItemAsInsert.
@Test
public void testUpdateItemAsInsert() {
TodoListItem item = new TodoListItem("InsertTest", 0, false, "", "uuid0", "uuid1");
repository.update(item);
Optional<TodoListItem> fromDb = repository.getItemById(item.getUuid());
assertEquals(item, fromDb.get());
}
use of de.djuelg.neuronizer.domain.model.todolist.TodoListItem in project Neuronizer by djuelg.
the class TodoListRepositoryImplTest method testTodoListItemInsert.
@Test
public void testTodoListItemInsert() {
TodoListItem item = createItem();
boolean success = repository.insert(item);
assertTrue(success);
TodoListItemDAO dao = realm.where(TodoListItemDAO.class).equalTo("uuid", item.getUuid()).findFirst();
assertNotNull(dao);
}
Aggregations