Commit d2632cb9 by Antti Tönkyrä

Merge branch 'master' of codecrew.fi:bortal

2 parents 41ba50bd e82919b4
......@@ -89,6 +89,10 @@ public class FoodWave extends GenericEntity {
return closed;
}
public boolean isClosed() {
return closed;
}
public void setClosed(boolean waveClosed) {
this.closed = waveClosed;
}
......@@ -108,5 +112,39 @@ public class FoodWave extends GenericEntity {
public FoodWaveTemplate getTemplate() {
return template;
}
public boolean isFull() {
return false;
}
/**
* Check if foodwave is orderable
*
* That means that it's not closed, full and it's in future
* @return
*/
public boolean isOrderable() {
if(isClosed()) {
return false;
}
if(getTime().before(Calendar.getInstance())) {
return false;
}
if(isFull()) {
return false;
}
return true;
}
}
......@@ -4,6 +4,7 @@
*/
package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
......@@ -100,5 +101,26 @@ 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()) {
returnList.add(wave);
}
}
return returnList;
}
}
package fi.insomnia.bortal.web;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import fi.insomnia.bortal.beans.CardPrintBeanLocal;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.web.cdiview.user.UserCartView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.Queue;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@Named
@RequestScoped
public class ErrorPageView {
@SessionScoped
public class ErrorPageView implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
// private static final long serialVersionUID = -2179309061036632342L;
String trace;
// maintain a trail of pages visited (10?)
Queue trail = new Queue();
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(ErrorPageView.class);
public String getStackTrace() {
FacesContext context = FacesContext.getCurrentInstance();
......
......@@ -113,7 +113,7 @@ public class FoodWaveView extends GenericCDIView {
public String selectTemplate() {
if (templates.isRowAvailable()) {
foodWaves = new ListDataModel<FoodWave>(templates.getRowData()
.getFoodwaves());
.getOrderableFoodwaves());
}
return "/foodwave/list";
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!