Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void run() {
before((request, response) -> response.header("Access-Control-Allow-Origin", "*"));

get("getById/:vocabulary/:id", (req, res) -> {
try (Connection connection = DriverManager.getConnection("jdbc:h2:~/.fsk/vocabularies")) {
try (Connection connection = DriverManager.getConnection("jdbc:h2:~/.fsk/vocabularies", "fsk", "fsk")) {
res.type("application/json");
BasicRepository<?> repository = getRepository(req.params(":vocabulary"), connection);
int id = Integer.parseInt(req.params(":id"));
Expand All @@ -155,15 +155,15 @@ public void run() {
}, jsonTransformer);

get("/getAll/:vocabulary", (req, res) -> {
try (Connection connection = DriverManager.getConnection("jdbc:h2:~/.fsk/vocabularies")) {
try (Connection connection = DriverManager.getConnection("jdbc:h2:~/.fsk/vocabularies", "fsk", "fsk")) {
res.type("application/json");
BasicRepository<?> repository = getRepository(req.params(":vocabulary"), connection);
return repository.getAll();
}
}, jsonTransformer);

get("/getAllNames/:vocabulary", (req, res) -> {
try (Connection connection = DriverManager.getConnection("jdbc:h2:~/.fsk/vocabularies")) {
try (Connection connection = DriverManager.getConnection("jdbc:h2:~/.fsk/vocabularies", "fsk", "fsk")) {
res.type("application/json");
BasicRepository<?> repository = getRepository(req.params(":vocabulary"), connection);
return repository.getAllNames();
Expand Down Expand Up @@ -397,6 +397,8 @@ private void initDatabase() throws SQLException, ClassNotFoundException {
fastImportProperties.put("CACHE_SIZE", 65536);
fastImportProperties.put("LOCK_MODE", 0);
fastImportProperties.put("UNDO_LOG", 0);
fastImportProperties.put("user", "fsk");
fastImportProperties.put("password", "fsk");

Class.forName("org.h2.Driver");
DeleteDbFiles.execute("~/.fsk", "vocabularies", true); // Delete DB if it exists
Expand Down