diff --git a/.gitignore b/.gitignore
index 108e0cc..a0c1c10 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,5 @@
# Maven
log/
-target/
\ No newline at end of file
+target/
+/temp/
diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
index c32394f..b901097 100644
--- a/.mvn/wrapper/MavenWrapperDownloader.java
+++ b/.mvn/wrapper/MavenWrapperDownloader.java
@@ -20,7 +20,7 @@
public class MavenWrapperDownloader {
- private static final String WRAPPER_VERSION = "0.5.5";
+ private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
index 0d5e649..2cc7d4a 100644
Binary files a/.mvn/wrapper/maven-wrapper.jar and b/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index fa87ad7..642d572 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1,2 +1,2 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
diff --git a/README.md b/README.md
index 4e01752..f932000 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,55 @@
-# InFactory-1.1 is an upgrade version from InFactory to support IndoorGML 1.1.
-The main difference of IndoorGML 1.1 from the previous one (v.1.0.3) is the inclusion of "level" property of CellSpace.
-Since "level" property is an optional and cardinatity is [0..*], no conflict takes place with IndoorGML 1.0.3.
-The remaining part is exactly identical with the previous InFactory (https://github.com/STEMLab/InFactory)
+# InFactory-1.1
+InFactory-1.1 is for creating & editing OGC IndoorGML 1.1 formatted data. This project is an upgrade version from [InFactory](https://github.com/STEMLab/InFactory) to support IndoorGML 1.1.
+
+`Note that the main difference of IndoorGML 1.1 from the previous one (v.1.0.3) is the inclusion of the "level" property of CellSpace. Since "level" property is an optional and cardinality is [0..*], no conflict occurs with IndoorGML 1.0.3.`
+
+## Getting Started
+
+### Prerequisites
+1) OS: regardless of OS
+2) Maven: over 3.5 version. You need to install Maven.
+ * This project supports the Maven wrapper. If you do not want to install Maven, follow `With Maven wrapper` section.
+3) JDK: over 11 version.
+
+### Installing and Running
+#### With installed Maven
+1) Project build `mvn clean install`
+2) Spring server execute `mvn jetty:run`
+3) We recommend using the other port number(e.g., 9797) with parameter
+`mvn jetty:run "-Djetty.port=9797"`
+
+#### With Maven wrapper
+1) Project build `./mvnw clean install`
+2) Spring server execute `./mvnw jetty:run`
+3) We recommend using the other port number(e.g., 9797) with parameter
+`./mvnw jetty:run "-Djetty.port=9797"`
+
+## Built With
+* [Maven](https://maven.apache.org/) - Dependency Management
+* [Spring Framework 5.0](https://spring.io/) - Java web framework
+
+## How to make HTTP requests
+It is explained at the [Wiki](https://github.com/STEMLab/InFactory/wiki).
+
+## Developer
+* Hyemi Jeong - IndoorGML CRUD DAO developer
+* Hyung-Gyu Ryoo - IndoorGML Restful API developer
+* **Do-Hoon Kang - InFactory Server developer and maintainer, dhkang@pnu.edu**
+* **Taehoon Kim - InFactory Server developer and maintainer, taehoon.kim@pnu.edu**
+
+## Contributing
+Please refer to each project's style guidelines and guidelines for submitting patches and additions. In general, we follow the **_"Fork & Pull"_** Git workflow.
+
+1) Fork the repo on GitHub.
+2) Clone the project to your own machine.
+3) Commit changes to your own branch.
+4) Push your work back up to your fork.
+5) Submit a Pull request so that we can review your changes.
+
+`NOTE: Be sure to merge the latest from "upstream" before making a pull request!`
+
+## License
+This project is under the MIT License - see the [LICENSE](https://github.com/STEMLab/InFactory-1.1/blob/master/LICENSE)
+
+## More Information
+More information can check at [Wiki](https://github.com/STEMLab/InFactory/wiki).
diff --git a/database/bin/pom.xml b/database/bin/pom.xml
deleted file mode 100644
index 7f27ddd..0000000
--- a/database/bin/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
- 4.0.0
-
- edu.pnu.stem.igml
- indoorgml-factory
- 0.0.1-SNAPSHOT
-
- edu.pnu.stem.igml
- database
- 0.0.1-SNAPSHOT
- database
- http://maven.apache.org
-
- UTF-8
-
-
-
- edu.pnu.stem.igml
- feature
- 0.0.1-SNAPSHOT
-
-
- org.springframework
- spring-jdbc
- ${spring.version}
-
-
- junit
- junit
- 3.8.1
- test
-
-
-
- org.orbisgis
- h2gis-ext
- 1.3.2
-
-
- org.jvnet.ogc
- gml-v_3_2_1
- 2.6.1
-
-
-
- org.slf4j
- slf4j-simple
- 1.7.25
-
-
- org.jvnet.ogc
- indoorgml-v_1_0
- ${ogc-schemas.version}
- system
- ${project.basedir}/../lib/indoorgml-v_1_0-2.6.2-SNAPSHOT.jar
-
-
- org.locationtech.jts
- jts-core
- ${jts.version}
-
-
-
diff --git a/database/bin/src/main/java/database/Connector.class b/database/bin/src/main/java/database/Connector.class
deleted file mode 100644
index 9a54ae2..0000000
Binary files a/database/bin/src/main/java/database/Connector.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/database/Connector.class b/database/bin/src/main/java/edu/pnu/stem/database/Connector.class
deleted file mode 100644
index 9bea9f8..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/database/Connector.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/database/DeleteMap.class b/database/bin/src/main/java/edu/pnu/stem/database/DeleteMap.class
deleted file mode 100644
index 31f5ec8..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/database/DeleteMap.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/database/InsertMap.class b/database/bin/src/main/java/edu/pnu/stem/database/InsertMap.class
deleted file mode 100644
index f170e9a..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/database/InsertMap.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/database/SearchMap.class b/database/bin/src/main/java/edu/pnu/stem/database/SearchMap.class
deleted file mode 100644
index 10fd84e..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/database/SearchMap.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/database/SqlUtil.class b/database/bin/src/main/java/edu/pnu/stem/database/SqlUtil.class
deleted file mode 100644
index e38b6c8..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/database/SqlUtil.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.class
deleted file mode 100644
index 2177982..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.class
deleted file mode 100644
index eedcb86..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.class
deleted file mode 100644
index 157b941..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.class
deleted file mode 100644
index a1a0072..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/IndoorFeaturesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/IndoorFeaturesDAO.class
deleted file mode 100644
index d15557b..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/IndoorFeaturesDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/MultiLayeredGraphDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/MultiLayeredGraphDAO.class
deleted file mode 100644
index 73330e8..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/MultiLayeredGraphDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/NodesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/NodesDAO.class
deleted file mode 100644
index 2130b20..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/NodesDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/PrimalSpaceFeaturesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/PrimalSpaceFeaturesDAO.class
deleted file mode 100644
index 8f04c4a..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/PrimalSpaceFeaturesDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayerDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayerDAO.class
deleted file mode 100644
index 19d39d3..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayerDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayersDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayersDAO.class
deleted file mode 100644
index 004e499..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayersDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/StateDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/StateDAO.class
deleted file mode 100644
index ab75831..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/StateDAO.class and /dev/null differ
diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/TransitionDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/TransitionDAO.class
deleted file mode 100644
index 532c096..0000000
Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/TransitionDAO.class and /dev/null differ
diff --git a/database/bin/src/test/java/edu/pnu/stem/AppTest.class b/database/bin/src/test/java/edu/pnu/stem/AppTest.class
deleted file mode 100644
index 49b6f13..0000000
Binary files a/database/bin/src/test/java/edu/pnu/stem/AppTest.class and /dev/null differ
diff --git a/database/pom.xml b/database/pom.xml
deleted file mode 100644
index 7f27ddd..0000000
--- a/database/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
- 4.0.0
-
- edu.pnu.stem.igml
- indoorgml-factory
- 0.0.1-SNAPSHOT
-
- edu.pnu.stem.igml
- database
- 0.0.1-SNAPSHOT
- database
- http://maven.apache.org
-
- UTF-8
-
-
-
- edu.pnu.stem.igml
- feature
- 0.0.1-SNAPSHOT
-
-
- org.springframework
- spring-jdbc
- ${spring.version}
-
-
- junit
- junit
- 3.8.1
- test
-
-
-
- org.orbisgis
- h2gis-ext
- 1.3.2
-
-
- org.jvnet.ogc
- gml-v_3_2_1
- 2.6.1
-
-
-
- org.slf4j
- slf4j-simple
- 1.7.25
-
-
- org.jvnet.ogc
- indoorgml-v_1_0
- ${ogc-schemas.version}
- system
- ${project.basedir}/../lib/indoorgml-v_1_0-2.6.2-SNAPSHOT.jar
-
-
- org.locationtech.jts
- jts-core
- ${jts.version}
-
-
-
diff --git a/database/src/main/java/database/Connector.java b/database/src/main/java/database/Connector.java
deleted file mode 100644
index a66dd94..0000000
--- a/database/src/main/java/database/Connector.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package database;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.sql.Blob;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.h2gis.ext.H2GISExtension;
-import org.locationtech.jts.geom.Geometry;
-
-import edu.pnu.stem.binder.Convert2Json;
-
-/**
- * Short demo of in memory spatial database.
- */
-public class Connector {
- private static void createTable(Statement st) throws SQLException {
- List tableName = new ArrayList();
- tableName.add("IndoorFeatures");
- tableName.add("PrimalSpaceFeatures");
- tableName.add("MultiLayeredGraph");
- tableName.add("CellSpace");
- tableName.add("CellSpaceBoundary");
- tableName.add("SpaceLayers");
- tableName.add("SpaceLayer");
- tableName.add("Nodes");
- tableName.add("Edges");
- tableName.add("State");
- tableName.add("Transition");
- tableName.add("InterEdges");
- tableName.add("InterLayerConnection");
- tableName.add("Geometry");
- tableName.add("Feature");
-
- st.execute("CREATE TABLE IF NOT EXISTS Documents (id CHAR(50),name CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS IndoorFeatures (id CHAR(50), name CHAR(50), description CHAR(50), primalspacefeature CHAR(50), multilayeredgraph CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS PrimalSpaceFeatures (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), cellspacemember array, cellspaceboundarymember array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS MultiLayeredGraph (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), interEdges array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS CellSpace (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), partialBoundedBy array, geom CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS CellSpaceBoundary (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), geom CHAR(50) )");
- st.execute(
- "CREATE TABLE IF NOT EXISTS SpaceLayers (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), spaceLayerMember array) ");
- st.execute(
- "CREATE TABLE IF NOT EXISTS SpaceLayer (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), nodes array, edges array)");
- st.execute("CREATE TABLE IF NOT EXISTS Nodes (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), stateMember array)");
- st.execute("CREATE TABLE IF NOT EXISTS Edges (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), transitionMember array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS State (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), geom CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS Transition (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), geom CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS InterEdges (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), interLayerConnection array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS InterLayerConnection (id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), interConnects array, connectedLayers array)");
- st.execute("CREATE TABLE IF NOT EXISTS Geometry (id CHAR(50), geom BLOB)");
- st.execute("CREATE TABLE IF NOT EXISTS Feature (id CHAR(50), type CHAR(50))");
- }
-
- public static byte[] changeGeometry2Binary(Geometry geom) throws IOException {
- byte[] result;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(geom);
- result = baos.toByteArray();
-
- return result;
- }
-
- public static void insertGeometry(Connection connection, String id, Geometry geom)
- throws IOException, SQLException {
- PreparedStatement pre = connection.prepareStatement("insert into geometry(id,geom)values(?,?)");
- byte[] serializedmember = changeGeometry2Binary(geom);
- pre.setString(1, id);
- pre.setBytes(2, serializedmember);
- pre.executeUpdate();
- }
-
-
- public static Geometry changeBinary2Geometry(Blob blob) throws SQLException, IOException, ClassNotFoundException {
- Geometry result = null;
- ByteArrayInputStream in = new ByteArrayInputStream(blob.getBytes(1, (int) blob.length()));
- ObjectInputStream is = new ObjectInputStream(in);
- result = (Geometry) is.readObject();
- return result;
- }
-
- public static Geometry searchGeometry(Connection connection, String id )
- throws SQLException, IOException, ClassNotFoundException {
- Geometry result = null;
-
- String getgeomsql = "SELECT geom FROM Geometry WHERE id = '" + id + "'";
-
- PreparedStatement pre = connection.prepareStatement(getgeomsql);
- ResultSet rs = pre.executeQuery();
- while (rs.next()) {
- Blob blob = rs.getBlob("geom");
- result = changeBinary2Geometry(blob);
- }
-
- return result;
- }
-
- public static void main(String[] args) {
- try {
- Class.forName("org.h2.Driver");
- // Open memory H2 table
- try (Connection connection = DriverManager.getConnection("jdbc:h2:mem:syntax", "sa", "sa");
- Statement st = connection.createStatement()) {
- // Import spatial functions, domains and drivers
- // If you are using a file database, you have to do only that once.
- H2GISExtension.load(connection);
- // Create a table
- // st.execute("CREATE TABLE ROADS (the_geom MULTILINESTRING, speed_limit INT)");
-
- createTable(st);
-
- st.execute("INSERT INTO Documents VALUES ('doc1', 'testdata')");
- st.execute("INSERT INTO IndoorFeatures VALUES('lf1', 'indoorfeatures', null, 'psf1', 'mlg1')");
- st.execute(
- "INSERT INTO PrimalSpaceFeatures VALUES ('psf1','primalspacefeatures', null, ('c1'),('csb1'))");
- st.execute("INSERT INTO CellSpace VALUES ('c1','myroom',null,null,('csb1'),'cg1')");
- String cg1 = "SOLID (( ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)), ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)), ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)) ))";
- Geometry cg1g = Convert2Json.wkt2Geometry("cg1", cg1);
-
- insertGeometry(connection, "cg1", cg1g);
- cg1g = searchGeometry(connection, "cg1");
-
-
-
- // st.execute(qcg1);
-
- // Add some roads
- // st.execute("INSERT INTO ROADS VALUES ('MULTILINESTRING((15 5, 20 6, 25 7))',
- // 80)");
- // st.execute("INSERT INTO ROADS VALUES ('MULTILINESTRING((20 6, 21 15, 21
- // 25))', 50)");
- // Compute the sum of roads length
- /*
- * try(ResultSet rs =
- * st.executeQuery("SELECT SUM(ST_LENGTH(the_geom)) total_length from ROADS")) {
- * if(rs.next()) {
- * System.out.println("Total length of roads: "+rs.getDouble("total_length")
- * +" m"); } }
- */
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-}
\ No newline at end of file
diff --git a/database/src/main/java/edu/pnu/stem/database/Connector.java b/database/src/main/java/edu/pnu/stem/database/Connector.java
deleted file mode 100644
index e109c7d..0000000
--- a/database/src/main/java/edu/pnu/stem/database/Connector.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package edu.pnu.stem.database;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.sql.Blob;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.h2.tools.Server;
-import org.h2gis.ext.H2GISExtension;
-import org.locationtech.jts.geom.Geometry;
-
-import edu.pnu.stem.binder.Convert2Json;
-
-/**
- * Short demo of in memory spatial database.
- */
-public class Connector {
- private static void createTable(Connection connection) throws SQLException {
- Statement st = connection.createStatement();
- /*
- List tableName = new ArrayList();
- tableName.add("IndoorFeatures");
- tableName.add("PrimalSpaceFeatures");
- tableName.add("MultiLayeredGraph");
- tableName.add("CellSpace");
- tableName.add("CellSpaceBoundary");
- tableName.add("SpaceLayers");
- tableName.add("SpaceLayer");
- tableName.add("Nodes");
- tableName.add("Edges");
- tableName.add("State");
- tableName.add("Transition");
- tableName.add("InterEdges");
- tableName.add("InterLayerConnection");
- tableName.add("Geometry");
- tableName.add("Feature");
- tableName.add("Documents");
-
- for (int i = 0; i < tableName.size(); i++) {
- String clearDB = "Drop table If Exists `" + tableName.get(i) + "`";
- System.out.println(clearDB);
- st.executeUpdate(clearDB);
- }
- * */
-
- st.execute("CREATE TABLE IF NOT EXISTS Documents (id CHAR(50),name CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS IndoorFeatures (documentId CHAR(50), id CHAR(50), name CHAR(50), description CHAR(50), primalspacefeatures CHAR(50), multilayeredgraph CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS PrimalSpaceFeatures (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), cellspacemember array, cellspaceboundarymember array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS MultiLayeredGraph (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), spaceLayers array,interEdges array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS CellSpace (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), partialBoundedBy array, geometry CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS CellSpaceBoundary (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), geometry CHAR(50) )");
- st.execute(
- "CREATE TABLE IF NOT EXISTS SpaceLayers (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), spaceLayerMember array) ");
- st.execute(
- "CREATE TABLE IF NOT EXISTS SpaceLayer (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), nodes array, edges array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS Nodes (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), stateMember array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS Edges (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), transitionMember array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS State (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), connects array, geometry CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS Transition (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), duality CHAR(50), connects array,geometry CHAR(50))");
- st.execute(
- "CREATE TABLE IF NOT EXISTS InterEdges (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), interLayerConnection array)");
- st.execute(
- "CREATE TABLE IF NOT EXISTS InterLayerConnection (documentId CHAR(50), id CHAR(50),parentId CHAR(50), name CHAR(50), description CHAR(50), interConnects array, connectedLayers array)");
- st.execute("CREATE TABLE IF NOT EXISTS Geometry (documentId CHAR(50), id CHAR(50), geom BLOB)");
- st.execute("CREATE TABLE IF NOT EXISTS Feature (documentId CHAR(50), id CHAR(50), type CHAR(50))");
- st.close();
- }
- public static Connection getConnection() throws SQLException {
- Connection result = null;
- result = DriverManager.getConnection("jdbc:h2:file:~/test;AUTO_SERVER=TRUE;","sa", "sa");
- return result;
- }
- public static Connection createConnection() throws SQLException {
- Connection connection = null;
-
- try {
-
- Class.forName("org.h2.Driver");
- connection = DriverManager.getConnection("jdbc:h2:file:~/test;AUTO_SERVER=TRUE;", "sa", "sa");
-
-
- System.out.println("Connection Established: " + connection.getMetaData().getDatabaseProductName() + "/"
- + connection.getCatalog());
- // Import spatial functions, domains and drivers
- // If you are using a file database, you have to do only that once.
- H2GISExtension.load(connection);
- // Create a table
- // st.execute("CREATE TABLE ROADS (the_geom MULTILINESTRING, speed_limit INT)");
-
- createTable(connection);
- // start a TCP server
-
- // .. use in embedded mode ..
-
- // or use it from another process:
-
-
-
-
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return connection;
- }
-
- public static void main(String[] args) throws SQLException {
- Server server;
- try {
- Class.forName("org.h2.Driver");
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- // Open memory H2 table
- try {
- Connection connection = createConnection();
- // Import spatial functions, domains and drivers
- // If you are using a file database, you have to do only that once.
- // Create a table
- // st.execute("CREATE TABLE ROADS (the_geom MULTILINESTRING, speed_limit INT)");
-
- server = Server.createTcpServer("-tcpAllowOthers", "-tcpPort", "9092").start(); // (4b)
-
- Server webServer = Server.createWebServer("-webAllowOthers", "-webPort", "8082").start(); // (4a)
- Connection connection2= getConnection();
- Statement st2 = connection2.createStatement();
- Statement st = connection.createStatement();
-
- st.execute("INSERT INTO Documents VALUES ('doc1', 'testdata')");
- st.execute("Insert into IndoorFeatures values('IFs',null,null,'PS1',null)");
- st2.execute(
- "INSERT INTO PrimalSpaceFeatures VALUES ('psf1','IFs','primalspacefeatures', null, ('c1'),('csb1'))");
- st2.execute("INSERT INTO CellSpace VALUES ('c1','psf1','myroom',null,null,('csb1'),'cg1')");
- String cg1 = "SOLID (( ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)), ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)), ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)) ))";
- Geometry cg1g = Convert2Json.wkt2Geometry("cg1", cg1);
-
- insertGeometry(connection, "cg1", cg1g);
- cg1g = searchGeometry(connection, "cg1");
-
-
-
- // st.execute(qcg1);
-
- // Add some roads
- // st.execute("INSERT INTO ROADS VALUES ('MULTILINESTRING((15 5, 20 6, 25 7))',
- // 80)");
- // st.execute("INSERT INTO ROADS VALUES ('MULTILINESTRING((20 6, 21 15, 21
- // 25))', 50)");
- // Compute the sum of roads length
- /*
- * try(ResultSet rs =
- * st.executeQuery("SELECT SUM(ST_LENGTH(the_geom)) total_length from ROADS")) {
- * if(rs.next()) {
- * System.out.println("Total length of roads: "+rs.getDouble("total_length")
- * +" m"); } }
- */
- //System.out.println("Server started and connection is open.");
- //System.out.println("URL: jdbc:h2:" + server.getURL() + "/mem:test");
-
- //System.out.println("\n");
- //System.out.println("now start the H2 Console in another process using:\n"
- // + "$ cd h2/bin; java -cp h2-1.4.185.jar org.h2.tools.Console -web -browser");
- } catch (Exception ex) {
- ex.printStackTrace();
-
- }
- }
-
- public static byte[] changeGeometry2Binary(Geometry geom) throws IOException {
- byte[] result;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(geom);
- result = baos.toByteArray();
-
- return result;
- }
-
- public static void insertGeometry(Connection connection, String id, Geometry geom)
- throws IOException, SQLException {
- PreparedStatement pre = connection.prepareStatement("insert into geometry(id,geom)values(?,?)");
- byte[] serializedmember = changeGeometry2Binary(geom);
- pre.setString(1, id);
- pre.setBytes(2, serializedmember);
- pre.executeUpdate();
- }
-
- public static Geometry changeBinary2Geometry(Blob blob) throws SQLException, IOException, ClassNotFoundException {
- Geometry result = null;
- ByteArrayInputStream in = new ByteArrayInputStream(blob.getBytes(1, (int) blob.length()));
- ObjectInputStream is = new ObjectInputStream(in);
- result = (Geometry) is.readObject();
- return result;
- }
-
- public static Geometry searchGeometry(Connection connection, String id)
- throws SQLException, IOException, ClassNotFoundException {
- Geometry result = null;
-
- String getgeomsql = "SELECT geom FROM Geometry WHERE id = '" + id + "'";
-
- PreparedStatement pre = connection.prepareStatement(getgeomsql);
- ResultSet rs = pre.executeQuery();
- while (rs.next()) {
- Blob blob = rs.getBlob("geom");
- result = changeBinary2Geometry(blob);
- }
-
- return result;
- }
-}
diff --git a/database/src/main/java/edu/pnu/stem/database/DeleteMap.java b/database/src/main/java/edu/pnu/stem/database/DeleteMap.java
deleted file mode 100644
index b7b2546..0000000
--- a/database/src/main/java/edu/pnu/stem/database/DeleteMap.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package edu.pnu.stem.database;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-
-public class DeleteMap {
- public static void dropMap(Connection connection, String docId) {
- try {
- Statement st = connection.createStatement();
-
- List tableName = new ArrayList();
- tableName.add("IndoorFeatures");
- tableName.add("PrimalSpaceFeatures");
- tableName.add("MultiLayeredGraph");
- tableName.add("CellSpace");
- tableName.add("CellSpaceBoundary");
- tableName.add("SpaceLayers");
- tableName.add("SpaceLayer");
- tableName.add("Nodes");
- tableName.add("Edges");
- tableName.add("State");
- tableName.add("Transition");
- tableName.add("InterEdges");
- tableName.add("InterLayerConnection");
- tableName.add("Geometry");
- tableName.add("Feature");
- //tableName.add("Documents");
-
- for (int i = 0; i < tableName.size(); i++) {
- //String clearDB = "Drop table If Exists `" + tableName.get(i) + "`";
- String deleteDoc = "Delete from "+tableName.get(i) + " where documentid = "+SqlUtil.change2SqlString(docId);
- //System.out.println(deleteDoc);
- st.executeUpdate(deleteDoc);
- }
- String deleteDoc = "Delete from Documents where id="+SqlUtil.change2SqlString(docId);
- st.executeUpdate(deleteDoc);
- System.out.println("Delete document which ID is :"+docId);
- st.close();
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-}
diff --git a/database/src/main/java/edu/pnu/stem/database/InsertMap.java b/database/src/main/java/edu/pnu/stem/database/InsertMap.java
deleted file mode 100644
index 7e47db6..0000000
--- a/database/src/main/java/edu/pnu/stem/database/InsertMap.java
+++ /dev/null
@@ -1,489 +0,0 @@
-package edu.pnu.stem.database;
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.locationtech.jts.geom.Geometry;
-
-import edu.pnu.stem.binder.IndoorGMLMap;
-import edu.pnu.stem.feature.core.CellSpace;
-import edu.pnu.stem.feature.core.CellSpaceBoundary;
-import edu.pnu.stem.feature.core.Edges;
-import edu.pnu.stem.feature.core.IndoorFeatures;
-import edu.pnu.stem.feature.core.InterEdges;
-import edu.pnu.stem.feature.core.MultiLayeredGraph;
-import edu.pnu.stem.feature.core.Nodes;
-import edu.pnu.stem.feature.core.PrimalSpaceFeatures;
-import edu.pnu.stem.feature.core.SpaceLayer;
-import edu.pnu.stem.feature.core.SpaceLayers;
-import edu.pnu.stem.feature.core.State;
-import edu.pnu.stem.feature.core.Transition;
-import edu.pnu.stem.util.GeometryUtil;
-
-public class InsertMap {
- public static void insert(Connection connection, IndoorGMLMap map) throws IOException, SQLException {
-
- List containerNameList = new ArrayList();
- containerNameList.add("IndoorFeatures");
- containerNameList.add("MultiLayeredGraph");
- containerNameList.add("PrimalSpaceFeatures");
- containerNameList.add("CellSpace");
- containerNameList.add("CellSpaceBoundary");
- containerNameList.add("SpaceLayers");
- containerNameList.add("SpaceLayer");
- containerNameList.add("Nodes");
- containerNameList.add("Edges");
- containerNameList.add("State");
- containerNameList.add("Transition");
- containerNameList.add("Geometry");
- //containerNameList.add("Documents");
- Statement st = connection.createStatement();
-
- st.execute(createInsertSqlDocument(map));
-
- for (String name : containerNameList) {
- ConcurrentHashMap featureContainer = map.getFeatureContainer(name);
- for (Entry elem : featureContainer.entrySet()) {
- if (name.equals("Geometry"))
- insertGeometry(connection, map.getDocId(), GeometryUtil.getMetadata((Geometry) elem.getValue(), "id"),
- (Geometry) elem.getValue());
- else {
- String sql = createInsertSql(elem.getValue());
-
- try {
-
- System.out.println(sql);
- st.executeUpdate(sql);
- } catch (SQLException e) {
- System.out.println("error at insert " + name);
- e.printStackTrace();
- }
- }
-
- }
- }
-
- insertSql4Id(connection, map.getDocId(), map.getFeatureContainer("ID"));
- connection.commit();
-
- }
-
- public static String createInsertSqlDocument(IndoorGMLMap map) {
- String sql = null;
- String id = change2SqlString(map.getDocId());
- String name = null;
-
- sql = "Insert into " + "Documents" + " values(" + id + "," + name + ")";
-
- return sql;
-
- }
-
- public static String createInsertSql(Object feature) {
- String sql = null;
- if (feature instanceof IndoorFeatures)
- sql = createInsertSql4IndoorFeatures((IndoorFeatures) feature);
- else if (feature instanceof PrimalSpaceFeatures)
- sql = createInsertSql4PrimalSpaceFeatures((PrimalSpaceFeatures) feature);
- else if (feature instanceof CellSpace)
- sql = createInsertSql4CellSpace((CellSpace) feature);
- else if (feature instanceof CellSpaceBoundary)
- sql = createInsertSql4CellSpaceBoundary((CellSpaceBoundary) feature);
- else if (feature instanceof MultiLayeredGraph)
- sql = createInsertSql4MultiLayeredGraph((MultiLayeredGraph) feature);
- else if (feature instanceof SpaceLayers)
- sql = createInsertSql4SpaceLayers((SpaceLayers) feature);
- else if (feature instanceof SpaceLayer)
- sql = createInsertSql4SpaceLayer((SpaceLayer) feature);
- else if (feature instanceof Nodes)
- sql = createInsertSql4Nodes((Nodes) feature);
- else if (feature instanceof Edges)
- sql = createInsertSql4Edges((Edges) feature);
- else if (feature instanceof State)
- sql = createInsertSql4State((State) feature);
- else if (feature instanceof Transition)
- sql = createInsertSql4Transition((Transition) feature);
-
- return sql;
- }
-
- public static void insertSql4Id(Connection connection, String docId, ConcurrentHashMap map) {
- try {
- Statement st = connection.createStatement();
- for (Entry elem : map.entrySet()) {
- String sql = "Insert into " + "Feature" + " values(" + change2SqlString(docId)+","+change2SqlString(elem.getKey()) + "," + change2SqlString((String) elem.getValue()) + ")";
-
-
- st = connection.createStatement();
- st.execute(sql);
- }
- st.close();
- }catch (SQLException e) {
- System.out.println("error at insert feature id");
- e.printStackTrace();
- }
- }
-
- public static String change2SqlString(String n) {
- if (n != null)
- n = "'" + n + "'";
- return n;
- }
-
- public static String createInsertSql4IndoorFeatures(IndoorFeatures feature) {
- String tableName = "IndoorFeatures";
-
- String id = change2SqlString(feature.getId());
- String docId = change2SqlString(feature.getDocId());
- String name = change2SqlString(feature.getName());
- String description = change2SqlString(feature.getDescription());
- String primalspacefeatures = null;
- if(feature.getPrimalSpaceFeatures() != null)
- primalspacefeatures = change2SqlString(feature.getPrimalSpaceFeatures().getId());
- String multilayeredgraph = null;
- if(feature.getMultiLayeredGraph() != null)
- multilayeredgraph = change2SqlString(feature.getMultiLayeredGraph().getId());
-
- String sql = "Insert into " + tableName + " values(" +docId+ ","+ id + ","+ name + "," + description + ","
- + primalspacefeatures + "," + multilayeredgraph + ")";
- return sql;
-
- }
-
- public static String createInsertSql4PrimalSpaceFeatures(PrimalSpaceFeatures feature) {
- String sql = null;
- String tableName = "PrimalSpaceFeatures";
-
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String docId = change2SqlString(feature.getDocId());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
- String csm = null;
- String csbm = null;
-
- if (feature.getCellSpaceMember() != null && feature.getCellSpaceMember().size() != 0) {
- csm = "(";
- for (CellSpace c : feature.getCellSpaceMember()) {
- csm += change2SqlString(c.getId());
- csm += ',';
- }
- csm = csm.substring(0, csm.length() - 1);
- csm += ")";
-
- }
-
- if (feature.getCellSpaceBoundaryMember() != null && feature.getCellSpaceBoundaryMember().size() != 0) {
- csbm = "(";
- for (CellSpaceBoundary c : feature.getCellSpaceBoundaryMember()) {
- csbm += change2SqlString(c.getId());
- csbm += ',';
- }
- csbm = csbm.substring(0, csm.length() - 1);
- csbm += ")";
-
- }
-
- sql = "Insert into " + tableName + " values(" +docId+ ","+ id + "," + parentId + "," + name + "," + description + "," + csm
- + "," + csbm + ")";
- return sql;
-
- }
-
- public static String createInsertSql4CellSpace(CellSpace feature) {
- String sql = null;
- String tableName = "CellSpace";
-
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String docId = change2SqlString(feature.getDocId());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
- String duality = null;
- if(feature.getDuality() != null)
- duality = change2SqlString(feature.getDuality().getId());
- String geom = null;
- String partialboundedby = null;
-
- if (feature.getGeometry() != null) {
- geom = change2SqlString(GeometryUtil.getMetadata(feature.getGeometry(), "id"));
- }
-
- if (feature.getPartialboundedBy() != null && feature.getPartialboundedBy().size() != 0) {
- partialboundedby = "(";
- for (CellSpaceBoundary c : feature.getPartialboundedBy()) {
- partialboundedby += change2SqlString(c.getId());
- partialboundedby += ',';
- }
- partialboundedby = partialboundedby.substring(0, partialboundedby.length() - 1);
- partialboundedby += ")";
- }
- sql = "Insert into " + tableName + " values(" +docId+ ","+ id + "," + parentId + "," + name + "," + description + ","
- + duality + "," + partialboundedby + "," + geom + ")";
- return sql;
- }
-
- public static String createInsertSql4CellSpaceBoundary(CellSpaceBoundary feature) {
- String sql = null;
- String tableName = "CellSpaceBoundary";
-
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String docId = change2SqlString(feature.getDocId());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String duality = null;
- if(feature.getDuality() != null)
- duality = change2SqlString(feature.getDuality().getId());
- String geom = null;
- if (feature.getGeometry() != null) {
- geom = change2SqlString(GeometryUtil.getMetadata(feature.getGeometry(), "id"));
- }
- sql = "Insert into " + tableName + " values("+docId+ "," + id + "," + parentId + "," + name + "," + description + ","
- + duality + "," + geom + ")";
- return sql;
- }
-
- public static String createInsertSql4MultiLayeredGraph(MultiLayeredGraph feature) {
- String sql = null;
- String tableName = "MultiLayeredGraph";
-
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String docId = change2SqlString(feature.getDocId());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String csm = null;
- String csbm = null;
-
- if (feature.getSpaceLayers() != null && feature.getSpaceLayers().size() != 0) {
- csm = "(";
- for (SpaceLayers c : feature.getSpaceLayers()) {
- csm += change2SqlString(c.getId());
- csm += ',';
- }
- csm = csm.substring(0, csm.length() - 1);
- csm += ")";
- }
-
- if (feature.getInterEdges() != null && feature.getInterEdges().size() != 0) {
- csbm = "(";
- for (InterEdges c : feature.getInterEdges()) {
- csbm += change2SqlString(c.getId());
- csbm += ',';
- }
- csbm = csbm.substring(0, csm.length() - 1);
- csbm += ")";
- }
-
- sql = "Insert into " + tableName + " values(" +docId+ "," + id + "," + parentId + "," + name + "," + description + "," + csm
- + "," + csbm + ")";
- return sql;
- }
-
- public static String createInsertSql4SpaceLayers(SpaceLayers feature) {
- String sql = null;
- String tableName = "SpaceLayers";
- String docId = change2SqlString(feature.getDocId());
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
-
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String csm = null;
-
- if (feature.getSpaceLayerMember() != null && feature.getSpaceLayerMember().size() != 0) {
- csm = "(";
- for (SpaceLayer c : feature.getSpaceLayerMember()) {
- csm += change2SqlString(c.getId());
- csm += ',';
- }
- csm = csm.substring(0, csm.length() - 1);
- csm += ")";
-
- }
-
- sql = "Insert into " + tableName + " values(" +docId+ "," + id + "," + parentId + "," + name + "," + description + "," + csm
- + ")";
- return sql;
- }
-
- public static String createInsertSql4SpaceLayer(SpaceLayer feature) {
- String sql = null;
- String tableName = "SpaceLayer";
- String docId = change2SqlString(feature.getDocId());
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String csm = null;
- String csbm = null;
-
- if (feature.getNodes() != null && feature.getNodes().size() != 0) {
- csm = "(";
- for (Nodes c : feature.getNodes()) {
- csm += change2SqlString(c.getId());
- csm += ',';
- }
- csm = csm.substring(0, csm.length() - 1);
- csm += ")";
- }
-
- if (feature.getEdges() != null && feature.getEdges().size() != 0) {
- csbm = "(";
- for (Edges c : feature.getEdges()) {
- csbm += change2SqlString(c.getId());
- csbm += ',';
- }
- csbm = csbm.substring(0, csm.length() - 1);
- csbm += ")";
-
- }
-
- sql = "Insert into " + tableName + " values("+docId+ "," + id + "," + parentId + "," + name + "," + description + "," + csm
- + "," + csbm + ")";
- return sql;
- }
-
- public static String createInsertSql4Nodes(Nodes feature) {
- String sql = null;
- String tableName = "Nodes";
- String docId = change2SqlString(feature.getDocId());
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String csm = null;
-
- if (feature.getStateMember() != null && feature.getStateMember().size() != 0) {
- csm = "(";
- for (State c : feature.getStateMember()) {
- csm += change2SqlString(c.getId());
- csm += ',';
- }
- csm = csm.substring(0, csm.length() - 1);
- csm += ")";
-
- }
-
- sql = "Insert into " + tableName + " values(" +docId+ ","+ id + "," + parentId + "," + name + "," + description + "," + csm
- + ")";
- return sql;
- }
-
- public static String createInsertSql4Edges(Edges feature) {
- String sql = null;
- String tableName = "Edges";
- String docId = change2SqlString(feature.getDocId());
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String csm = null;
-
- if (feature.getTransitionMember() != null && feature.getTransitionMember().size() != 0) {
- csm = "(";
- for (Transition c : feature.getTransitionMember()) {
- csm += change2SqlString(c.getId());
- csm += ',';
- }
- csm = csm.substring(0, csm.length() - 1);
- csm += ")";
-
- }
- sql = "Insert into " + tableName + " values("+docId+ "," + id + "," + parentId + "," + name + "," + description + "," + csm
- + ")";
- return sql;
- }
-
- public static String createInsertSql4State(State feature) {
- String sql = null;
- String tableName = "State";
- String docId = change2SqlString(feature.getDocId());
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String duality = null;
- if(feature.getDuality() != null)
- change2SqlString(feature.getDuality().getId());
-
- String geom = null;
- if (feature.getGeometry() != null)
- geom = change2SqlString(GeometryUtil.getMetadata(feature.getGeometry(), "id"));
-
- String connects = null;
- if (feature.getConnects() != null && feature.getConnects().size() != 0) {
- connects = "(";
- for (Transition c : feature.getConnects()) {
- connects += change2SqlString(c.getId());
- connects += ',';
- }
- connects = connects.substring(0, connects.length() - 1);
- connects += ")";
-
- }
- sql = "Insert into " + tableName + " values("+docId+ "," + id + "," + parentId + "," + name + "," + description + ","
- + duality + "," + connects + "," + geom + ")";
- return sql;
- }
-
- public static String createInsertSql4Transition(Transition feature) {
- String sql = null;
- String tableName = "Transition";
- String docId = change2SqlString(feature.getDocId());
- String id = change2SqlString(feature.getId());
- String name = change2SqlString(feature.getName());
- String description = change2SqlString(feature.getDescription());
- String parentId = change2SqlString(feature.getParent().getId());
-
- String duality = null;
- if(feature.getDuality() != null)
- change2SqlString(feature.getDuality().getId());
- String geom = null;
- if (feature.getGeometry() != null)
- geom = change2SqlString(GeometryUtil.getMetadata(feature.getGeometry(), "id"));
-
- String connects = null;
-
- if (feature.getConnects() != null && feature.getConnects().length != 0) {
- connects = "(";
- for (State c : feature.getConnects()) {
- connects += change2SqlString(c.getId());
- connects += ',';
- }
- connects = connects.substring(0, connects.length() - 1);
- connects += ")";
-
- }
- sql = "Insert into " + tableName + " values("+docId+ "," + id + "," + parentId + "," + name + "," + description + ","
- + duality + "," + connects + "," + geom + ")";
- return sql;
- }
-
-
-
- public static void insertGeometry(Connection connection,String docId, String id, Geometry geom)
- throws IOException, SQLException {
- PreparedStatement pre = connection.prepareStatement("insert into geometry(documentId,id,geom) values(?,?,?)");
- byte[] serializedmember = SqlUtil.changeGeometry2Binary(geom);
- pre.setString(1, docId);
- pre.setString(2, id);
- pre.setBytes(3, serializedmember);
- pre.executeUpdate();
- }
-}
diff --git a/database/src/main/java/edu/pnu/stem/database/SearchMap.java b/database/src/main/java/edu/pnu/stem/database/SearchMap.java
deleted file mode 100644
index f5cdfd3..0000000
--- a/database/src/main/java/edu/pnu/stem/database/SearchMap.java
+++ /dev/null
@@ -1,646 +0,0 @@
-package edu.pnu.stem.database;
-
-import java.io.IOException;
-import java.sql.Blob;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.locationtech.jts.geom.Geometry;
-
-import edu.pnu.stem.binder.IndoorGMLMap;
-import edu.pnu.stem.feature.core.CellSpace;
-import edu.pnu.stem.feature.core.CellSpaceBoundary;
-import edu.pnu.stem.feature.core.Edges;
-import edu.pnu.stem.feature.core.IndoorFeatures;
-import edu.pnu.stem.feature.core.InterEdges;
-import edu.pnu.stem.feature.core.InterLayerConnection;
-import edu.pnu.stem.feature.core.MultiLayeredGraph;
-import edu.pnu.stem.feature.core.Nodes;
-import edu.pnu.stem.feature.core.PrimalSpaceFeatures;
-import edu.pnu.stem.feature.core.SpaceLayer;
-import edu.pnu.stem.feature.core.SpaceLayers;
-import edu.pnu.stem.feature.core.State;
-import edu.pnu.stem.feature.core.Transition;
-
-public class SearchMap {
-
- public static IndoorGMLMap search(Connection connection, String docId) throws ClassNotFoundException, IOException {
- IndoorGMLMap result = new IndoorGMLMap();
- result.setDocId(docId);
- try {
- Statement st = connection.createStatement();
- ResultSet rs = st.executeQuery("Select * from Feature");
- while (rs.next()) {
- String id = rs.getString("id");
- String type = rs.getString("type");
- if (type.equals("IndoorFeatures")) {
- result.setFeature(id, "IndoorFeatures", searchIndoorFeatures(connection, result, id));
- } else if (type.equals("MultiLayeredGraph")) {
- result.setFeature(id, "MultiLayeredGraph", searchMultiLayeredGraph(connection, result, id));
- } else if (type.equals("PrimalSpaceFeatures")) {
- result.setFeature(id, "PrimalSpaceFeatures", searchPrimalSpaceFeatures(connection, result, id));
- } else if (type.equals("CellSpace")) {
- result.setFeature(id, "CellSpace", searchCellSpace(connection, result, id));
- } else if (type.equals("CellSpaceBoundary")) {
- result.setFeature(id, "CellSpaceBoundary", searchCellSpaceBoundary(connection, result, id));
- } else if (type.equals("SpaceLayers")) {
- result.setFeature(id, "SpaceLayers", searchSpaceLayers(connection, result, id));
- } else if (type.equals("SpaceLayer")) {
- result.setFeature(id, "SpaceLayer", searchSpaceLayer(connection, result, id));
- } else if (type.equals("Nodes")) {
- result.setFeature(id, "Nodes", searchNodes(connection, result, id));
- } else if (type.equals("Edges")) {
- result.setFeature(id, "Edges", searchEdges(connection, result, id));
- } else if (type.equals("State")) {
- result.setFeature(id, "State", searchState(connection, result, id));
- } else if (type.equals("Transition")) {
- result.setFeature(id, "Transition", searchTransition(connection, result, id));
- } else if (type.equals("InterEdges")) {
- result.setFeature(id, "InterEdges", searchInterEdges(connection, result, id));
- } else if (type.equals("InterLayerConnection")) {
- result.setFeature(id, "InterLayerConnection",
- searchInterLayerConnection(connection, result, id));
- } else if (type.equals("Geometry")) {
- result.setFeature4Geometry(id, searchGeometry(connection, result, id));
- }
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- result.setDocId(docId);
- return result;
- }
-
- private static Geometry searchGeometry(Connection connection, IndoorGMLMap result, String id)
- throws ClassNotFoundException, IOException {
- Geometry feature = null;
-
- String getgeomsql = "SELECT geom FROM Geometry WHERE id = '" + id + "'" + " AND documentid = " + SqlUtil.change2SqlString(result.getDocId());
-
- PreparedStatement pre;
- try {
- pre = connection.prepareStatement(getgeomsql);
- ResultSet rs = pre.executeQuery();
- while (rs.next()) {
- Blob blob = rs.getBlob("geom");
- feature = SqlUtil.changeBinary2Geometry(blob);
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
-
- }
-
- public static IndoorFeatures searchIndoorFeatures(Connection connection, IndoorGMLMap map, String id) {
- IndoorFeatures feature = new IndoorFeatures(map, id);
- String sql = "SELECT * from IndoorFeatures where id =" + SqlUtil.change2SqlString(id) + " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String primalSpaceFeatures = rs.getString("primalspacefeatures");
- String multiLayeredGraph = rs.getString("multiLayeredGraph");
-
- feature.setName(name);
- feature.setDescription(description);
- if (primalSpaceFeatures != null)
- feature.setPrimalSpaceFeatures(new PrimalSpaceFeatures(map, primalSpaceFeatures));
- if (multiLayeredGraph != null)
- feature.setMultiLayeredGraph(new MultiLayeredGraph(map, multiLayeredGraph));
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static PrimalSpaceFeatures searchPrimalSpaceFeatures(Connection connection, IndoorGMLMap map, String id) {
- PrimalSpaceFeatures feature = new PrimalSpaceFeatures(map, id);
- String sql = "SELECT * from PrimalSpaceFeatures where id =" + SqlUtil.change2SqlString(id) + " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String parentId = rs.getString("parentId");
- String name = rs.getString("name");
- String description = rs.getString("description");
- if(rs.getArray("cellspacemember")!=null) {
- List csm = SqlUtil.getArray(rs.getArray("cellspacemember"));
- List csml = new ArrayList();
- for (String c : csm) {
- csml.add(new CellSpace(map, c));
- }
-
- feature.setCellSpaceMember(csml);
- }
-
- if(rs.getArray("cellspaceboundarymember")!=null) {
- List csbm = SqlUtil.getArray(rs.getArray("cellspaceboundarymember"));
- List csbml = new ArrayList();
-
- for (String c : csbm) {
- csbml.add(new CellSpaceBoundary(map, c));
- }
-
- feature.setCellSpaceBoundaryMember(csbml);
- }
-
- feature.setName(name);
- feature.setDescription(description);
- feature.setParent(new IndoorFeatures(map, parentId));
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static CellSpace searchCellSpace(Connection connection, IndoorGMLMap map, String id) throws ClassNotFoundException, IOException {
- CellSpace feature = new CellSpace(map, id);
- String sql = "SELECT * from CellSpace where id =" + SqlUtil.change2SqlString(id)+ " AND " + " documentId = " + SqlUtil.change2SqlString(map.getDocId());
- // String sql = "SELECT * from CellSpace";
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
- String duality = rs.getString("duality");
- String geom = rs.getString("geometry");
-
- if(rs.getArray("partialboundedby") != null) {
- List pb = SqlUtil.getArray(rs.getArray("partialboundedby"));
- List partialBoundedBy = new ArrayList();
- for (String c : pb) {
- partialBoundedBy.add(new CellSpaceBoundary(map, c));
- }
- feature.setPartialboundedBy(partialBoundedBy);
- }
-
- if(geom != null) {
- Geometry g = searchGeometry(connection,map,geom);
- feature.setGeometry(g);
- }
-
- feature.setName(name);
- feature.setDescription(description);
- feature.setParent(new PrimalSpaceFeatures(map, parentId));
-
- if (duality != null) {
- feature.setDuality(new State(map, duality));
- }
-
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static CellSpaceBoundary searchCellSpaceBoundary(Connection connection, IndoorGMLMap map, String id) throws ClassNotFoundException, IOException {
- CellSpaceBoundary feature = new CellSpaceBoundary(map, id);
- String sql = "SELECT * from CellSpaceBoundary where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
- String duality = rs.getString("duality");
- String primalSpaceFeatures = rs.getString("primalspacefeatures");
- String multiLayeredGraph = rs.getString("multiLayeredGraph");
- String geom = rs.getString("geometry");
-
- if (duality != null)
- feature.setDuality(new Transition(map, duality));
-
- if(geom != null) {
- Geometry g = searchGeometry(connection,map,geom);
- feature.setGeometry(g);
- }
- feature.setName(name);
- feature.setDescription(description);
- feature.setParent(new PrimalSpaceFeatures(map, parentId));
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static MultiLayeredGraph searchMultiLayeredGraph(Connection connection, IndoorGMLMap map, String id) {
- MultiLayeredGraph feature = new MultiLayeredGraph(map, id);
- String sql = "SELECT * from MultiLayeredGraph where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
-
- if (rs.getArray("InterEdges") != null) {
- List ie = SqlUtil.getArray(rs.getArray("InterEdges"));
- List iel = new ArrayList();
- for (String i : ie) {
- iel.add(new InterEdges(map, i));
- }
- feature.setInterEdges(iel);
- }
-
- if (rs.getArray("SpaceLayers") != null) {
- List sls = SqlUtil.getArray(rs.getArray("SpaceLayers"));
- List slsl = new ArrayList();
-
- for (String s : sls) {
- slsl.add(new SpaceLayers(map, s));
- }
- feature.setSpaceLayers(slsl);
- }
-
- feature.setName(name);
- feature.setParent(new IndoorFeatures(map, parentId));
- feature.setDescription(description);
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static SpaceLayers searchSpaceLayers(Connection connection, IndoorGMLMap map, String id) {
- SpaceLayers feature = new SpaceLayers(map, id);
- String sql = "SELECT * from SpaceLayers where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
-
- feature.setName(name);
- feature.setDescription(description);
-
- if (rs.getArray("spacelayermember") != null) {
- List sl = SqlUtil.getArray(rs.getArray("spacelayermember"));
- List spacelayer = new ArrayList();
- for (String s : sl) {
- spacelayer.add(new SpaceLayer(map, s));
- }
- feature.setSpaceLayerMember(spacelayer);
-
- }
- feature.setParent(new MultiLayeredGraph(map, parentId));
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static SpaceLayer searchSpaceLayer(Connection connection, IndoorGMLMap map, String id) {
- SpaceLayer feature = new SpaceLayer(map, id);
- String sql = "SELECT * from SpaceLayer where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
-
- if (rs.getArray("nodes") != null) {
- List n = SqlUtil.getArray(rs.getArray("nodes"));
- List nodes = new ArrayList();
-
- for (String s : n) {
- nodes.add(new Nodes(map, s));
- }
- feature.setNodes(nodes);
-
- }
-
- if (rs.getArray("edges") != null) {
- List e = SqlUtil.getArray(rs.getArray("edges"));
- List edges = new ArrayList();
-
- for (String s : e) {
- edges.add(new Edges(map, s));
- }
- feature.setEdges(edges);
-
- }
-
- feature.setName(name);
- feature.setDescription(description);
- feature.setParent(new SpaceLayers(map, parentId));
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static Nodes searchNodes(Connection connection, IndoorGMLMap map, String id) {
- Nodes feature = new Nodes(map, id);
- String sql = "SELECT * from IndoorFeatures where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
-
- feature.setName(name);
- feature.setDescription(description);
-
- if (rs.getArray("statemember") != null) {
- List sm = SqlUtil.getArray(rs.getArray("statemember"));
- List statemember = new ArrayList();
-
- for (String s : sm) {
- statemember.add(new State(map, s));
- }
-
- feature.setStateMember(statemember);
-
- }
- feature.setParent(new SpaceLayer(map, parentId));
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static Edges searchEdges(Connection connection, IndoorGMLMap map, String id) {
- Edges feature = new Edges(map, id);
- String sql = "SELECT * from Edges where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
-
- if (rs.getArray("transitionMember") != null) {
- List sm = SqlUtil.getArray(rs.getArray("transitionmember"));
- List statemember = new ArrayList();
-
- for (String s : sm) {
- statemember.add(new Transition(map, s));
- }
-
- feature.setTransitionMembers(statemember);
-
- }
- feature.setParent(new SpaceLayer(map, parentId));
-
- feature.setName(name);
- feature.setDescription(description);
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static State searchState(Connection connection, IndoorGMLMap map, String id) throws ClassNotFoundException, IOException {
- State feature = new State(map, id);
- String sql = "SELECT * from State where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
- String duality = rs.getString("duality");
- String geom = rs.getString("geometry");
-
- if (rs.getArray("connects") != null) {
- List c = SqlUtil.getArray(rs.getArray("connects"));
-
- List t = new ArrayList();
-
- for (String i : c) {
- t.add(new Transition(map, id));
- }
-
- feature.setConnects(t);
- }
- if(geom != null) {
-
- Geometry g = searchGeometry(connection,map,geom);
- feature.setGeometry(g);
- }
-
- feature.setName(name);
- feature.setDescription(description);
- if (duality != null) {
- feature.setDuality(new CellSpace(map, duality));
- }
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static Transition searchTransition(Connection connection, IndoorGMLMap map, String id) throws ClassNotFoundException, IOException {
- Transition feature = new Transition(map, id);
- String sql = "SELECT * from Transition where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
- String geom = rs.getString("geometry");
- String duality = rs.getString("duality");
-
- if (rs.getArray("connects") != null) {
- List c = SqlUtil.getArray(rs.getArray("connects"));
-
- State[] t = new State[2];
-
- t[0] = new State(map, c.get(0));
- t[1] = new State(map, c.get(1));
-
- feature.setConnects(t);
- }
-
- if(geom != null) {
- Geometry g = searchGeometry(connection,map,geom);
- feature.setGeometry(g);
- }
-
- feature.setName(name);
- feature.setDescription(description);
-
- if (duality != null) {
- feature.setDuality(new CellSpaceBoundary(map, duality));
- }
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static InterEdges searchInterEdges(Connection connection, IndoorGMLMap map, String id) {
- InterEdges feature = new InterEdges(map, id);
- String sql = "SELECT * from InterEdges where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
-
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
-
- feature.setName(name);
- feature.setDescription(description);
- feature.setParent(new MultiLayeredGraph(map, parentId));
-
- if (rs.getArray("InterLayerConnectionMember") != null) {
- List c = SqlUtil.getArray(rs.getArray("connects"));
-
- List t = new ArrayList();
-
- for (String i : c) {
- t.add(new InterLayerConnection(map, id));
- }
-
- feature.setInterLayerConnectionMember(t);
- }
-
- }
-
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
- public static InterLayerConnection searchInterLayerConnection(Connection connection, IndoorGMLMap map, String id) {
- InterLayerConnection feature = new InterLayerConnection(map, id);
- String sql = "SELECT * from InterLayerConnection where id =" + SqlUtil.change2SqlString(id)+ " AND " + "documentId = " + SqlUtil.change2SqlString(map.getDocId());;
- Statement st;
- try {
- st = connection.createStatement();
- ResultSet rs = st.executeQuery(sql);
-
- if (rs.next()) {
- String name = rs.getString("name");
- String description = rs.getString("description");
- String parentId = rs.getString("parentId");
-
- if (rs.getArray("connecteLayers") != null) {
- List c = SqlUtil.getArray(rs.getArray("connectedLayers"));
-
- SpaceLayer[] t = new SpaceLayer[2];
-
- t[0] = new SpaceLayer(map, c.get(0));
- t[1] = new SpaceLayer(map, c.get(1));
-
- feature.setConnectedLayers(t);
- }
-
- if (rs.getArray("interConnects") != null) {
- List c = SqlUtil.getArray(rs.getArray("interConnects"));
-
- State[] t = new State[2];
-
- t[0] = new State(map, c.get(0));
- t[1] = new State(map, c.get(1));
-
- feature.setInterConnects(t);
- }
- feature.setName(name);
- feature.setDescription(description);
-
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return feature;
- }
-
-}
diff --git a/database/src/main/java/edu/pnu/stem/database/SqlUtil.java b/database/src/main/java/edu/pnu/stem/database/SqlUtil.java
deleted file mode 100644
index dddbbac..0000000
--- a/database/src/main/java/edu/pnu/stem/database/SqlUtil.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package edu.pnu.stem.database;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.locationtech.jts.geom.Geometry;
-
-
-public class SqlUtil {
- public static String change2SqlString(String n) {
- if (n != null)
- n = "'" + n + "'";
- return n;
- }
-
- public static List getArray(Array a) throws SQLException {
- List result = new ArrayList();
- Object[] tempArr = (Object[]) a.getArray();
- for (Object o : tempArr) {
- result.add((String) o);
- }
- return result;
- }
-
- public static Geometry changeBinary2Geometry(Blob blob) throws SQLException, IOException, ClassNotFoundException {
- Geometry result = null;
- ByteArrayInputStream in = new ByteArrayInputStream(blob.getBytes(1, (int) blob.length()));
- ObjectInputStream is = new ObjectInputStream(in);
- result = (Geometry) is.readObject();
- in.close();
- is.close();
- return result;
- }
-
- public static byte[] changeGeometry2Binary(Geometry geom) throws IOException {
- byte[] result;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(geom);
- result = baos.toByteArray();
-
- baos.close();
- oos.close();
-
- return result;
- }
-}
diff --git a/database/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.java b/database/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.java
deleted file mode 100644
index fdc5ddc..0000000
--- a/database/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package edu.pnu.stem.db.dao;
-
-public class CellSpaceBoundaryDAO {
-
-}
diff --git a/database/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.java b/database/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.java
deleted file mode 100644
index 908cb67..0000000
--- a/database/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package edu.pnu.stem.db.dao;
-
-public class CellSpaceDAO {
-
-}
diff --git a/database/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.java b/database/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.java
deleted file mode 100644
index 4ebad07..0000000
--- a/database/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package edu.pnu.stem.db.dao;
-
-public class EdgesDAO {
-
-}
diff --git a/database/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.java b/database/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.java
deleted file mode 100644
index 8a83293..0000000
--- a/database/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package edu.pnu.stem.db.dao;
-
-import java.util.List;
-
-import edu.pnu.stem.binder.IndoorGMLMap;
-
-public interface FeatureDAO {
- public Object searchById(IndoorGMLMap map, String id);
- public List