@Override protected List<BookDO> getChoices(final String input) { final BookFilter filter = new BookFilter(); filter.setSearchString(input); filter.setSearchFields("title", "authors"); final List<BookDO> list = bookDao.getList(filter); return list; }
@Override protected void onSaveOrModify(final BookDO obj) { if (obj.getTaskId() == null) { setTask(obj, getDefaultTaskId()); } }
@Override public BookDO newInstance() { return new BookDO(); }
public Object doInTransaction(TransactionStatus status) { BookDO dbBook = bookDao.internalGetById(ids[1]); BookDO book = new BookDO(); book.copyValuesFrom(dbBook); assertFalse("Signature should not exist.", bookDao.doesSignatureAlreadyExist(book)); book.setSignature("42"); assertTrue("Signature should already exist.", bookDao.doesSignatureAlreadyExist(book)); book.setSignature("4711"); assertFalse("Signature should not exist.", bookDao.doesSignatureAlreadyExist(book)); bookDao.internalUpdate(book); return null; } });
private BookDO createTestBook(String signature) { BookDO book = new BookDO(); book.setTask(getTask("root")); book.setSignature(signature); book.setStatus(BookStatus.PRESENT); return book; } }
public BookEditForm(final BookEditPage parentPage, final BookDO data) { super(parentPage, data); if (isNew() == true) { data.setStatus(BookStatus.PRESENT); data.setType(BookType.BOOK); } if (getData().getTaskId() == null) { bookDao.setTask(getData(), bookDao.getDefaultTaskId()); } }
public Object doInTransaction(TransactionStatus status) { BookDO book = bookDao.internalGetById(ids[1]); assertFalse("Signature should not exist.", bookDao.doesSignatureAlreadyExist(book)); book.setSignature(null); assertFalse("Signature should not exist.", bookDao.doesSignatureAlreadyExist(book)); bookDao.internalUpdate(book); return null; } });
protected void returnBook() { getData().setLendOutDate(null); getData().setLendOutBy(null); getData().setLendOutComment(null); bookDao.update(getData()); setResponsePage(); }
public Object doInTransaction(TransactionStatus status) { BookDO book = createTestBook("42"); assertTrue("Signature should already exist.", bookDao.doesSignatureAlreadyExist(book)); book.setSignature("5"); assertFalse("Signature should not exist.", bookDao.doesSignatureAlreadyExist(book)); bookDao.internalSave(book); return null; } });
@Override protected String formatLabel(final BookDO book) { return StringHelper.listToString("; ", book.getAuthors(), book.getTitle()); }
/** * @param book * @param taskId If null, then task will be set to null; * @see BaseDao#getOrLoad(Integer) */ public void setTask(final BookDO book, final Integer taskId) { final TaskDO task = taskDao.getOrLoad(taskId); book.setTask(task); }
protected void lendOut() { getData().setLendOutDate(new Date()); bookDao.setLendOutBy(getData(), getUserId()); bookDao.update(getData()); setResponsePage(); }
@Override protected String formatValue(final BookDO book) { return "id:" + book.getId(); }
/** * @param book * @param lendOutById If null, then task will be set to null; * @see BaseDao#getOrLoad(Integer) */ public void setLendOutBy(final BookDO book, final Integer lendOutById) { final PFUserDO user = userDao.getOrLoad(lendOutById); book.setLendOutBy(user); }
/** * @see org.projectforge.framework.persistence.api.BaseDao#hasAccess(Object, OperationType) */ @Override public boolean hasAccess(final PFUserDO user, final BookDO obj, final BookDO oldObj, final OperationType operationType, final boolean throwException) { return accessChecker.hasPermission(user, obj.getTaskId(), AccessType.TASKS, operationType, throwException); }
/** * @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { return data.getLendOutBy() != null; } });
public Object doInTransaction(TransactionStatus status) { BookDO book = createTestBook("42"); ids[0] = bookDao.internalSave(book); book = createTestBook(null); ids[1] = bookDao.internalSave(book); return null; } });
@Override public BookListFilter reset() { super.reset(); setPresent(true); setMissed(false); setDisposed(false); return this; } }
/** * @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { return data.getLendOutBy() != null; } });