1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| public class Article {
private int id;
private String name; // description varchar(50)not null,
private String image; // image varchar(200) null,
private BigDecimal price; // decimal(7,2) not null,
private String content; // varchar(1000)not null,
private Category category; // numeric not null,
private Manufacturer manufacturer; //constructeur_id numeric not null,
private Date published; // dateMiseEnLigne date null,
private int stock; // numeric not null,
private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
/**
* Construct a new article with invalid fields except
* image (null), content (empty), published (null) and stock (0).
*/
public Article() {
this(0, null, null, null, null);// call to the overloaded constructor
}
/**
* Construct a new article with required fields
* @param id
* @param name
* @param price
* @param category
* @param manufacturer
*/
public Article(int id, String name, BigDecimal price, Category category, Manufacturer manufacturer) {
this(id, name, "", price, "", category, manufacturer, null, 0);
}
/**
* Construct a new article with all fields
* @param id
* @param name
* @param image
* @param price
* @param content
* @param category
* @param manufacturer
* @param published
* @param stock
*/
public Article(int id, String name, String image, BigDecimal price, String content, Category category, Manufacturer manufacturer, Date published, int stock) {
this.setId(id);
this.setName(name);
this.setImage(image);
this.setPrice(price);
this.setContent(content);
this.setCategory(category);
this.setManufacturer(manufacturer);
this.setPublished(published);
this.setStock(stock);
} |
Partager