本文整理汇总了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();
}