Browse Source

Implement publish attribute

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.3-alpha
Pekka Helenius 4 years ago
parent
commit
486ec6a108
1 changed files with 22 additions and 2 deletions
  1. +22
    -2
      bookstore/src/main/java/com/fjordtek/bookstore/model/book/Book.java

+ 22
- 2
bookstore/src/main/java/com/fjordtek/bookstore/model/book/Book.java View File

@ -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 + "]";
}
}

Loading…
Cancel
Save