Web implementation of the Gourmet Recipe Manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

229 lines
4.0 KiB

package com.mousetech.gourmetj.persistence.model;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
/**
* The persistent class for the "ingredients" database table. The
* display model is @see IngredientUI. Persistence is usually
* done along with the containing recipe via
*
* @see RecipeService.
*/
@Entity
@Table(name = "ingredients")
@NamedQuery(name = "Ingredient.findAll", query = "SELECT i FROM Ingredient i")
public class Ingredient implements Serializable, IngredientIF {
private static final long serialVersionUID = 1L;
@ManyToOne(fetch = FetchType.EAGER, cascade = {
CascadeType.PERSIST, CascadeType.MERGE,
CascadeType.REFRESH }, optional = true)
@JoinColumn(name = "ingkey", referencedColumnName = "ingkey")
Shopcat shopCat;
/**
* @return the shopCat
*/
public Shopcat getShopCat() {
return shopCat;
}
/**
* @param shopCat the shopCat to set
*/
public void setShopCat(Shopcat shopCat) {
this.shopCat = shopCat;
}
@Column(name = "amount")
private Double amount;
@Column(name = "deleted")
private Integer deleted;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "inggroup")
private String inggroup;
@Column(name = "ingkey",insertable = false, updatable = false)
private String ingkey;
@Column(name = "item")
private String item;
@Column(name = "optional")
//@NotNull
private Integer optional;
@Column(name = "position")
private Integer position;
@Column(name = "rangeamount")
private Double rangeamount;
@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "recipe_id")
Recipe recipe;
@Column(name = "refid")
private Long refid;
@Column(name = "shopoptional")
private Integer shopoptional;
@Column(name = "unit")
private String unit;
public Ingredient() {
// Attempt to remedy lack of constraints in DB
this.optional = 0;
}
@Override
public Double getAmount() {
return this.amount;
}
@Override
public void setAmount(Double amount) {
this.amount = amount;
}
@Override
public Integer getDeleted() {
return this.deleted;
}
@Override
public void setDeleted(Integer deleted) {
this.deleted = deleted;
}
@Override
public Long getId() {
return this.id;
}
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public String getInggroup() {
return this.inggroup;
}
@Override
public void setInggroup(String inggroup) {
this.inggroup = inggroup;
}
@Override
public String getIngkey() {
return this.ingkey;
}
@Override
public void setIngkey(String ingkey) {
this.ingkey = ingkey;
}
@Override
public String getItem() {
return this.item;
}
@Override
public void setItem(String item) {
this.item = item;
}
@Override
public Integer getOptional() {
return this.optional;
}
@Override
public void setOptional(Integer optional) {
this.optional = optional;
}
@Override
public Integer getPosition() {
return this.position;
}
@Override
public void setPosition(Integer position) {
this.position = position;
}
@Override
public Double getRangeamount() {
return this.rangeamount;
}
@Override
public void setRangeamount(Double rangeamount) {
this.rangeamount = rangeamount;
}
// public Long getRecipeId() {
// return this.recipeId;
// }
//
// public void setRecipeId(Long recipeId) {
// this.recipeId = recipeId;
// }
@Override
public Recipe getRecipe() {
return recipe;
}
@Override
public void setRecipe(Recipe recipe) {
this.recipe = recipe;
}
@Override
public Long getRefid() {
return this.refid;
}
@Override
public void setRefid(Long refid) {
this.refid = refid;
}
@Override
public Integer getShopoptional() {
return this.shopoptional;
}
@Override
public void setShopoptional(Integer shopoptional) {
this.shopoptional = shopoptional;
}
@Override
public String getUnit() {
return this.unit;
}
@Override
public void setUnit(String unit) {
this.unit = unit;
}
@Override
public String toString() {
return this.getItem();
}
}