Commit 73158b8a by Tuomas Riihimäki

Product descr + foodwavestuff

1 parent 788b6bdd
......@@ -41,6 +41,9 @@ public class FoodWave extends GenericEntity {
@Temporal(TemporalType.TIMESTAMP)
private Calendar time;
@Column(name = "max_foods")
private Integer maximumFoods;
@Column(name = "wave_closed", nullable = false, columnDefinition = "boolean default false")
private boolean closed = false;
......@@ -92,7 +95,7 @@ public class FoodWave extends GenericEntity {
public boolean isClosed() {
return closed;
}
public void setClosed(boolean waveClosed) {
this.closed = waveClosed;
}
......@@ -112,7 +115,7 @@ public class FoodWave extends GenericEntity {
public FoodWaveTemplate getTemplate() {
return template;
}
public boolean isFull() {
return false;
}
......@@ -121,30 +124,32 @@ public class FoodWave extends GenericEntity {
* Check if foodwave is orderable
*
* That means that it's not closed, full and it's in future
*
* @return
*/
public boolean isOrderable() {
if(isClosed()) {
if (isClosed()) {
return false;
}
if(getTime().before(Calendar.getInstance())) {
if (getTime().before(Calendar.getInstance())) {
return false;
}
if(isFull()) {
if (isFull()) {
return false;
}
return true;
}
}
public Integer getMaximumFoods() {
return maximumFoods;
}
public void setMaximumFoods(Integer maximumFoods) {
this.maximumFoods = maximumFoods;
}
}
......@@ -49,6 +49,9 @@ public class FoodWaveTemplate extends GenericEntity {
@OrderBy(value = "time")
private List<FoodWave> foodwaves;
@Column(name = "max_foods")
private Integer maximumFoods;
public FoodWaveTemplate() {
}
......@@ -103,26 +106,17 @@ public class FoodWaveTemplate extends GenericEntity {
public void setEvent(LanEvent event) {
this.event = event;
}
public List<FoodWave> getOrderableFoodwaves() {
List<FoodWave> returnList = new ArrayList<FoodWave>();
for(FoodWave wave : getFoodwaves()) {
if(wave.isOrderable()) {
for (FoodWave wave : getFoodwaves()) {
if (wave.isOrderable()) {
returnList.add(wave);
}
}
return returnList;
}
}
......@@ -20,6 +20,7 @@ import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
......@@ -53,6 +54,9 @@ public class Product extends GenericEntity {
@Column(name = "product_name")
private String name;
@Column(name = "description")
@Lob
private String description;
@Column(name = "price", nullable = false, precision = 24, scale = 4)
private BigDecimal price = BigDecimal.ZERO;
......@@ -281,4 +285,12 @@ public class Product extends GenericEntity {
this.productLimits = productLimits;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!