diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Book.java b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Book.java index f176323..9ac6710 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Book.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/model/book/Book.java @@ -24,6 +24,7 @@ import javax.validation.Valid; import javax.validation.constraints.DecimalMax; import javax.validation.constraints.DecimalMin; import javax.validation.constraints.Digits; +import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; @@ -232,6 +233,15 @@ public class Book { ) private Category category; + @Column( + nullable = false, + columnDefinition = "BIT" + ) + @Min(0) + @Max(1) + @JsonIgnore + private int publish; + //////////////////// // Attribute setters @@ -274,6 +284,10 @@ public class Book { this.category = category; } + public void setPublish(int publish) { + this.publish = publish; + } + //////////////////// // Attribute getters @@ -312,12 +326,16 @@ public class Book { return category; } + public int getPublish() { + return publish; + } + //////////////////// // Class constructors public Book() {} - public Book(String title, Author author, int year, String isbn, BigDecimal price, Category category) { + public Book(String title, Author author, int year, String isbn, BigDecimal price, Category category, int publish) { // super(); this.title = title; this.author = author; @@ -325,6 +343,7 @@ public class Book { this.isbn = isbn; this.price = price; this.category = category; + this.publish = publish; } //////////////////// @@ -339,7 +358,8 @@ public class Book { "year: " + this.year + ", " + "isbn: " + this.isbn + ", " + "price: " + this.price + ", " + - "category: " + this.category + "]"; + "category: " + this.category + ", " + + "publish: " + this.publish + "]"; } }