From 031ac646f6150a2a51cf039677247338d40f275a Mon Sep 17 00:00:00 2001 From: Gregor Riegler Date: Sun, 12 May 2013 23:57:23 +0200 Subject: [PATCH] Solve some bugs caused by incompatibilities of JMS and XVSM version --- src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java | 2 +- .../java/at/ac/tuwien/sbc/valesriegler/group/GroupAgent.java | 4 +++- .../at/ac/tuwien/sbc/valesriegler/pizzeria/PizzeriaAgent.java | 2 ++ .../pizzeria/gui/tablemodels/PizzasOfOrderModel.java | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java index 25a2296..de46881 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java @@ -20,7 +20,7 @@ public abstract class Util { private static final Logger log = LoggerFactory.getLogger(Util.class); // TODO: solve the switch between mom by command-line arguments - public static final boolean useJMS = true; + public static boolean useJMS = true; public static final String TABLE_ASSIGNED = "tables"; public static final String GROUPS_CONTAINER = "groups"; diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/group/GroupAgent.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/group/GroupAgent.java index cad536b..9266222 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/group/GroupAgent.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/group/GroupAgent.java @@ -43,9 +43,11 @@ public class GroupAgent { if ("JMS".equalsIgnoreCase(mw)) { groupAgent = new GroupAgent(new JMSGroupConnector()); + Util.useJMS = true; } else if ("XVSM".equalsIgnoreCase(mw)) { // TODO: XVSM Connector? - groupAgent = new GroupAgent(new JMSGroupConnector()); + Util.useJMS = false; + groupAgent = new GroupAgent(null); } else { throw new IllegalArgumentException(USAGE); } diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/PizzeriaAgent.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/PizzeriaAgent.java index fea4978..cadbb01 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/PizzeriaAgent.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/PizzeriaAgent.java @@ -54,11 +54,13 @@ public class PizzeriaAgent { pizzeriaAgent.createModels(); pizzeriaAgent.initXVSM(); pizzeriaAgent.initGUI(); + Util.useJMS = false; break; case "JMS": pizzeriaAgent.createModels(); pizzeriaAgent.initJMS(); pizzeriaAgent.initGUI(); + Util.useJMS = true; break; default: throw new IllegalArgumentException(USAGE); diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/tablemodels/PizzasOfOrderModel.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/tablemodels/PizzasOfOrderModel.java index bec5d9e..62cccc5 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/tablemodels/PizzasOfOrderModel.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/tablemodels/PizzasOfOrderModel.java @@ -37,10 +37,11 @@ public class PizzasOfOrderModel extends TableModel { case STATUS: return pizzaOrder.getStatus(); case COOK: - if (pizzaOrder.getStatus() == PizzaOrderStatus.DONE) { + if (pizzaOrder.getStatus() == PizzaOrderStatus.DONE && Util.useJMS) { Pizza pizza = pizzas.get(rowIndex); return Util.getId(pizza.getCookId()); } + else if(!Util.useJMS) return Util.getId(pizzaOrder.getCookId()); return ""; default: throw new RuntimeException(UNHANDLEDCOLUMN); -- 2.43.0