From fc628686d2b0b6b5b7e24bd5a7d895dfcd6b7f69 Mon Sep 17 00:00:00 2001 From: Robert-Ciubotaru <100339334+Robert-Ciubotaru@users.noreply.github.com> Date: Sun, 4 Jun 2023 21:38:08 +0300 Subject: [PATCH] Server done --- .../orders/hotejkzqxc_order.txt | 22 + .../orders/olhoftbdos_order.txt | 5 + .../orders/yqhbgirrtp_order.txt | 12 + Server Delivery Planner/ordersorder_1 | 4 + Server Delivery Planner/pom.xml | 28 + .../routes/hotejkzqxc_route.txt | 47 ++ .../routes/yqhbgirrtp_route.txt | 28 + Server Delivery Planner/routesroute_1 | 28 + .../main/java/com/andreicerbu/Algorithm.java | 190 +++++ .../java/com/andreicerbu/ClientThread.java | 67 ++ .../main/java/com/andreicerbu/Database.java | 650 ++++++++++++++++++ .../com/andreicerbu/InitializeDatabase.java | 98 +++ .../src/main/java/com/andreicerbu/Main.java | 14 + .../src/main/java/com/andreicerbu/Server.java | 46 ++ .../java/com/andreicerbu/SocketInput.java | 135 ++++ .../FieldAlreadyExistsException.java | 7 + .../FieldToUpdateNotExistingException.java | 7 + .../InvalidCredentialsException.java | 7 + .../exceptions/NotExistingUserException.java | 7 + .../exceptions/ProcessDoneException.java | 7 + .../ProductUnavailableAnymoreException.java | 7 + .../andreicerbu/interfaces/JSONMethods.java | 11 + .../java/com/andreicerbu/items/AdminJson.java | 47 ++ .../java/com/andreicerbu/items/BaseItem.java | 144 ++++ .../andreicerbu/items/DatabaseClientJson.java | 140 ++++ .../com/andreicerbu/items/DatabaseJson.java | 218 ++++++ .../java/com/andreicerbu/items/Order.java | 51 ++ .../andreicerbu/items/ProductForOrder.java | 36 + .../items/database/TableDeposit.java | 12 + .../items/database/TableOrder.java | 10 + .../items/database/TableProdInDepo.java | 13 + .../items/database/TableProduct.java | 10 + .../items/database/TableRoute.java | 11 + .../andreicerbu/items/database/TableUser.java | 15 + .../items/database/TableUserOrder.java | 11 + .../java/com/andreicerbu/json/JsonFields.java | 52 ++ .../src/main/java/com/andreicerbu/test.java | 21 + .../resources/META-INF/maven/archetype.xml | 9 + .../resources/archetype-resources/pom.xml | 15 + .../src/main/java/App.java | 13 + .../src/test/java/AppTest.java | 38 + .../classes/META-INF/maven/archetype.xml | 9 + .../classes/archetype-resources/pom.xml | 15 + .../src/main/java/App.java | 13 + .../src/test/java/AppTest.java | 38 + .../classes/com/andreicerbu/Algorithm.class | Bin 0 -> 7178 bytes .../classes/com/andreicerbu/Algorithm�1.class | Bin 0 -> 1414 bytes .../com/andreicerbu/ClientThread.class | Bin 0 -> 2637 bytes .../classes/com/andreicerbu/Database.class | Bin 0 -> 20426 bytes .../com/andreicerbu/InitializeDatabase.class | Bin 0 -> 4791 bytes .../target/classes/com/andreicerbu/Main.class | Bin 0 -> 805 bytes .../classes/com/andreicerbu/Server.class | Bin 0 -> 3030 bytes .../classes/com/andreicerbu/SocketInput.class | Bin 0 -> 5443 bytes .../FieldAlreadyExistsException.class | Bin 0 -> 427 bytes .../FieldToUpdateNotExistingException.class | Bin 0 -> 445 bytes .../InvalidCredentialsException.class | Bin 0 -> 427 bytes .../exceptions/NotExistingUserException.class | Bin 0 -> 411 bytes .../exceptions/ProcessDoneException.class | Bin 0 -> 406 bytes .../ProductUnavailableAnymoreException.class | Bin 0 -> 448 bytes .../andreicerbu/interfaces/JSONMethods.class | Bin 0 -> 304 bytes .../com/andreicerbu/items/AdminJson.class | Bin 0 -> 2332 bytes .../com/andreicerbu/items/BaseItem.class | Bin 0 -> 6834 bytes .../items/DatabaseClientJson.class | Bin 0 -> 5451 bytes .../com/andreicerbu/items/DatabaseJson.class | Bin 0 -> 7434 bytes .../classes/com/andreicerbu/items/Order.class | Bin 0 -> 2386 bytes .../andreicerbu/items/ProductForOrder.class | Bin 0 -> 1764 bytes .../items/database/TableDeposit.class | Bin 0 -> 643 bytes .../items/database/TableOrder.class | Bin 0 -> 509 bytes .../items/database/TableProdInDepo.class | Bin 0 -> 722 bytes .../items/database/TableProduct.class | Bin 0 -> 505 bytes .../items/database/TableRoute.class | Bin 0 -> 556 bytes .../items/database/TableUser.class | Bin 0 -> 757 bytes .../items/database/TableUserOrder.class | Bin 0 -> 557 bytes .../com/andreicerbu/json/JsonFields.class | Bin 0 -> 1970 bytes .../target/classes/com/andreicerbu/test.class | Bin 0 -> 1003 bytes .../compile/default-compile/createdFiles.lst | 30 + .../compile/default-compile/inputFiles.lst | 29 + 77 files changed, 2427 insertions(+) create mode 100644 Server Delivery Planner/orders/hotejkzqxc_order.txt create mode 100644 Server Delivery Planner/orders/olhoftbdos_order.txt create mode 100644 Server Delivery Planner/orders/yqhbgirrtp_order.txt create mode 100644 Server Delivery Planner/ordersorder_1 create mode 100644 Server Delivery Planner/pom.xml create mode 100644 Server Delivery Planner/routes/hotejkzqxc_route.txt create mode 100644 Server Delivery Planner/routes/yqhbgirrtp_route.txt create mode 100644 Server Delivery Planner/routesroute_1 create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/Algorithm.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/ClientThread.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/Database.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/InitializeDatabase.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/Main.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/Server.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/SocketInput.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldAlreadyExistsException.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldToUpdateNotExistingException.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/InvalidCredentialsException.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/NotExistingUserException.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProcessDoneException.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProductUnavailableAnymoreException.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/interfaces/JSONMethods.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/AdminJson.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/BaseItem.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseClientJson.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseJson.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/Order.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/ProductForOrder.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableDeposit.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableOrder.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProdInDepo.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProduct.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableRoute.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUser.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUserOrder.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/json/JsonFields.java create mode 100644 Server Delivery Planner/src/main/java/com/andreicerbu/test.java create mode 100644 Server Delivery Planner/src/main/resources/META-INF/maven/archetype.xml create mode 100644 Server Delivery Planner/src/main/resources/archetype-resources/pom.xml create mode 100644 Server Delivery Planner/src/main/resources/archetype-resources/src/main/java/App.java create mode 100644 Server Delivery Planner/src/main/resources/archetype-resources/src/test/java/AppTest.java create mode 100644 Server Delivery Planner/target/classes/META-INF/maven/archetype.xml create mode 100644 Server Delivery Planner/target/classes/archetype-resources/pom.xml create mode 100644 Server Delivery Planner/target/classes/archetype-resources/src/main/java/App.java create mode 100644 Server Delivery Planner/target/classes/archetype-resources/src/test/java/AppTest.java create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/Algorithm.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/Algorithm�1.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/ClientThread.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/Database.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/InitializeDatabase.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/Main.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/Server.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/SocketInput.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/exceptions/FieldAlreadyExistsException.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/exceptions/FieldToUpdateNotExistingException.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/exceptions/InvalidCredentialsException.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/exceptions/NotExistingUserException.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/exceptions/ProcessDoneException.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/exceptions/ProductUnavailableAnymoreException.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/interfaces/JSONMethods.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/AdminJson.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/BaseItem.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/DatabaseClientJson.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/DatabaseJson.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/Order.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/ProductForOrder.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableDeposit.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableOrder.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableProdInDepo.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableProduct.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableRoute.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableUser.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableUserOrder.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/json/JsonFields.class create mode 100644 Server Delivery Planner/target/classes/com/andreicerbu/test.class create mode 100644 Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst diff --git a/Server Delivery Planner/orders/hotejkzqxc_order.txt b/Server Delivery Planner/orders/hotejkzqxc_order.txt new file mode 100644 index 0000000..1b0f497 --- /dev/null +++ b/Server Delivery Planner/orders/hotejkzqxc_order.txt @@ -0,0 +1,22 @@ +[ + { + "id_product": 48, + "quantity": 3, + "name": "JAVA" + }, + { + "id_product": 49, + "quantity": 2, + "name": "SQL" + }, + { + "id_product": 51, + "quantity": 1, + "name": "C++" + }, + { + "id_product": 46, + "quantity": 1, + "name": "PHP" + } +] \ No newline at end of file diff --git a/Server Delivery Planner/orders/olhoftbdos_order.txt b/Server Delivery Planner/orders/olhoftbdos_order.txt new file mode 100644 index 0000000..67ca11e --- /dev/null +++ b/Server Delivery Planner/orders/olhoftbdos_order.txt @@ -0,0 +1,5 @@ +[{ + "id_product": 48, + "quantity": 1, + "name": "JAVA" +}] \ No newline at end of file diff --git a/Server Delivery Planner/orders/yqhbgirrtp_order.txt b/Server Delivery Planner/orders/yqhbgirrtp_order.txt new file mode 100644 index 0000000..af9d1f3 --- /dev/null +++ b/Server Delivery Planner/orders/yqhbgirrtp_order.txt @@ -0,0 +1,12 @@ +[ + { + "id_product": 49, + "quantity": 3, + "name": "SQL" + }, + { + "id_product": 46, + "quantity": 2, + "name": "PHP" + } +] \ No newline at end of file diff --git a/Server Delivery Planner/ordersorder_1 b/Server Delivery Planner/ordersorder_1 new file mode 100644 index 0000000..26ec136 --- /dev/null +++ b/Server Delivery Planner/ordersorder_1 @@ -0,0 +1,4 @@ +[{ + "id_product": 1, + "quantity": 2 +}] \ No newline at end of file diff --git a/Server Delivery Planner/pom.xml b/Server Delivery Planner/pom.xml new file mode 100644 index 0000000..f371996 --- /dev/null +++ b/Server Delivery Planner/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + com.andreicerbu.deliveryplanner + Server_Delivery_Planner + 1.0-SNAPSHOT + + 20 + 20 + + + + + org.json + json + 20230227 + + + + com.mysql + mysql-connector-j + 8.0.33 + + + + + diff --git a/Server Delivery Planner/routes/hotejkzqxc_route.txt b/Server Delivery Planner/routes/hotejkzqxc_route.txt new file mode 100644 index 0000000..e0b2be9 --- /dev/null +++ b/Server Delivery Planner/routes/hotejkzqxc_route.txt @@ -0,0 +1,47 @@ +{ + "id_route": 89, + "destination": { + "lat_coord": 763.51, + "name": "Robert", + "id_user": 17, + "long_coord": 323.417 + }, + "deposits": [ + { + "lat_coord": 40, + "distance": 774.57404, + "name": "deposit4", + "id_deposit": 4, + "long_coord": 600, + "products": [ + { + "id_product": 46, + "quantity": 1, + "name": "PHP" + }, + { + "id_product": 48, + "quantity": 3, + "name": "JAVA" + }, + { + "id_product": 51, + "quantity": 1, + "name": "C++" + } + ] + }, + { + "lat_coord": 501, + "distance": 484.8045, + "name": "deposit2", + "id_deposit": 5, + "long_coord": 731, + "products": [{ + "id_product": 49, + "quantity": 2, + "name": "SQL" + }] + } + ] +} \ No newline at end of file diff --git a/Server Delivery Planner/routes/yqhbgirrtp_route.txt b/Server Delivery Planner/routes/yqhbgirrtp_route.txt new file mode 100644 index 0000000..70ee8a6 --- /dev/null +++ b/Server Delivery Planner/routes/yqhbgirrtp_route.txt @@ -0,0 +1,28 @@ +{ + "id_route": 88, + "destination": { + "lat_coord": 763.51, + "name": "Robert", + "id_user": 17, + "long_coord": 323.417 + }, + "deposits": [{ + "lat_coord": 40, + "distance": 774.57404, + "name": "deposit4", + "id_deposit": 4, + "long_coord": 600, + "products": [ + { + "id_product": 46, + "quantity": 2, + "name": "PHP" + }, + { + "id_product": 49, + "quantity": 3, + "name": "SQL" + } + ] + }] +} \ No newline at end of file diff --git a/Server Delivery Planner/routesroute_1 b/Server Delivery Planner/routesroute_1 new file mode 100644 index 0000000..2697b12 --- /dev/null +++ b/Server Delivery Planner/routesroute_1 @@ -0,0 +1,28 @@ +{ + "destination": { + "lat_coord": 422.917, + "id_user": 1, + "long_coord": 151.684 + }, + "deposits": [ + { + "lat_coord": 3, + "name": "deposit3", + "long_coord": 3, + "products": [] + }, + { + "lat_coord": 2, + "name": "deposit2", + "long_coord": 2, + "products": [{ + "quantity": 2, + "name": "apple" + }] + } + ], + "products": [{ + "id_product": 1, + "quantity": 2 + }] +} \ No newline at end of file diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/Algorithm.java b/Server Delivery Planner/src/main/java/com/andreicerbu/Algorithm.java new file mode 100644 index 0000000..edee0bc --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/Algorithm.java @@ -0,0 +1,190 @@ +package com.andreicerbu; + +import com.andreicerbu.exceptions.*; +import com.andreicerbu.items.database.TableDeposit; +import com.andreicerbu.json.JsonFields; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.sql.*; +import java.util.*; + +import static com.andreicerbu.json.JsonFields.listOfDeposits; + +public class Algorithm { + JSONObject order = null; + Integer id_user = null; + String name = null; + Float lat_coord = null; + Float long_coord = null; + + JSONObject routeJson = null; + JSONObject destination = null; + JSONArray deposits = null; + + List listOfDeposits = new ArrayList<>(); + Map mapProductIdToName = new HashMap<>(); + + public Algorithm(JSONObject order) throws SQLException, ProductUnavailableAnymoreException { + this.order = new JSONObject(order.toString()); + this.id_user = this.order.getInt(JsonFields.id_user); + this.order.remove(JsonFields.id_user); + + run(); + } + + private void getUserInformation(Connection conn) throws SQLException{ + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM users WHERE id = ?"); + pstmt.setInt(1, id_user); + + ResultSet resultSet = pstmt.executeQuery(); + resultSet.next(); + + name = resultSet.getString("username"); + lat_coord = resultSet.getFloat(JsonFields.lat_coord); + long_coord = resultSet.getFloat(JsonFields.long_coord); + + destination = new JSONObject(); + destination.put(JsonFields.id_user, id_user); + destination.put(JsonFields.name, name); + destination.put(JsonFields.lat_coord, lat_coord); + destination.put(JsonFields.long_coord, long_coord); + } + + private void getDeposits(Connection conn) throws SQLException{ + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM deposits"); + ResultSet resultSet = pstmt.executeQuery(); + + while(resultSet.next()){ + listOfDeposits.add(new TableDeposit( + resultSet.getInt("id"), resultSet.getString("name"), + resultSet.getFloat("lat_coord"), resultSet.getFloat("long_coord") + )); + } + + listOfDeposits.sort(new Comparator() { + @Override + public int compare(TableDeposit d1, TableDeposit d2) { + return (int) (findDistanceBetweenCoord(d2.getLat_coord(), d2.getLong_coord(), lat_coord, long_coord) - + findDistanceBetweenCoord(d1.getLat_coord(), d1.getLong_coord(), lat_coord, long_coord)); + } + }); + } + + private float findDistanceBetweenCoord(Float x1, Float y1, Float x2, Float y2){ + return (float) Math.sqrt( + Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2) + ); + } + + private void getProductNames(Connection conn) throws SQLException { + JSONArray products = new JSONArray(order.get(JsonFields.listOfProducts).toString()); + Statement stmt = conn.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT id, name FROM products"); + + while (resultSet.next()) { + int id_product = resultSet.getInt("id"); + String name = resultSet.getString("name"); + + for (int index = 0; index < products.length(); index++) { + JSONObject item = products.getJSONObject(index); + + if(id_product == item.getInt(JsonFields.id_product)){ + mapProductIdToName.put(id_product, name); + break; + } + } + } + } + + private void createRoute(Connection conn) throws SQLException, ProductUnavailableAnymoreException { + deposits = new JSONArray(); + JSONArray products = new JSONArray(order.get(JsonFields.listOfProducts).toString()); + + PreparedStatement pstmt; + for(TableDeposit deposit : listOfDeposits){//we take each deposit + JSONObject depositJSON = new JSONObject(createDepositJSONForRoute(deposit).toString()); + JSONArray listOfProductsJSON = depositJSON.getJSONArray(JsonFields.listOfProducts); + + pstmt = conn.prepareStatement("SELECT * FROM prod_in_depo WHERE id_deposit = ?"); + pstmt.setInt(1, deposit.getId_deposit()); + ResultSet resultSet = pstmt.executeQuery();//we take all the products that exists in a deposit + + while(resultSet.next()){ + int id_product = resultSet.getInt("id_product"); + int quantity = resultSet.getInt("quantity"); + String name = mapProductIdToName.get(id_product); + + for(int index = 0; index < products.length(); index++){//iterate through our order + JSONObject item = products.getJSONObject(index); + JSONObject itemForList = new JSONObject(); + + if(item.getInt(JsonFields.id_product) == id_product){ + itemForList.put(JsonFields.id_product, id_product); + itemForList.put(JsonFields.name, name); + int newQuantity = item.getInt(JsonFields.quantity) - quantity; + + if(newQuantity > 0){ + item.put(JsonFields.quantity, newQuantity); + itemForList.put(JsonFields.quantity, quantity); + }else{ + itemForList.put(JsonFields.quantity, item.getInt(JsonFields.quantity)); + products.remove(index); + } + + listOfProductsJSON.put(itemForList); + } + } + } + + if(!depositJSON.getJSONArray(JsonFields.listOfProducts).isEmpty()) { + deposits.put(depositJSON); + } + + if(products.isEmpty()){ + return; + } + } + + if(!products.isEmpty()){ + throw new ProductUnavailableAnymoreException("One of the chosen products is not available anymore"); + } + } + + private JSONObject createDepositJSONForRoute(TableDeposit deposit){ + JSONObject depositJSON = new JSONObject(); + + depositJSON.put(JsonFields.id_deposit, deposit.getId_deposit()); + depositJSON.put(JsonFields.name, deposit.getName()); + depositJSON.put(JsonFields.lat_coord, deposit.getLat_coord()); + depositJSON.put(JsonFields.long_coord, deposit.getLong_coord()); + depositJSON.put(JsonFields.listOfProducts, new JSONArray()); + depositJSON.put(JsonFields.distance, findDistanceBetweenCoord(lat_coord, long_coord, deposit.getLat_coord(), deposit.getLong_coord())); + + return depositJSON; + } + + + private void createJsonRoute(){ + routeJson = new JSONObject(); + + routeJson.put(JsonFields.destination, destination); + routeJson.put(JsonFields.listOfDeposits, deposits); + routeJson.put(JsonFields.listOfProducts, order.getJSONArray(JsonFields.listOfProducts)); + } + + private synchronized void run() throws SQLException, ProductUnavailableAnymoreException{ + Connection conn = Database.getConnection(); + + getUserInformation(conn); + getDeposits(conn); + getProductNames(conn); + + createRoute(conn); + createJsonRoute(); + } + + public JSONObject getRouteJson() { + return routeJson; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/ClientThread.java b/Server Delivery Planner/src/main/java/com/andreicerbu/ClientThread.java new file mode 100644 index 0000000..c907f51 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/ClientThread.java @@ -0,0 +1,67 @@ +package com.andreicerbu; + +import com.andreicerbu.json.JsonFields; + +import java.io.*; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.sql.Connection; +import java.sql.SQLException; + +public class ClientThread extends Thread{ + private final Socket socket; + private boolean isRunning = true; + private static final int TIME_OUT = 3000; + + public ClientThread(Socket socket)throws IOException { + this.socket = socket; + socket.setSoTimeout(TIME_OUT); + } + + @Override + public void run(){ + try { + BufferedReader in = new BufferedReader( + new InputStreamReader(socket.getInputStream())); + PrintWriter out = new PrintWriter(socket.getOutputStream(), true); + + SocketInput socketInput = new SocketInput(); + + while (isRunning) { + try { + if(!socket.isConnected()){ + throw new SocketTimeoutException(); + } + String input = in.readLine(); + socketInput = new SocketInput(input); + + Connection conn = Database.getConnection(); + socketInput.processInputJson(conn); + + out.println(socketInput.getJsonResponse().toString()); + } catch (SocketTimeoutException ignored) { + } catch (SQLException e) { + socketInput.processOutputJson(JsonFields.responseError, "Internal server error.\nPlease try again later"); + out.println(socketInput.getJsonResponse().toString()); + } catch (IOException e){ + System.out.println("Closing Thread"); + System.out.flush(); + isRunning = false; + } + } + + in.close(); + out.close(); + socket.close(); + }catch(IOException ignored){ + } + } + + public void endThread(){ + isRunning = false; + } + + public boolean isThreadNotAlive(){ + return !this.isAlive(); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/Database.java b/Server Delivery Planner/src/main/java/com/andreicerbu/Database.java new file mode 100644 index 0000000..7bcbe8c --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/Database.java @@ -0,0 +1,650 @@ +package com.andreicerbu; + +import com.andreicerbu.exceptions.*; +import com.andreicerbu.items.AdminJson; +import com.andreicerbu.items.BaseItem; +import com.andreicerbu.json.JsonFields; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.sql.*; +import java.util.Random; +import java.util.Scanner; + +public class Database { + private static final String URL = + "jdbc:mysql://localhost:3306/java"; + private static final String USER = "root"; + private static final String PASSWORD = ""; + + private static Connection conn; + + public static Connection getConnection() throws SQLException{ + conn = DriverManager.getConnection(URL, USER, PASSWORD); + conn.setAutoCommit(false); + return conn; + } + + + public static synchronized void placeOrder(Connection conn, JSONObject json, Integer id_user) throws SQLException, IOException { + JSONArray listOfProducts = new JSONArray(json.getJSONArray(JsonFields.listOfProducts)); + json.remove(JsonFields.listOfProducts); + + for(int index = 0; index < listOfProducts.length(); index++){ + JSONObject item = listOfProducts.getJSONObject(index); + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM products WHERE id = ?"); + pstmt.setInt(1, item.getInt(JsonFields.id_product)); + ResultSet resultSet = pstmt.executeQuery(); + resultSet.next(); + + item.put(JsonFields.name, resultSet.getString("name")); + } + + String pathToOrders = "D:\\Server Delivery Planner\\orders\\"; + String pathToRoutes = "D:\\Server Delivery Planner\\routes\\"; + String pathToOrderDatabase = "D:\\\\Server Delivery Planner\\\\orders\\\\"; + String pathToRouteDatabase = "D:\\\\Server Delivery Planner\\\\routes\\\\"; + + + String nameOfFile; + while(true){ + nameOfFile = randomStringGenerator(); + + Statement pstmt = conn.createStatement(); + ResultSet resultSet = pstmt.executeQuery("SELECT * FROM orders WHERE path_to_file = '" + pathToOrderDatabase + nameOfFile + "'"); + if(!resultSet.next()){ + break; + } + } + + String orderFileName = pathToOrders + nameOfFile + "_order.txt"; + String routeFileName = pathToRoutes + nameOfFile + "_route.txt"; + + PreparedStatement pstmt = conn.prepareStatement("INSERT INTO orders (path_to_file) VALUES (?)"); + pstmt.setString(1,pathToOrderDatabase + nameOfFile + "_order.txt" ); + pstmt.executeUpdate(); + + pstmt = conn.prepareStatement("INSERT INTO routes (path_to_file) VALUES (?)"); + pstmt.setString(1, pathToRouteDatabase + nameOfFile + "_route.txt"); + pstmt.executeUpdate(); + + conn.commit(); + + int idOrder; + pstmt = conn.prepareStatement("SELECT id FROM orders WHERE path_to_file = ?"); + pstmt.setString(1,pathToOrderDatabase + nameOfFile + "_order.txt" ); + ResultSet resultSet = pstmt.executeQuery(); + resultSet.next(); + idOrder = resultSet.getInt("id"); + + pstmt = conn.prepareStatement("SELECT id FROM routes WHERE path_to_file = ?"); + pstmt.setString(1,pathToRouteDatabase + nameOfFile + "_route.txt" ); + resultSet = pstmt.executeQuery(); + resultSet.next(); + json.put(JsonFields.id_route, resultSet.getInt("id")); + + File order = new File(orderFileName); + File route = new File(routeFileName); + + FileWriter writerOrder = new FileWriter(order); + FileWriter writerRoute = new FileWriter(route); + + writerOrder.write(listOfProducts.toString(4)); + writerRoute.write(json.toString(4)); + + writerOrder.close(); + writerRoute.close(); + + JSONArray array = new JSONArray(listOfProducts.toString()); + for(int index = 0; index < array.length(); index++){ + JSONObject item = array.getJSONObject(index); + + pstmt = conn.prepareStatement("SELECT * FROM prod_in_depo"); + ResultSet products = pstmt.executeQuery(); + while(products.next()){ + int id_product = products.getInt(JsonFields.id_product); + int quantity = products.getInt(JsonFields.quantity); + int id_deposit = products.getInt(JsonFields.id_deposit); + + if(item.getInt(JsonFields.id_product) == id_product && item.has(JsonFields.quantity)){ + if(quantity - item.getInt(JsonFields.quantity) > 0) { + int newQuantity = quantity - item.getInt(JsonFields.quantity); + item.put(JsonFields.quantity, newQuantity); + pstmt = conn.prepareStatement( + "UPDATE prod_in_depo SET quantity = ? WHERE id_product = ? AND id_deposit = ?"); + pstmt.setInt(1, item.getInt(JsonFields.quantity)); + pstmt.setInt(2, id_product); + pstmt.setInt(3, id_deposit); + + item.remove(JsonFields.quantity); + + pstmt.executeUpdate(); + conn.commit(); + + + }else{ + int newQuantity = item.getInt(JsonFields.quantity) - quantity; + item.put(JsonFields.quantity, newQuantity); + pstmt = conn.prepareStatement("DELETE FROM prod_in_depo WHERE id_product = ? AND id_deposit = ?"); + pstmt.setInt(1, id_product); + pstmt.setInt(2, id_deposit); + + if(newQuantity == 0){ + item.remove(JsonFields.quantity); + }else { + item.put(JsonFields.quantity, newQuantity); + } + + pstmt.executeUpdate(); + conn.commit(); + } + } + } + } + + pstmt = conn.prepareStatement("INSERT INTO user_orders (id_user, id_order) VALUES (?, ?) "); + pstmt.setInt(1, id_user); + pstmt.setInt(2, idOrder); + + pstmt.executeUpdate(); + conn.commit(); + } + + private static String randomStringGenerator(){ + int leftLimit = 97; // letter 'a' + int rightLimit = 122; // letter 'z' + int targetStringLength = 10; + Random random = new Random(); + + return random.ints(leftLimit, rightLimit + 1) + .limit(targetStringLength) + .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) + .toString(); + } + + public static JSONObject getUserOrders(Connection conn, Integer idUser) throws SQLException, IOException { + JSONObject json = new JSONObject(); + JSONArray array = new JSONArray(); + PreparedStatement getUserOrders = conn.prepareStatement("SELECT id_order WHERE id_user = ?"); + getUserOrders.setInt(1, idUser); + + ResultSet userOrders = getUserOrders.executeQuery(); + while(userOrders.next()){ + int id_order = userOrders.getInt("id_order"); + PreparedStatement getOrders = conn.prepareStatement("SELECT path_to_file FROM orders WHERE id = ?"); + getOrders.setInt(1, id_order); + + ResultSet order = getOrders.executeQuery(); + if(!order.next()){ + continue; + } + + String path = order.getString("path_to_file"); + array.put(getDataFromFile(path)); + } + + json.put(JsonFields.response, JsonFields.responseSuccess); + json.put(JsonFields.responseMessage, array); + + return json; + } + + private static String getDataFromFile(String path) throws IOException{ + Scanner myReader = new Scanner(new File(path)); + StringBuilder data = new StringBuilder(); + + while(myReader.hasNextLine()){ + data.append(myReader.nextLine()); + } + + return data.toString(); + } + + public static void registerUser(Connection conn, BaseItem user) throws SQLException, InvalidCredentialsException { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM users where email = ?"); + pstmt.setString(1, user.getEmail()); + ResultSet resultSet = pstmt.executeQuery(); + + if(resultSet.isBeforeFirst()){ + throw new InvalidCredentialsException("User already exists"); + } + + pstmt = conn.prepareStatement( + "INSERT INTO users (username, email, password, lat_coord, long_coord) VALUES (?, ?, ?, ?, ?)"); + pstmt.setString(1, user.getName()); + pstmt.setString(2, user.getEmail()); + pstmt.setString(3, user.getPassword()); + pstmt.setFloat(4, user.getLat_coord()); + pstmt.setFloat(5, user.getLong_coord()); + + pstmt.executeUpdate(); + conn.commit(); + } + + public static Integer loginUser(Connection conn, BaseItem user) throws SQLException, InvalidCredentialsException { + Statement stmt = conn.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT id, password FROM users WHERE email = '" + user.getEmail() + "'"); + + if(!resultSet.isBeforeFirst()){ + throw new InvalidCredentialsException("Incorrect credentials"); + } + + resultSet.next(); + Integer id = resultSet.getInt("id"); + String password = resultSet.getString("password"); + + if(!user.getPassword().equals(password)){ + throw new InvalidCredentialsException("Incorrect credentials"); + } + + return id; + } + + public static void alterTable(Connection conn, AdminJson adminJson) throws SQLException, ProcessDoneException, + FieldToUpdateNotExistingException, FieldAlreadyExistsException { + + switch (adminJson.getTable()){ + case JsonFields.tableRoutes -> alterTableRoutes(conn, adminJson); + case JsonFields.tableDeposits -> alterTableDeposits(conn, adminJson); + case JsonFields.tableProducts -> alterTableProducts(conn, adminJson); + case JsonFields.tableProdInDepo -> alterTableProdInDepo(conn, adminJson); + case JsonFields.tableUsers -> alterTableUsers(conn, adminJson); + } + } + + + + private static void alterTableRoutes(Connection conn, AdminJson adminJson) throws SQLException, ProcessDoneException { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM routes WHERE id = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_route()); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + String nameOfFile = getNameOfFileRoute(conn, adminJson.getListOfValues().get(0).getId_route()); + + pstmt = conn.prepareStatement("DELETE FROM routes WHERE id = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_route()); + pstmt.executeUpdate(); + + File routeFile = new File("D:\\Server Delivery Planner\\routes\\" + nameOfFile + "_route.txt"); + + System.gc(); + routeFile.delete(); + + conn.commit(); + throw new ProcessDoneException("Route successfully deleted"); + } catch (SQLException ignored){ + throw new SQLException("Route was already deleted"); + } + } + + private static void alterTableDeposits(Connection conn, AdminJson adminJson) throws SQLException, ProcessDoneException{ + switch (adminJson.getCommand()){ + case JsonFields.commandInsert -> { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM deposits WHERE name = ?"); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + ResultSet resultSet = pstmt.executeQuery(); + + if(resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("INSERT INTO deposits (name, lat_coord, long_coord) VALUES (?, ?, ?)"); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + pstmt.setFloat(2, adminJson.getListOfValues().get(0).getLat_coord()); + pstmt.setFloat(3, adminJson.getListOfValues().get(0).getLong_coord()); + + pstmt.executeUpdate(); + conn.commit(); + + throw new ProcessDoneException("Deposit " + adminJson.getListOfValues().get(0).getName() + " successfully inserted"); + } catch (SQLException ignored){ + throw new SQLException("Deposit " + adminJson.getListOfValues().get(0).getName() + " was already inserted"); + } + } + + case JsonFields.commandUpdate -> { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM deposits WHERE lat_coord = ? AND long_coord = ? AND id <> ? "); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + pstmt.setFloat(2, adminJson.getListOfValues().get(0).getLat_coord()); + pstmt.setFloat(3, adminJson.getListOfValues().get(0).getLong_coord()); + pstmt.setInt(4, adminJson.getListOfValues().get(0).getId_deposit()); + ResultSet resultSet = pstmt.executeQuery(); + + if(resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("UPDATE deposits SET name = ?, lat_coord = ?, long_coord = ? WHERE id = ?"); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + pstmt.setFloat(2, adminJson.getListOfValues().get(0).getLat_coord()); + pstmt.setFloat(3, adminJson.getListOfValues().get(0).getLong_coord()); + pstmt.setInt(4, adminJson.getListOfValues().get(0).getId_deposit()); + + pstmt.executeUpdate(); + conn.commit(); + + throw new ProcessDoneException("Deposit successfully updated"); + } catch (SQLException ignored){ + throw new SQLException("Deposit was not updated"); + } + } + + case JsonFields.commandDelete -> { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM deposits WHERE id = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_deposit()); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + int idDeposit = adminJson.getListOfValues().get(0).getId_deposit(); + pstmt = conn.prepareStatement("DELETE FROM prod_in_depo WHERE id_deposit = ?"); + pstmt.setInt(1, idDeposit); + pstmt.executeUpdate(); + + pstmt = conn.prepareStatement("DELETE FROM deposits WHERE id = ?"); + pstmt.setInt(1, idDeposit); + pstmt.executeUpdate(); + + conn.commit(); + + throw new ProcessDoneException("Deposit " + adminJson.getListOfValues().get(0).getName() + " successfully deleted"); + } catch (SQLException ignored){ + throw new SQLException("Deposit " + adminJson.getListOfValues().get(0).getName() + " was already deleted"); + } + } + } + } + + private static void alterTableProducts(Connection conn, AdminJson adminJson) throws SQLException, ProcessDoneException, + FieldToUpdateNotExistingException, FieldAlreadyExistsException{ + switch (adminJson.getCommand()){ + case JsonFields.commandInsert -> { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM products WHERE name = ?"); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + ResultSet resultSet = pstmt.executeQuery(); + + if(resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("INSERT INTO products (name) VALUES (?)"); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + + pstmt.executeUpdate(); + conn.commit(); + + throw new ProcessDoneException("Product " + adminJson.getListOfValues().get(0).getName() + " successfully inserted"); + } catch (SQLException ignored){ + throw new SQLException("Product " + adminJson.getListOfValues().get(0).getName() + " was already inserted"); + } + } + + case JsonFields.commandUpdate -> { + String oldName = null; + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM products WHERE id = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_product()); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new FieldToUpdateNotExistingException("Product not existing anymore"); + } + + resultSet.next(); + oldName = resultSet.getString("name"); + + pstmt = conn.prepareStatement("SELECT id FROM products WHERE name = ?"); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + resultSet = pstmt.executeQuery(); + + if(resultSet.isBeforeFirst()){ + throw new FieldAlreadyExistsException("New label can't be added because it already exists"); + } + + pstmt = conn.prepareStatement("UPDATE products SET name = ? WHERE id = ?"); + pstmt.setString(1, adminJson.getListOfValues().get(0).getName()); + pstmt.setInt(2, adminJson.getListOfValues().get(0).getId_product()); + + pstmt.executeUpdate(); + conn.commit(); + + throw new ProcessDoneException("Product " + oldName + " successfully updated to " + adminJson.getListOfValues().get(0).getName()); + } catch (SQLException ignored){ + throw new SQLException( "Product " + oldName + " was not updated to " + adminJson.getListOfValues().get(0).getName()); + } + } + + case JsonFields.commandDelete -> { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM products WHERE id = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_product()); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("DELETE FROM prod_in_depo WHERE id_product = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_product()); + pstmt.executeUpdate(); + + pstmt = conn.prepareStatement("DELETE FROM products WHERE id = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_product()); + pstmt.executeUpdate(); + + conn.commit(); + + throw new ProcessDoneException("Product " + adminJson.getListOfValues().get(0).getName() + " successfully deleted"); + }catch (SQLException ignored){ + throw new SQLException("Product " + adminJson.getListOfValues().get(0).getName() + " was already deleted"); + } + } + } + } + + private static void alterTableProdInDepo(Connection conn, AdminJson adminJson) throws SQLException, ProcessDoneException, FieldToUpdateNotExistingException { + switch (adminJson.getCommand()) { + case JsonFields.commandInsert -> { + try { + String name = adminJson.getListOfValues().get(0).getName(); + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM products WHERE name = ?"); + pstmt.setString(1, name); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new FieldToUpdateNotExistingException("Product not existing anymore"); + } + + resultSet.next(); + int idProduct = resultSet.getInt("id"); + + pstmt = conn.prepareStatement("SELECT * FROM prod_in_depo WHERE id_product = ? AND id_deposit = ?"); + pstmt.setInt(1, idProduct); + pstmt.setInt(2, adminJson.getListOfValues().get(0).getId_deposit()); + resultSet = pstmt.executeQuery(); + + if(resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("INSERT INTO prod_in_depo (id_product, id_deposit, quantity) VALUES (?, ?, ?)"); + pstmt.setInt(1, idProduct); + pstmt.setInt(2, adminJson.getListOfValues().get(0).getId_deposit()); + pstmt.setInt(3, adminJson.getListOfValues().get(0).getQuantity()); + + pstmt.executeUpdate(); + conn.commit(); + + throw new ProcessDoneException("Product " + adminJson.getListOfValues().get(0).getName() + " successfully inserted in deposit"); + } catch (SQLException ignored){ + throw new SQLException("Product " + adminJson.getListOfValues().get(0).getName() + " was already inserted in deposit"); + } + } + + case JsonFields.commandUpdate -> { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM prod_in_depo WHERE id_product = ? AND id_deposit = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_product()); + pstmt.setInt(2, adminJson.getListOfValues().get(0).getId_deposit()); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("UPDATE prod_in_depo SET quantity = ? WHERE id_product = ? AND id_deposit = ?"); + + pstmt.setInt(1, adminJson.getListOfValues().get(0).getQuantity()); + pstmt.setInt(2, adminJson.getListOfValues().get(0).getId_product()); + pstmt.setInt(3, adminJson.getListOfValues().get(0).getId_deposit()); + + pstmt.executeUpdate(); + conn.commit(); + + throw new ProcessDoneException("Product " + adminJson.getListOfValues().get(0).getName() + " successfully updated"); + } catch (SQLException ignored){ + throw new SQLException("Product " + adminJson.getListOfValues().get(0).getName() + " was not updated"); + } + } + + case JsonFields.commandDelete -> { + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM prod_in_depo WHERE id_product = ? AND id_deposit = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_product()); + pstmt.setInt(2, adminJson.getListOfValues().get(0).getId_deposit()); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("DELETE FROM prod_in_depo WHERE id_product = ? AND id_deposit = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_product()); + pstmt.setInt(2, adminJson.getListOfValues().get(0).getId_deposit()); + + pstmt.executeUpdate(); + conn.commit(); + + throw new ProcessDoneException("Product " + adminJson.getListOfValues().get(0).getName() + " successfully deleted from deposit"); + } catch (SQLException ignored) { + throw new SQLException("Product " + adminJson.getListOfValues().get(0).getName() + " was already deleted from deposit"); + } + } + + } + } + + private static void alterTableUsers(Connection conn, AdminJson adminJson) throws SQLException, ProcessDoneException{ + try { + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM users WHERE id = ?");//check for user existence + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_user()); + ResultSet resultSet = pstmt.executeQuery(); + + if(!resultSet.isBeforeFirst()){ + throw new SQLException(); + } + + pstmt = conn.prepareStatement("SELECT id_order FROM user_orders WHERE id_user = ?");//get all orders made by user + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_user()); + resultSet = pstmt.executeQuery(); + + while(resultSet.next()){ + int id_order = resultSet.getInt("id_order"); + String nameOfOrder = getNameOfFile(conn, id_order); + + String pathToFileRouteDatabase = "D:\\\\Server Delivery Planner\\\\routes\\\\" + nameOfOrder + "_route.txt"; + String pathToFileOrderDatabase = "D:\\\\Server Delivery Planner\\\\orders\\\\" + nameOfOrder + "_order.txt"; + String pathToFileOrder = "D:\\Server Delivery Planner\\orders\\" + nameOfOrder + "_order.txt"; + String pathToFileRoute = "D:\\Server Delivery Planner\\routes\\" + nameOfOrder + "_route.txt"; + + File orderFile = new File(pathToFileOrder); + File routeFile = new File(pathToFileRoute); + + System.gc(); + orderFile.delete(); + + System.gc(); + routeFile.delete(); + + pstmt = conn.prepareStatement("DELETE FROM user_orders WHERE id_order = ?"); + pstmt.setInt(1, id_order); + pstmt.executeUpdate(); + + pstmt = conn.prepareStatement("DELETE FROM orders WHERE path_to_file = ?"); + pstmt.setString(1, pathToFileOrderDatabase); + pstmt.executeUpdate(); + + pstmt = conn.prepareStatement("DELETE FROM routes WHERE path_to_file = ?"); + pstmt.setString(1, pathToFileRouteDatabase); + pstmt.executeUpdate(); + + conn.commit(); + } + + pstmt = conn.prepareStatement("DELETE FROM users WHERE id = ?"); + pstmt.setInt(1, adminJson.getListOfValues().get(0).getId_user()); + pstmt.executeUpdate(); + + conn.commit(); + + throw new ProcessDoneException("User " + adminJson.getListOfValues().get(0).getName() + " successfully deleted"); + } catch (SQLException ignored){ + throw new SQLException("User " + adminJson.getListOfValues().get(0).getName() + " was already deleted"); + } + } + + private static String getNameOfFile(Connection conn, int id_order)throws SQLException{ + PreparedStatement pstmt = conn.prepareStatement("SELECT path_to_file FROM orders WHERE id = ?"); + pstmt.setInt(1, id_order); + ResultSet resultSet1 = pstmt.executeQuery(); + resultSet1.next(); + + String resultStringToProcess = resultSet1.getString("path_to_file"); + int left, right = resultStringToProcess.indexOf('_'); + left = right; + + while(resultStringToProcess.charAt(left) != '\\'){ + left--; + } + left++; + + return resultStringToProcess.substring(left, right); + } + + private static String getNameOfFileRoute(Connection conn, int id_route)throws SQLException{ + PreparedStatement pstmt = conn.prepareStatement("SELECT path_to_file FROM routes WHERE id = ?"); + pstmt.setInt(1, id_route); + ResultSet resultSet1 = pstmt.executeQuery(); + resultSet1.next(); + + String resultStringToProcess = resultSet1.getString("path_to_file"); + int left, right = resultStringToProcess.indexOf('_'); + left = right; + + while(resultStringToProcess.charAt(left) != '\\'){ + left--; + } + left++; + + return resultStringToProcess.substring(left, right); + } + + + public static void closeConnection(Connection conn) throws SQLException{ + conn.close(); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/InitializeDatabase.java b/Server Delivery Planner/src/main/java/com/andreicerbu/InitializeDatabase.java new file mode 100644 index 0000000..7327fc5 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/InitializeDatabase.java @@ -0,0 +1,98 @@ +package com.andreicerbu; + +import java.sql.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class InitializeDatabase { + private static final String URL = + "jdbc:mysql://localhost:3306/java"; + private static final String USER = "root"; + private static final String PASSWORD = ""; + private static Connection conn; + + private final static String createProduct = + "CREATE TABLE products( id INT AUTO_INCREMENT, name VARCHAR(256) NOT NULL, PRIMARY KEY(id) , UNIQUE(name))"; + private final static String createDeposit = + "CREATE TABLE deposits( id INT AUTO_INCREMENT, name VARCHAR(256) NOT NULL, lat_coord FLOAT NOT NULL, long_coord FLOAT NOT NULL, PRIMARY KEY(id), UNIQUE (lat_coord), UNIQUE (long_coord) )"; + private final static String createProdInDepo = + "CREATE TABLE prod_in_depo( id INT AUTO_INCREMENT, id_product INT NOT NULL, id_deposit INT NOT NULL, quantity INT NOT NULL, PRIMARY KEY(id), FOREIGN KEY (id_product) REFERENCES products(id), FOREIGN KEY (id_deposit) REFERENCES deposits(id), UNIQUE (id_product, id_deposit) )"; + private final static String createOrders = + "CREATE TABLE orders( id INT AUTO_INCREMENT, path_to_file VARCHAR(512) NOT NULL, PRIMARY KEY(id), UNIQUE (path_to_file) )"; + private final static String createRoutes = + "CREATE TABLE routes( id INT AUTO_INCREMENT, path_to_file VARCHAR(512) NOT NULL, PRIMARY KEY(id), UNIQUE (path_to_file) )"; + private final static String createUsers = + "CREATE TABLE users( id INT AUTO_INCREMENT, username VARCHAR(256) NOT NULL, email VARCHAR(256) NOT NULL, password VARCHAR(256) NOT NULL, lat_coord FLOAT NOT NULL, long_coord FLOAT NOT NULL, PRIMARY KEY(id), UNIQUE(email) );"; + private final static String createUserOrders = + "CREATE TABLE user_orders( id INT AUTO_INCREMENT, id_user INT NOT NULL, id_order INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (id_user) REFERENCES users(id), FOREIGN KEY (id_order) REFERENCES orders (id), UNIQUE (id_order) )"; + + private final static String dropProduct = "DROP TABLE products"; + private final static String dropDeposit = "DROP TABLE deposits"; + private final static String dropProdInDepo = "DROP TABLE prod_in_depo"; + private final static String dropOrders = "DROP TABLE orders"; + private final static String dropRoutes = "DROP TABLE routes"; + private final static String dropUsers = "DROP TABLE users"; + private final static String dropUserOrders = "DROP TABLE user_orders"; + + private final static List dropTablesQueries = new ArrayList<>(Arrays.asList(dropProdInDepo, dropUserOrders, dropDeposit, dropProduct, dropRoutes, dropUsers, dropOrders)); + private final static List createTablesQueries = new ArrayList<>(Arrays.asList(createDeposit, createOrders, createRoutes, createProduct, createProdInDepo, createUsers, createUserOrders)); + + public static void main(String[] args){ + createTables(); + //dropTables(); + } + + private static void createTables(){ + try { + conn = DriverManager.getConnection(URL, USER, PASSWORD); + conn.setAutoCommit(false); + + Statement stmt = conn.createStatement(); + + for(String query : createTablesQueries){ + try { + stmt.executeUpdate(query); + System.out.println("Table created successfully"); + } + catch (SQLException tableExists){ + System.out.println(tableExists.getMessage()); + } + } + + conn.commit(); + }catch (SQLException e){ + try { + System.err.println(e); + conn.rollback(); + }catch(SQLException rollback){ + System.err.println(rollback); + } + } + } + + private static void dropTables(){ + try { + conn = DriverManager.getConnection(URL, USER, PASSWORD); + conn.setAutoCommit(false); + + Statement stmt = conn.createStatement(); + + for(String query : dropTablesQueries){ + try { + stmt.executeUpdate(query); + System.out.println("Dropped table"); + } catch (SQLException tableNotExisting) { + System.out.println(tableNotExisting.getMessage()); + } + } + conn.commit(); + }catch (SQLException e){ + try { + conn.rollback(); + }catch(SQLException ee){ + System.err.println(ee); + } + } + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/Main.java b/Server Delivery Planner/src/main/java/com/andreicerbu/Main.java new file mode 100644 index 0000000..0c01c08 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/Main.java @@ -0,0 +1,14 @@ +package com.andreicerbu; + +import java.io.IOException; + +public class Main { + public static void main(String[] args){ + try { + Server server = new Server(); + server.run(); + }catch (IOException e){ + System.out.println(e.getMessage()); + } + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/Server.java b/Server Delivery Planner/src/main/java/com/andreicerbu/Server.java new file mode 100644 index 0000000..7f6b0a1 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/Server.java @@ -0,0 +1,46 @@ +package com.andreicerbu; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.List; + +public class Server { + private static final int PORT = 8672; + private static final int TIME_OUT = 10000; + ServerSocket serverSocket = null; + List clients; + + public Server()throws IOException { + serverSocket = new ServerSocket(PORT); + serverSocket.setSoTimeout(TIME_OUT); + clients = new ArrayList<>(); + + InetAddress localaddr = InetAddress.getLocalHost(); + System.out.println("Local IP Address : " + localaddr); + System.out.println("Local hostname : " + localaddr.getHostName()); + } + + private void acceptConnection() throws IOException{ + Socket clientSocket = serverSocket.accept(); + System.out.println("Client Connected!"); + clients.add(new ClientThread(clientSocket)); + clients.get(clients.size() - 1).start(); + } + + public void run(){ + while(true) { + try { + acceptConnection(); + }catch (SocketTimeoutException ignored){ + clients.removeIf(ClientThread::isThreadNotAlive); + System.out.println("Waiting for client!"); + } catch (IOException e) { + System.err.println(e); + } + } + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/SocketInput.java b/Server Delivery Planner/src/main/java/com/andreicerbu/SocketInput.java new file mode 100644 index 0000000..e7f1c8c --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/SocketInput.java @@ -0,0 +1,135 @@ +package com.andreicerbu; + +import com.andreicerbu.exceptions.*; +import com.andreicerbu.items.*; + +import com.andreicerbu.json.JsonFields; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; + +public class SocketInput { + private String input; + private JSONObject jsonInput = null; + private JSONObject jsonOutput = null; + + private static final String registrationDone = "Registration done succesfully"; + private static final String orderDone = "Order placed successfully"; + + + private static final String genericError = "Internal server error. Please try again"; + + public SocketInput(){} + + public SocketInput(String input){ + this.input = input; + jsonInput = new JSONObject(input); + } + + public void processInputJson(Connection conn) throws IOException{ + jsonOutput = new JSONObject(); + AdminJson adminJson = new AdminJson(); + + switch(jsonInput.getString(JsonFields.command)) { + case JsonFields.commandPlaceOrder -> { + try { + Algorithm algorithm = new Algorithm(jsonInput); + Database.placeOrder(Database.getConnection(), algorithm.getRouteJson(), jsonInput.getInt(JsonFields.id_user)); + processOutputJson(JsonFields.responseSuccess, orderDone); + } catch (ProductUnavailableAnymoreException e){ + processOutputJson(JsonFields.responseError, e.getMessage()); + } catch (SQLException ignored){ + processOutputJson(JsonFields.responseError, genericError); + } + } + + case JsonFields.commandGetDatabase -> { + try { + DatabaseJson databaseJson = new DatabaseJson(); + databaseJson.createJSON(); + jsonOutput = databaseJson.getJSON(); + } catch (SQLException e){ + System.err.println(e); + System.err.flush(); + processOutputJson(JsonFields.responseError, genericError); + } + } + + case JsonFields.commandGetUserDatabase -> { + try { + adminJson.deserializeJSON(jsonInput); + DatabaseClientJson databaseClientJson = new DatabaseClientJson(adminJson.getListOfValues().get(0).getId_user()); + databaseClientJson.createJSON(); + jsonOutput = databaseClientJson.getJSON(); + } catch (SQLException ignored){ + processOutputJson(JsonFields.responseError, genericError); + } + } + + case JsonFields.commandGetOrders -> { + try { + jsonOutput = Database.getUserOrders(conn, adminJson.getListOfValues().get(0).getId_user()); + } catch (SQLException ignored){ + processOutputJson(JsonFields.responseError, genericError); + } + } + + case JsonFields.commandRegister -> { + try { + adminJson.deserializeJSON(jsonInput); + Database.registerUser(conn, adminJson.getListOfValues().get(0)); + processOutputJson(JsonFields.responseSuccess, registrationDone); + } catch (InvalidCredentialsException e) { + processOutputJson(JsonFields.responseError, e.getMessage()); + } catch (SQLException ignored){ + processOutputJson(JsonFields.responseError, genericError); + } + } + + case JsonFields.commandLogin -> { + try{ + adminJson.deserializeJSON(jsonInput); + Integer userId = Database.loginUser(conn, adminJson.getListOfValues().get(0)); + processOutputJson(JsonFields.responseSuccess, String.valueOf(userId)); + } catch (InvalidCredentialsException e){ + processOutputJson(JsonFields.responseError, e.getMessage()); + } catch (SQLException ignored){ + processOutputJson(JsonFields.responseError, genericError); + } + } + + default -> { + try { + adminJson.deserializeJSON(jsonInput); + Database.alterTable(conn, adminJson); + }catch(SQLException | FieldToUpdateNotExistingException | FieldAlreadyExistsException e){ + processOutputJson(JsonFields.responseError, e.getMessage()); + } catch(ProcessDoneException e){ + processOutputJson(JsonFields.responseSuccess, e.getMessage()); + } + } + } + } + + public void processOutputJson(String response, String message){ + jsonOutput = new JSONObject(); + switch (response){ + case JsonFields.responseSuccess -> { + jsonOutput.put(JsonFields.response, JsonFields.responseSuccess); + jsonOutput.put(JsonFields.responseMessage, message); + } + + case JsonFields.responseError -> { + jsonOutput.put(JsonFields.response, JsonFields.responseError); + jsonOutput.put(JsonFields.responseMessage, message); + } + } + } + + public JSONObject getJsonResponse(){ + return jsonOutput; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldAlreadyExistsException.java b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldAlreadyExistsException.java new file mode 100644 index 0000000..6b5020d --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldAlreadyExistsException.java @@ -0,0 +1,7 @@ +package com.andreicerbu.exceptions; + +public class FieldAlreadyExistsException extends Exception{ + public FieldAlreadyExistsException(String message){ + super(message); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldToUpdateNotExistingException.java b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldToUpdateNotExistingException.java new file mode 100644 index 0000000..ba57263 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/FieldToUpdateNotExistingException.java @@ -0,0 +1,7 @@ +package com.andreicerbu.exceptions; + +public class FieldToUpdateNotExistingException extends Exception{ + public FieldToUpdateNotExistingException(String message){ + super(message); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/InvalidCredentialsException.java b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/InvalidCredentialsException.java new file mode 100644 index 0000000..717eca9 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/InvalidCredentialsException.java @@ -0,0 +1,7 @@ +package com.andreicerbu.exceptions; + +public class InvalidCredentialsException extends Exception{ + public InvalidCredentialsException(String message){ + super(message); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/NotExistingUserException.java b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/NotExistingUserException.java new file mode 100644 index 0000000..b56abe9 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/NotExistingUserException.java @@ -0,0 +1,7 @@ +package com.andreicerbu.exceptions; + +public class NotExistingUserException extends Exception{ + public NotExistingUserException(){ + super("Incorrect credentials"); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProcessDoneException.java b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProcessDoneException.java new file mode 100644 index 0000000..88accc2 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProcessDoneException.java @@ -0,0 +1,7 @@ +package com.andreicerbu.exceptions; + +public class ProcessDoneException extends Exception{ + public ProcessDoneException(String message){ + super(message); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProductUnavailableAnymoreException.java b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProductUnavailableAnymoreException.java new file mode 100644 index 0000000..978d539 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/exceptions/ProductUnavailableAnymoreException.java @@ -0,0 +1,7 @@ +package com.andreicerbu.exceptions; + +public class ProductUnavailableAnymoreException extends Exception{ + public ProductUnavailableAnymoreException(String message){ + super(message); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/interfaces/JSONMethods.java b/Server Delivery Planner/src/main/java/com/andreicerbu/interfaces/JSONMethods.java new file mode 100644 index 0000000..4bbdf50 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/interfaces/JSONMethods.java @@ -0,0 +1,11 @@ +package com.andreicerbu.interfaces; + +import org.json.JSONObject; + +import java.sql.SQLException; + +public interface JSONMethods { + void createJSON() throws SQLException; + JSONObject getJSON(); + void deserializeJSON(JSONObject json); +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/AdminJson.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/AdminJson.java new file mode 100644 index 0000000..37f7227 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/AdminJson.java @@ -0,0 +1,47 @@ +package com.andreicerbu.items; + +import com.andreicerbu.interfaces.JSONMethods; +import com.andreicerbu.json.JsonFields; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +public class AdminJson extends BaseItem implements JSONMethods { + private List listOfValues = new ArrayList<>(); + private JSONArray listOfValuesJSON = new JSONArray(); + + public AdminJson(){} + + + @Override + public void createJSON() { + json.put(JsonFields.table, table == null ? JSONObject.NULL : table); + json.put(JsonFields.command, command == null ? JSONObject.NULL : command); + } + + @Override + public JSONObject getJSON() { + json.put(JsonFields.listOfValues,listOfValuesJSON); + return json; + } + + @Override + public void deserializeJSON(JSONObject json) { + table = json.get(JsonFields.table) == JSONObject.NULL ? null : json.getString(JsonFields.table); + command = json.getString(JsonFields.command) == JSONObject.NULL ? null : json.getString(JsonFields.command); + + JSONArray listOfValuesJSON = json.getJSONArray(JsonFields.listOfValues); + + for (int index = 0; index < listOfValuesJSON.length(); index++) { + JSONObject value = listOfValuesJSON.getJSONObject(index); + BaseItem item = deserializeBaseItemJSON(table, value); + this.listOfValues.add(item); + } + } + + public List getListOfValues() { + return listOfValues; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/BaseItem.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/BaseItem.java new file mode 100644 index 0000000..5a97e8d --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/BaseItem.java @@ -0,0 +1,144 @@ +package com.andreicerbu.items; + +import org.json.JSONObject; +import static com.andreicerbu.json.JsonFields.*; +import com.andreicerbu.json.JsonFields; +import com.andreicerbu.items.database.*; + +public abstract class BaseItem { + protected JSONObject json = new JSONObject(); + + protected Integer id_user_orders = null; + protected Integer id_user = null; + protected Integer id_order = null; + protected Integer id_deposit = null; + protected Integer id_prod_in_depo = null; + protected Integer id_product = null; + protected Integer id_route = null; + + protected Integer quantity = null; + protected String name = null; + protected String email = null; + protected String password = null; + protected Float lat_coord = null; + protected Float long_coord = null; + + protected String command = null; + protected String table = null; + protected String jsonType = null; + + + + protected BaseItem deserializeBaseItemJSON(String table, JSONObject json){ + BaseItem item; + + switch(table){ + case tableOrders -> item = new TableOrder( + json.get(JsonFields.id_order) == JSONObject.NULL ? null : json.getInt(JsonFields.id_order), + json.get(JsonFields.name) == JSONObject.NULL ? null : json.getString(JsonFields.name) + ); + case tableDeposits -> item = new TableDeposit( + json.get(JsonFields.id_deposit) == JSONObject.NULL ? null : json.getInt(JsonFields.id_deposit), + json.get(JsonFields.name) == JSONObject.NULL ? null : json.getString(JsonFields.name), + json.get(JsonFields.lat_coord) == JSONObject.NULL ? null : json.getFloat(JsonFields.lat_coord), + json.get(JsonFields.long_coord) == JSONObject.NULL ? null : json.getFloat(JsonFields.long_coord) + ); + case tableProdInDepo -> item = new TableProdInDepo( + json.get(JsonFields.id_prod_in_depo) == JSONObject.NULL ? null : json.getInt(JsonFields.id_prod_in_depo), + json.get(JsonFields.id_product) == JSONObject.NULL ? null : json.getInt(JsonFields.id_product), + json.get(JsonFields.id_deposit) == JSONObject.NULL ? null : json.getInt(JsonFields.id_deposit), + json.get(JsonFields.name) == JSONObject.NULL ? null : json.getString(JsonFields.name), + json.get(JsonFields.quantity) == JSONObject.NULL ? null : json.getInt(JsonFields.quantity) + + ); + case tableProducts -> item = new TableProduct( + json.get(JsonFields.id_product) == JSONObject.NULL ? null : json.getInt(JsonFields.id_product), + json.get(JsonFields.name) == JSONObject.NULL ? null : json.getString(JsonFields.name) + ); + case tableRoutes -> item = new TableRoute( + json.get(JsonFields.id_route) == JSONObject.NULL ? null : json.getInt(JsonFields.id_route), + json.get(JsonFields.name) == JSONObject.NULL ? null : json.getString(JsonFields.name), + json.get(JsonFields.id_order) == JSONObject.NULL ? null : json.getInt(JsonFields.id_order) + ); + + case tableUsers -> item = new TableUser( + json.get(JsonFields.id_user) == JSONObject.NULL ? null : json.getInt(JsonFields.id_user), + json.get(JsonFields.name) == JSONObject.NULL ? null : json.getString(JsonFields.name), + json.get(JsonFields.email) == JSONObject.NULL ? null : json.getString(JsonFields.email), + json.get(JsonFields.password) == JSONObject.NULL ? null : json.getString(JsonFields.password), + json.get(JsonFields.lat_coord) == JSONObject.NULL ? null : json.getFloat(JsonFields.lat_coord), + json.get(JsonFields.long_coord) == JSONObject.NULL ? null : json.getFloat(JsonFields.long_coord) + ); + + case tableUserOrders -> item = new TableUserOrder ( + json.get(JsonFields.id_user_orders) == JSONObject.NULL ? null : json.getInt(JsonFields.id_user_orders), + json.get(JsonFields.id_user) == JSONObject.NULL ? null : json.getInt(JsonFields.id_user), + json.get(JsonFields.id_order) == JSONObject.NULL ? null : json.getInt(JsonFields.id_order) + ); + + default -> item = null; + } + + return item; + } + + public Integer getId_user() { + return id_user; + } + + public Integer getId_user_orders() { + return id_user_orders; + } + + public Integer getId_prod_in_depo() { + return id_prod_in_depo; + } + + public Integer getId_route() { + return id_route; + } + + public Integer getId_product() { + return id_product; + } + + public Integer getId_deposit() { + return id_deposit; + } + + public Integer getId_order() { + return id_order; + } + + public Integer getQuantity() { + return quantity; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + public String getPassword() { + return password; + } + + public Float getLat_coord() { + return lat_coord; + } + + public Float getLong_coord() { + return long_coord; + } + + public String getCommand() { + return command; + } + + public String getTable() { + return table; + } +} \ No newline at end of file diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseClientJson.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseClientJson.java new file mode 100644 index 0000000..f45684f --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseClientJson.java @@ -0,0 +1,140 @@ +package com.andreicerbu.items; + +import com.andreicerbu.Database; +import com.andreicerbu.interfaces.JSONMethods; +import com.andreicerbu.items.database.*; +import com.andreicerbu.json.JsonFields; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.File; +import java.io.IOException; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class DatabaseClientJson implements JSONMethods { + JSONObject json = new JSONObject(); + Integer idUser; + + JSONArray listTableOrderJson; + JSONArray listTableProductJson; + JSONArray listTableProdInDepoJson; + JSONArray listTableUserJson; + + public DatabaseClientJson(Integer idUser){ + this.idUser = idUser; + } + + public void readDatabase() throws SQLException { + Connection conn = Database.getConnection(); + + listTableOrderJson = new JSONArray(); + listTableProductJson = new JSONArray(); + listTableUserJson = new JSONArray(); + listTableProdInDepoJson = new JSONArray(); + + populateListTableOrderJson(conn, idUser); + populateListTableProductJson(conn); + populateListTableUserJson(conn, idUser); + populateListTableProdInDepoJson(conn); + + Database.closeConnection(conn); + } + + @Override + public void createJSON() throws SQLException { + readDatabase(); + } + + @Override + public JSONObject getJSON() { + return json; + } + + @Override + public void deserializeJSON(JSONObject json) { + + } + + private void populateListTableOrderJson(Connection conn, Integer idUser) throws SQLException{ + PreparedStatement pstmt = conn.prepareStatement("SELECT id_order FROM user_orders WHERE id_user = ?"); + pstmt.setInt(1, idUser); + + ResultSet resultSet = pstmt.executeQuery(); + while(resultSet.next()){ + int id_order = resultSet.getInt("id_order"); + + Statement stmt = conn.createStatement(); + ResultSet resultSetPath = stmt.executeQuery("SELECT path_to_file FROM orders WHERE id = " + id_order); + resultSetPath.next(); + + String path_to_file = resultSetPath.getString("path_to_file"); + StringBuilder content = new StringBuilder(); + + try { + File myObj = new File(path_to_file); + Scanner myReader = new Scanner(myObj); + while (myReader.hasNextLine()) { + content.append(myReader.nextLine()); + } + }catch (IOException ignored){} + + JSONArray order = new JSONArray(content.toString()); + listTableOrderJson.put(order); + } + + json.put(JsonFields.tableOrders, listTableOrderJson); + } + + private void populateListTableProdInDepoJson(Connection conn) throws SQLException{ + Statement stmt = conn.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT * FROM prod_in_depo"); + while(resultSet.next()){ + JSONObject object = new JSONObject(); + object.put(JsonFields.id_prod_in_depo, resultSet.getInt("id")); + object.put(JsonFields.id_product, resultSet.getInt("id_product")); + object.put(JsonFields.id_deposit, resultSet.getInt("id_deposit")); + object.put(JsonFields.quantity, resultSet.getInt("quantity")); + + listTableProdInDepoJson.put(object); + } + + json.put(JsonFields.tableProdInDepo, listTableProdInDepoJson); + } + + private void populateListTableProductJson(Connection conn) throws SQLException{ + Statement stmt = conn.createStatement(); + ResultSet resultSet = stmt.executeQuery("SELECT * FROM products"); + while(resultSet.next()){ + JSONObject object = new JSONObject(); + object.put(JsonFields.id_product, resultSet.getInt("id")); + object.put(JsonFields.name, resultSet.getString("name")); + + listTableProductJson.put(object); + } + + json.put(JsonFields.tableProducts, listTableProductJson); + } + + private void populateListTableUserJson(Connection conn, Integer idUser) throws SQLException{ + PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM users WHERE id = ?"); + pstmt.setInt(1, idUser); + + ResultSet resultSet = pstmt.executeQuery(); + while(resultSet.next()){ + JSONObject object = new JSONObject(); + object.put(JsonFields.id_user, resultSet.getInt("id")); + object.put(JsonFields.name, resultSet.getString("username")); + object.put(JsonFields.email, resultSet.getString("email")); + object.put(JsonFields.password, resultSet.getString("password")); + object.put(JsonFields.lat_coord, resultSet.getString("lat_coord")); + object.put(JsonFields.long_coord, resultSet.getString("long_coord")); + + listTableUserJson.put(object); + } + + json.put(JsonFields.tableUsers, listTableUserJson); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseJson.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseJson.java new file mode 100644 index 0000000..3930f9a --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/DatabaseJson.java @@ -0,0 +1,218 @@ +package com.andreicerbu.items; + +import com.andreicerbu.Database; +import com.andreicerbu.interfaces.JSONMethods; +import com.andreicerbu.items.database.*; +import com.andreicerbu.json.JsonFields; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.File; +import java.io.IOException; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class DatabaseJson implements JSONMethods { + JSONObject json = new JSONObject(); + + JSONArray listTableDepositJson; + JSONArray listTableOrderJson; + JSONArray listTableProdInDepoJson; + JSONArray listTableProductJson; + JSONArray listTableRouteJson; + JSONArray listTableUserJson; + JSONArray listTableUserOrderJson; + + public DatabaseJson() { + } + + public void readDatabase() throws SQLException { + Connection conn = Database.getConnection(); + Statement stmt = conn.createStatement(); + + listTableDepositJson = new JSONArray(); + listTableOrderJson = new JSONArray(); + listTableProdInDepoJson = new JSONArray(); + listTableProductJson = new JSONArray(); + listTableRouteJson = new JSONArray(); + listTableUserJson = new JSONArray(); + listTableUserOrderJson = new JSONArray(); + + populateListTableDepositJson(stmt); + populateListTableOrderJson(stmt); + populateListTableProdInDepoJson(stmt); + populateListTableProductJson(stmt); + populateListTableRouteJson(stmt); + populateListTableUserJson(stmt); + populateListTableUserOrderJson(stmt); + + Database.closeConnection(conn); + } + + @Override + public void createJSON() throws SQLException { + readDatabase(); + } + + @Override + public JSONObject getJSON() { + return json; + } + + @Override + public void deserializeJSON(JSONObject json) { + + } + + private void populateListTableDepositJson(Statement stmt) throws SQLException { + ResultSet resultSet = stmt.executeQuery("SELECT * FROM deposits"); + while (resultSet.next()) { + JSONObject object = new JSONObject(); + object.put(JsonFields.id_deposit, resultSet.getInt("id")); + object.put(JsonFields.name, resultSet.getString("name")); + object.put(JsonFields.lat_coord, resultSet.getString("lat_coord")); + object.put(JsonFields.long_coord, resultSet.getString("long_coord")); + + listTableDepositJson.put(object); + } + + json.put(JsonFields.tableDeposits, listTableDepositJson); + } + + private void populateListTableOrderJson(Statement stmt) throws SQLException { + ResultSet resultSet = stmt.executeQuery("SELECT * FROM orders"); + + while (resultSet.next()) { + JSONObject item = new JSONObject(); + int id_order = resultSet.getInt("id"); + String fileName = getNameOfFileRoute(Database.getConnection(), id_order, "orders"); + String path_to_file = "D:\\Server Delivery Planner\\orders\\" + fileName + "_order.txt"; + + StringBuilder content = new StringBuilder(); + + try { + File myObj = new File(path_to_file); + Scanner myReader = new Scanner(myObj); + while (myReader.hasNextLine()) { + content.append(myReader.nextLine()); + } + } catch (IOException e) { + System.out.println(e.getMessage()); + System.out.flush(); + } + + item.put(JsonFields.id_order, id_order); + item.put(JsonFields.order, new JSONArray(content.toString())); + listTableOrderJson.put(item); + } + + resultSet.close(); + json.put(JsonFields.tableOrders, listTableOrderJson); + } + + private void populateListTableProdInDepoJson(Statement stmt) throws SQLException { + ResultSet resultSet = stmt.executeQuery("SELECT * FROM prod_in_depo"); + while (resultSet.next()) { + JSONObject object = new JSONObject(); + object.put(JsonFields.id_prod_in_depo, resultSet.getInt("id")); + object.put(JsonFields.id_product, resultSet.getInt("id_product")); + object.put(JsonFields.id_deposit, resultSet.getInt("id_deposit")); + object.put(JsonFields.quantity, resultSet.getInt("quantity")); + + listTableProdInDepoJson.put(object); + } + + json.put(JsonFields.tableProdInDepo, listTableProdInDepoJson); + } + + private void populateListTableProductJson(Statement stmt) throws SQLException { + ResultSet resultSet = stmt.executeQuery("SELECT * FROM products"); + while (resultSet.next()) { + JSONObject object = new JSONObject(); + object.put(JsonFields.id_product, resultSet.getInt("id")); + object.put(JsonFields.name, resultSet.getString("name")); + + listTableProductJson.put(object); + } + + json.put(JsonFields.tableProducts, listTableProductJson); + } + + private void populateListTableRouteJson(Statement stmt) throws SQLException { + ResultSet resultSet = stmt.executeQuery("SELECT id FROM routes"); + while (resultSet.next()) { + JSONObject item = new JSONObject(); + int id_route = resultSet.getInt("id"); + String fileName = getNameOfFileRoute(Database.getConnection(), id_route, "routes"); + String path_to_file = "D:\\Server Delivery Planner\\routes\\" + fileName + "_route.txt"; + StringBuilder content = new StringBuilder(); + + try { + File myObj = new File(path_to_file); + Scanner myReader = new Scanner(myObj); + while (myReader.hasNextLine()) { + content.append(myReader.nextLine()); + } + } catch (IOException ignored) { + } + + item.put(JsonFields.id_route, id_route); + item.put(JsonFields.route, new JSONObject(content.toString())); + listTableRouteJson.put(item); + } + + json.put(JsonFields.tableRoutes, listTableRouteJson); + } + + private void populateListTableUserJson(Statement stmt) throws SQLException { + ResultSet resultSet = stmt.executeQuery("SELECT * FROM users"); + while (resultSet.next()) { + JSONObject object = new JSONObject(); + object.put(JsonFields.id_user, resultSet.getInt("id")); + object.put(JsonFields.name, resultSet.getString("username")); + object.put(JsonFields.email, resultSet.getString("email")); + object.put(JsonFields.password, resultSet.getString("password")); + object.put(JsonFields.lat_coord, resultSet.getString("lat_coord")); + object.put(JsonFields.long_coord, resultSet.getString("long_coord")); + + listTableUserJson.put(object); + } + + json.put(JsonFields.tableUsers, listTableUserJson); + } + + private void populateListTableUserOrderJson(Statement stmt) throws SQLException { + ResultSet resultSet = stmt.executeQuery("SELECT * FROM user_orders"); + while (resultSet.next()) { + JSONObject object = new JSONObject(); + + object.put(JsonFields.id_user_orders, resultSet.getInt("id")); + object.put(JsonFields.id_user, resultSet.getInt("id_user")); + object.put(JsonFields.id_order, resultSet.getInt("id_order")); + + listTableUserOrderJson.put(object); + } + + json.put(JsonFields.tableUserOrders, listTableUserOrderJson); + } + + private static String getNameOfFileRoute(Connection conn, int id, String tableName) throws SQLException { + PreparedStatement pstmt = conn.prepareStatement("SELECT path_to_file FROM " + tableName + " WHERE id = ?"); + pstmt.setInt(1, id); + ResultSet resultSet1 = pstmt.executeQuery(); + resultSet1.next(); + + String resultStringToProcess = resultSet1.getString("path_to_file"); + int left, right = resultStringToProcess.indexOf('_'); + left = right; + + while (resultStringToProcess.charAt(left) != '\\') { + left--; + } + left++; + + return resultStringToProcess.substring(left, right); + } +} \ No newline at end of file diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/Order.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/Order.java new file mode 100644 index 0000000..4b3c91f --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/Order.java @@ -0,0 +1,51 @@ +package com.andreicerbu.items; + +import com.andreicerbu.interfaces.JSONMethods; +import com.andreicerbu.json.JsonFields; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +public class Order extends BaseItem implements JSONMethods { + List listOfProducts = new ArrayList<>(); + JSONArray listOfProductsJSON = new JSONArray(); + + public Order(){} + + public Order(Integer id_user){ + this.id_user = id_user; + } + + + @Override + public void createJSON() {} + + @Override + public JSONObject getJSON() { + json.put(JsonFields.id_user, id_user); + json.put(JsonFields.listOfProducts, listOfProductsJSON); + return json; + } + + @Override + public void deserializeJSON(JSONObject json) { + id_user = json.getInt(JsonFields.id_user); + + JSONArray listOfProducts = json.getJSONArray(JsonFields.listOfProducts); + for(int index = 0; index < listOfProducts.length(); index++){ + JSONObject product = listOfProducts.getJSONObject(index); + + this.listOfProducts.add(new ProductForOrder(product.getInt(JsonFields.id_product), product.getInt(JsonFields.quantity))); + } + } + + public List getListOfProducts() { + return listOfProducts; + } + + public void addProductToOrder(ProductForOrder product){ + listOfProductsJSON.put(product.getJSON()); + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/ProductForOrder.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/ProductForOrder.java new file mode 100644 index 0000000..b3519d1 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/ProductForOrder.java @@ -0,0 +1,36 @@ +package com.andreicerbu.items; + +import com.andreicerbu.interfaces.JSONMethods; +import com.andreicerbu.json.JsonFields; +import org.json.JSONObject; + +public class ProductForOrder extends BaseItem implements JSONMethods { + public ProductForOrder(Integer id_product, Integer quantity){ + this.id_product = id_product; + this.quantity = quantity; + + createJSON(); + } + + + @Override + public void createJSON() { + json.put(JsonFields.id_product, id_product); + json.put(JsonFields.quantity, quantity); + } + + @Override + public JSONObject getJSON() { + return json; + } + + @Override + public void deserializeJSON(JSONObject json){ + this.id_product = json.getInt(JsonFields.id_product); + this.quantity = json.getInt(JsonFields.quantity); + } + + public String toString(){ + return id_product + " " + quantity; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableDeposit.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableDeposit.java new file mode 100644 index 0000000..3d24f06 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableDeposit.java @@ -0,0 +1,12 @@ +package com.andreicerbu.items.database; + +import com.andreicerbu.items.BaseItem; + +public class TableDeposit extends BaseItem { + public TableDeposit(Integer id_deposit, String name, Float lat_coord, Float long_coord){ + this.id_deposit = id_deposit; + this.name = name; + this.lat_coord = lat_coord; + this.long_coord = long_coord; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableOrder.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableOrder.java new file mode 100644 index 0000000..8799477 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableOrder.java @@ -0,0 +1,10 @@ +package com.andreicerbu.items.database; + +import com.andreicerbu.items.BaseItem; + +public class TableOrder extends BaseItem { + public TableOrder(Integer id_order, String file_name){ + this.id_order = id_order; + this.name = file_name; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProdInDepo.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProdInDepo.java new file mode 100644 index 0000000..42c9a21 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProdInDepo.java @@ -0,0 +1,13 @@ +package com.andreicerbu.items.database; + +import com.andreicerbu.items.BaseItem; + +public class TableProdInDepo extends BaseItem { + public TableProdInDepo(Integer id_prod_in_depo, Integer id_product, Integer id_deposit, String prod_in_depo_name, Integer quantity){ + this.id_prod_in_depo = id_prod_in_depo; + this.id_product = id_product; + this.id_deposit = id_deposit; + this.name = prod_in_depo_name; + this.quantity = quantity; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProduct.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProduct.java new file mode 100644 index 0000000..a3e5c23 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableProduct.java @@ -0,0 +1,10 @@ +package com.andreicerbu.items.database; + +import com.andreicerbu.items.BaseItem; + +public class TableProduct extends BaseItem { + public TableProduct(Integer id_product, String name){ + this.id_product = id_product; + this.name = name; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableRoute.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableRoute.java new file mode 100644 index 0000000..d3fa820 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableRoute.java @@ -0,0 +1,11 @@ +package com.andreicerbu.items.database; + +import com.andreicerbu.items.BaseItem; + +public class TableRoute extends BaseItem { + public TableRoute(Integer id_route, String name, Integer id_order){ + this.id_route = id_route; + this.name = name; + this.id_order = id_order; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUser.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUser.java new file mode 100644 index 0000000..2c64225 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUser.java @@ -0,0 +1,15 @@ +package com.andreicerbu.items.database; + +import com.andreicerbu.items.BaseItem; + +public class TableUser extends BaseItem { + public TableUser(Integer id_user, String username, String email, String password, + Float lat_coord, Float long_coord){ + this.id_user = id_user; + this.name = username; + this.email = email; + this.password = password; + this.lat_coord = lat_coord; + this.long_coord = long_coord; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUserOrder.java b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUserOrder.java new file mode 100644 index 0000000..a163983 --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/items/database/TableUserOrder.java @@ -0,0 +1,11 @@ +package com.andreicerbu.items.database; + +import com.andreicerbu.items.BaseItem; + +public class TableUserOrder extends BaseItem { + public TableUserOrder(Integer id_user_orders, Integer id_user, Integer id_order){ + this.id_user_orders = id_user_orders; + this.id_user = id_user; + this.id_order = id_order; + } +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/json/JsonFields.java b/Server Delivery Planner/src/main/java/com/andreicerbu/json/JsonFields.java new file mode 100644 index 0000000..7cd5e4e --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/json/JsonFields.java @@ -0,0 +1,52 @@ +package com.andreicerbu.json; + +public class JsonFields { + public static final String response = "response"; + public static final String responseSuccess = "success"; + public static final String responseError = "error"; + public static final String responseMessage = "message"; + + public static final String id_user = "id_user"; + public static final String id_order = "id_order"; + public static final String id_deposit = "id_deposit"; + public static final String id_prod_in_depo = "id_prod_in_depo"; + public static final String id_product = "id_product"; + public static final String id_user_orders = "id_user_orders"; + public static final String id_route = "id_route"; + + public static final String quantity = "quantity"; + public static final String name = "name"; + public static final String oldName = "oldName"; + public static final String email = "email"; + public static final String password = "password"; + public static final String lat_coord = "lat_coord"; + public static final String long_coord = "long_coord"; + public static final String order = "order"; + public static final String route = "route"; + public static final String distance = "distance"; + + public static final String listOfProducts = "products"; + public static final String listOfDeposits = "deposits"; + public static final String listOfValues = "values"; + + public static final String destination = "destination"; + public static final String table = "table"; + public static final String tableOrders = "orders"; + public static final String tableDeposits = "deposits"; + public static final String tableProdInDepo = "prod_in_depo"; + public static final String tableProducts = "products"; + public static final String tableRoutes = "routes"; + public static final String tableUsers = "users"; + public static final String tableUserOrders = "user_orders"; + + public static final String command = "command"; + public static final String commandGetDatabase = "getDatabase"; + public static final String commandGetUserDatabase = "userDatabase"; + public static final String commandInsert = "insert"; + public static final String commandUpdate = "update"; + public static final String commandDelete = "delete"; + public static final String commandRegister = "register"; + public static final String commandLogin = "login"; + public static final String commandGetOrders = "getOrders"; + public static final String commandPlaceOrder = "placeOrder"; +} diff --git a/Server Delivery Planner/src/main/java/com/andreicerbu/test.java b/Server Delivery Planner/src/main/java/com/andreicerbu/test.java new file mode 100644 index 0000000..e6167cf --- /dev/null +++ b/Server Delivery Planner/src/main/java/com/andreicerbu/test.java @@ -0,0 +1,21 @@ +package com.andreicerbu; + +public class test { + public static void main (String[] args){ + float x1 = 258, y1 = 326; // user + + float x2 = 200, y2 = 320; + float x3 = 250, y3 = 280; + float x4 = 230, y4 = 310; + + System.out.println(calculateDistance(x1, y1, x2, y2)); + System.out.println(calculateDistance(x1, y1, x3, y3)); + System.out.println(calculateDistance(x1, y1, x4, y4)); + } + + public static float calculateDistance(float x1, float y1, float x2, float y2){ + return (float) Math.sqrt( + Math.pow(x2-x1, 2) + Math.pow(y2-y1, 2) + ); + } +} diff --git a/Server Delivery Planner/src/main/resources/META-INF/maven/archetype.xml b/Server Delivery Planner/src/main/resources/META-INF/maven/archetype.xml new file mode 100644 index 0000000..eb49f98 --- /dev/null +++ b/Server Delivery Planner/src/main/resources/META-INF/maven/archetype.xml @@ -0,0 +1,9 @@ + + Server_Delivery_Planner + + src/main/java/App.java + + + src/test/java/AppTest.java + + diff --git a/Server Delivery Planner/src/main/resources/archetype-resources/pom.xml b/Server Delivery Planner/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000..f1bb383 --- /dev/null +++ b/Server Delivery Planner/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,15 @@ + + 4.0.0 + $com.andreicerbu.deliveryplanner + $Server_Delivery_Planner + $1.0-SNAPSHOT + + + junit + junit + 3.8.1 + test + + + diff --git a/Server Delivery Planner/src/main/resources/archetype-resources/src/main/java/App.java b/Server Delivery Planner/src/main/resources/archetype-resources/src/main/java/App.java new file mode 100644 index 0000000..bfd334b --- /dev/null +++ b/Server Delivery Planner/src/main/resources/archetype-resources/src/main/java/App.java @@ -0,0 +1,13 @@ +package $com.andreicerbu.deliveryplanner; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/Server Delivery Planner/src/main/resources/archetype-resources/src/test/java/AppTest.java b/Server Delivery Planner/src/main/resources/archetype-resources/src/test/java/AppTest.java new file mode 100644 index 0000000..977e8ac --- /dev/null +++ b/Server Delivery Planner/src/main/resources/archetype-resources/src/test/java/AppTest.java @@ -0,0 +1,38 @@ +package $com.andreicerbu.deliveryplanner; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/Server Delivery Planner/target/classes/META-INF/maven/archetype.xml b/Server Delivery Planner/target/classes/META-INF/maven/archetype.xml new file mode 100644 index 0000000..eb49f98 --- /dev/null +++ b/Server Delivery Planner/target/classes/META-INF/maven/archetype.xml @@ -0,0 +1,9 @@ + + Server_Delivery_Planner + + src/main/java/App.java + + + src/test/java/AppTest.java + + diff --git a/Server Delivery Planner/target/classes/archetype-resources/pom.xml b/Server Delivery Planner/target/classes/archetype-resources/pom.xml new file mode 100644 index 0000000..f1bb383 --- /dev/null +++ b/Server Delivery Planner/target/classes/archetype-resources/pom.xml @@ -0,0 +1,15 @@ + + 4.0.0 + $com.andreicerbu.deliveryplanner + $Server_Delivery_Planner + $1.0-SNAPSHOT + + + junit + junit + 3.8.1 + test + + + diff --git a/Server Delivery Planner/target/classes/archetype-resources/src/main/java/App.java b/Server Delivery Planner/target/classes/archetype-resources/src/main/java/App.java new file mode 100644 index 0000000..bfd334b --- /dev/null +++ b/Server Delivery Planner/target/classes/archetype-resources/src/main/java/App.java @@ -0,0 +1,13 @@ +package $com.andreicerbu.deliveryplanner; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/Server Delivery Planner/target/classes/archetype-resources/src/test/java/AppTest.java b/Server Delivery Planner/target/classes/archetype-resources/src/test/java/AppTest.java new file mode 100644 index 0000000..977e8ac --- /dev/null +++ b/Server Delivery Planner/target/classes/archetype-resources/src/test/java/AppTest.java @@ -0,0 +1,38 @@ +package $com.andreicerbu.deliveryplanner; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/Algorithm.class b/Server Delivery Planner/target/classes/com/andreicerbu/Algorithm.class new file mode 100644 index 0000000000000000000000000000000000000000..092f2129662487002495f1b859022cbb00d15133 GIT binary patch literal 7178 zcmai333yc3b^h;YMsH^HB*BQm9@YUH&}xB=g)M;rYcaxF3<4>lw&^hQBn=+T$TLp{ zl2F@$(8f(tCw9}2)Q;n(p=koPTO%P8CuzDRX}YAXo35$Trkm3?-R&$!`OkfC7Hw4D z$D8}^yUSVr^Ph7sU%U3o7Xa*0LqT{@X25I0hjN8w$77Ggnp3g#XmkIu<5t{ODBqb( zC+)iw%4+Kd1MnkYAZVfjra~m18E=lI6Im-6x3b43oA;(hGufm)Hm=~yWD{0aA>5P6 zjy509Wzx<22m1S*W!q$-DihUMreGu!M<;VKwx*}Je|OrpMy;$K88T6W6$;*TY}`@^ zl?)rOv&r;^~hBwR?Em>Dw7^{hKfLIO{^2O z0@=)@ZSAMX(i=6gL3%3^R?beQV|LQ%zsbbS*rec3SQD9C(#|QYn5*mFY&LeP&A=9F zrWKpClc{Fi+mp=ML2O2u>`-r_0gVb(Dfae{bQIQG=18xn$qcS_3w0{4wJ(+%>y1qW z(d4YO&BU#^jTRb@P288wBqrl_cj8c{Pn)f}WHnCWVz*PUMZ6QlcI+^52kxYHcE&L= zwX3Zwv8HQy8QUi4*-2N|F8p3MXn^2ZKOZR$AZX&Qq?JnK{HT_d_L{gG?F8MZWfK5P zEZH4IC%O#WV`3k=^9IqVbx}i5JrYYzTKyvmD{H$;<<8?uw!7Cv4|=&>)*8<|LS$`T zOoI}oT=WL%w0;x!NywCCC)0i$REQ3A_H?!%iq=QF4)*s(1<|?a(7w)tozY|>x+}W7 z0*7$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2^q#uhe_@cfTo0K?b~&zQxPoLRorkDgH`7bc&pN~Lw|$nIZ&f&HW$l!H+K?Dm6~Y#ixL_+A zT*8+zz}t@x6?Y}_rQ_O!8@LI9SG==V5#&CE*C>CTCnH>?U0rkzA{u-ICEEH3m9143 z^Ep&K@NC|Ya@v4?gQ!F~s<4J}YEgq*p3L)rH}MvKNnM$Nz}wu*Xd3_CK`FnCDE_6V zQc8YXK>hFn8i%6~QJKSrIc%B3Q;7xa$e-*A&Y`t;0kPpZ?CztM@(mncdCz@RETDse z1An#VaIiBd)f#DVxNjauJ45Y_p&U-Nwdc^2LvIcPvx|Rs24@%l=nS@34_CjC!;7ng zKXe9vMXK7!;R@Fr%xHj6%r4%h_p5C=xPIL1EP{y#EUE)j9K8;2&EkT$-eIA@L(Fjv zK!SD?oB3^E8yX2p6Lw-FFW=47j^HR;b_Uzfi|x2b$tCQFp=%$1ga**oPSXAm;gM-D2bclA@Qf-o<;&`4Zdq zK0YA)*VwoZ=`l!ea`!QJb@&dq89^|YyS&5hk`^)A-NPrWhV9C?_fzhpD0_^Uf_eoz z6vP@P6m*Y=+rF8RM4aDTj!FA3s8oV4{{u}mhM52W literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/Database.class b/Server Delivery Planner/target/classes/com/andreicerbu/Database.class new file mode 100644 index 0000000000000000000000000000000000000000..e82204d7a4144a52a47be2bbeb459b15a0f1a529 GIT binary patch literal 20426 zcmc(H34D~*)%Q7fW-^n>0|^rX3?PgP7(zl+1T{f+kYK_V7C|fy$pi)`Ght@J;#wD6 zUh7s@tX8Y7DB8LQ0&Z=!Rohzi)wi}*t8KN5_HApmuE6_0_gUtd$%5ba{rp~pXYMn1 zJNGRAbMCo!e189)Cx~dedNfFiJbv;Th~$cEOnEp_c%GaD0iwY7;< zOEj@QmC4pkoOsmaS{Xh-29r0PN@W8ykcom+MuYqmGN_yeGY!!spm*);bbM1R-4snm z*TvFI1J=c|vr@?3DKo{g?S>oY_cb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QGtMEA;a!{k%p$uhq}% z_47vk+^(PB($8D<^EUnbj(*;$pWoBZ9r}5Xe%`B}-&glz1-MV39#9YAwnF%S0OQ91 AAOHXW literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/InitializeDatabase.class b/Server Delivery Planner/target/classes/com/andreicerbu/InitializeDatabase.class new file mode 100644 index 0000000000000000000000000000000000000000..fe70a5867bb4f9f201dd8f401a50b798e798b0db GIT binary patch literal 4791 zcmcgw`F9i775<)WJhD815nDoAI!Re1a1cu%tqml?7GRKNBiSY*i!+u6F(7Ho%!t^e zZ4#QMS-bE1PPeoLTEOjTPk-(&{SW$wc_AL=i!sf~bmq zDgJ2DswVYX$u`WQVb9f*V-z*@ih0=>)m?o~cMJiwXdAj~OzCqK!--&}fOft#R~)J? zIu|QL$z;VU>Xmbr;|}fHxBEa+Mi9Yjfgank+z8ePAd0nEr(nH`4cI8K!HbgG$x++9 zWZ2_+O)nd^z{;}Wj##xC12?Ujz<4~wQu7lkwqUEkY9F_} zOYo{jjUpT3p}?AaFRtw>;z-a}80=GZ!!`|vW%a|XyJjVsF&%ffA3HIq;4u}ukQ7+u zMc7;xh?uTn>#jvin@+vuu?C+O_F%7qeJUQuet}raLLefboYS4GvB1dLJ7=WE6DmH5 zPchk=$6gmC6zaHP1;cHP=+~_uhj3WIlPbG575I|{YT`ghjRm7vca7=!5;0?S?os~4 zSRY0(svxc6D2}yzT673CqqXXcxlvowN=~wIT!vxj)!_)n1U7litoc}%G^buH8jf?e zUa2fbaS|B?<0`V42x{MMgTTy7ixt^G_X=@F!6_~^+a`Z1lU^tq^RlU2Y=B)@SY{AfC-7)N0%Ptu<&k_Q-Hnb)c9Mk2( zeEWj5STD*2HuRd1hRsULLy6@c2(hITaxb+D`(C41z@mc7Dqg~;gZ61<#NF1bJ2EeU zt?_3{+wYN@D+>z2PL5jVG+^dH;N;cfaxd zoloaDwI);f{OO6@C?))%J?T$`COztp4xZ<&^|6}dHZQOf-q2~1Id60b^!p0aa%42s zB^Ai`%jwwk=TS{>tAe$_S5z_rO^*ot^vRWm7f&thqc3lkYr0#vnePdw$fpbqnf z)iYw1D7`vk){JbuI%nA41ed_d3;B$0n{sS7m_6<}lj&{AeDIB5+UC~aY~Ii|{~AR~ z%y3<|%e1yOJRX}h?Dwt<=>?8Z%53zb_ilQjYY?5RxXA16B8@q2mBV&jNHDlEQ%W$$ zmAoSsFO2K{9fkKM38j~qteEF6Yq_3Bz7Pbu3@Swq7AuXHPc(1U?V@p%lZXM`{l?iP zZ)$jiH=-`Ss@Cy^@I`zH0$(Q81^Ht5N{C)X`l}&&fX^GgDJZ)MUkmYHC;jyh{R-)C zgy=U&e=|g1A^oio{Tk_Shv>IReWS7K^x zRczokVmI*6bv)F)gpYQCKbG*Qz{%^_wuBu5nVn16EeP)}{x~4;4-Ad(7+k`^E}XuO zBeCN*apEdgW%>KDo5)G(&c8e>+znT;nT85GZsJ*wH7i;D8M1bgb&Zh>;RMEc@dt`H z%kMHSVUge6kcedYItF$VjXhY8eb|is)OZ3%_|`gsgVY?N%rIX8hj{IOk~WUf%2Tv* z1U0?}F7Y9>h*4Zd8n5EGhs@(FM3#vB4)1yXH{ zg_l043Ud!s1>^oz*vKldt`7pg1-l9V31$Ff2>&?YpCCl1m}{QkP7(goI8lzhS7*9W(QVp4f$aVMVN(FZ9N&d_jp_%oidtCtn!ojn(tF@!~Cf<_6}%TCYg0 pD^lwL@s_=T+->KVh0NcsAMSd4<{|}*7#JB(e literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/Main.class b/Server Delivery Planner/target/classes/com/andreicerbu/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..b3b115ad4a6c9470cb143eeba4c08f46cd38e8b7 GIT binary patch literal 805 zcmZva&2G~`5Xb);r`_0fn$WbNG<>vBz-gg|a}h#9AR##f$*2iwx~!aU%S&NMnCE zI+jtvu=qr!s(8v^dHn;9217T>5?`c;TB=CuQR#n(WhE7FQ zng43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NFArD4+kDTm3KFE1%wLp2ym`H1O)?zq&-Hb1{ zh0f?&VhJClcFVfW1W#5)jkMmEO^xZ+pf;A|O0ClYuCS4KhOX12yn~W@W@pqir?S&w zH@d?1QLs{UaBy~7U&Z`Hfqkxg3zj?=-C8mkGguKmyu)_kYn$>0a@B?=cHt7i$OLz!a#2C>?oa4kf zcja$lK1JSAb65Uyj+8;c15UKfjJ6bc26r*q4(_%PU@LiRBfJiR4D!}$=U;~dG{7@H z?mmm>2xbTEpT`Rv5sU}^MUE?I)x#H!D$Yw@;!+7-#w+}7caDL%v3 Q_=dZF?tF_m{D95>0hn+gBme*a literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/SocketInput.class b/Server Delivery Planner/target/classes/com/andreicerbu/SocketInput.class new file mode 100644 index 0000000000000000000000000000000000000000..40785f01e6f020cc42ff05da7bcdd9a660ef6fd4 GIT binary patch literal 5443 zcmbVQdvp}l8UNkMZf3I?AS{9s5Q0U?gRs6pAt;0ZH4qXc5DZ#jvO7rzW_OZ(AW_j4 zYq2j&i`r^yYinCX`%o*JXw+ICEwwLeTl>&ft*x!CkJEp8j^|iTfA`MrX0ut+$DT8D zpWk=C=kL3-&z^YXaR96Fb`ToMbodPTQ7%xm+uUo09W&k+?&#TVMN$IgEA6%sB zwyvuJ0aWM+8mNRJFel>1!e%_0uX-%R$mxKT?vrZs@Y zG~s|_My!rR)JjMOOALf@Ha%z!rcEbVWQ(i|>UIQhu0SPaTx+Jx9y4hLaK3<%PFjhv znPr|DiZ?aAP#}=7`s`%NN(8WiZgSi{JFa7;!0cj+HamT8!cO(af@s3U(l4t7POB{$ z5z;lySfiuGz*?;1zG7}UnFOX#<`y>|XPDY06JaL;y7fu#vvBqdTP)q%SuaXh#QaN&40}gS%v0wFYr1w&>_Iuoc?`rjNxe ziL5>=L9TmECvA1~3e2i)%?hj%F1v%`HeI%LS9;TqGZbXnU1?w^c2V+ygeytBg!GKHs6^}*9GcC_x-K0( z0v8q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jqchDFUy?R@lTtJq(Ih_)6{tqr|e2X<@Qu}8ZC1GI*tnTTl)`!3?zAYAQQCWwTi z3?bny0>&@#EBL8#C0@X<*^~JB8~m2NrG&2E;YIc?!7Q%IxdWVg3BPCW*8IN5^1Zhe zmp^dzL~f4qR^nw^*-vTZ8C<2T*)u4eoO_jXgR1vOna0}w9B{Gs8vaDsnxXB+pYb}O zi)qdOCaO zKJtHq55MI3CNzp5V@1Nr9R<+XPy~e+a9uleY;_six&Ei053p@$40U^OrJ#;*74hJT zP&d=(VQ8DA<0F4__{dtalmIa$^gT)Z)OOYX0aN~|?W|4N74jLkB1?gaXGXC+c`vPZ z75XuR6hD=($2B;B>u@uBx3eexUBmsWy%&K+mZvuqX0|An)aSu5wxewTh1 l_&ZuXyCBR~%IlX>-Or9DQ%aRa;KqU~=g(KUH`T7U{tY+c#@YY? literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/FieldAlreadyExistsException.class b/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/FieldAlreadyExistsException.class new file mode 100644 index 0000000000000000000000000000000000000000..152c2af0b12fda3d7fd8e7a7ec83f8eedbbe7306 GIT binary patch literal 427 zcmbVIO-sW-5PchCqOn@7=vi-mfVoMbQWR-V!Aqt0O|rz1WFxytsXxn;;K3izA0^IK zMM3c34h-`iZ$9=d-d(@s{p5e^1_EKFtd+%b!LQE?Q{rdL&0^k~h1OYZ;ggtB`VmQ1P4}#Z1SA4uGMRarp%HNLhe{qW=Mq&MS8)JN{6ihh0LX#~%9Y KUi*Xs9J~X|pmk0F literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/InvalidCredentialsException.class b/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/InvalidCredentialsException.class new file mode 100644 index 0000000000000000000000000000000000000000..6a671911d82daf164951b3a3489a42dfc1b268ec GIT binary patch literal 427 zcmbVIO-sW-5PchCqOn@7=vi-mfVoMbQiP%)1TU4|H^~r3l8tPV;@|Qlc<=}Kqr};& zCzju^%;d|T6Z?1OLiyh{c-t; zYsNl8anL;_As$Lz6*Lys@xjsY6V#(r9wN!kZ-~w**QDD0P@#u)L88Y7`iohcf;?=! E1OAF`NdN!< literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/NotExistingUserException.class b/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/NotExistingUserException.class new file mode 100644 index 0000000000000000000000000000000000000000..7422a1c010aba3f91e296be0c23313cded568001 GIT binary patch literal 411 zcmbVIO-sW-6r4@drp9VD#iO9N)`K}nPZbfQf)IMC=DyiH>PosRn{Dae@+5fh2l%7J z7gY4(#eFb4^O$`f`}Y3w3g8lhE&_pr8>6gqr2LU`RFd&pR&|UJ?FgM7B6I}?4{|Nj zN}5GF-6(qW+8Tk*xi;EgaE)R1W0-rV&0;djBg6t{$}UrBN=I6eD^@9ezpvAo_0x^6 zJ=^bUa=$9KhND~{ys{+;^fPT}wpteCZe>w%CdsUlRW6-w^j9+U_qrAsXaDFp5s2q@ z-}6Jt#~B5dvD z--2=LjV*`!lN3t?p$9bB2Vp=5Sfgoqw%Q$i}YoN?)3gz4Ol-4W|X`f^vns?GF`tSY^a|tf4>mT4xkt;~l|XWyAmg literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/ProductUnavailableAnymoreException.class b/Server Delivery Planner/target/classes/com/andreicerbu/exceptions/ProductUnavailableAnymoreException.class new file mode 100644 index 0000000000000000000000000000000000000000..9c1190ef4d1d3dc2f926aa8e461628a682e3c98c GIT binary patch literal 448 zcmbtRO-sZu5Phk&)w;U6qIXYzf&Brit0HaqpXEvL;1BReiIY`P z@ZiA&hIx-SZ!(kDx91lCM;IgsFcTx}VHT0V>W#dUX(dgWp580EZM8K5(Y`ji9SN*$ zW#58v>$E9{+mje`0td?0sWgQnt;pqFN?-L&df{x*srJgSxvpeh(Xn}`t)m}3!V_DN zKtI!l&bvA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~#(J3FcaN)chDTQ?c0-EUX8YhPbfwBNEeeac3cvB&w0Y&a7igqgtr zay%X4uFhS_+PTelWDf;LkwY&*rla0lrkKX8Q)vMxMHbMpMfT5VMnSr$f%pF;>%aVu sI@Blr#x#BH!z8UrgA`|~PMzeMtgA8x;WQZ!dw|@sKj8i$PXti>4@1iv1^@s6 literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/BaseItem.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/BaseItem.class new file mode 100644 index 0000000000000000000000000000000000000000..8c30b79e9127ba4332624868518f3e85a7878cd4 GIT binary patch literal 6834 zcmb7HTXa-c8UFT}nas&>xFuX$ghILGN`RJ2Nm}ly2_fMY5NbyG#W%=M*>XXam@eJ_4{pEJqfoP8k7n%VpO z|G&Tgy3fD&{PC0bKLD^1zfZytSkRs8Z?LmHc_-cN|=IA#?JOObaeGO-9>@2rgS!4d_W*pRlP5Xlt5)J-|Okw)6wp(OQ9Tz za!kgQB&J%JhUo(HgSOK}r@zp!*)BLOd=iLDX9Q-pX%sd}WtA3YV5Y#7bkCu|f|Ea# z%lA0>0$peuceEv2bb6h<0?f8BM*@-_Kq|Sz!kv<5lBe*J`6&zYB{M~4k28=fq>GY$ zmxYCrJ(cW%e6HtEI;+G|cDIGaC5V&_b}PtI3(HFC^SQyIBiB}2s8P(LgLbx>$XT_`-x5F~Srg|%2G zP@b`ihq`m*3QYHDY|iBDqEfitLZe)n%H*=W?oz4XehUvstw~m?pF2eIHd@%EY!~gW zj0$9ng{{iAEY;rQ15OIfcrb}iTWCS+4I9Rdfo>kL3rDu(dKe=w!51es}GvkO;uiL3MTdnSpJHb*e5gM)`9ZRP@_sepARy7a=Y;H zvjUTRJ12=p1giD>vd3oB+?x%1W$+zxr0#NDlE^B6duMCvRfP%sPbo`WWtw;lIv_6pA)E^ zNZPl$@1lwMCe}(1j^k8GJE`FUj;g%QtvDJsxaERkJ@O?h9g~ zF@+QOs*LD4f!2vd(xp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K@;XU{IjRwy0uSKHfJK zQ_Ow7yL-Yr2L&!^!4*O9K`r>Q7Q7$`enbl%(Snx*!ChML6)kvC5PVn*{<#)BF9`0_ zg5TGI=LW%9EqGK5t_p(lTJSG$Ra58MAo!RT{DBtS5Coslf`6$6uL^>n(t>}5Uu)c6 q9R#1!f`6k0-xmZws|A0kb-O7DeohO%rUh>Zf`_!=->P@-cmD^~V|Ane literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/DatabaseClientJson.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/DatabaseClientJson.class new file mode 100644 index 0000000000000000000000000000000000000000..fdd5d8852b4fbd4000d1517ea6ed214515ab0bf6 GIT binary patch literal 5451 zcmai233wFc8GdK8o7rrJ!9{a^ih?jsr8j!&s=St?6P+bj6B$z*(sJ<-8ZckR z0tKfbBH^@|`xkeXFl$IN+l@?y5$a;&1x?Miz5K3ptTYgpak_+XnN#a>Idv?Ag?6}S zDmV*`oRik`=2mqut##*8TF#DYUU@jyN-LTr3eFa*=DDjj<&0DzX`vy)U8Z2Um~e_a zK}0RAiqR$o&0=(cJ1UkZGM8ytL(BwRHunmn zF$L%0dQlxVWSwL*y$n#uM#_*RWWO3s0~=HpiRu3lS~_= zm77*!=VAqy2x2QaO-&W^AH-S-D|Zt)kq^xnnmhO#>1;T8%^NoF1bZqGm z_RdZU8Nzg~ga0%x*cvyASW9IbCP~5|} zP4sp0z)=*wE zSuzp=O^HNvuUOinU@NX7OxmcHESTEnf|eVTFyC7iTeN&3ZT4tpydHhHT1LNuYj7>O z?{4N!VMS-OQEoxexF(3}guf2XV)1~2>!H#UmZ9ZILp6jL)H);;q`)BOB$+|ei)xv3 zCG5f!wjl+>&{-fO>P|t3q-yr*<}ly#rkXMHRGOxQlL2p1>ai1P86yG>szNC+*F06N znyaNUav_KZktLv6)f^r$je#5Vv?fB&DaeDs)G>6M3KEvTvPrLZGIleh5*O^{>kE3C z^bMgPgq%rJtQooy+rTYD7{xv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UYwM~uq@uVWEo%ztfp z1Pj~7@v5!+j~-w3c;u6PJi*X%qBui<(y=(rztl&pH z4~b{J_z-I~K3$H)nMGE#8C3m6;{!Eo_H=!Q?XdA#=_%KB3AF@X%jX{IdL4DWp1Qt{ zhq!^?6K~|F!kf{DTLL;R^_d^@y(H#)$%cTJ)D@ZEUS?~4ee`($w8#4ct;XleHN3f~ zVNtyz@1OH||E2$d_ciUIHsi}hntxR`^JxBckLD2%xKRhV=lEn!l+Zbu;5|5w0KS0$ z-bMg#CxH7%@HdiTZz8$wAg%5qLGLCt?;*k8LW18*g1?Ofy^n764(w&9xD)T>=(|bq z{SMHBjE0p+Jr7s;RJM7!cBwqALvH8{wxYli}4i2G#N>*KuF z$NBmI&Ve+ztBekkZJnwQ&wF?cv>HDy$7@Xqub-CVMfkqu2REj!h%xTJQsL7)2qqi| zel9)b5VSan_b?&&Fd_H|A$Xh+Ji#+PNeDiUP51<2c#0Y7>44fRe6*e+Xlp~Y@i)f> zB>T_oAICpdX!Y8P+J>6?+Hs|3Zoe0GduosFKl;L+S|y$J+PJEb@-A5NJWI=e8uj=L z7T~iiV?R&6et~>_4y*7b7C~QT(eqUXzOOq<_qpeDN>mEMc7CE?%1FSLil}B*bu-Yb z+SD>?vH<6*D2pFSvJthMqcxPdP@T#ZwcKHmI*l#ODUIf%>L>?88s@rr^93h~9#IrM qD}dHCbvpN|QfDYBJ7-gq6)Z!~cAn=r&-2u3j)d9Usn)6s(C}}ZF8oXY literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/Order.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/Order.class new file mode 100644 index 0000000000000000000000000000000000000000..8d7018ad7ae47a8ea200e41f78e48a59b1699fa8 GIT binary patch literal 2386 zcmb7GZBrXn7(F)$-H>j02{b?{wA7}}3vFy|RS3ntSTr>hFbGm#>XKc;(y+nJrepo= zFY$|Cbw+~P8Ncg{f5;hM&fVRFB!n5A%sg}V?!D)n=RD87o8S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r#v*>iXAKmWe}8^BX+*cid6g)s*Oj592G z^1$U`R|($}YG>g3S{y{~I*&w)W(?zx{Lt5r8AdDBtqBw{VZnBA0S?2>{N$gM><&EL zl&Yh;LNVBW_m_UM$uQmCZ0c-V7Wp%y)%>IS#uV9J0Ne;x2p`})YH%}Wl-MyBm4 z!L@j?+1W6$GY&3emSJo!k|D$8wp2aW%v}@F+1V4Gu3MO6SRR&`L{Vtd7eO~F;)0C@ zT(z+1U;wOGMR=CEB9GHe^>YOtt+` zYzz)|gnGqy0@^9JrN@IUu6(mjH^=m@PXxEy=cL4!dFVdY$vQIM+!XSql3y+2?utkd zP2j(Y?;XQjCAY9u(p%Ir@q}T95YMWWIz=~lQx23Tn!Y*3%#ftJCV}DNx|BN7iuY5~ zrpED|jde6Ed~XW*1Hh)No||l(^4HV{FXI44NO3v(`yezwAz+(f6&if z-&AWx{r?hQ9rZ;{_|KX6(+6-)WP=C6CiRwj5zpu~u@%PPw8BuRM!=&;L>699Lphh1 zr`bZA8rO$I>47BL*{BVcgpH56zp;B)$ZK`U-rA&t|uKf!8i?_kyLyu)Pe7#Dx1 z?Gb!Q-&slkL5yL7{%n+BTGAxGqTQ7w9ry4xtq91pMFKZ7>SZx4wXc+}L(%59#o8a3 zF3;1~I>wdlc(p>`NwYd5F2&$wBAmum%*2EV_+m=Pa32p+aF<2{UNCTPX_BZn+`wEW zxp12N4IZY++e9@&aSOGz^87Kb{e_#xjJ5L0$zpO?*CJW4gezE%p=XoyQzI5kdyW;= z@hByE5ZeKi%)!lZ-(w9JmU=xSwUpwG;@kK@kMV@YBH=xy|0bT(%BEQhKjJ0k{{!O& Br)vNJ literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableDeposit.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableDeposit.class new file mode 100644 index 0000000000000000000000000000000000000000..cad40160d8b7557da25ee2e4b3dd78c610b2ecab GIT binary patch literal 643 zcmb7C%SyvQ6g|_Xt&P!I>$ARhH9oR&R}oPWD#eY`txS`lj-(k$rmp=Z7eR302l!Fq zowS93Ze-xj+%qTV-kdvM-yfd<&arEwfMNxfgA&RN+rAolJPKkVeG&IZp44KPco#eo z9Xc_TPh}+a8AGwP->YH<)e39}vv3#={{A@Nn)gY-yXXB-T#09uNX=l&;31eMjqVeF z;aKxS)aM=4u)ttNd?*+ebF@1h%V?0X79BLO#83^ne(;rw1BQBzdL1gR zGvm2${f@E5S(qfReXK%LgQG7`6=VPC}AZ=2qg&%+*% zrLkcGTKZ8Y3`gC6Sl6cZ@6;&v#kCBnR6XzOvGEamWL<#<3@}xkoAL?z)v?`HgN1Xc`X66w9zsK{g7C4cMeJiw(Lt87pBETa+0-Jp!s@ YPBgQue$&ha#SA0gNsFEsWd-c~0NY2Fc>n+a literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableOrder.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableOrder.class new file mode 100644 index 0000000000000000000000000000000000000000..497db37370227ada9ac6c776ee44a13fd22cd434 GIT binary patch literal 509 zcma)3O-sW-5Ph4bO$q1BH{E#ie=HOYr$RLq= z9Q1WgV=_JKyy2sUx`3-?N&=0QvSDtN9`^)Vtrhl1yh1Gt+atEQ%3`*u4V0#vX&RE5 z_hXH-NG2m`l9(XZp+?$_PBVi4;g7f&1Q&jQ zA0^&QD->}fft%#y-g6J<=JV_Q1HdVEY-Ervz;cj7o?*ie`yN+8B&08*PV7l7`UCHb z4@84b4EYnOq^>h$clTP8n80KKwu31+3`c(#2VCtyl?4ZY7ss>6LOaSfjXs0>wNm+S3_Q zEWswzr?3eJ>-1V5a#HRl-H6@%B#6sw|4eCCx#N9q{qHT|}~0UX|| AF8}}l literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableProduct.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableProduct.class new file mode 100644 index 0000000000000000000000000000000000000000..486e6fd4f272dcc748ff0462d1002fd126776040 GIT binary patch literal 505 zcmb7BO-sW-5Ph4bjg8UT*3XORtsiQBKt)7BC=?MY1y8a`mb#K`WV`Wyc_@Mhe}F$q zoUJY7;6)bR&OGM5otgdm{`drNi31-FDjwVbRn!;`<2(zwO04S*L!a3paZGbLw0(flsiH~P zqU^zb1>KF_J6Nwjhu1rqW8;k|2W`R@T*4ZmhsAOTw~0CWm0<_Fl#zk`4l=b7ZI9Fp Jdz3lY{{fCFceVfk literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableRoute.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableRoute.class new file mode 100644 index 0000000000000000000000000000000000000000..c8e1e2e552bfe5e7a3e1122dc70d3f69ee7ad359 GIT binary patch literal 556 zcma)3%SyvQ6g`usO&g=tw$>+tyEawx0TmGip-@~{=~gDmP)G8BY2tsmD1r+=z>gB| zq%CIQLIO8;4)>fh_srM#$0vYm9NREZv0yr=qQ-C%q_M}7Pzf0b<>#KvL_GIy_*{&r zW2jxqL}phEm0o|^KphPWwu22g4E?{!AtnP8~P@JTJ(_V|Uraxdb^ z%o`<{mT1g+R5WIfcM zlHF|@l3jBw6LFu%zEH)z^##&^M^mn(-eU!t*|VH8495T7eaK)>(p&}NPDa}3H z1WsvpgI)(<^i|QJx=W{sP?P>0_Z`d~EMU233v9aQ3+%iRZlFuGOAMe!lNO2;skUKb hk5G5X$370|L`wSINL_anb>Z64aiT)#A>js&egH>hfYJZ} literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableUser.class b/Server Delivery Planner/target/classes/com/andreicerbu/items/database/TableUser.class new file mode 100644 index 0000000000000000000000000000000000000000..dc64e71974a4f5cf78acccbb7ba6bdedd5455566 GIT binary patch literal 757 zcmb7C%Wl&^6g`tTapO+Y7q9SWDbSFbhd-bQA&@F6MQjS$Rug*^2Kj-;4*U{Z78Vi< zK7fxxoN-#@1q+a+nLEelo_puq`T6Vn4*)OlFhB=gAD%=HeSy8W$Rd>|R-0Jc`7$z< z&dTVeD)lKNf&Md-o9ekhcXBivU=0Hwfy6qbz~t}AiK^6`0?}JFPxZS}TLIrB=gTJA zoqkZCRFtZG5uN6hUTAylbcYg~*b?w^m1%*U7VWIECSNqH9f@7X>gi0G)a6~3xaN?x zkE$#`7dCO=4T%wM3Jg+JoyP@Hf$f&!Nm{6?5xgyN$1#Jn$QPH?eA41xHrawM8v0LU zRkW3~0*+?9^s6G_r8lQ0*Kd~DT-(MwXG0OIbf&CvUS5D+_1=^M;q+hqKc+p-{gt)B zS+TUSJ~1gv4*v}4shbN9=w63U1rYpt*yFm-(-)#X_i^|QB79WC4%SyvQ6o&sv)25BF)u!G-aMwm_9-u`;K_~=WsNI%HGSrbYfl1Y)9ESL`JXfPZ{*}~^(tb~k&3QJ!WVv+k-JQox4 z7#d@l%Ho2d)*nn;Xrg7ocCZ15VYpr#^MZ$zz<=OjA|7+0?o=!kLtDnPlEPW0e7WiYR^STJ+~nTp$T z5eii`%+L+8h$mC7q#j@e&EiQ?%YN{$p+^k%eO9VS+{lEAxxaUEuII-Ijc3sJ0E|u@ zF4-PM2~m^op7#dkoi1T{XG?5)!zH#}i5u7Aj*x^nkd5!*5{sg5v-H literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/json/JsonFields.class b/Server Delivery Planner/target/classes/com/andreicerbu/json/JsonFields.class new file mode 100644 index 0000000000000000000000000000000000000000..a865944dbaf2cf69fbc2b1a281f23984dfce8c6d GIT binary patch literal 1970 zcmaLXS69?P6bJA-)UbkBv5R0sRMy@*MbQ-yWbNW?GOmN!%$kDbTlwTUKKKFrP#*s? zN!h7nWLF%PGL0i`4hOCA%YE~B;>&j0B_1(~s zPHze7o;XqOCr{9*Z(3Cu1+mh;iW^yVJuy-BAs%yDg+U_7i&fG#QKAHGt94SYq_K{g z*98qtBbdr4t;;Y|9t{W@E{CjSzORzRqhUe)Ne+xC!?SU0Vvn{7>Q%PMMn1+c*+jaX z7}?5!mJZgkL}APb3Ij|WSnU>6fdbVwiB3J*i%f7kHo=;XT)#*A^OtOA=HsPXP@Xn6S&F&Gp-&l>rqiz;9TC(M$rk#Lp%N1Y3l0;u`j*t8N0WHJEtBLk%JS%x zpn*`PYrb)u!t|kunx)TRTv7fxG>a)OAVr|T0cSVl?qu+g8- zV*AUQR*}XAi<85F;3Bthkv*#8q87NX(iw@IGQqlDVo0;oA!wxYmQCGx^9`0@lb1bM zLhp3YCq$M=Wq{EUL)4teQAtdyO^DE-r); zig?X5HBKnRc7(QxFS}ECxgQ3X4U5YuXlwDtQYd}pIz7VYRcZe-F7vbr@KF!fbfgxt zRzt;4?FF!(x$$LKm$9}kI(yO&8YeMUL+1beFz`pHte7nJ)tt7;hCBa~Df{=JG3v*E zis&Tmp#iE8P6g_sL3oIHGrWa)E4-a~2Ry>O3*ODV2j0uP58lsw06xe(3Ljz~gU6W< z!$+8p!pE48!xPLW;7Mk?-c!t{;VI@Se1`cfe2)1%e1Z8Qe2Muoe1-Wce4Y6Qe2e)u ze3$tiJk2}<&oa-!514JfdFF?3joHrsn0WzSVtxXzFh7Os%+KKG%rD?q%&+0M%xkb@ zZomPvf}6}A;C1GYaEm#D+svPEQ}GE>AD#(rY}J{lck%~`@9qkxc-k;gH)VJZx^^#Z N&}T@{7d*S@>t8g)fWiO( literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/classes/com/andreicerbu/test.class b/Server Delivery Planner/target/classes/com/andreicerbu/test.class new file mode 100644 index 0000000000000000000000000000000000000000..8d7633c7dd9f5af48fd08044cb8480d32894a504 GIT binary patch literal 1003 zcmZuw%Wl&^6g}fOc9Obj<30j`0)2r~prJ1sNP$)j;i2%5in4)?K1g^a;f;hX3Gaa<29eQW8W_Ux ze`PoJ+o9WJwN{74N2*anuT^*)cz(DM2Cm&Kr7()DjuQq>A}28Hw3-Fm-wa&Oaf5oN z5V~#VW*ocWbQ*T(mc4dp`;IH1TNQr!N(!ejrsIr(vp6R(bW9g+-jh8WzJO{~@-=Oh zBavSUQ<&Cq-oOP|0_mffJg~zZO5ba}6o^~pa=tA0&KS6eORUm<9#EHR(a&YQwMj(- zRnK=HcA9lJcw*NZ^qAEamDlXRllGxg4R^e@z-aZjvzAz`X?qkpYCY{uEV?3&%k#HO z`5NPPu+99TW5NPTcTPZ5NcKsT?!06Yx(kv?=q^e|NNuz_f#X&@DK#l4JuAwQx%n~B?I zvSOx+s@YeJn?_MH`-{4nE+)QUU~+0Ys~%wFD^5jLHlEe~HT7(wXC5h-K!TN}P#yi` zBkVMWK3-5}1I#TznrvQss;{F)!;3}4>PeU0+GKKLqTqBDy>jra|p&~<1i7d{# zOIRV(_*mx{UuM5Cp6(`Dg1LOcho{};9+f?EQxjWnhcSMD$?3_z%sD{*-6uwS^GmZE m*oFTPJ7glIGrjCcAA_tb^~pKsB7O3Da*;lHMYm`vSp5TP8>)r? literal 0 HcmV?d00001 diff --git a/Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..b554552 --- /dev/null +++ b/Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,30 @@ +com\andreicerbu\Algorithm.class +com\andreicerbu\exceptions\NotExistingUserException.class +com\andreicerbu\items\database\TableDeposit.class +com\andreicerbu\items\Order.class +com\andreicerbu\items\AdminJson.class +com\andreicerbu\exceptions\FieldToUpdateNotExistingException.class +com\andreicerbu\Algorithm$1.class +com\andreicerbu\items\DatabaseJson.class +com\andreicerbu\exceptions\ProcessDoneException.class +com\andreicerbu\items\database\TableOrder.class +com\andreicerbu\ClientThread.class +com\andreicerbu\Database.class +com\andreicerbu\interfaces\JSONMethods.class +com\andreicerbu\test.class +com\andreicerbu\json\JsonFields.class +com\andreicerbu\exceptions\ProductUnavailableAnymoreException.class +com\andreicerbu\SocketInput.class +com\andreicerbu\items\ProductForOrder.class +com\andreicerbu\Server.class +com\andreicerbu\items\database\TableUserOrder.class +com\andreicerbu\items\BaseItem.class +com\andreicerbu\exceptions\FieldAlreadyExistsException.class +com\andreicerbu\items\database\TableProduct.class +com\andreicerbu\InitializeDatabase.class +com\andreicerbu\items\database\TableProdInDepo.class +com\andreicerbu\exceptions\InvalidCredentialsException.class +com\andreicerbu\items\database\TableUser.class +com\andreicerbu\items\database\TableRoute.class +com\andreicerbu\items\DatabaseClientJson.class +com\andreicerbu\Main.class diff --git a/Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..6ed28d7 --- /dev/null +++ b/Server Delivery Planner/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,29 @@ +D:\Server Delivery Planner\src\main\java\com\andreicerbu\ClientThread.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\interfaces\JSONMethods.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\database\TableProdInDepo.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\database\TableUserOrder.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\Algorithm.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\DatabaseJson.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\database\TableOrder.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\ProductForOrder.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\SocketInput.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\Main.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\Server.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\AdminJson.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\exceptions\ProductUnavailableAnymoreException.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\database\TableProduct.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\exceptions\FieldAlreadyExistsException.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\DatabaseClientJson.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\Order.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\BaseItem.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\Database.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\test.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\database\TableRoute.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\json\JsonFields.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\exceptions\FieldToUpdateNotExistingException.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\database\TableUser.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\exceptions\InvalidCredentialsException.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\exceptions\ProcessDoneException.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\items\database\TableDeposit.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\exceptions\NotExistingUserException.java +D:\Server Delivery Planner\src\main\java\com\andreicerbu\InitializeDatabase.java