Updated files and created compose.yml for internal database usage
This commit is contained in:
@@ -3,15 +3,50 @@ package hhn.temp.project.provider;
|
||||
import hhn.temp.project.Task;
|
||||
import hhn.temp.project.Worker;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
public class SimpleDatabaseManager implements DatabaseManager {
|
||||
|
||||
private final static Path INSERT_TASK = Path.of("./src/main/resources/sql/InsertTaskTable.sql");
|
||||
private final static Path DELETE_TASK = Path.of("./src/main/resources/sql/DeleteTaskTable.sql");
|
||||
private final static Path SELECT_TASK = Path.of("./src/main/resources/sql/SelectTaskTable.sql");
|
||||
private final static Path UPDATE_TASK = Path.of("./src/main/resources/sql/UpdateTaskTable.sql");
|
||||
|
||||
private boolean connected = false;
|
||||
private Map<Integer, Task> temporaryTaskList = new HashMap();
|
||||
private Map<Integer, Worker> temporaryWorkerList = new HashMap<>();
|
||||
|
||||
public enum QueryMode {
|
||||
INSERT,
|
||||
SELECT,
|
||||
UPDATE,
|
||||
DELETE
|
||||
}
|
||||
|
||||
public String loadFile(QueryMode queryMode) throws IOException, URISyntaxException {
|
||||
switch (queryMode) {
|
||||
case INSERT -> {
|
||||
return Files.readString(INSERT_TASK);
|
||||
}
|
||||
case SELECT -> {
|
||||
|
||||
}
|
||||
case DELETE -> {
|
||||
|
||||
}
|
||||
case UPDATE -> {
|
||||
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveTask(Task task) throws SQLException {
|
||||
if (!connected) {
|
||||
|
||||
Reference in New Issue
Block a user