diff --git a/src/main/java/de/hsel/spm/baudas/analysis/Analysis.java b/src/main/java/de/hsel/spm/baudas/analysis/Analysis.java index 3f8f86a..3723996 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/Analysis.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/Analysis.java @@ -12,7 +12,7 @@ import java.io.IOException; * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 * @param Type the chosen analysis returns as a result */ public interface Analysis { diff --git a/src/main/java/de/hsel/spm/baudas/analysis/Attribute.java b/src/main/java/de/hsel/spm/baudas/analysis/Attribute.java index e6d9883..9d29e36 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/Attribute.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/Attribute.java @@ -5,7 +5,7 @@ package de.hsel.spm.baudas.analysis; * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 **/ class Attribute { diff --git a/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java b/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java index d8cd1bd..0608bd7 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java @@ -15,7 +15,7 @@ import java.util.Map; * * @author Johannes Theiner * @version 0.1 - * @since 0.4 + * @since 1.0 */ public class Cluster implements Analysis>> { diff --git a/src/main/java/de/hsel/spm/baudas/analysis/TopFlopArticle.java b/src/main/java/de/hsel/spm/baudas/analysis/SalesNumbers.java similarity index 91% rename from src/main/java/de/hsel/spm/baudas/analysis/TopFlopArticle.java rename to src/main/java/de/hsel/spm/baudas/analysis/SalesNumbers.java index 059532b..2950b7d 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/TopFlopArticle.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/SalesNumbers.java @@ -15,15 +15,14 @@ import java.util.stream.Stream; * * @author Karsten Eden * @version 0.1 - * @since 0.2 + * @since 1.0 */ -public class TopFlopArticle implements Analysis> { +public class SalesNumbers implements Analysis> { private Instances instances; private Map results; - public TopFlopArticle(File file) { - + public SalesNumbers(File file) { instances = load(file); } diff --git a/src/main/java/de/hsel/spm/baudas/analysis/ShoppingCart.java b/src/main/java/de/hsel/spm/baudas/analysis/ShoppingCart.java index edac14f..f1277e1 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/ShoppingCart.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/ShoppingCart.java @@ -18,7 +18,7 @@ import java.util.Map; * The shopping-cart analysis. * * @author Julian Hinxlage - * @version 0.4 + * @version 1.0 */ public class ShoppingCart implements Analysis, List>> { diff --git a/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java b/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java index 26810ba..f9c494f 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java @@ -13,7 +13,7 @@ import java.util.Map; * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 **/ public class ShoppingTimes implements Analysis, Integer>> { diff --git a/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java b/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java index c41d92a..ee3dd19 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java @@ -13,7 +13,7 @@ import java.util.Map; * * @author Julian Hinxlage * @version 0.1 - * @since 0.1 + * @since 1.0 **/ public class WeekOverview implements Analysis>> { @@ -45,14 +45,13 @@ public class WeekOverview implements Analysis(0.0, 0)); - } else { - result.put(day, - new AbstractMap.SimpleEntry<>( - result.get(day).getKey() + amount, - result.get(day).getValue() + 1 - ) - ); } + result.put(day, + new AbstractMap.SimpleEntry<>( + result.get(day).getKey() + amount, + result.get(day).getValue() + 1 + ) + ); } diff --git a/src/main/java/de/hsel/spm/baudas/web/AuthenticationFilter.java b/src/main/java/de/hsel/spm/baudas/web/AuthenticationFilter.java deleted file mode 100644 index df5f74f..0000000 --- a/src/main/java/de/hsel/spm/baudas/web/AuthenticationFilter.java +++ /dev/null @@ -1,67 +0,0 @@ -package de.hsel.spm.baudas.web; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.annotation.WebFilter; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import java.io.IOException; - -/** - * Filter implementation class AuthenticationFilter. - * - * @author Edgar Schkrob - */ - -@WebFilter(urlPatterns = {"/*"}) -public class AuthenticationFilter implements Filter { - private ServletContext context; - - /** - * Called by the web container to indicate to a filter that it is being placed into service. This filter manages the authentication. - * - * @param filterConfig This parameter provides access to everything the code needs to work. - * @throws ServletException Defines a general exception a servlet can throw when it encounters difficulty. - */ - - public void init(FilterConfig filterConfig) throws ServletException { - this.context = filterConfig.getServletContext(); - this.context.log("AuthenticationFilter initialized"); - } - - /** - * The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. - * - * @param request This parameter provides access to everything the code needs to work. - * @param response This parameter provides access to everything the code needs to issue a response. - * @param chain This parameter allows passing request along the chain of potential handlers until one of them handles the request. - * @throws ServletException Defines a general exception a servlet can throw when it encounters difficulty. - * @throws IOException Signals that an I/O exception of some sort has occurred. This class is the general class of exceptions produced by failed or interrupted I/O operations. - */ - - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletRequest req = (HttpServletRequest) request; - HttpServletResponse res = (HttpServletResponse) response; - HttpSession session = req.getSession(false); - String url = req.getRequestURI(); - if (url.contains("login") || url.contains("logo") || url.contains("js/")) { - chain.doFilter(request, response); - } else if (session == null || !((boolean) session.getAttribute("authentication"))) { //checking whether the session exists and if authentication succeed - this.context.log("Unauthorized access request"); - res.sendRedirect(req.getContextPath() + "/login.html"); - } else { - chain.doFilter(request, response); - - } - } - - public void destroy() { - //close any resources here - } -} \ No newline at end of file diff --git a/src/main/java/de/hsel/spm/baudas/web/AuthorizationFilter.java b/src/main/java/de/hsel/spm/baudas/web/AuthorizationFilter.java new file mode 100644 index 0000000..6d0b81c --- /dev/null +++ b/src/main/java/de/hsel/spm/baudas/web/AuthorizationFilter.java @@ -0,0 +1,68 @@ +package de.hsel.spm.baudas.web; + +import org.jetbrains.annotations.NotNull; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebFilter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +/** + * handles all authorisation filtering. + * + * @author Edgar Schkrob + * @version 0.1 + * @since 0.4 + */ + +@WebFilter(urlPatterns = {"/*"}) +public class AuthorizationFilter implements Filter { + + private ServletContext context; + + /** + * initialize this filter. + * + * @param filterConfig configuration + * @throws ServletException failed to initialize filter + */ + @Override + public void init(@NotNull FilterConfig filterConfig) throws ServletException { + this.context = filterConfig.getServletContext(); + this.context.log("AuthorizationFilter initialized"); + } + + /** + * filter all unauthorized requests. + * + * @param request request object + * @param response response object + * @param chain filter chain + * @throws ServletException something failed inside the filter chain + * @throws IOException failed to redirect + */ + @Override + public void doFilter(@NotNull ServletRequest request, @NotNull ServletResponse response, @NotNull FilterChain chain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse res = (HttpServletResponse) response; + HttpSession session = req.getSession(false); + String url = req.getRequestURI(); + if (url.contains("login") || url.contains("logo") || url.contains("js/")) { + chain.doFilter(request, response); + } else if (session == null || !((boolean) session.getAttribute("authentication"))) { //checking whether the session exists and if authentication succeed + this.context.log("Unauthorized access request"); + res.sendRedirect(req.getContextPath() + "/login.jsp"); + } else { + chain.doFilter(request, response); + + } + } +} \ No newline at end of file diff --git a/src/main/java/de/hsel/spm/baudas/web/Data.java b/src/main/java/de/hsel/spm/baudas/web/DatasetManagement.java similarity index 90% rename from src/main/java/de/hsel/spm/baudas/web/Data.java rename to src/main/java/de/hsel/spm/baudas/web/DatasetManagement.java index 88c3d32..5cd4f69 100644 --- a/src/main/java/de/hsel/spm/baudas/web/Data.java +++ b/src/main/java/de/hsel/spm/baudas/web/DatasetManagement.java @@ -22,9 +22,9 @@ import java.util.concurrent.ConcurrentMap; * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 **/ -public class Data { +public class DatasetManagement { @Getter private static ConcurrentMap> files = new ConcurrentHashMap<>(); @@ -46,7 +46,7 @@ public class Data { if (files.get(session).size() >= 5) { SavedFile file = files.get(session).iterator().next(); if (!get(file.getUuid()).delete()) { - System.err.println("failed to delete file..." + file); + System.err.println("failed to delete file " + file); } files.get(session).remove(file); } @@ -59,10 +59,12 @@ public class Data { * * @param session session id */ - static void delete(String session) { + static void delete(@NotNull String session) { + if (!files.containsKey(session)) return; + for (SavedFile file : files.get(session)) { if (!get(file.getUuid()).delete()) - System.err.println("failed to delete file..." + file); + System.err.println("failed to delete file " + file); } files.remove(session); diff --git a/src/main/java/de/hsel/spm/baudas/web/Files.java b/src/main/java/de/hsel/spm/baudas/web/DatasetsServlet.java similarity index 66% rename from src/main/java/de/hsel/spm/baudas/web/Files.java rename to src/main/java/de/hsel/spm/baudas/web/DatasetsServlet.java index 362ef89..d809412 100644 --- a/src/main/java/de/hsel/spm/baudas/web/Files.java +++ b/src/main/java/de/hsel/spm/baudas/web/DatasetsServlet.java @@ -12,18 +12,26 @@ import java.io.PrintWriter; import java.nio.charset.StandardCharsets; /** - * list all currently available files. + * list all currently available datasets. * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 **/ -@WebServlet("/files") -public class Files extends HttpServlet { +@WebServlet("/datasets") +public class DatasetsServlet extends HttpServlet { private static final long serialVersionUID = 148451844848L; + + /** + * returns all available datasets for session. + * + * @param req request object + * @param resp response object + * @throws IOException failed to initialize print writer + */ @Override protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException { @@ -31,6 +39,6 @@ public class Files extends HttpServlet { resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); PrintWriter out = resp.getWriter(); Gson gson = new Gson(); - out.print(gson.toJson(Data.getFiles().get(req.getSession().getId()))); + out.print(gson.toJson(DatasetManagement.getFiles().get(req.getSession().getId()))); } } \ No newline at end of file diff --git a/src/main/java/de/hsel/spm/baudas/web/ErrorCode.java b/src/main/java/de/hsel/spm/baudas/web/ErrorCode.java index 7fa1d53..c293349 100644 --- a/src/main/java/de/hsel/spm/baudas/web/ErrorCode.java +++ b/src/main/java/de/hsel/spm/baudas/web/ErrorCode.java @@ -8,6 +8,7 @@ import lombok.Getter; * * @author Julian Hinxlage * @version 0.1 + * @since 1.0 */ @Getter @AllArgsConstructor diff --git a/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java b/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java index e6571e0..de96b79 100644 --- a/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java +++ b/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java @@ -1,5 +1,7 @@ package de.hsel.spm.baudas.web; +import org.jetbrains.annotations.NotNull; + import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; @@ -11,9 +13,11 @@ import java.io.IOException; import java.io.PrintWriter; /** - * Servlet implementation class LoginServlet. + * authenticates users. * * @author Edgar Schkrob + * @version 0.1 + * @since 1.0 */ @WebServlet("/login") @@ -22,25 +26,23 @@ public class LoginServlet extends HttpServlet { private final String password = "SPM2019SS"; /** - * This is a Servlet that manages the Login and creates Sessions. + * reads from HTTP POST parameter 'password' and compares it. * - * @param request This parameter provides access to everything the code needs to work. - * @param response This parameter provides access to everything the code needs to issue a response. - * @throws ServletException Defines a general exception a servlet can throw when it encounters difficulty. - * @throws IOException Signals that an I/O exception of some sort has occurred. This class is the general class of exceptions produced by failed or interrupted I/O operations. + * @param request request object + * @param response response object + * @throws IOException failed to initialize print writer */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void doPost(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws ServletException, IOException { String password = request.getParameter("password"); if (this.password.equals(password)) { HttpSession newSession = request.getSession(true); newSession.setAttribute("authentication", true); newSession.setMaxInactiveInterval(5 * 60 * 60); //setting session to expiry in 5 hours - response.sendRedirect("index.jsp"); + response.sendRedirect("/"); } else { - RequestDispatcher rd = getServletContext().getRequestDispatcher("/login.html"); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/login.jsp"); PrintWriter out = response.getWriter(); - out.println("Das eingegebene Passwort ist falsch."); + out.println("Das eingegebene Passwort ist falsch."); rd.include(request, response); } } diff --git a/src/main/java/de/hsel/spm/baudas/web/LogoutServlet.java b/src/main/java/de/hsel/spm/baudas/web/LogoutServlet.java index cf04180..302c2ca 100644 --- a/src/main/java/de/hsel/spm/baudas/web/LogoutServlet.java +++ b/src/main/java/de/hsel/spm/baudas/web/LogoutServlet.java @@ -1,5 +1,7 @@ package de.hsel.spm.baudas.web; +import org.jetbrains.annotations.NotNull; + import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -8,26 +10,27 @@ import javax.servlet.http.HttpSession; import java.io.IOException; /** - * Servlet implementation class LogoutServlet. + * logs out user if they request this. * * @author Edgar Schkrob + * @version 0.1 + * @since 1.0 */ @WebServlet("/logout") public class LogoutServlet extends HttpServlet { /** - * This is a Servlet that manages the Logout and deletes Sessions. + * if this servlet is request logout the user. * - * @param request This parameter provides access to everything the code needs to work. - * @param response This parameter provides access to everything the code needs to issue a response. - * @throws IOException Signals that an I/O exception of some sort has occurred. This class is the general class of exceptions produced by failed or interrupted I/O operations. + * @param request request object + * @param response response object + * @throws IOException failed to initialize print writer */ - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + protected void doGet(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); if (session != null) { - Data.delete(session.getId()); + DatasetManagement.delete(session.getId()); session.invalidate(); } response.sendRedirect(request.getContextPath() + "/"); diff --git a/src/main/java/de/hsel/spm/baudas/web/SavedFile.java b/src/main/java/de/hsel/spm/baudas/web/SavedFile.java index c0ae3fa..4380a56 100644 --- a/src/main/java/de/hsel/spm/baudas/web/SavedFile.java +++ b/src/main/java/de/hsel/spm/baudas/web/SavedFile.java @@ -12,7 +12,7 @@ import java.util.UUID; * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 */ @Getter @AllArgsConstructor diff --git a/src/main/java/de/hsel/spm/baudas/web/ShoppingCartDiagram.java b/src/main/java/de/hsel/spm/baudas/web/ShoppingCartDiagram.java deleted file mode 100644 index c2413f6..0000000 --- a/src/main/java/de/hsel/spm/baudas/web/ShoppingCartDiagram.java +++ /dev/null @@ -1,70 +0,0 @@ -package de.hsel.spm.baudas.web; - -import com.google.gson.Gson; -import de.hsel.spm.baudas.analysis.ShoppingCart; -import org.jetbrains.annotations.NotNull; - -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; -import java.util.*; - -/** - * Changes data to readable format for table - * - * @author Karsten Eden - * @version 0.1 - * @since 0.1 - */ -@WebServlet("/shopping_cart") -public class ShoppingCartDiagram extends HttpServlet { - - private static final long serialVersionUID = 5026732432605473505L; - - private static List> cache; - - protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException { - req.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setContentType("application/json"); - PrintWriter out = resp.getWriter(); - Gson gson = new Gson(); - - if(cache != null) { - out.println(gson.toJson(cache)); - return; - } - - List> result = new ArrayList<>(); - - if (req.getParameter("id") == null) { - out.print(gson.toJson(result)); - return; - } - - UUID uuid = UUID.fromString(req.getParameter("id")); - File file = Data.get(uuid); - - ShoppingCart cart = new ShoppingCart(file); - Map, List> map = cart.getResult(); - - List col1 = new ArrayList<>(); - List col2 = new ArrayList<>(); - - for(Map.Entry, List> entry : map.entrySet()){ - col1.add(String.join(", ", entry.getKey())); - col2.add(String.join(", ", entry.getValue())); - } - - for(int i = 0; i < col1.size(); i++ ){ - result.add(new AbstractMap.SimpleEntry<>(col1.get(i), col2.get(i))); - } - - out.print(gson.toJson(result)); - } -} diff --git a/src/main/java/de/hsel/spm/baudas/web/Upload.java b/src/main/java/de/hsel/spm/baudas/web/UploadServlet.java similarity index 89% rename from src/main/java/de/hsel/spm/baudas/web/Upload.java rename to src/main/java/de/hsel/spm/baudas/web/UploadServlet.java index 6383e98..9616b2c 100644 --- a/src/main/java/de/hsel/spm/baudas/web/Upload.java +++ b/src/main/java/de/hsel/spm/baudas/web/UploadServlet.java @@ -28,7 +28,7 @@ import java.nio.file.StandardCopyOption; @WebServlet("/upload") @MultipartConfig -public class Upload extends HttpServlet { +public class UploadServlet extends HttpServlet { private static final long serialVersionUID = 14144111845151L; @@ -48,6 +48,13 @@ public class Upload extends HttpServlet { } } + /** + * validates file and saves it. + * + * @param req request object + * @param resp response object + * @throws IOException failed to initialize print writer + */ @Override protected void doPost(@NotNull HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding(StandardCharsets.UTF_8.name()); @@ -89,7 +96,7 @@ public class Upload extends HttpServlet { inputStream = filePart.getInputStream(); } - Path path = Data.add(fileName, req.getSession().getId()); + Path path = DatasetManagement.add(fileName, req.getSession().getId()); if (!Files.exists(path)) { Files.createFile(path); } diff --git a/src/main/java/de/hsel/spm/baudas/web/ClusterDiagram.java b/src/main/java/de/hsel/spm/baudas/web/depiction/ClusterTable.java similarity index 52% rename from src/main/java/de/hsel/spm/baudas/web/ClusterDiagram.java rename to src/main/java/de/hsel/spm/baudas/web/depiction/ClusterTable.java index a4ba39a..aa3afb5 100644 --- a/src/main/java/de/hsel/spm/baudas/web/ClusterDiagram.java +++ b/src/main/java/de/hsel/spm/baudas/web/depiction/ClusterTable.java @@ -1,7 +1,8 @@ -package de.hsel.spm.baudas.web; +package de.hsel.spm.baudas.web.depiction; import com.google.gson.Gson; import de.hsel.spm.baudas.analysis.Cluster; +import de.hsel.spm.baudas.web.DatasetManagement; import org.jetbrains.annotations.NotNull; import javax.servlet.annotation.WebServlet; @@ -11,45 +12,45 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; /** - * changes data from cluster analysis into a readable format + * changes data from cluster analysis into a readable format. * * @author Julian Hinxlage * @version 0.1 - * @since 0.1 + * @since 1.0 **/ @WebServlet("/clusters") -public class ClusterDiagram extends HttpServlet { +public class ClusterTable extends HttpServlet implements Depiction { - private static Map> cache; + private static Map cache; + /** + * returns formatted analysis result to HTTP GET request from supplied id. + * + * @param req request object + * @param resp response object + * @throws IOException failed to initialize print writer + */ @Override protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException { - req.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setContentType("application/json"); - PrintWriter out = resp.getWriter(); - Gson gson = new Gson(); + UUID uuid = setup(req, resp, cache); + if (uuid == null) return; - if(cache != null) { - out.println(gson.toJson(cache)); - return; - } Map> result = new HashMap<>(); - - if (req.getParameter("id") == null) { - out.print(gson.toJson(result)); - return; - } - UUID uuid = UUID.fromString(req.getParameter("id")); - File file = Data.get(uuid); + File file = DatasetManagement.get(uuid); Cluster cluster = new Cluster(file); result = cluster.getResult(); + + PrintWriter out = resp.getWriter(); + Gson gson = new Gson(); + + cache.put(uuid, result); out.print(gson.toJson(result)); } } diff --git a/src/main/java/de/hsel/spm/baudas/web/depiction/Depiction.java b/src/main/java/de/hsel/spm/baudas/web/depiction/Depiction.java new file mode 100644 index 0000000..edca3ce --- /dev/null +++ b/src/main/java/de/hsel/spm/baudas/web/depiction/Depiction.java @@ -0,0 +1,73 @@ +package de.hsel.spm.baudas.web.depiction; + +import com.google.gson.Gson; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.UUID; +import java.util.regex.Pattern; + +/** + * handle all common methods for depictions. + * + * @author Johannes Theiner + * @version 0.1 + * @since 1.0 + **/ +interface Depiction { + + /** + * set all default values and handle caching. + * + * @param request request object + * @param response response object + * @param cache cached results + * @return validated uuid + */ + @Nullable + default UUID setup(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Map cache) { + try { + request.setCharacterEncoding(StandardCharsets.UTF_8.name()); + response.setCharacterEncoding(StandardCharsets.UTF_8.name()); + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + + + Gson gson = new Gson(); + + UUID uuid = validateAndConvert(request.getParameter("id")); + if (uuid == null) return null; + + if (cache.containsKey(uuid)) { + out.println(gson.toJson(cache.get(uuid))); + return null; + } + return uuid; + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * validates and converts uuid. + * + * @param id potential uuid + * @return UUID object + */ + @Nullable + default UUID validateAndConvert(String 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 null; + } + + return UUID.fromString(id); + } +} \ No newline at end of file diff --git a/src/main/java/de/hsel/spm/baudas/web/TopFlopArticleDiagram.java b/src/main/java/de/hsel/spm/baudas/web/depiction/SalesNumberChart.java similarity index 60% rename from src/main/java/de/hsel/spm/baudas/web/TopFlopArticleDiagram.java rename to src/main/java/de/hsel/spm/baudas/web/depiction/SalesNumberChart.java index 85a36f3..24eba0e 100644 --- a/src/main/java/de/hsel/spm/baudas/web/TopFlopArticleDiagram.java +++ b/src/main/java/de/hsel/spm/baudas/web/depiction/SalesNumberChart.java @@ -1,7 +1,8 @@ -package de.hsel.spm.baudas.web; +package de.hsel.spm.baudas.web.depiction; import com.google.gson.Gson; -import de.hsel.spm.baudas.analysis.TopFlopArticle; +import de.hsel.spm.baudas.analysis.SalesNumbers; +import de.hsel.spm.baudas.web.DatasetManagement; import org.jetbrains.annotations.NotNull; import javax.servlet.annotation.WebServlet; @@ -11,13 +12,11 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.regex.Pattern; /** * top/flop articles list diagram. @@ -27,38 +26,28 @@ import java.util.regex.Pattern; * @since 0.1 **/ -@WebServlet("/top_flop") -public class TopFlopArticleDiagram extends HttpServlet { +@WebServlet("/sales") +public class SalesNumberChart extends HttpServlet implements Depiction { private static Map cache = new HashMap<>(); private static final long serialVersionUID = 6567531464214L; + /** + * returns formatted analysis result to HTTP GET request from supplied id. + * + * @param req request object + * @param resp response object + * @throws IOException failed to initialize print writer + */ @Override protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException { - req.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setContentType("application/json"); - PrintWriter out = resp.getWriter(); + UUID uuid = setup(req, resp, cache); + if (uuid == null) return; - Gson gson = new Gson(); + File file = DatasetManagement.get(uuid); - 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; - } - - File file = Data.get(uuid); - - TopFlopArticle articles = new TopFlopArticle(file); + SalesNumbers articles = new SalesNumbers(file); Map map = articles.getResult(); Map> result = new HashMap<>(); @@ -74,6 +63,8 @@ public class TopFlopArticleDiagram extends HttpServlet { result.put("labels", labels); result.put("data", data); + PrintWriter out = resp.getWriter(); + Gson gson = new Gson(); cache.put(uuid, result); out.print(gson.toJson(result)); diff --git a/src/main/java/de/hsel/spm/baudas/web/depiction/ShoppingCartTable.java b/src/main/java/de/hsel/spm/baudas/web/depiction/ShoppingCartTable.java new file mode 100644 index 0000000..311df27 --- /dev/null +++ b/src/main/java/de/hsel/spm/baudas/web/depiction/ShoppingCartTable.java @@ -0,0 +1,80 @@ +package de.hsel.spm.baudas.web.depiction; + +import com.google.gson.Gson; +import de.hsel.spm.baudas.analysis.ShoppingCart; +import de.hsel.spm.baudas.web.DatasetManagement; +import org.jetbrains.annotations.NotNull; + +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Changes data to readable format for table. + * + * @author Karsten Eden + * @version 0.1 + * @since 0.1 + */ +@WebServlet("/shopping_cart") +public class ShoppingCartTable extends HttpServlet implements Depiction { + + private static final long serialVersionUID = 5026732432605473505L; + + private static Map cache; + + /** + * returns formatted analysis result to HTTP GET request from supplied id. + * + * @param req request object + * @param resp response object + * @throws IOException failed to initialize print writer + */ + protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException { + UUID uuid = setup(req, resp, cache); + if (uuid == null) return; + + + List> tmp = new ArrayList<>(); + + File file = DatasetManagement.get(uuid); + + ShoppingCart cart = new ShoppingCart(file); + Map, List> map = cart.getResult(); + + List premises = new ArrayList<>(); + List consequences = new ArrayList<>(); + + for (Map.Entry, List> entry : map.entrySet()) { + premises.add(String.join(", ", entry.getKey())); + consequences.add(String.join(", ", entry.getValue())); + } + + for (int i = 0; i < premises.size(); i++) { + tmp.add(new AbstractMap.SimpleEntry<>(premises.get(i), consequences.get(i))); + } + Map> result = new HashMap<>(); + int i = 0; + for (Map.Entry entry : tmp) { + result.put(i, entry); + i++; + } + + cache.put(uuid, result); + + PrintWriter out = resp.getWriter(); + Gson gson = new Gson(); + + out.print(gson.toJson(result)); + } +} diff --git a/src/main/java/de/hsel/spm/baudas/web/ShoppingTimesDiagram.java b/src/main/java/de/hsel/spm/baudas/web/depiction/ShoppingTimesChart.java similarity index 69% rename from src/main/java/de/hsel/spm/baudas/web/ShoppingTimesDiagram.java rename to src/main/java/de/hsel/spm/baudas/web/depiction/ShoppingTimesChart.java index bbe011d..615bf57 100644 --- a/src/main/java/de/hsel/spm/baudas/web/ShoppingTimesDiagram.java +++ b/src/main/java/de/hsel/spm/baudas/web/depiction/ShoppingTimesChart.java @@ -1,7 +1,8 @@ -package de.hsel.spm.baudas.web; +package de.hsel.spm.baudas.web.depiction; import com.google.gson.Gson; import de.hsel.spm.baudas.analysis.ShoppingTimes; +import de.hsel.spm.baudas.web.DatasetManagement; import org.jetbrains.annotations.NotNull; import javax.servlet.annotation.WebServlet; @@ -11,54 +12,51 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.regex.Pattern; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.UUID; /** * changes data from shopping times diagram into a readable format for chart.js * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 **/ @WebServlet("/shopping_times") -public class ShoppingTimesDiagram extends HttpServlet { +public class ShoppingTimesChart extends HttpServlet implements Depiction { private static Map cache = new HashMap<>(); private static final long serialVersionUID = 6567531484L; + /** + * returns formatted analysis result to HTTP GET request from supplied id. + * + * @param req request object + * @param resp response object + * @throws IOException failed to initialize print writer + */ @Override protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException { - req.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setContentType("application/json"); - PrintWriter out = resp.getWriter(); + UUID uuid = setup(req, resp, cache); + if (uuid == null) return; + List definedOrder = Arrays.asList("<10 Uhr", "10-12 Uhr", "12-14 Uhr", "14-17 Uhr", ">17 Uhr"); Comparator comparator = Comparator.comparingInt(definedOrder::indexOf); Map> result = new HashMap<>(); - 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.print(gson.toJson(cache.get(uuid))); - return; - } - - - File file = Data.get(uuid); + File file = DatasetManagement.get(uuid); ShoppingTimes shoppingTimes = new ShoppingTimes(file); Map, Integer> map = shoppingTimes.getResult(); @@ -73,14 +71,17 @@ public class ShoppingTimesDiagram extends HttpServlet { for (String day : days) { - if (!result.containsKey(day)) + if (!result.containsKey(day)) { result.put(day, new ArrayList<>()); + } for (String hour : hours) { if (map.containsKey(new AbstractMap.SimpleEntry<>(day, hour))) { result.get(day).add(map.get(new AbstractMap.SimpleEntry<>(day, hour)).toString()); } else result.get(day).add("0"); } } + PrintWriter out = resp.getWriter(); + Gson gson = new Gson(); cache.put(uuid, result); out.print(gson.toJson(result)); diff --git a/src/main/java/de/hsel/spm/baudas/web/WeekOverviewDiagram.java b/src/main/java/de/hsel/spm/baudas/web/depiction/WeekOverviewChart.java similarity index 71% rename from src/main/java/de/hsel/spm/baudas/web/WeekOverviewDiagram.java rename to src/main/java/de/hsel/spm/baudas/web/depiction/WeekOverviewChart.java index 6f8534f..d9d0cb0 100644 --- a/src/main/java/de/hsel/spm/baudas/web/WeekOverviewDiagram.java +++ b/src/main/java/de/hsel/spm/baudas/web/depiction/WeekOverviewChart.java @@ -1,7 +1,8 @@ -package de.hsel.spm.baudas.web; +package de.hsel.spm.baudas.web.depiction; import com.google.gson.Gson; import de.hsel.spm.baudas.analysis.WeekOverview; +import de.hsel.spm.baudas.web.DatasetManagement; import org.jetbrains.annotations.NotNull; import javax.servlet.annotation.WebServlet; @@ -11,7 +12,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -19,50 +19,39 @@ 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 * * @author Johannes Theiner * @version 0.1 - * @since 0.1 + * @since 1.0 **/ @WebServlet("/week_overview") -public class WeekOverviewDiagram extends HttpServlet { +public class WeekOverviewChart extends HttpServlet implements Depiction { private static Map cache = new HashMap<>(); private static final long serialVersionUID = 8484151844118L; + /** + * returns formatted analysis result to HTTP GET request from supplied id. + * + * @param req request object + * @param resp response object + * @throws IOException failed to initialize print writer + */ @Override protected void doGet(@NotNull HttpServletRequest req, @NotNull HttpServletResponse resp) throws IOException { - req.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setCharacterEncoding(StandardCharsets.UTF_8.name()); - resp.setContentType("application/json"); - PrintWriter out = resp.getWriter(); + UUID uuid = setup(req, resp, cache); + + if (uuid == null) return; List definedOrder = Arrays.asList("Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"); Map> result = new HashMap<>(); - 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; - } - - File file = Data.get(uuid); + File file = DatasetManagement.get(uuid); WeekOverview overview = new WeekOverview(file); @@ -86,6 +75,9 @@ public class WeekOverviewDiagram extends HttpServlet { result.put("count", count); result.put("revenue", revenue); + PrintWriter out = resp.getWriter(); + Gson gson = new Gson(); + cache.put(uuid, result); out.print(gson.toJson(result)); } diff --git a/src/main/resources/LogoBauDas2.gif b/src/main/resources/LogoBauDas2.gif deleted file mode 100644 index 2fbc6e1..0000000 Binary files a/src/main/resources/LogoBauDas2.gif and /dev/null differ diff --git a/src/main/webapp/analysis.jsp b/src/main/webapp/analysis.jsp new file mode 100644 index 0000000..db38a5d --- /dev/null +++ b/src/main/webapp/analysis.jsp @@ -0,0 +1,87 @@ + + +
+ +
+
+
+ Wochenübersicht +
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ Einkaufszeiten +
+
+
+ + +
+
+
+ +
+
+
+
+ + +
+
+
+ Verkaufszahlen +
+
+
+ +
+
+
+
+ + +
+
+
+
+ Gruppenübersicht +
+
+ +
+
+
+
+
+ + +
+
+
+ Warenkorbanalyse +
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/footer.jsp b/src/main/webapp/footer.jsp index 1e71394..e597888 100644 --- a/src/main/webapp/footer.jsp +++ b/src/main/webapp/footer.jsp @@ -1,19 +1,11 @@ - - - - -<%@include file="theming.jsp"%> + + + - - - - - - - diff --git a/src/main/webapp/head.jsp b/src/main/webapp/head.jsp index 3d556dd..b9079f1 100644 --- a/src/main/webapp/head.jsp +++ b/src/main/webapp/head.jsp @@ -1,3 +1,4 @@ +<%@ page import="java.nio.charset.StandardCharsets" %> <% response.setCharacterEncoding(StandardCharsets.UTF_8.name()); %> <% request.setCharacterEncoding(StandardCharsets.UTF_8.name()); %> diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index 739394e..28e2390 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -1,198 +1,10 @@ <%@ page import="java.nio.charset.StandardCharsets" %> -<%@ page contentType="text/html;charset=UTF-8" %> -<%@include file="menu.jsp" %> <% response.setCharacterEncoding(StandardCharsets.UTF_8.name()); %> <% request.setCharacterEncoding(StandardCharsets.UTF_8.name()); %> +<%@ page contentType="text/html;charset=UTF-8" %> +<%@include file="menu.jsp" %> - - -
- -
-
-
- Wochenübersicht -
+<%@include file="analysis.jsp"%> +<%@include file="marketing.jsp"%> -
-
- -
-
-
-
- - -
-
-
-
- Einkaufszeiten -
-
-
- - -
-
-
- -
-
-
-
- - -
-
-
- Verkaufszahlen -
-
-
- -
-
-
-
- - -
-
-
-
- Gruppenübersicht -
-
- -
-
-
-
-
- - -
-
-
- Warenkorbanalyse -
-
- -
-
-
-
-
- -
-
-
-
-
-
- Werbung -
-
-

- Werbung dient dazu, auf bestimmte Produkte, Angebote oder den Markt im - Allgemeinen aufmerksam zu machen. Sie kann über verschiedene Wege verbreitet - werden, etwa das Internet, Zeitungsannoncen oder auch per TV/Radio. - Im Gegensatz zu Rabatten (die zeitabhängig am besten funktionieren) ist Werbung - stark von der Zielgruppe abhängig. Insbesondere in der Kombination mit anderen - Marketingmaßnahmen kann sie so ihre volle Wirkung entfalten. -
-
- Analysen, die für Werbung nützlich sein könnten: - Clusteranalyse, Wochenübersicht, Verkaufszahlen -

-
-
-
-
-
-
-
-
- Sortimentsveränderung -
-
-

- Gibt es eine Produktgruppe, die sich besonders gut verkauft, so sollte unter - Umständen über die Erweiterung des Sortiments innerhalb dieser Gruppe - nachgedacht werden. - Im Umkehrschluss dazu bietet sich an, schlecht verkaufte Produkte, welche keinen - hohen Gewinn abwerfen aus dem täglichen Verkaufsgeschäft wieder zu entfernen. - Dies verringert die Bildung von „Ladenhütern“ und schafft Platz für neue, sich - besser verkaufende Produkte. -
-
- Analysen, die bei der Sortimentswahl nützlich sein könnten: - Verkaufszahlen, Clusterübersicht -

-
-
-
-
-
-
-
-
-
-
- Rabatt -
-
-

- Rabatte können z.B. an Tagen angeboten werden, an denen nur wenige Kunden - erscheinen. Dadurch wird einerseits an dieses Tagen oder Uhrzeiten das - Kaufverhalten angeregt, als auch der Andrang an anderen reduziert. Dies dient - insbesondere der Entzerrung des zeitabhängigen Kaufverhaltens. - Des Weiteren können durch Rabatte weniger gut laufende Produkte in den - Vordergrund gerückt du vergünstigt angeboten werden. - Zusätzlich dazu können sich gut verkaufende Produkte mit einem (vermeintlich) - verringerten Preis versehen werden. Dies kann beim Kunden den „inneren - Schnäppchenjäger“ wecken und dafür sorgen, dass er sich dieses gute Angebot - nicht entgehen lassen kann. -
-
- Analysen, die zur Platzierung von Rabatten nützlich sein können: - Wochenübersicht, Einkaufszeiten, Verkaufszahlen -

-
-
-
-
-
-
-
-
- Produktplatzierung -
-
-

- Es gibt bestimmte Produkte, die werden häufig zusammen erworben. Sind diese - Produkte quer durch den Laden verstreut, so müssen die Kunden zusätzlich zu - ihren Wunschprodukten auch an anderen Auslagen vorbei und die Anzahl an - Spontankäufen eben jener weiteren Produkte steigt. -
-
- Analysen, die bei der Produktplatzierung hilfreich sein könnten: - Warenkorbsanalyse, Verkaufszahlen -

-
-
-
-
-
-
- - -<%@include file="footer.jsp" %> \ No newline at end of file +<%@include file="theming.jsp" %> \ No newline at end of file diff --git a/src/main/webapp/js/cache.js b/src/main/webapp/js/cache.js index 5768c22..e474c4b 100644 --- a/src/main/webapp/js/cache.js +++ b/src/main/webapp/js/cache.js @@ -32,7 +32,7 @@ function clearSelected(){ function updateDatasets() { let dataset = $('#dataset'); - request('files').then(results => { + request('datasets').then(results => { dataset.empty(); for (const result of results) { dataset.append($("") @@ -56,7 +56,7 @@ function updateCache() { } else { //requesting files, getting values from html does not work... //if no selection is provided, select newest file - request('files').then(results => { + request('datasets').then(results => { let uuid = results[results.length - 1].uuid; dataset.val(uuid); updateAll(uuid); @@ -69,7 +69,7 @@ function updateAll(uuid) { updateWeekOverviewChart(uuid); updateShoppingTimesChart(uuid); updateTopFlopChart(uuid); - updateClusters(uuid) + updateClusters(uuid); updateShoppingCartTable(uuid); //add new charts here. } diff --git a/src/main/webapp/js/top_flop.js b/src/main/webapp/js/sales.js similarity index 72% rename from src/main/webapp/js/top_flop.js rename to src/main/webapp/js/sales.js index 74b51e1..995a428 100644 --- a/src/main/webapp/js/top_flop.js +++ b/src/main/webapp/js/sales.js @@ -1,7 +1,7 @@ let top_flop_result; -let top_flop = new Chart($("#top_flop_chart"), { +let sales = new Chart($("#sales_chart"), { type: 'horizontalBar', data: { labels: [], @@ -34,23 +34,23 @@ let top_flop = new Chart($("#top_flop_chart"), { function updateTopFlopChart(id) { if (typeof id !== 'undefined') { - request('top_flop', id).then(function (data) { + request('sales', id).then(function (data) { top_flop_result = data; updateTopFlop(); }); - } else request('top_flop').then(function (data) { + } else request('sales').then(function (data) { top_flop_result = data; updateTopFlop(); }); } function updateTopFlop() { - top_flop.data.labels = top_flop_result.labels; - top_flop.data.datasets[0].data = top_flop_result.data; + sales.data.labels = top_flop_result.labels; + sales.data.datasets[0].data = top_flop_result.data; let seq = palette('mpn65', 15); for (let i = 0; i < 15; i++) { - top_flop.data.datasets[0].backgroundColor[i] = "#" + seq[i]; + sales.data.datasets[0].backgroundColor[i] = "#" + seq[i]; } - top_flop.update(); + sales.update(); } diff --git a/src/main/webapp/login.html b/src/main/webapp/login.html deleted file mode 100644 index cf45487..0000000 --- a/src/main/webapp/login.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - Login - - - - - - - - - -
- -
-
-
-
- -
-
-
-
- -
- - -
-
-
-
-
-
-
- - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/login.jsp b/src/main/webapp/login.jsp new file mode 100644 index 0000000..f3153e3 --- /dev/null +++ b/src/main/webapp/login.jsp @@ -0,0 +1,26 @@ +<%@include file="emptyHeader.jsp"%> + +
+ +
+
+
+
+ +
+
+
+
+ +
+ + +
+
+
+
+
+
+
+ +<%@include file="footer.jsp"%> \ No newline at end of file diff --git a/src/main/webapp/marketing.jsp b/src/main/webapp/marketing.jsp new file mode 100644 index 0000000..79cbc3b --- /dev/null +++ b/src/main/webapp/marketing.jsp @@ -0,0 +1,102 @@ + +
+
+
+
+
+
+ Werbung +
+
+

+ Werbung dient dazu, auf bestimmte Produkte, Angebote oder den Markt im + Allgemeinen aufmerksam zu machen. Sie kann über verschiedene Wege verbreitet + werden, etwa das Internet, Zeitungsannoncen oder auch per TV/Radio. + Im Gegensatz zu Rabatten (die zeitabhängig am besten funktionieren) ist Werbung + stark von der Zielgruppe abhängig. Insbesondere in der Kombination mit anderen + Marketingmaßnahmen kann sie so ihre volle Wirkung entfalten. +
+
+ Analysen, die für Werbung nützlich sein könnten: + Clusteranalyse, Wochenübersicht, Verkaufszahlen +

+
+
+
+
+
+
+
+
+ Sortimentsveränderung +
+
+

+ Gibt es eine Produktgruppe, die sich besonders gut verkauft, so sollte unter + Umständen über die Erweiterung des Sortiments innerhalb dieser Gruppe + nachgedacht werden. + Im Umkehrschluss dazu bietet sich an, schlecht verkaufte Produkte, welche keinen + hohen Gewinn abwerfen aus dem täglichen Verkaufsgeschäft wieder zu entfernen. + Dies verringert die Bildung von „Ladenhütern“ und schafft Platz für neue, sich + besser verkaufende Produkte. +
+
+ Analysen, die bei der Sortimentswahl nützlich sein könnten: + Verkaufszahlen, Clusterübersicht +

+
+
+
+
+
+
+
+
+
+
+ Rabatt +
+
+

+ Rabatte können z.B. an Tagen angeboten werden, an denen nur wenige Kunden + erscheinen. Dadurch wird einerseits an dieses Tagen oder Uhrzeiten das + Kaufverhalten angeregt, als auch der Andrang an anderen reduziert. Dies dient + insbesondere der Entzerrung des zeitabhängigen Kaufverhaltens. + Des Weiteren können durch Rabatte weniger gut laufende Produkte in den + Vordergrund gerückt du vergünstigt angeboten werden. + Zusätzlich dazu können sich gut verkaufende Produkte mit einem (vermeintlich) + verringerten Preis versehen werden. Dies kann beim Kunden den „inneren + Schnäppchenjäger“ wecken und dafür sorgen, dass er sich dieses gute Angebot + nicht entgehen lassen kann. +
+
+ Analysen, die zur Platzierung von Rabatten nützlich sein können: + Wochenübersicht, Einkaufszeiten, Verkaufszahlen +

+
+
+
+
+
+
+
+
+ Produktplatzierung +
+
+

+ Es gibt bestimmte Produkte, die werden häufig zusammen erworben. Sind diese + Produkte quer durch den Laden verstreut, so müssen die Kunden zusätzlich zu + ihren Wunschprodukten auch an anderen Auslagen vorbei und die Anzahl an + Spontankäufen eben jener weiteren Produkte steigt. +
+
+ Analysen, die bei der Produktplatzierung hilfreich sein könnten: + Warenkorbsanalyse, Verkaufszahlen +

+
+
+
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/theming.jsp b/src/main/webapp/theming.jsp index 4df5f5e..d6dcc2f 100644 --- a/src/main/webapp/theming.jsp +++ b/src/main/webapp/theming.jsp @@ -1,5 +1,17 @@ - - - \ No newline at end of file + + + + + + + + + + + + + + + +<%@include file="footer.jsp"%> \ No newline at end of file diff --git a/src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java b/src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java index b81f4a2..418c8d4 100644 --- a/src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java +++ b/src/test/java/de/hsel/spm/baudas/analysis/TopFlopArticlesTest.java @@ -14,7 +14,7 @@ public class TopFlopArticlesTest { void test100() { URL url = getClass().getClassLoader().getResource("kd100.csv"); assert url != null; - TopFlopArticle tfArticle = new TopFlopArticle(new File(url.getFile())); + SalesNumbers tfArticle = new SalesNumbers(new File(url.getFile())); Map results = tfArticle.getResult(); assertEquals(529, results.get("Farben")); @@ -29,7 +29,7 @@ public class TopFlopArticlesTest { void test1000() { URL url = getClass().getClassLoader().getResource("kd1000.csv"); assert url != null; - TopFlopArticle tfArticle = new TopFlopArticle(new File(url.getFile())); + SalesNumbers tfArticle = new SalesNumbers(new File(url.getFile())); Map results = tfArticle.getResult(); assertEquals(5643, results.get("Eisenwaren")); @@ -44,7 +44,7 @@ public class TopFlopArticlesTest { void test10000() { URL url = getClass().getClassLoader().getResource("kd10000.csv"); assert url != null; - TopFlopArticle tfArticle = new TopFlopArticle(new File(url.getFile())); + SalesNumbers tfArticle = new SalesNumbers(new File(url.getFile())); Map results = tfArticle.getResult(); assertEquals(101665, results.get("Handwerkzeuge")); diff --git a/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java b/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java index 5a18db5..da83c26 100644 --- a/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java +++ b/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertTimeout; /** - * Week WeekOverviewDiagram Analysis Test. + * Week Overview Analysis Test. * * @author Johannes Theiner * @version 0.1