commit 9b0966a76ac2d5adfb100dad6101f34941cd45fa
Author: Tomáš Šimandl <tomas.simandl@gmail.com>
Date:   Thu Aug 30 19:16:49 2018 +0200

    Backend refactor

diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/AttributeDataType.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/AttributeDataType.java
new file mode 100644
index 0000000..b4a6f33
--- /dev/null
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/AttributeDataType.java
@@ -0,0 +1,28 @@
+package cz.zcu.kiv.offscreen.api;
+
+public enum AttributeDataType {
+    NUMBER {
+        @Override
+        public String toString() {
+            return "number";
+        }
+    },
+    DATE {
+        @Override
+        public String toString() {
+            return "date";
+        }
+    },
+    ENUM {
+        @Override
+        public String toString() {
+            return "enum";
+        }
+    },
+    STRING {
+        @Override
+        public String toString() {
+            return "string";
+        }
+    }
+}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/AttributeType.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/AttributeType.java
new file mode 100644
index 0000000..5261859
--- /dev/null
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/AttributeType.java
@@ -0,0 +1,32 @@
+package cz.zcu.kiv.offscreen.api;
+
+/**
+ * Class represents one attribute type which is used in input JSON file and in output JSON file (file between frontend
+ * and backend).
+ */
+public class AttributeType {
+    /** name of attribute */
+    public String name;
+    /** data type of attribute */
+    public AttributeDataType dataType;
+    /** additional info */
+    public String text;
+
+    public AttributeType(String name, AttributeDataType dataType, String text) {
+        this.name = name;
+        this.dataType = dataType;
+        this.text = text;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public AttributeDataType getDataType() {
+        return dataType;
+    }
+
+    public String getText() {
+        return text;
+    }
+}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/EdgeArchetype.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/EdgeArchetype.java
new file mode 100644
index 0000000..74eff60
--- /dev/null
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/EdgeArchetype.java
@@ -0,0 +1,19 @@
+package cz.zcu.kiv.offscreen.api;
+
+public class EdgeArchetype {
+    public String name;
+    public String text;
+
+    EdgeArchetype(String name, String text) {
+        this.name = name;
+        this.text = text;
+    }
+
+    public String getName() {
+        return  name;
+    }
+
+    public String getText() {
+        return text;
+    }
+}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/Graph.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/Graph.java
index 5148667..c6f42ba 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/api/Graph.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/Graph.java
@@ -1,7 +1,5 @@
 package cz.zcu.kiv.offscreen.api;
 
-import cz.zcu.kiv.offscreen.graph.*;
-
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/VertexArchetype.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/VertexArchetype.java
new file mode 100644
index 0000000..207320b
--- /dev/null
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/VertexArchetype.java
@@ -0,0 +1,29 @@
+package cz.zcu.kiv.offscreen.api;
+
+public class VertexArchetype {
+    public String name;
+    public String text;
+    public String icon;
+
+    VertexArchetype(String name, String text, String icon) {
+        this.name = name;
+        this.text = text;
+        this.icon = icon;
+    }
+
+    VertexArchetype(String name, String text) {
+        this(name, text, "");
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public String getIcon() {
+        return icon;
+    }
+}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/AttributeType.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/AttributeType.java
deleted file mode 100644
index 1240c67..0000000
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/AttributeType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package cz.zcu.kiv.offscreen.graph;
-
-/**
- * Class represents one attribute type which is used in input JSON file and in output JSON file (file between frontend
- * and backend).
- */
-public class AttributeType {
-    /** name of attribute */
-    public String name;
-    /** data type of attribute */
-    public GraphManager.AttributeDataType dataType;
-    /** additional info */
-    public String text;
-
-    public AttributeType(String name, GraphManager.AttributeDataType dataType, String text) {
-        this.name = name;
-        this.dataType = dataType;
-        this.text = text;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public GraphManager.AttributeDataType getDataType() {
-        return dataType;
-    }
-
-    public String getText() {
-        return text;
-    }
-}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/EdgeArchetype.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/EdgeArchetype.java
deleted file mode 100644
index 71b1995..0000000
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/EdgeArchetype.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package cz.zcu.kiv.offscreen.graph;
-
-public class EdgeArchetype {
-    public String name;
-    public String text;
-
-    EdgeArchetype(String name, String text) {
-        this.name = name;
-        this.text = text;
-    }
-
-    public String getName() {
-        return  name;
-    }
-
-    public String getText() {
-        return text;
-    }
-}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java
index 0d66d34..f5aef98 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java
@@ -1,7 +1,6 @@
 package cz.zcu.kiv.offscreen.graph;
 
-import cz.zcu.kiv.offscreen.api.Edge;
-import cz.zcu.kiv.offscreen.api.Vertex;
+import cz.zcu.kiv.offscreen.api.*;
 import org.apache.log4j.Logger;
 
 import java.util.*;
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java
index 843062f..49ae707 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java
@@ -1,9 +1,6 @@
 package cz.zcu.kiv.offscreen.graph;
 
-import cz.zcu.kiv.offscreen.api.Edge;
-import cz.zcu.kiv.offscreen.api.Group;
-import cz.zcu.kiv.offscreen.api.SubedgeInfo;
-import cz.zcu.kiv.offscreen.api.Vertex;
+import cz.zcu.kiv.offscreen.api.*;
 import cz.zcu.kiv.offscreen.graph.filter.*;
 import cz.zcu.kiv.offscreen.graph.loader.JSONConfigLoader;
 
@@ -11,33 +8,6 @@ import java.util.*;
 
 public class GraphManager {
 
-    public enum AttributeDataType {
-        NUMBER {
-            @Override
-            public String toString() {
-                return "number";
-            }
-        },
-        DATE {
-            @Override
-            public String toString() {
-                return "date";
-            }
-        },
-        ENUM {
-            @Override
-            public String toString() {
-                return "enum";
-            }
-        },
-        STRING {
-            @Override
-            public String toString() {
-                return "string";
-            }
-        }
-    }
-
     public List<VertexArchetype> vertexArchetypes = new ArrayList<>();
     public List<EdgeArchetype> edgeArchetypes = new ArrayList<>();
     public List<AttributeType> attributeTypes = new ArrayList<>();
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/VertexArchetype.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/VertexArchetype.java
deleted file mode 100644
index a0cf937..0000000
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/VertexArchetype.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package cz.zcu.kiv.offscreen.graph;
-
-public class VertexArchetype {
-    public String name;
-    public String text;
-    public String icon;
-
-    VertexArchetype(String name, String text, String icon) {
-        this.name = name;
-        this.text = text;
-        this.icon = icon;
-    }
-
-    VertexArchetype(String name, String text) {
-        this(name, text, "");
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getText() {
-        return text;
-    }
-
-    public String getIcon() {
-        return icon;
-    }
-}
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/GraphJSONDataLoader.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/GraphJSONDataLoader.java
index 6315870..a8b86cf 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/GraphJSONDataLoader.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/GraphJSONDataLoader.java
@@ -2,6 +2,7 @@ package cz.zcu.kiv.offscreen.graph.loader;
 
 import com.google.common.base.Strings;
 import cz.zcu.kiv.offscreen.graph.Attribute;
+import cz.zcu.kiv.offscreen.api.AttributeDataType;
 import cz.zcu.kiv.offscreen.graph.EdgeArchetypeInfo;
 import cz.zcu.kiv.offscreen.graph.GraphManager;
 import net.sf.json.JSONArray;
@@ -91,12 +92,12 @@ public class GraphJSONDataLoader {
         for (int i = 0; i < attributeTypes.size(); i++) {
             JSONObject attributeType = attributeTypes.getJSONObject(i);
             String dataTypeString = attributeType.getString("dataType");
-            GraphManager.AttributeDataType dataType;
+            AttributeDataType dataType;
             switch (dataTypeString) {
-                case "number": dataType = GraphManager.AttributeDataType.NUMBER; break;
-                case "date": dataType = GraphManager.AttributeDataType.DATE; break;
-                case "enum": dataType = GraphManager.AttributeDataType.ENUM; break;
-                default: dataType = GraphManager.AttributeDataType.STRING; break;
+                case "number": dataType = AttributeDataType.NUMBER; break;
+                case "date": dataType = AttributeDataType.DATE; break;
+                case "enum": dataType = AttributeDataType.ENUM; break;
+                default: dataType = AttributeDataType.STRING; break;
             }
             graphManager.addAttributeType(attributeType.getString("name"), dataType, attributeType.getString("text"));
         }
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/JSONConfigLoader.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/JSONConfigLoader.java
index cfb0e28..22902a1 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/JSONConfigLoader.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/JSONConfigLoader.java
@@ -1,6 +1,7 @@
 package cz.zcu.kiv.offscreen.graph.loader;
 
-import cz.zcu.kiv.offscreen.graph.AttributeType;
+import cz.zcu.kiv.offscreen.api.AttributeDataType;
+import cz.zcu.kiv.offscreen.api.AttributeType;
 import cz.zcu.kiv.offscreen.graph.EdgeArchetypeInfo;
 import cz.zcu.kiv.offscreen.graph.GraphManager;
 import cz.zcu.kiv.offscreen.graph.filter.*;
@@ -222,7 +223,7 @@ public class JSONConfigLoader {
         for (Object[] vertexAttributeFilterString : vertexAttributeFilterStrings) {
             int archetypeIndex = graphManager.getVertexArchetypeIndex(vertexAttributeFilterString[0].toString());
             int attributeIndex = graphManager.getAttributeIndex(vertexAttributeFilterString[1].toString());
-            GraphManager.AttributeDataType type = graphManager.attributeTypes.get(attributeIndex).dataType;
+            AttributeDataType type = graphManager.attributeTypes.get(attributeIndex).dataType;
             switch (type) {
                 case NUMBER:
                     NumberAttributeFilter nf = (NumberAttributeFilter) vertexAttributeFilterString[2];
@@ -253,7 +254,7 @@ public class JSONConfigLoader {
         for (Object[] edgeAttributeFilterString : edgeAttributeFilterStrings) {
             int archetypeIndex = graphManager.getEdgeArchetypeIndex(edgeAttributeFilterString[0].toString());
             int attributeIndex = graphManager.getAttributeIndex(edgeAttributeFilterString[1].toString());
-            GraphManager.AttributeDataType type = graphManager.attributeTypes.get(attributeIndex).dataType;
+            AttributeDataType type = graphManager.attributeTypes.get(attributeIndex).dataType;
             switch (type) {
                 case NUMBER:
                     NumberAttributeFilter nf = (NumberAttributeFilter) edgeAttributeFilterString[2];
