use of de.djuelg.neuronizer.storage.converter.TodoListHeaderDAOConverter in project Neuronizer by djuelg.
the class PreviewRepositoryImpl method constructPreview.
private TodoListPreview constructPreview(Realm realm, TodoListDAO todoListDAO, ItemsPerPreview itemsPerPreview) {
TodoList todoList = RealmConverter.convert(todoListDAO);
Optional<TodoListHeaderDAO> headerDAO = Optional.fromNullable(realm.where(TodoListHeaderDAO.class).equalTo("parentTodoListUuid", todoListDAO.getUuid()).findAllSorted("position", Sort.DESCENDING).where().findFirst());
TodoListHeader header = headerDAO.transform(new TodoListHeaderDAOConverter()).orNull();
List<TodoListItem> items = getItemPreviewOfHeader(realm, header, itemsPerPreview);
return new TodoListPreview(todoList, header, items);
}
use of de.djuelg.neuronizer.storage.converter.TodoListHeaderDAOConverter in project Neuronizer by djuelg.
the class TodoListRepositoryImpl method getHeaderById.
@Override
public Optional<TodoListHeader> getHeaderById(String uuid) {
Realm realm = Realm.getInstance(configuration);
Optional<TodoListHeaderDAO> headerDAO = Optional.fromNullable(realm.where(TodoListHeaderDAO.class).equalTo("uuid", uuid).findFirst());
Optional<TodoListHeader> header = headerDAO.transform(new TodoListHeaderDAOConverter());
realm.close();
return header;
}
Aggregations