本文整理匯總了Java中ch.bfh.swos.bookapp.service.dto.BookDTO類的典型用法代碼示例。如果您正苦於以下問題:Java BookDTO類的具體用法?Java BookDTO怎麽用?Java BookDTO使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BookDTO類屬於ch.bfh.swos.bookapp.service.dto包,在下文中一共展示了BookDTO類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
@Test
public void test() {
// Create
BookDTO newBook = new BookDTO();
newBook.setTitle("Test");
newBook = bookService.create(newBook);
// Read
BookDTO readBook = bookService.read(newBook.getId());
Assert.assertTrue(newBook.getTitle().equals(readBook.getTitle()));
// Update
readBook.setTitle("Test2");
readBook = bookService.update(readBook);
BookDTO updatedBook = bookService.read(readBook.getId());
Assert.assertTrue(readBook.getTitle().equals(updatedBook.getTitle()));
// Delete
bookService.delete(updatedBook);
BookDTO deletedBook = bookService.read(readBook.getId());
Assert.assertNull(deletedBook);
}
示例2: test
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
@Test
public void test() {
// Create
BookDTO newBook = new BookDTO();
newBook.setTitle("Test");
newBook = bookService.create(newBook);
// Read
BookDTO readBook = bookService.read(newBook.getId());
Assert.assertTrue(newBook.getTitle().equals(readBook.getTitle()));
// Update
readBook.setTitle("Test2");
readBook = bookService.update(readBook);
BookDTO updatedBook = bookService.read(readBook.getId());
Assert.assertTrue(readBook.getTitle().equals(updatedBook.getTitle()));
// Delete
bookService.delete(updatedBook);
BookDTO deletedBook = bookService.read(readBook.getId());
Assert.assertNull(deletedBook);
}
示例3: create
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Create
*/
@RequestMapping(method = RequestMethod.POST)
public BookDTO create(@RequestBody BookDTO book) {
BookDTO createdBook = bookService.create(book);
System.out.println("Book created with id = " + createdBook.getId());
return createdBook;
}
示例4: update
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Update
*/
@RequestMapping(value = "{id}", method = RequestMethod.PUT)
public BookDTO update(@RequestBody BookDTO book, @PathVariable long id) {
BookDTO updatedBook = bookService.update(book);
System.out.println("Book updated with id = " + updatedBook.getId());
return updatedBook;
}
示例5: delete
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Delete
*/
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
public void delete(@PathVariable long id) {
BookDTO book = bookService.read(id);
bookService.delete(book);
System.out.println("Delete Book with id = " + id);
}
示例6: createBook
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Create
*/
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public BookDTO createBook(@RequestBody BookDTO book) {
BookDTO createdBook = bookService.create(book);
System.out.println("Book created with id = " + createdBook.getId());
return createdBook;
}
示例7: getBooks
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* ReadAll
*/
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public Collection<BookDTO> getBooks() {
System.out.println("Collection of Book requested");
return bookService.list();
}
示例8: getBook
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Read
*/
@RequestMapping(value = "{id}", method = RequestMethod.GET)
@ResponseBody
public BookDTO getBook(@PathVariable long id) {
System.out.println("Book requested with id = " + id);
return bookService.read(id);
}
示例9: updateBook
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Update
*/
@RequestMapping(method = RequestMethod.PUT)
@ResponseBody
public BookDTO updateBook(@RequestBody BookDTO book) {
BookDTO updatedBook = bookService.update(book);
System.out.println("Book updated with id = " + updatedBook.getId());
return updatedBook;
}
示例10: deleteBook
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Delete
*/
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
public void deleteBook(@PathVariable long id) {
BookDTO book = bookService.read(id);
bookService.delete(book);
System.out.println("Delete Book with id = " + id);
}
示例11: create
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Create
*/
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public BookDTO create(@RequestBody BookDTO book) {
BookDTO createdBook = bookService.create(book);
System.out.println("Book created with id = " + createdBook.getId());
return createdBook;
}
示例12: list
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* ReadAll
*/
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public Collection<BookDTO> list() {
System.out.println("Collection of Book requested");
return bookService.list();
}
示例13: read
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Read
*/
@RequestMapping(value = "{id}", method = RequestMethod.GET)
@ResponseBody
public BookDTO read(@PathVariable long id) {
System.out.println("Book requested with id = " + id);
return bookService.read(id);
}
示例14: update
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* Update
*/
@RequestMapping(value = "{id}", method = RequestMethod.PUT)
@ResponseBody
public BookDTO update(@RequestBody BookDTO book, @PathVariable long id) {
BookDTO updatedBook = bookService.update(book);
System.out.println("Book updated with id = " + updatedBook.getId());
return updatedBook;
}
示例15: list
import ch.bfh.swos.bookapp.service.dto.BookDTO; //導入依賴的package包/類
/**
* ReadAll
*/
@RequestMapping(method = RequestMethod.GET)
public Collection<BookDTO> list() {
System.out.println("Collection of Book requested");
return bookService.list();
}