From 6ba1eb7feab6fd7cf569786a7dfbda43c44eaf0b Mon Sep 17 00:00:00 2001 From: Tim Holloway Date: Tue, 28 Dec 2021 13:30:53 -0500 Subject: [PATCH] Added Gourmet Model Entities --- pom.xml | 16 +- .../gourmetj/persistence/model/Category.java | 34 +-- .../gourmetj/persistence/model/Convtable.java | 54 ++++ .../persistence/model/Crossunitdict.java | 54 ++++ .../gourmetj/persistence/model/Density.java | 54 ++++ .../gourmetj/persistence/model/Info.java | 76 +++++ .../persistence/model/Ingredient.java | 223 +++++++++++++++ .../persistence/model/IngredientIF.java | 64 +++++ .../gourmetj/persistence/model/Keylookup.java | 76 +++++ .../gourmetj/persistence/model/Pantry.java | 54 ++++ .../persistence/model/PluginInfo.java | 87 ++++++ .../gourmetj/persistence/model/Recipe.java | 267 ++++++++++++++++++ .../gourmetj/persistence/model/Shopcat.java | 85 ++++++ .../persistence/model/Shopcatsorder.java | 54 ++++ .../gourmetj/persistence/model/Unitdict.java | 54 ++++ 15 files changed, 1230 insertions(+), 22 deletions(-) create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Convtable.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Crossunitdict.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Density.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Info.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Ingredient.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/IngredientIF.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Keylookup.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Pantry.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/PluginInfo.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Shopcat.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Shopcatsorder.java create mode 100644 src/main/java/com/mousetech/gourmetj/persistence/model/Unitdict.java diff --git a/pom.xml b/pom.xml index 71ffe3a..a91b077 100644 --- a/pom.xml +++ b/pom.xml @@ -6,13 +6,13 @@ 4.0.0 com.mousetech.gourmet - jsf-primefaces-datatable - 0.0.1-SNAPSHOT + gourmetj + 0.1.1-SNAPSHOT jar - jsf-primefaces-datatable - JSF PrimeFaces DataTable Example - https://codenotfound.com/jsf-primefaces-datatable-example.html + GourmetJ + Gourmet Recipe Manager (Spring Boot) + https://www.mousetech.com org.springframework.boot @@ -53,6 +53,12 @@ org.springframework.boot spring-boot-starter-data-jpa + + javax.validation + validation-api + 2.0.1.Final + + org.xerial sqlite-jdbc diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Category.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Category.java index 0f30766..c9ce4b5 100644 --- a/src/main/java/com/mousetech/gourmetj/persistence/model/Category.java +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Category.java @@ -24,23 +24,23 @@ public class Category implements Serializable { @Column(name="id") private Long id; -// @ManyToOne(fetch=FetchType.EAGER, optional = false) -// @JoinColumn(name="recipe_id") -// private Recipe recipe; -// -// /** -// * @return the parent recipe -// */ -// public Recipe getRecipe() { -// return recipe; -// } -// -// /** -// * @param recipe the parent recipe to set -// */ -// public void setRecipe(Recipe recipe) { -// this.recipe = recipe; -// } + @ManyToOne(fetch=FetchType.EAGER, optional = false) + @JoinColumn(name="recipe_id") + private Recipe recipe; + + /** + * @return the parent recipe + */ + public Recipe getRecipe() { + return recipe; + } + + /** + * @param recipe the parent recipe to set + */ + public void setRecipe(Recipe recipe) { + this.recipe = recipe; + } public Category() { } diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Convtable.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Convtable.java new file mode 100644 index 0000000..7d9e89c --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Convtable.java @@ -0,0 +1,54 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "convtable" database table. + * + */ +@Entity +@Table(name="\"convtable\"") +@NamedQuery(name="Convtable.findAll", query="SELECT c FROM Convtable c") +public class Convtable implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name="\"ckey\"") + private Integer ckey; + + @Id + @Column(name="\"id\"") + private int id; + + @Column(name="\"value\"") + private String value; + + public Convtable() { + } + + public Integer getCkey() { + return this.ckey; + } + + public void setCkey(Integer ckey) { + this.ckey = ckey; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Crossunitdict.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Crossunitdict.java new file mode 100644 index 0000000..731a5a7 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Crossunitdict.java @@ -0,0 +1,54 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "crossunitdict" database table. + * + */ +@Entity +@Table(name="\"crossunitdict\"") +@NamedQuery(name="Crossunitdict.findAll", query="SELECT c FROM Crossunitdict c") +public class Crossunitdict implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name="\"cukey\"") + private Integer cukey; + + @Id + @Column(name="\"id\"") + private int id; + + @Column(name="\"value\"") + private String value; + + public Crossunitdict() { + } + + public Integer getCukey() { + return this.cukey; + } + + public void setCukey(Integer cukey) { + this.cukey = cukey; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Density.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Density.java new file mode 100644 index 0000000..124d735 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Density.java @@ -0,0 +1,54 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "density" database table. + * + */ +@Entity +@Table(name="\"density\"") +@NamedQuery(name="Density.findAll", query="SELECT d FROM Density d") +public class Density implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name="\"dkey\"") + private Integer dkey; + + @Id + @Column(name="\"id\"") + private int id; + + @Column(name="\"value\"") + private String value; + + public Density() { + } + + public Integer getDkey() { + return this.dkey; + } + + public void setDkey(Integer dkey) { + this.dkey = dkey; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Info.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Info.java new file mode 100644 index 0000000..da7d7c5 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Info.java @@ -0,0 +1,76 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "info" database table. + * + */ +@Entity +@Table(name="\"info\"") +@NamedQuery(name="Info.findAll", query="SELECT i FROM Info i") +public class Info implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name="\"last_access\"") + private int lastAccess; + + @Id + @Column(name="\"rowid\"") + private int rowid; + + @Column(name="\"version_major\"") + private int versionMajor; + + @Column(name="\"version_minor\"") + private int versionMinor; + + @Column(name="\"version_super\"") + private int versionSuper; + + public Info() { + } + + public int getLastAccess() { + return this.lastAccess; + } + + public void setLastAccess(int lastAccess) { + this.lastAccess = lastAccess; + } + + public int getRowid() { + return this.rowid; + } + + public void setRowid(int rowid) { + this.rowid = rowid; + } + + public int getVersionMajor() { + return this.versionMajor; + } + + public void setVersionMajor(int versionMajor) { + this.versionMajor = versionMajor; + } + + public int getVersionMinor() { + return this.versionMinor; + } + + public void setVersionMinor(int versionMinor) { + this.versionMinor = versionMinor; + } + + public int getVersionSuper() { + return this.versionSuper; + } + + public void setVersionSuper(int versionSuper) { + this.versionSuper = versionSuper; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Ingredient.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Ingredient.java new file mode 100644 index 0000000..4ec7adb --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Ingredient.java @@ -0,0 +1,223 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + +/** + * 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.LAZY, cascade = { + CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }, optional = true) + @JoinColumn(name = "ingkey",insertable = false, updatable = false, nullable = true) + 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") + private String ingkey; + + @Column(name = "item") + private String item; + + @Column(name = "optional") + 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() { + } + + @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(); + } +} diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/IngredientIF.java b/src/main/java/com/mousetech/gourmetj/persistence/model/IngredientIF.java new file mode 100644 index 0000000..414a25c --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/IngredientIF.java @@ -0,0 +1,64 @@ +package com.mousetech.gourmetj.persistence.model; + +public interface IngredientIF { + + Double getAmount(); + + void setAmount(Double amount); + + Integer getDeleted(); + + void setDeleted(Integer deleted); + + Long getId(); + + void setId(Long id); + + String getInggroup(); + + void setInggroup(String inggroup); + + String getIngkey(); + + void setIngkey(String ingkey); + + String getItem(); + + void setItem(String item); + + Integer getOptional(); + + void setOptional(Integer optional); + + Integer getPosition(); + + void setPosition(Integer position); + + Double getRangeamount(); + + void setRangeamount(Double rangeamount); + + // public Long getRecipeId() { + // return this.recipeId; + // } + // + // public void setRecipeId(Long recipeId) { + // this.recipeId = recipeId; + // } + Recipe getRecipe(); + + void setRecipe(Recipe recipe); + + Long getRefid(); + + void setRefid(Long refid); + + Integer getShopoptional(); + + void setShopoptional(Integer shopoptional); + + String getUnit(); + + void setUnit(String unit); + +} diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Keylookup.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Keylookup.java new file mode 100644 index 0000000..37a73a7 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Keylookup.java @@ -0,0 +1,76 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "keylookup" database table. + * + */ +@Entity +@Table(name="\"keylookup\"") +@NamedQuery(name="Keylookup.findAll", query="SELECT k FROM Keylookup k") +public class Keylookup implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name="\"count\"") + private int count; + + @Id + @Column(name="\"id\"") + private int id; + + @Column(name="\"ingkey\"") + private String ingkey; + + @Column(name="\"item\"") + private String item; + + @Column(name="\"word\"") + private String word; + + public Keylookup() { + } + + public int getCount() { + return this.count; + } + + public void setCount(int count) { + this.count = count; + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getIngkey() { + return this.ingkey; + } + + public void setIngkey(String ingkey) { + this.ingkey = ingkey; + } + + public String getItem() { + return this.item; + } + + public void setItem(String item) { + this.item = item; + } + + public String getWord() { + return this.word; + } + + public void setWord(String word) { + this.word = word; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Pantry.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Pantry.java new file mode 100644 index 0000000..c24daf7 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Pantry.java @@ -0,0 +1,54 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "pantry" database table. + * + */ +@Entity +@Table(name="\"pantry\"") +@NamedQuery(name="Pantry.findAll", query="SELECT p FROM Pantry p") +public class Pantry implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Column(name="\"id\"") + private int id; + + @Column(name="\"ingkey\"") + private Integer ingkey; + + @Column(name="\"pantry\"") + private String pantry; + + public Pantry() { + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public Integer getIngkey() { + return this.ingkey; + } + + public void setIngkey(Integer ingkey) { + this.ingkey = ingkey; + } + + public String getPantry() { + return this.pantry; + } + + public void setPantry(String pantry) { + this.pantry = pantry; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/PluginInfo.java b/src/main/java/com/mousetech/gourmetj/persistence/model/PluginInfo.java new file mode 100644 index 0000000..d54de12 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/PluginInfo.java @@ -0,0 +1,87 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "plugin_info" database table. + * + */ +@Entity +@Table(name="\"plugin_info\"") +@NamedQuery(name="PluginInfo.findAll", query="SELECT p FROM PluginInfo p") +public class PluginInfo implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name="\"id\"") + private int id; + + @Id + @Column(name="\"plugin\"") + private String plugin; + + @Column(name="\"plugin_version\"") + private String pluginVersion; + + @Column(name="\"version_major\"") + private int versionMajor; + + @Column(name="\"version_minor\"") + private int versionMinor; + + @Column(name="\"version_super\"") + private int versionSuper; + + public PluginInfo() { + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public String getPlugin() { + return this.plugin; + } + + public void setPlugin(String plugin) { + this.plugin = plugin; + } + + public String getPluginVersion() { + return this.pluginVersion; + } + + public void setPluginVersion(String pluginVersion) { + this.pluginVersion = pluginVersion; + } + + public int getVersionMajor() { + return this.versionMajor; + } + + public void setVersionMajor(int versionMajor) { + this.versionMajor = versionMajor; + } + + public int getVersionMinor() { + return this.versionMinor; + } + + public void setVersionMinor(int versionMinor) { + this.versionMinor = versionMinor; + } + + public int getVersionSuper() { + return this.versionSuper; + } + + public void setVersionSuper(int versionSuper) { + this.versionSuper = versionSuper; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java new file mode 100644 index 0000000..f1b58e6 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java @@ -0,0 +1,267 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.*; + +/** + * The persistent class for the "recipe" database table. + * Persisted by @see RecipeDAO + */ +@Entity +@Table(name = "recipe") +@NamedQueries({ + @NamedQuery(name = "Recipe.findAll", query = "SELECT r FROM Recipe r"), + @NamedQuery(name = "Recipe.findByTitle", query = "SELECT r FROM Recipe r WHERE r.title LIKE concat('%', :searchText,'%')") }) +public class Recipe implements Serializable { + private static final long serialVersionUID = 1L; + + @Column(name = "cooktime") + private Integer cooktime; + + @Column(name = "cuisine") + private String cuisine; + + @Column(name = "deleted") + private Integer deleted; + + @Column(name = "description") + private String description; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "image") + private byte[] image; + + // Actual Ingredient_hash field is VARCHAR(32) - UUID??? + @OneToMany(fetch = FetchType.LAZY, mappedBy = "recipe", cascade = CascadeType.ALL, orphanRemoval = true) + private List ingredientHash = new ArrayList(); + + @Column(name = "instructions") + private String instructions; + + @Column(name = "last_modified") + private Integer lastModified; + + @Column(name = "link") + private String link; + + @Column(name = "modifications") + private String modifications; + + @Column(name = "preptime") + private Integer preptime; + + @Column(name = "rating") + private Integer rating; + + @Column(name = "recipe_hash") + private Long recipeHash; + + @Column(name = "servings") + private Double servings; + + @Column(name = "source") + private String source; + + @Column(name = "thumb") + private byte[] thumb; + + @Column(name = "title") + private String title; + + @Column(name = "yield_unit") + private Integer yieldUnit; + + @Column(name = "yields") + private Double yields; + + @OneToMany(fetch = FetchType.EAGER, mappedBy = "recipe", cascade = CascadeType.ALL, orphanRemoval = true) + private List categories = + new ArrayList(); + + /** + * @param categories the categories to set + */ + public void setCategories(List categories) { + this.categories = categories; + } + + public Recipe() { + } + + public Integer getCooktime() { + return this.cooktime; + } + + public void setCooktime(Integer cooktime) { + this.cooktime = cooktime; + } + + public String getCuisine() { + return this.cuisine; + } + + public void setCuisine(String cuisine) { + this.cuisine = cuisine; + } + + public Integer getDeleted() { + return this.deleted; + } + + public void setDeleted(Integer deleted) { + this.deleted = deleted; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public byte[] getImage() { + return this.image; + } + + public void setImage(byte[] image) { + this.image = image; + } + + public List getIngredientHash() { + return this.ingredientHash; + } + + public void setIngredientHash( + List ingredientHash) { + this.ingredientHash = ingredientHash; + } + + public String getInstructions() { + return this.instructions; + } + + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + public Integer getLastModified() { + return this.lastModified; + } + + public void setLastModified(Integer lastModified) { + this.lastModified = lastModified; + } + + public String getLink() { + return this.link; + } + + public void setLink(String link) { + this.link = link; + } + + public String getModifications() { + return this.modifications; + } + + public void setModifications(String modifications) { + this.modifications = modifications; + } + + public Integer getPreptime() { + return this.preptime; + } + + public void setPreptime(Integer preptime) { + this.preptime = preptime; + } + + public Integer getRating() { + return this.rating; + } + + public void setRating(Integer rating) { + this.rating = rating; + } + + public Long getRecipeHash() { + return this.recipeHash; + } + + public void setRecipeHash(Long recipeHash) { + this.recipeHash = recipeHash; + } + + public Double getServings() { + return this.servings; + } + + public void setServings(Double servings) { + this.servings = servings; + } + + public String getSource() { + return this.source; + } + + public void setSource(String source) { + this.source = source; + } + + public byte[] getThumb() { + return this.thumb; + } + + public void setThumb(byte[] thumb) { + this.thumb = thumb; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getYieldUnit() { + return this.yieldUnit; + } + + public void setYieldUnit(Integer yieldUnit) { + this.yieldUnit = yieldUnit; + } + + public Double getYields() { + return this.yields; + } + + public void setYields(Double yields) { + this.yields = yields; + } + + @Override + public String toString() { + return "Recipe #" + this.getId() + " " + this.getTitle(); + } + + public List getCategories() { + return this.categories; + } +} diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Shopcat.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Shopcat.java new file mode 100644 index 0000000..c9e05c7 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Shopcat.java @@ -0,0 +1,85 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +/** + * The persistent class for the "shopcats" database table. + * + * Properly, a Shopcat should be an optional ManyToOne reference + * from Ingredient, but the database schema does not rigorously + * enforce that. To do so, Ingredient.ingKey would be formally + * declared as a foreign key and in Shopcat.ingKey would be declared + * as a unique key (and could serve as primary key). + * + * Failing that, crud can accumulate in the database and it's + * mostly dealt with in the @see ReceipeDAO. + * + */ +@Entity +@Table(name = "shopcats") +@NamedQueries({ + @NamedQuery(name = "Shopcat.findAll", query = "SELECT s FROM Shopcat s"), + @NamedQuery(name = "Shopcat.findIngkey", query = "SELECT s FROM Shopcat s where s.ingkey = :ingkey") }) +public class Shopcat implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "ingkey") + @NotNull + // @UniqueConstraint(name="ingkey") + private String ingkey; + // @OneToMany ingredients + + @Column(name = "position") + private Integer position; + + @Column(name = "shopcategory") + private String shopcategory; + + public Shopcat() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getIngkey() { + return this.ingkey; + } + + public void setIngkey(String ingkey) { + this.ingkey = ingkey; + } + + public Integer getPosition() { + return this.position; + } + + public void setPosition(Integer position) { + this.position = position; + } + + public String getShopcategory() { + return this.shopcategory; + } + + public void setShopcategory(String shopcategory) { + this.shopcategory = shopcategory; + } + + @Override + public String toString() { + return "Shopcat for " + ingkey + "(" + shopcategory + + ")"; + } +} diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Shopcatsorder.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Shopcatsorder.java new file mode 100644 index 0000000..ccc9253 --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Shopcatsorder.java @@ -0,0 +1,54 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "shopcatsorder" database table. + * + */ +@Entity +@Table(name="\"shopcatsorder\"") +@NamedQuery(name="Shopcatsorder.findAll", query="SELECT s FROM Shopcatsorder s") +public class Shopcatsorder implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Column(name="\"id\"") + private int id; + + @Column(name="\"position\"") + private int position; + + @Column(name="\"shopcategory\"") + private Integer shopcategory; + + public Shopcatsorder() { + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public int getPosition() { + return this.position; + } + + public void setPosition(int position) { + this.position = position; + } + + public Integer getShopcategory() { + return this.shopcategory; + } + + public void setShopcategory(Integer shopcategory) { + this.shopcategory = shopcategory; + } + +} \ No newline at end of file diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Unitdict.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Unitdict.java new file mode 100644 index 0000000..c8f717c --- /dev/null +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Unitdict.java @@ -0,0 +1,54 @@ +package com.mousetech.gourmetj.persistence.model; + +import java.io.Serializable; +import javax.persistence.*; + + +/** + * The persistent class for the "unitdict" database table. + * + */ +@Entity +@Table(name="\"unitdict\"") +@NamedQuery(name="Unitdict.findAll", query="SELECT u FROM Unitdict u") +public class Unitdict implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Column(name="\"id\"") + private int id; + + @Column(name="\"ukey\"") + private Integer ukey; + + @Column(name="\"value\"") + private String value; + + public Unitdict() { + } + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + + public Integer getUkey() { + return this.ukey; + } + + public void setUkey(Integer ukey) { + this.ukey = ukey; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + +} \ No newline at end of file