diff --git a/src/main/java/de/hsel/spm/baudas/web/ShoppingTimesDiagram.java b/src/main/java/de/hsel/spm/baudas/web/ShoppingTimesDiagram.java index ed40db8..11b6c69 100644 --- a/src/main/java/de/hsel/spm/baudas/web/ShoppingTimesDiagram.java +++ b/src/main/java/de/hsel/spm/baudas/web/ShoppingTimesDiagram.java @@ -23,7 +23,6 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.UUID; -import java.util.regex.Pattern; /** * changes data from shopping times diagram into a readable format for chart.js @@ -35,8 +34,6 @@ import java.util.regex.Pattern; @WebServlet("/shopping_times") public class ShoppingTimesDiagram extends HttpServlet { - private static Map cache = new HashMap<>(); - private static final long serialVersionUID = 6567531484L; @Override @@ -53,21 +50,13 @@ public class ShoppingTimesDiagram extends HttpServlet { Gson gson = new Gson(); - String id = req.getParameter("id"); - boolean match = Pattern.matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", id); - if (id == null || !match) { + + if (req.getParameter("id") == null) { + result.put("labels", definedOrder); + out.print(gson.toJson(result)); return; } - - UUID uuid = UUID.fromString(id); - - - if(cache.containsKey(uuid)) { - out.print(gson.toJson(cache.get(uuid))); - return; - } - - + UUID uuid = UUID.fromString(req.getParameter("id")); File file = Data.get(uuid); ShoppingTimes shoppingTimes = new ShoppingTimes(file); @@ -92,7 +81,7 @@ public class ShoppingTimesDiagram extends HttpServlet { } } - cache.put(uuid, result); + out.print(gson.toJson(result)); } diff --git a/src/main/java/de/hsel/spm/baudas/web/TopFlopArticleDiagram.java b/src/main/java/de/hsel/spm/baudas/web/TopFlopArticleDiagram.java index 660d6e3..2d6692f 100644 --- a/src/main/java/de/hsel/spm/baudas/web/TopFlopArticleDiagram.java +++ b/src/main/java/de/hsel/spm/baudas/web/TopFlopArticleDiagram.java @@ -13,7 +13,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.regex.Pattern; /** * @author Johannes Theiner @@ -24,8 +23,6 @@ import java.util.regex.Pattern; @WebServlet("/top_flop") public class TopFlopArticleDiagram extends HttpServlet { - private static Map cache = new HashMap<>(); - private static final long serialVersionUID = 6567531464214L; @Override @@ -37,19 +34,7 @@ public class TopFlopArticleDiagram extends HttpServlet { Gson gson = new Gson(); - String id = req.getParameter("id"); - boolean match = Pattern.matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", id); - if(id == null || !match) { - return; - } - - UUID uuid = UUID.fromString(id); - - if(cache.containsKey(uuid)) { - out.println(gson.toJson(cache.get(uuid))); - return; - } - + UUID uuid = UUID.fromString(req.getParameter("id")); File file = Data.get(uuid); TopFlopArticle articles = new TopFlopArticle(file); @@ -68,8 +53,6 @@ public class TopFlopArticleDiagram extends HttpServlet { result.put("labels", labels); result.put("data", data); - - cache.put(uuid, result); out.print(gson.toJson(result)); } } \ No newline at end of file diff --git a/src/main/java/de/hsel/spm/baudas/web/Upload.java b/src/main/java/de/hsel/spm/baudas/web/Upload.java index 11f7794..28f7c9d 100644 --- a/src/main/java/de/hsel/spm/baudas/web/Upload.java +++ b/src/main/java/de/hsel/spm/baudas/web/Upload.java @@ -48,5 +48,7 @@ public class Upload extends HttpServlet { } Files.copy(inputStream, path, StandardCopyOption.REPLACE_EXISTING); + + resp.sendRedirect(""); } } \ No newline at end of file diff --git a/src/main/java/de/hsel/spm/baudas/web/WeekOverviewDiagram.java b/src/main/java/de/hsel/spm/baudas/web/WeekOverviewDiagram.java index 6f8534f..9230839 100644 --- a/src/main/java/de/hsel/spm/baudas/web/WeekOverviewDiagram.java +++ b/src/main/java/de/hsel/spm/baudas/web/WeekOverviewDiagram.java @@ -19,7 +19,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.regex.Pattern; /** * changes data from week overview into readable format for chart.js @@ -31,8 +30,6 @@ import java.util.regex.Pattern; @WebServlet("/week_overview") public class WeekOverviewDiagram extends HttpServlet { - private static Map cache = new HashMap<>(); - private static final long serialVersionUID = 8484151844118L; @@ -48,20 +45,16 @@ public class WeekOverviewDiagram extends HttpServlet { Gson gson = new Gson(); - String id = req.getParameter("id"); - boolean match = Pattern.matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", id); - - if (id == null || !match) { - return; - } - - UUID uuid = UUID.fromString(id); - if(cache.containsKey(uuid)) { - out.println(gson.toJson(cache.get(uuid))); + if (req.getParameter("id") == null) { + result.put("labels", definedOrder); + result.put("count", new ArrayList<>()); + result.put("revenue", new ArrayList<>()); + out.print(gson.toJson(result)); return; } + UUID uuid = UUID.fromString(req.getParameter("id")); File file = Data.get(uuid); WeekOverview overview = new WeekOverview(file); @@ -86,7 +79,6 @@ public class WeekOverviewDiagram extends HttpServlet { result.put("count", count); result.put("revenue", revenue); - cache.put(uuid, result); out.print(gson.toJson(result)); } } \ No newline at end of file diff --git a/src/main/webapp/footer.jsp b/src/main/webapp/footer.jsp index 175265d..5e91340 100644 --- a/src/main/webapp/footer.jsp +++ b/src/main/webapp/footer.jsp @@ -12,7 +12,6 @@ M.AutoInit(); - diff --git a/src/main/webapp/header.jsp b/src/main/webapp/header.jsp index a3a8979..5cd9784 100644 --- a/src/main/webapp/header.jsp +++ b/src/main/webapp/header.jsp @@ -12,7 +12,6 @@ media="screen,projection"/> - @@ -38,7 +37,7 @@