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 { ...@@ -89,6 +89,10 @@ public class FoodWave extends GenericEntity {
return closed; return closed;
} }
public boolean isClosed() {
return closed;
}
public void setClosed(boolean waveClosed) { public void setClosed(boolean waveClosed) {
this.closed = waveClosed; this.closed = waveClosed;
} }
...@@ -108,5 +112,39 @@ public class FoodWave extends GenericEntity { ...@@ -108,5 +112,39 @@ public class FoodWave extends GenericEntity {
public FoodWaveTemplate getTemplate() { public FoodWaveTemplate getTemplate() {
return template; 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 @@ ...@@ -4,6 +4,7 @@
*/ */
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
...@@ -100,5 +101,26 @@ public class FoodWaveTemplate extends GenericEntity { ...@@ -100,5 +101,26 @@ 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() {
List<FoodWave> returnList = new ArrayList<FoodWave>();
for(FoodWave wave : getFoodwaves()) {
if(wave.isOrderable()) {
returnList.add(wave);
}
}
return returnList;
}
} }
package fi.insomnia.bortal.web; package fi.insomnia.bortal.web;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.SessionScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import fi.insomnia.bortal.beans.CardPrintBeanLocal; import org.slf4j.Logger;
import fi.insomnia.bortal.model.EventUser; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.web.cdiview.user.UserCartView;
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.PrintWriter;
import java.io.Serializable; import java.io.Serializable;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
import java.util.Map; import java.util.Map;
@Named @Named
@RequestScoped @SessionScoped
public class ErrorPageView { public class ErrorPageView implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
// private static final long serialVersionUID = -2179309061036632342L;
String trace; 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() { public String getStackTrace() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
......
...@@ -113,7 +113,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -113,7 +113,7 @@ public class FoodWaveView extends GenericCDIView {
public String selectTemplate() { public String selectTemplate() {
if (templates.isRowAvailable()) { if (templates.isRowAvailable()) {
foodWaves = new ListDataModel<FoodWave>(templates.getRowData() foodWaves = new ListDataModel<FoodWave>(templates.getRowData()
.getFoodwaves()); .getOrderableFoodwaves());
} }
return "/foodwave/list"; return "/foodwave/list";
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!