- Added .gitignore

- Moved files
- Renamed packages
This commit is contained in:
Administrator 2021-06-07 13:59:23 +02:00
parent d85a49407b
commit c817ad6694
8 changed files with 25 additions and 14 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.idea/
out/
*.iml

View File

@ -1,4 +1,4 @@
package project; package de.dhbw.contactdb;
import java.time.LocalDateTime; import java.time.LocalDateTime;

View File

@ -1,6 +1,6 @@
package project; package de.dhbw.contactdb;
import project.utils.Parser; import de.dhbw.contactdb.utils.Parser;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -16,7 +16,7 @@ public class Main {
public static HashMap<Integer, Ort> orte = new HashMap<>(); public static HashMap<Integer, Ort> orte = new HashMap<>();
public static void main(String[] args) { public static void main(String[] args) {
Parser.parse("/project/db/contacts2021.db"); Parser.parse("/de/dhbw/contactdb/db/contacts2021.db");
if (args.length == 1) { if (args.length == 1) {
if (args[0].contains("--personensuche")) { if (args[0].contains("--personensuche")) {
@ -83,6 +83,7 @@ public class Main {
}); });
} else { } else {
// Outdoor // Outdoor
// TODO
} }
} }
}); });

View File

@ -1,4 +1,4 @@
package project; package de.dhbw.contactdb;
public class Ort { public class Ort {
private int id; private int id;

View File

@ -1,4 +1,4 @@
package project; package de.dhbw.contactdb;
public class Person { public class Person {
private int id; private int id;

View File

@ -1,22 +1,29 @@
package project.utils; package de.dhbw.contactdb.utils;
import project.Besuch; import de.dhbw.contactdb.Besuch;
import project.Main; import de.dhbw.contactdb.Main;
import project.Ort; import de.dhbw.contactdb.Ort;
import project.Person; import de.dhbw.contactdb.Person;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Objects;
public class Parser { public class Parser {
private static db_new_entity new_entity = null; private static db_new_entity new_entity = null;
public static void parse(String filename) { public static void parse(String filename) {
try (BufferedReader bf = new BufferedReader(new InputStreamReader(Objects.requireNonNull(Main.class.getResourceAsStream(filename))))) { InputStream db = Main.class.getResourceAsStream(filename);
if(db == null) {
System.err.println("Cannot find database!");
System.exit(-1);
}
try (BufferedReader bf = new BufferedReader(new InputStreamReader(db))) {
String line; String line;
while ((line = bf.readLine()) != null) { while ((line = bf.readLine()) != null) {
if (line.toLowerCase().contains("new_entity")) { if (line.toLowerCase().contains("new_entity")) {

View File

@ -1,4 +1,4 @@
package project.utils; package de.dhbw.contactdb.utils;
public enum db_new_entity { public enum db_new_entity {
PERSON, ORT, BESUCH PERSON, ORT, BESUCH