Commit ea0d6513 by Antti Tönkyrä

Merge branch 'master' of codecrew.fi:bortal

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