commit 085e478328106a9c35022300ab668b3a32ea6225
Author: Pavel Fidranský <fidransky@outlook.com>
Date:   Wed Aug 22 10:48:47 2018 +0200

    dropped some unused functionality, merged DefaultPage with UploadFiles servlet

diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/DefaultPage.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/DefaultPage.java
deleted file mode 100644
index 7813e35..0000000
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/DefaultPage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package cz.zcu.kiv.offscreen.servlets;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import cz.zcu.kiv.offscreen.loader.configuration.ConfigurationLoader;
-import cz.zcu.kiv.offscreen.session.SessionManager;
-import cz.zcu.kiv.offscreen.storage.FileManager;
-import cz.zcu.kiv.offscreen.user.DB;
-import cz.zcu.kiv.offscreen.user.Diagram;
-
-/**
- *
- * @author Jindra Pavlíková <jindra.pav2@seznam.cz>
- */
-public class DefaultPage extends HttpServlet {
-
-    /**
-     * Loads currently uploaded components and renders uploadFiles.jsp.
-     */
-    @Override
-    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        String sessionValue = SessionManager.getSessionValue(request, "JSESSIONID");
-        if (sessionValue != null && !"".equals(sessionValue)) {
-            String storageLocation = ConfigurationLoader.getStorageLocation(request.getServletContext());
-
-            FileManager fileManager = new FileManager(sessionValue, storageLocation);
-            if (!fileManager.isExistStorage()) {
-                fileManager.createStorageDirectory();
-            }
-
-            request.setAttribute("componentNames", fileManager.getUploadedComponentsNames());
-        }
-        
-        DB db = new DB(getServletContext()); 
-        Diagram diagram_list = new Diagram(db);
-
-        List<Map<String, String>> list = new ArrayList<>();
-        if (request.getSession().getAttribute("logged_user") == "1") {
-			list = diagram_list.getDiagramListByUserId((int) request.getSession().getAttribute("logged_user_id"));
-        }
-
-        List<Map<String, String>> diagram_public_list = diagram_list.getDiagramPublicList();
-
-        request.setAttribute("diagramPublic", diagram_public_list);
-        request.setAttribute("diagramNames", list);
-
-        // render
-        RequestDispatcher rd = getServletContext().getRequestDispatcher("/uploadFiles.jsp");
-        rd.forward(request, response);
-    }
-}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/LoadGraphData.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/LoadGraphData.java
index 9dd15a3..d28b488 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/LoadGraphData.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/LoadGraphData.java
@@ -51,28 +51,19 @@ public class LoadGraphData extends HttpServlet {
         response.setCharacterEncoding("UTF-8");
 
         if (request.getSession().getAttribute("demo_id") == null) {
-            // it doesn't have EFPs -> read from ComAV
-            if (request.getSession().getAttribute("graph_json_data") == null) {
-                File[] uploadedFiles = fileManager.getUploadedComponents().toArray(new File[0]);
-                File fileToDisplay = uploadedFiles[0];
+            File[] uploadedFiles = fileManager.getUploadedComponents().toArray(new File[0]);
+            File fileToDisplay = uploadedFiles[0];
 
-                GraphManager graphManager = new GraphJSONDataLoader(fileToDisplay).LoadData();
-                String configLocation = ConfigurationLoader.getConfigLocation(request.getServletContext());
-                JSONConfigLoader configLoader = new JSONConfigLoader(graphManager, configLocation);
-                Graph graph = graphManager.createGraph(configLoader);
-                GraphExport export = new GraphExport(graph);
-                JSONObject json = JSONObject.fromObject(export);
+            GraphManager graphManager = new GraphJSONDataLoader(fileToDisplay).LoadData();
+            String configLocation = ConfigurationLoader.getConfigLocation(request.getServletContext());
+            JSONConfigLoader configLoader = new JSONConfigLoader(graphManager, configLocation);
+            Graph graph = graphManager.createGraph(configLoader);
+            GraphExport export = new GraphExport(graph);
+            JSONObject json = JSONObject.fromObject(export);
 
-                String resultJsonString = json.toString();
+            String resultJsonString = json.toString();
 
-                response.getWriter().write(resultJsonString);
-
-            } else {
-                // it has EFPs -> read from the session
-                response.getWriter().write(request.getSession().getAttribute("graph_json_data").toString());
-
-                request.getSession().removeAttribute("graph_json_data");
-            }
+            response.getWriter().write(resultJsonString);
 
         } else {
             String demoId = request.getSession().getAttribute("demo_id").toString();
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/ShowGraph.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/ShowGraph.java
index 103a444..61dd50a 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/ShowGraph.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/ShowGraph.java
@@ -32,10 +32,6 @@ public class ShowGraph extends HttpServlet {
 
     @Override
     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-		// framework
-        String framework = request.getParameter("framework") == null ? "osgi" : request.getParameter("framework");
-        response.addCookie(new Cookie("framework", framework));
-
         // should save button be displayed?
 		boolean showSaveButton = request.getParameter("diagram_id") != null && request.getParameter("diagram_hash") != null;
 		request.setAttribute("show_icon_save", showSaveButton);
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/UploadFiles.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/UploadFiles.java
new file mode 100644
index 0000000..782acea
--- /dev/null
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/UploadFiles.java
@@ -0,0 +1,102 @@
+package cz.zcu.kiv.offscreen.servlets;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+
+import cz.zcu.kiv.offscreen.loader.configuration.ConfigurationLoader;
+import cz.zcu.kiv.offscreen.session.SessionManager;
+import cz.zcu.kiv.offscreen.storage.FileManager;
+import cz.zcu.kiv.offscreen.user.DB;
+import cz.zcu.kiv.offscreen.user.Diagram;
+
+/**
+ *
+ * @author Jindra PavlĂ­kovĂˇ <jindra.pav2@seznam.cz>
+ */
+public class UploadFiles extends HttpServlet {
+
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        doPost(request, response);
+    }
+
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        DB db = new DB(getServletContext());
+
+        String diagram_id = request.getParameter("diagram_id");
+        if (diagram_id != null) {
+            Integer diagramId = Integer.parseInt(diagram_id);
+
+	        Diagram diagram_edit = new Diagram(db, diagramId);
+	        Map<String, String> diag_param = diagram_edit.getDiagramParam(diagramId);
+	        
+	        request.setAttribute("diagram_name", diag_param.get("name"));
+	        request.setAttribute("diagram_user_id", diag_param.get("user_id"));
+	        request.setAttribute("diagram_public_checked", (diag_param.get("public").compareTo("1") == 0 ? " checked=\"checked\" " : ""));
+        } else {
+        	request.setAttribute("diagram_name", "");
+        	request.setAttribute("diagram_public_checked", "");
+        	request.setAttribute("diagram_user_id", "-1");
+        }
+
+        // initialize file manager
+        String workingDirectory;
+        if (request.getParameter("diagram_hash") == null) {
+            workingDirectory = SessionManager.getSessionValue(request, "JSESSIONID");
+        } else {
+            workingDirectory = request.getParameter("diagram_hash");
+        }
+
+        int version = 1;
+        workingDirectory += File.separator + String.valueOf(version);
+
+        String storageLocation = ConfigurationLoader.getStorageLocation(request.getServletContext());
+
+        FileManager fileManager = new FileManager(workingDirectory, storageLocation);
+        if (!fileManager.isExistStorage()) {
+            fileManager.createStorageDirectory();
+        }
+
+        // save files from request
+        String result;
+        if (ServletFileUpload.isMultipartContent(request)) {
+            result = fileManager.saveFile(request);
+        } else {
+            result = "";
+        }
+
+        response.addCookie(new Cookie("graphVersion", String.valueOf(version)));
+
+        // response
+        List<Map<String, String>> userDiagramList = new ArrayList<>();
+        if (request.getSession().getAttribute("logged_user") == "1") {
+            int loggedUserId = (int) request.getSession().getAttribute("logged_user_id");
+
+			userDiagramList = new Diagram(db).getDiagramListByUserId(loggedUserId);
+        }
+        request.setAttribute("diagramNames", userDiagramList);
+
+        List<Map<String, String>> publicDiagramList = new Diagram(db).getDiagramPublicList();
+        request.setAttribute("diagramPublic", publicDiagramList);
+        
+        request.setAttribute("componentNames", fileManager.getUploadedComponentsNames());
+        request.setAttribute("errorMessage", result);
+
+        // render
+        RequestDispatcher rd = getServletContext().getRequestDispatcher("/uploadFiles.jsp");
+        rd.forward(request, response);
+    }
+}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/CopyComponents.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/CopyComponents.java
deleted file mode 100644
index 03364fc..0000000
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/CopyComponents.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package cz.zcu.kiv.offscreen.servlets.actions;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.ParseException;
-import java.util.List;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-import cz.zcu.kiv.offscreen.loader.configuration.ConfigurationLoader;
-import cz.zcu.kiv.offscreen.session.SessionManager;
-import cz.zcu.kiv.offscreen.storage.FileManager;
-
-/**
- * @author Pavel Fidransky [jsem@pavelfidransky.cz]
- */
-public class CopyComponents extends HttpServlet {
-
-    /**
-     * Makes a copy of components stored in the current graph version folder to the (current + 1) folder. Components to
-     * be copied are set by input JSON.
-     */
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        // read input data
-        StringBuilder sb = new StringBuilder();
-        try (BufferedReader reader = request.getReader()) {
-            String line;
-            while ((line = reader.readLine()) != null) {
-                sb.append(line);
-            }
-        }
-
-        // parse the data as JSON
-        JSONObject componentsJson;
-        try {
-            componentsJson = new JSONObject(sb.toString());
-        } catch (ParseException e) {
-            response.sendError(response.SC_BAD_REQUEST);
-            return;
-        }
-
-        // get current graph version from cookie
-        int version = Integer.parseInt(SessionManager.getSessionValue(request, "graphVersion"));
-
-        // initialize file manager
-        String workingDirectory;
-        if (request.getParameter("diagram_hash") == null) {
-            workingDirectory = SessionManager.getSessionValue(request, "JSESSIONID");
-        } else {
-            workingDirectory = request.getParameter("diagram_hash");
-        }
-
-        String storageLocation = ConfigurationLoader.getStorageLocation(request.getServletContext());
-
-        FileManager oldFileManager = new FileManager(workingDirectory + File.separator + String.valueOf(version), storageLocation);
-        FileManager newFileManager = new FileManager(workingDirectory + File.separator + String.valueOf(version + 1), storageLocation);
-
-        List<String> currentComponents = oldFileManager.getUploadedComponentsNames();
-
-        // copy components
-        JSONArray components = componentsJson.getJSONArray("components");
-        for (int i = 0; i < components.length(); i++) {
-            JSONObject component = components.getJSONObject(i);
-            String name = component.getString("name");
-
-            if (!currentComponents.contains(name)) continue;
-
-            String oldPath = storageLocation + File.separator + workingDirectory + File.separator + String.valueOf(version) + File.separator + name;
-            newFileManager.saveFile(new FileInputStream( oldPath), name);
-        }
-    }
-}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteAllComponents.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteAllComponents.java
index 1331a86..e22b992 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteAllComponents.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteAllComponents.java
@@ -47,7 +47,7 @@ public class DeleteAllComponents extends HttpServlet {
             request.setAttribute("componentNames", fileManager.getUploadedComponentsNames());
 
             // redirect
-            response.sendRedirect(getServletContext().getInitParameter("HOME_URL") + "upload-files");
+            response.sendRedirect(getServletContext().getInitParameter("HOME_URL"));
         }
     }
 }
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteComponent.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteComponent.java
index a8058ef..6e49fed 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteComponent.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DeleteComponent.java
@@ -75,7 +75,7 @@ public class DeleteComponent extends HttpServlet {
 
         } else {
             // redirect
-            response.sendRedirect(getServletContext().getInitParameter("HOME_URL") + "upload-files" + redirectUrlParams);
+            response.sendRedirect(getServletContext().getInitParameter("HOME_URL") + redirectUrlParams);
         }
     }
 }
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DownloadComponent.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DownloadComponent.java
deleted file mode 100644
index 1be3897..0000000
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/DownloadComponent.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package cz.zcu.kiv.offscreen.servlets.actions;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.log4j.Logger;
-import org.json.JSONObject;
-
-import cz.zcu.kiv.offscreen.loader.configuration.ConfigurationLoader;
-import cz.zcu.kiv.offscreen.session.SessionManager;
-import cz.zcu.kiv.offscreen.storage.FileManager;
-
-/**
- * @author Pavel Fidransky [jsem@pavelfidransky.cz]
- */
-public class DownloadComponent extends HttpServlet {
-
-    private String crceApiBase;
-    private FileManager fileManager;
-
-    private Logger logger = Logger.getLogger(DownloadComponent.class);
-
-    /**
-     * Downloads component by its UUID set in query parameter. The component is then stored in the current graph version
-     * folder. As a response, JSON containing component's UUID and filename is returned.
-     */
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        logger.error("Method is no longer supported because CRCE is removed from project.");
-//        // there was no uuid passed in the request
-//        if (request.getParameter("uuid") == null) {
-//            response.sendError(response.SC_BAD_REQUEST);
-//            return;
-//        }
-//
-//        // initialize file manager
-//        String workingDirectory;
-//        if (request.getParameter("diagram_hash") == null) {
-//            workingDirectory = SessionManager.getSessionValue(request, "JSESSIONID");
-//        } else {
-//            workingDirectory = request.getParameter("diagram_hash");
-//        }
-//
-//        if (request.getParameter("graphVersion") != null) {
-//            workingDirectory += File.separator + request.getParameter("graphVersion");
-//        } else {
-//            workingDirectory += File.separator + SessionManager.getSessionValue(request, "graphVersion");
-//        }
-//
-//        String storageLocation = ConfigurationLoader.getStorageLocation(request.getServletContext());
-//
-//        fileManager = new FileManager(workingDirectory, storageLocation);
-//        if (!fileManager.isExistStorage()) {
-//            fileManager.createStorageDirectory();
-//        }
-//
-//        // download component
-//        crceApiBase = ConfigurationLoader.getCrceApiBase(request.getServletContext());
-//
-//        String uuid = request.getParameter("uuid");
-//        String name = downloadComponent(uuid);
-//
-//        JSONObject componentJson = new JSONObject();
-//        componentJson.put("uuid", uuid);
-//        componentJson.put("name", name);
-//
-//        // send response
-//        response.setContentType("application/json");
-//        response.getWriter().write(componentJson.toString());
-    }
-
-    /*
-    PRIVATE METHODS
-     */
-
-    private String downloadComponent(String uuid) throws IOException {
-        URL url = new URL(this.crceApiBase + "/resources/" + uuid);
-        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-        connection.setConnectTimeout(60 * 1000);
-        connection.setReadTimeout(60 * 1000);
-
-        InputStream inputStream = connection.getInputStream();
-
-        String contentDisposition = connection.getHeaderField("Content-Disposition");
-        String fileName = contentDisposition.replaceFirst("(?i)^.*filename = ([^\"]+).*$", "$1");
-        File file = new File(fileName);
-
-        fileManager.saveFile(inputStream, file.getName());
-
-        inputStream.close();
-
-        return file.getName();
-    }
-
-}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/UploadFiles.java b/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/UploadFiles.java
deleted file mode 100644
index 784afc2..0000000
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/servlets/actions/UploadFiles.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package cz.zcu.kiv.offscreen.servlets.actions;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-
-import cz.zcu.kiv.offscreen.loader.configuration.ConfigurationLoader;
-import cz.zcu.kiv.offscreen.session.SessionManager;
-import cz.zcu.kiv.offscreen.storage.FileManager;
-import cz.zcu.kiv.offscreen.user.DB;
-import cz.zcu.kiv.offscreen.user.Diagram;
-
-/**
- *
- * @author Jindra PavlĂ­kovĂˇ <jindra.pav2@seznam.cz>
- */
-public class UploadFiles extends HttpServlet {
-
-    @Override
-    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        doPost(request, response);
-    }
-
-    @Override
-    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        DB db = new DB(getServletContext());
-
-        String diagram_id = request.getParameter("diagram_id");
-        if (diagram_id != null) {
-            Integer diagramId = Integer.parseInt(diagram_id);
-
-	        Diagram diagram_edit = new Diagram(db, diagramId);
-	        Map<String, String> diag_param = diagram_edit.getDiagramParam(diagramId);
-	        
-	        request.setAttribute("diagram_name", diag_param.get("name"));
-	        request.setAttribute("diagram_user_id", diag_param.get("user_id"));
-	        request.setAttribute("diagram_public_checked", (diag_param.get("public").compareTo("1") == 0 ? " checked=\"checked\" " : ""));
-        } else {
-        	request.setAttribute("diagram_name", "");
-        	request.setAttribute("diagram_public_checked", "");
-        	request.setAttribute("diagram_user_id", "-1");
-        }
-
-        // initialize file manager
-        String workingDirectory;
-        if (request.getParameter("diagram_hash") == null) {
-            workingDirectory = SessionManager.getSessionValue(request, "JSESSIONID");
-        } else {
-            workingDirectory = request.getParameter("diagram_hash");
-        }
-
-        int version = 1;
-        workingDirectory += File.separator + String.valueOf(version);
-
-        String storageLocation = ConfigurationLoader.getStorageLocation(request.getServletContext());
-
-        FileManager fileManager = new FileManager(workingDirectory, storageLocation);
-        if (!fileManager.isExistStorage()) {
-            fileManager.createStorageDirectory();
-        }
-
-        // save files from request
-        String result;
-        if (ServletFileUpload.isMultipartContent(request)) {
-            result = fileManager.saveFile(request);
-        } else {
-            result = "";
-        }
-
-        response.addCookie(new Cookie("graphVersion", String.valueOf(version)));
-
-        // response
-        ArrayList<Map<String, String>> list = new ArrayList<>();
-        if (request.getSession().getAttribute("logged_user") == "1") {
-            int loggedUserId = (int) request.getSession().getAttribute("logged_user_id");
-
-			list = new Diagram(db).getDiagramListByUserId(loggedUserId);
-        }
-        request.setAttribute("diagramNames", list);
-
-        request.setAttribute("diagramPublic", new Diagram(db).getDiagramPublicList());
-        
-        request.setAttribute("componentNames", fileManager.getUploadedComponentsNames());
-        request.setAttribute("errorMessage", result);
-
-        // render
-        RequestDispatcher rd = getServletContext().getRequestDispatcher("/uploadFiles.jsp");
-        rd.forward(request, response);
-    }
-}
diff --git a/sources/src/main/webapp/META-INF/context.xml b/sources/src/main/webapp/META-INF/context.xml
index 45eb2ab..b354160 100644
--- a/sources/src/main/webapp/META-INF/context.xml
+++ b/sources/src/main/webapp/META-INF/context.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Context antiJARLocking="true" path="/VisualizationTool"/>
+<Context antiJARLocking="true" path="/imiger"/>
diff --git a/sources/src/main/webapp/WEB-INF/glassfish-web.xml b/sources/src/main/webapp/WEB-INF/glassfish-web.xml
deleted file mode 100644
index 3c63094..0000000
--- a/sources/src/main/webapp/WEB-INF/glassfish-web.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
-<glassfish-web-app error-url="">
-  <context-root>/VisualizationTool</context-root>
-  <class-loader delegate="true"/>
-  <jsp-config>
-    <property name="keepgenerated" value="true">
-      <description>Keep a copy of the generated servlet class' java code.</description>
-    </property>
-  </jsp-config>
-</glassfish-web-app>
diff --git a/sources/src/main/webapp/WEB-INF/web.xml b/sources/src/main/webapp/WEB-INF/web.xml
index c416ad7..652c861 100644
--- a/sources/src/main/webapp/WEB-INF/web.xml
+++ b/sources/src/main/webapp/WEB-INF/web.xml
@@ -44,10 +44,6 @@
 	<!--
 	servlets
 	-->
-	<servlet>
-		<servlet-name>DefaultPage</servlet-name>
-		<servlet-class>cz.zcu.kiv.offscreen.servlets.DefaultPage</servlet-class>
-	</servlet>
 	<servlet>
 		<servlet-name>Register</servlet-name>
 		<servlet-class>cz.zcu.kiv.offscreen.servlets.Register</servlet-class>
@@ -66,11 +62,7 @@
 	</servlet>
 	<servlet>
 		<servlet-name>UploadFiles</servlet-name>
-		<servlet-class>cz.zcu.kiv.offscreen.servlets.actions.UploadFiles</servlet-class>
-	</servlet>
-	<servlet>
-		<servlet-name>CopyComponents</servlet-name>
-		<servlet-class>cz.zcu.kiv.offscreen.servlets.actions.CopyComponents</servlet-class>
+		<servlet-class>cz.zcu.kiv.offscreen.servlets.UploadFiles</servlet-class>
 	</servlet>
 	<servlet>
 		<servlet-name>DeleteAllComponents</servlet-name>
@@ -84,10 +76,6 @@
 		<servlet-name>DiagramEndpoint</servlet-name>
 		<servlet-class>cz.zcu.kiv.offscreen.servlets.actions.DiagramEndpoint</servlet-class>
 	</servlet>
-	<servlet>
-		<servlet-name>DownloadComponent</servlet-name>
-		<servlet-class>cz.zcu.kiv.offscreen.servlets.actions.DownloadComponent</servlet-class>
-	</servlet>
 	<servlet>
 		<servlet-name>LoadGraphData</servlet-name>
 		<servlet-class>cz.zcu.kiv.offscreen.servlets.LoadGraphData</servlet-class>
@@ -97,7 +85,7 @@
 	URL-to-servlet mappings
 	-->
 	<servlet-mapping>
-		<servlet-name>DefaultPage</servlet-name>
+		<servlet-name>UploadFiles</servlet-name>
 		<url-pattern></url-pattern>
 	</servlet-mapping>
 	<servlet-mapping>
@@ -116,14 +104,6 @@
 		<servlet-name>ShowGraph</servlet-name>
 		<url-pattern>/graph</url-pattern>
 	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>UploadFiles</servlet-name>
-		<url-pattern>/upload-files</url-pattern>
-	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>CopyComponents</servlet-name>
-		<url-pattern>/api/copy-components</url-pattern>
-	</servlet-mapping>
 	<servlet-mapping>
 		<servlet-name>DeleteAllComponents</servlet-name>
 		<url-pattern>/delete-components</url-pattern>
@@ -136,10 +116,6 @@
 		<servlet-name>DiagramEndpoint</servlet-name>
 		<url-pattern>/api/diagram</url-pattern>
 	</servlet-mapping>
-	<servlet-mapping>
-		<servlet-name>DownloadComponent</servlet-name>
-		<url-pattern>/api/download-component</url-pattern>
-	</servlet-mapping>
 	<servlet-mapping>
 		<servlet-name>LoadGraphData</servlet-name>
 		<url-pattern>/api/graph-data</url-pattern>
diff --git a/sources/src/main/webapp/js/app.js b/sources/src/main/webapp/js/app.js
index b91bc55..59d0d4d 100644
--- a/sources/src/main/webapp/js/app.js
+++ b/sources/src/main/webapp/js/app.js
@@ -62,16 +62,7 @@ function App() {
 	 * @param diagramHash Diagram hash.
 	 */
 	this.diagramLoader = function(diagramId, diagramHash) {
-		return loadGraphData.bind(this, diagramId, diagramHash, null, null);
-	};
-
-	/**
-	 * Loads graph using EFP data.
-	 * @param {boolean} withEfps Is EFPs in graph?
-	 * @param {object} efpSettings EFP settings.
-	 */
-	this.efpLoader = function(withEfps, efpSettings) {
-		return loadGraphData.bind(this, null, null, withEfps, efpSettings);
+		return loadGraphData.bind(this, diagramId, diagramHash);
 	};
 
 	/**
@@ -292,10 +283,8 @@ function App() {
 	 * Loads graph data of a diagram.
 	 * @param {string} diagramId Identifier of the diagram to be loaded.
 	 * @param {string} diagramHash Hash of the diagram to be loaded.
-	 * @param {boolean} withEfps Load diagram with extra-functional properties.
-	 * @param {object} efpSettings Settings of EFP graph.
 	 */
-	function loadGraphData(diagramId, diagramHash, withEfps, efpSettings) {
+	function loadGraphData(diagramId, diagramHash) {
 		var self = this;
 
 		self.loader.enable();
@@ -313,16 +302,6 @@ function App() {
 			loadDiagramURL += '&diagramHash=' + diagramHash;
 		}
 
-		// TODO: how to handle EFPs? see old code for details
-		if (withEfps !== null) {
-			// Build graph with EFPs
-			//GraphManager.isEfpGraph = true;
-	
-			// set EFP settings
-			//GraphManager.efpMinIntDiameter = efpSettings.minInterfaceDiameter;
-			//GraphManager.efpMaxIntDiameter = efpSettings.maxInterfaceDiameter;
-		}
-
 		// exported data of graph
 		var graphExportData = null;
 
@@ -345,7 +324,7 @@ function App() {
 
 		}, function() {
 			// go to the upload page
-			window.location.replace('./upload-files');
+			window.location.replace('./');
 		});
 	}
 
diff --git a/sources/src/main/webapp/logged_user_menu.jsp b/sources/src/main/webapp/logged_user_menu.jsp
index 2f9cd48..810b5b8 100644
--- a/sources/src/main/webapp/logged_user_menu.jsp
+++ b/sources/src/main/webapp/logged_user_menu.jsp
@@ -7,7 +7,7 @@
 	<ul>	
 		<c:forEach items="${diagramNames}" var="diagramName">
 			<li id="diagram_id_${diagramName.id}">
-				<a href="<%= getServletContext().getInitParameter("HOME_URL") %>upload-files?diagram_id=${diagramName.id}&diagram_hash=${diagramName.hash}">${diagramName.name}</a><a href="#" onclick="return deleteDiagram(${diagramName.id});"><img src="images/button_cancel.png" alt="odstranit" class="imgDelete"/></a>
+				<a href="<%= getServletContext().getInitParameter("HOME_URL") %>?diagram_id=${diagramName.id}&diagram_hash=${diagramName.hash}">${diagramName.name}</a><a href="#" onclick="return deleteDiagram(${diagramName.id});"><img src="images/button_cancel.png" alt="odstranit" class="imgDelete"/></a>
 			</li>
 		</c:forEach>
 		<li id="diagram_id_new">
@@ -21,7 +21,7 @@
 	<ul>	
 		<c:forEach items="${diagramPublic}" var="diagramPublic">
 			<li id="public_diagram_id_${diagramPublic.id}">
-				<a href="<%= getServletContext().getInitParameter("HOME_URL") %>upload-files?diagram_id=${diagramPublic.id}&diagram_hash=${diagramPublic.hash}">${diagramPublic.name}</a>
+				<a href="<%= getServletContext().getInitParameter("HOME_URL") %>?diagram_id=${diagramPublic.id}&diagram_hash=${diagramPublic.hash}">${diagramPublic.name}</a>
 			</li>
 		</c:forEach>
 	</ul>
diff --git a/sources/src/main/webapp/showGraph.jsp b/sources/src/main/webapp/showGraph.jsp
index 9068e77..343adfc 100644
--- a/sources/src/main/webapp/showGraph.jsp
+++ b/sources/src/main/webapp/showGraph.jsp
@@ -1,8 +1,4 @@
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="cz.zcu.kiv.offscreen.graph.efp.EfpGraphicSettings"%>
-<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
-<%@page import="cz.zcu.kiv.comav.loaders.osgi.service.RequiredService"%>
-<%@page import="sun.reflect.ReflectionFactory.GetReflectionFactoryAction"%>
 <%@page import="java.util.Map"%>
 <%@page import="com.google.gson.Gson"%>
 <%@page import="com.google.gson.GsonBuilder"%>
@@ -60,47 +56,27 @@
 
 	<body>
 		<%
-		//String path = request.getContextPath();
 		String getProtocol = request.getScheme();
 		String getDomain = request.getServerName();
 		String getPort = Integer.toString(request.getServerPort());
-		String getPath = getProtocol+"://"+getDomain+":"+getPort+"/";
+		String getPath = getProtocol + "://" + getDomain + ":" + getPort + "/";
 		String getURI = request.getRequestURI();
 
-		// set graphic settings for EFP graph
-		ServletContext context = this.getServletContext();
-		EfpGraphicSettings efpSettings = new EfpGraphicSettings();
-
-		efpSettings.setMinInterfaceDiameter(Integer.valueOf(context.getInitParameter("minInterfaceDiameter")));
-		efpSettings.setMaxInterfaceDiameter(Integer.valueOf(context.getInitParameter("maxInterfaceDiameter")));
-
-		// JSONize graph settings
-		GsonBuilder gsonBuilder = new GsonBuilder();
-		Gson gson = gsonBuilder.create();
-
-		String efpSettingsJson = gson.toJson(efpSettings);
-
 		// logged-in user
 		boolean logged_user = false;
-		boolean diagram_id_hash_set = false;
-		if (request.getSession().getAttribute("logged_user") == "1"){
+		if (request.getSession().getAttribute("logged_user") == "1") {
 			logged_user = true;
 		}
 
-		if (request.getParameter("diagram_id")!= null && request.getParameter("diagram_hash") != null) {
+		// saved diagram
+		boolean diagram_id_hash_set = false;
+		if (request.getParameter("diagram_id") != null && request.getParameter("diagram_hash") != null) {
 			diagram_id_hash_set = true;
 		}
 
 		String diagram_url = "";
-		boolean show_icon_save = true;
 		if (logged_user && diagram_id_hash_set) {
-			diagram_url = "?diagram_id="+ request.getParameter("diagram_id")+"&diagram_hash=" + request.getParameter("diagram_hash");
-			show_icon_save = true;
-		}
-
-		boolean is_efp_diagram = false;
-		if (request.getAttribute("efpPortalRefererUrl") != null) {
-			is_efp_diagram = true;
+			diagram_url = "?diagram_id=" + request.getParameter("diagram_id") + "&diagram_hash=" + request.getParameter("diagram_hash");
 		}
 		%>
 
@@ -110,9 +86,7 @@
 
 				<h2 class="header-title">Interactive Multimodal Graph Explorer</h2>
 
-				<% if (!is_efp_diagram) { %>
-					<jsp:include page="logged_user.jsp" />
-				<% } %>
+				<jsp:include page="logged_user.jsp" />
 
 				<nav class="navbar" id="navigation">
 					<ul>
@@ -172,11 +146,7 @@
 							<hr class="navbar-separator">
 						</li>
 						<li>
-							<% if (!is_efp_diagram) { %>
-								<a href="<%=getServletContext().getInitParameter("HOME_URL")%>upload-files<%=diagram_url%>" class="btn btn-block back-to-upload" id="view_back_to_upload" title="Back to upload"></a>
-							<% } else { %>
-								<a href="<%=request.getAttribute("efpPortalRefererUrl")%>" class="btn btn-block back-to-upload" id="view_back_to_upload" title="Back"></a>
-							<% } %>
+							<a href="<%=getServletContext().getInitParameter("HOME_URL")%><%=diagram_url%>" class="btn btn-block back-to-upload" id="view_back_to_upload" title="Back to upload"></a>
 						</li>
 						<li>
 							<hr class="navbar-separator">
@@ -186,26 +156,6 @@
 								<img src="images/layout_off.png" id="applyLayoutImg" alt="Apply layout to current graph.">
 							</button>
 						</li>
-						<%
-						if (request.getAttribute("efpPortalEfpNames") != null) {
-							final Map<String, String> efpMappings = (Map<String, String>)request.getAttribute("efpPortalEfpNames");
-							if (!efpMappings.isEmpty()) {
-						%>
-						<li><hr class="navbar-separator"></li>
-						<li>
-							<select name="EFPselector" class="EFP-selector" id="EFPselector">
-								<option value="" selected="selected" class="option_default">none</option>
-								<% for (Map.Entry<String, String> entry : efpMappings.entrySet()) { %>
-									<option value="<%=entry.getValue()%>"><%=entry.getValue()%></option>
-								<% } %>
-							</select>
-						</li>
-						<%
-							}
-						}
-						%>
-
-						<% if (show_icon_save) { %>
 						<li>
 							<hr class="navbar-separator">
 						</li>
@@ -218,15 +168,14 @@
 							<hr class="navbar-separator">
 						</li>
 						<li>
-							<a href="<%=getServletContext().getInitParameter("HOME_URL")%>graph?diagram_id=<%=request.getParameter("diagram_id")%>&diagram_hash=<%=request.getParameter("diagram_hash")%>" class="btn btn-block view-refresh-diagram" id="view_refresh_diagram" title="Refresh diagram"></a>
+							<a href="<%=getServletContext().getInitParameter("HOME_URL")%>graph<%=diagram_url%>" class="btn btn-block view-refresh-diagram" id="view_refresh_diagram" title="Refresh diagram"></a>
 						</li>
 						<li>
 							<hr class="navbar-separator">
 						</li>
 						<li>
-							<a href="<%=getServletContext().getInitParameter("HOME_URL")%>graph?diagram_id=<%=request.getParameter("diagram_id")%>&diagram_hash=<%=request.getParameter("diagram_hash")%>" class="btn btn-block view-refresh-reset-diagram" id="view_refresh_reset_diagram" onclick="reset_diagram(<%=request.getParameter("diagram_id")%>,'<%=request.getParameter("diagram_hash")%>'); return false;" title="Refresh diagram - reset position"></a>
+							<a href="<%=getServletContext().getInitParameter("HOME_URL")%>graph<%=diagram_url%>" class="btn btn-block view-refresh-reset-diagram" id="view_refresh_reset_diagram" onclick="reset_diagram(<%=request.getParameter("diagram_id")%>,'<%=request.getParameter("diagram_hash")%>'); return false;" title="Refresh diagram - reset position"></a>
 						</li>
-						<% } %>
 					</ul>
 				</nav>
 			</header>
@@ -278,12 +227,7 @@
 		app.HOME_URL = '<%=getPath%>imiger/';
 
 		$(document).ready(function() {
-			var loaderFn;
-			<% if (request.getAttribute("graph_json") != null) { %>
-				loaderFn = app.efpLoader('<%=request.getAttribute("graph_json")%>', '<%=efpSettingsJson%>');
-			<% } else { %>
-				loaderFn = app.diagramLoader('<%=request.getParameter("diagram_id")%>', '<%=request.getParameter("diagram_hash")%>');
-			<% } %>
+			var loaderFn = app.diagramLoader('<%=request.getParameter("diagram_id")%>', '<%=request.getParameter("diagram_hash")%>');
 
 			app.run(loaderFn);
 		});
diff --git a/sources/src/main/webapp/uploadFiles.jsp b/sources/src/main/webapp/uploadFiles.jsp
index bba157e..a630158 100644
--- a/sources/src/main/webapp/uploadFiles.jsp
+++ b/sources/src/main/webapp/uploadFiles.jsp
@@ -35,84 +35,16 @@
 						<p class="errorMessage">${errorMessage}</p>
 					</c:if>
 
-					<h3>Upload components:</h3>
+					<h3>Upload SPADe data:</h5>
 
-					<form name="uploadForm" action="upload-files" method="post" enctype="multipart/form-data">
+					<form name="uploadForm" method="post" enctype="multipart/form-data">
 						<div class="form-field">
-							<input type="file" name="uploads[]" class="hidden" id="fileUpload" multiple>
-
-							<button type="button">
-								<label for="fileUpload">Browse files</label>
-							</button>
-
-							<label for="fileUpload" id="fileCounter"></label>
+							<input type="file" name="file">
 						</div>
 
 						<input type="submit" value="Upload">
 					</form>
 
-					<hr class="verticalSeparator">
-
-					<% if (request.getParameter("diagram_id") != null) { %>
-						<form name="diagramForm" action="graph?diagram_id=<%= request.getParameter("diagram_id") %>&diagram_hash=<%= request.getParameter("diagram_hash") %>" method="post">
-							<input type="hidden" name="diagram_id" value="<%= request.getParameter("diagram_id") %>">
-
-							<%
-							if (request.getSession().getAttribute("logged_user_id") != null &&
-									request.getAttribute("diagram_user_id") != null && 
-									request.getAttribute("diagram_user_id").toString().compareTo(request.getSession().getAttribute("logged_user_id").toString()) == 0 ) { %>
-
-								<div class="form-field">
-									<label for="diagramName">Edit diagram name:</label><br>
-									<input type="text" name="diagram_name" id="diagramName" value="${diagram_name}">
-								</div>
-
-								<div class="form-field">
-									<label for="publicDiagram">Public diagram:</label><br>
-									<input type="checkbox" name="public_diagram" id="publicDiagram" value="1" ${diagram_public_checked}>
-								</div>
-
-							<% } else if (request.getSession().getAttribute("logged_user_id") != null) { %>
-								<div class="form-field">
-									<label for="diagramName">Edit diagram name:</label><br>
-									<input type="text" name="diagram_name" id="diagramName" value="${diagram_name}">
-								</div>
-
-								<div class="form-field">
-									<label for="copyDiagram">Copy diagram:</label><br>
-									<input type="checkbox" name="copy_diag" id="copyDiagram" value="1">
-								</div>
-							<% } %>
-
-					<% } else { %>
-						<form name="diagramForm" action="graph" method="post">
-							<% if (request.getSession().getAttribute("logged_user") == "1" ) { %>
-								<div class="form-field">
-									<label for="diagramName">Diagram name:</label><br>
-									<input type="text" name="diagram_name" id="diagramName">
-								</div>
-
-								<div class="form-field">
-									<label for="publicDiagram">Public diagram:</label><br>
-									<input type="checkbox" name="public_diagram" id="publicDiagram" value="1" ${diagram_public_checked}>
-								</div>
-							<% } %>
-					<% } %>
-
-						<!--
-						<div class="form-field">
-							<label for="framework">Choose framework:</label><br>
-							<select name="framework" id="framework">
-								<option value="osgi">OSGi</option>
-								<option value="ejb3">EJB3</option>
-								<option value="sofa2">SOFA2</option>
-							</select>
-						</div>
-						-->
-
-						<input type="submit" value="Start visualization" ${not empty componentNames ? "" : "disabled='disabled'"}>
-					</form>
-
 					<c:if test="${not empty componentNames}">
 						<hr class="verticalSeparator">
 
@@ -139,18 +71,14 @@
 							</c:forEach>
 						</ul>
 					</c:if>
+
+					<hr class="verticalSeparator">
+
+					<form name="diagramForm" action="graph" method="post">
+						<input type="submit" value="Start visualization" ${not empty componentNames ? "" : "disabled='disabled'"}>
+					</form>
 				</div>
 			</main>
 		</div>
-
-		<script>
-			var fileUploadField = document.getElementById('fileUpload');
-			var fileCounter = document.getElementById('fileCounter');
-
-			fileUploadField.addEventListener('change', function() {
-				var message = this.files.length === 1 ? '1 file selected.' : (this.files.length + ' files selected.');
-				fileCounter.innerText = message;
-			});
-		</script>
 	</body>
 </html>
