diff --git a/.gitea/workflows/javadoc.yml b/.gitea/workflows/javadoc.yml index 928b391..ce04dcc 100644 --- a/.gitea/workflows/javadoc.yml +++ b/.gitea/workflows/javadoc.yml @@ -15,9 +15,7 @@ jobs: - name: "Checkout" uses: "https://git.euph.dev/actions/checkout@v3" - name: "javadoc" - run: | - mvn package - mvn javadoc:javadoc -f pom.xml + run: mvn package javadoc:javadoc -f pom.xml - name: "Deploy Javadoc" env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock diff --git a/.gitea/workflows/quality.yml b/.gitea/workflows/quality.yml index 0904003..1f899ab 100644 --- a/.gitea/workflows/quality.yml +++ b/.gitea/workflows/quality.yml @@ -5,13 +5,23 @@ on: - pull_request jobs: - qs: - name: "Qualty Check" + linting: + name: "Linting Check" runs-on: "ubuntu-latest" container: image: "git.euph.dev/actions/runner-java-21:latest" steps: - name: "Checkout" uses: "https://git.euph.dev/actions/checkout@v3" - - name: "CHECK" - run: mvn checkstyle:check -e \ No newline at end of file + - name: "Checkstyle Linting" + run: mvn checkstyle:check -e + javadoc: + name: "Javadoc Check" + runs-on: "ubuntu-latest" + container: + image: "git.euph.dev/actions/runner-java-21:latest" + steps: + - name: "Checkout" + uses: "https://git.euph.dev/actions/checkout@v3" + - name: "Generate Javadoc" + run: mvn package javadoc:javadoc -f pom.xml \ No newline at end of file diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index c1dd12f..0000000 Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index 40ca015..0000000 --- a/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,2 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8a13de1..e1374e6 100644 --- a/pom.xml +++ b/pom.xml @@ -21,12 +21,12 @@ org.openjfx javafx-controls - 20.0.1 + 21.0.2 org.openjfx javafx-fxml - 20.0.1 + 21.0.2 org.controlsfx @@ -112,11 +112,20 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.6.0 + 3.6.3 + 21 + 21 + true + all,-missing ${project.basedir} src/main/java javadoc_build + + + implSpec + + diff --git a/src/main/java/de/hitec/nhplus/datastorage/ConnectionBuilder.java b/src/main/java/de/hitec/nhplus/datastorage/ConnectionBuilder.java index 3b1bcf2..3945a3c 100644 --- a/src/main/java/de/hitec/nhplus/datastorage/ConnectionBuilder.java +++ b/src/main/java/de/hitec/nhplus/datastorage/ConnectionBuilder.java @@ -10,6 +10,7 @@ import java.sql.SQLException; * The {@link DaoFactory} allows a safe connection to the Database. * * @author Bernd Heidemann + * @author Dominik Säume * @version 1.0 */ public class ConnectionBuilder { @@ -20,7 +21,7 @@ public class ConnectionBuilder { private static Connection connection; /** - * @return a Thread-safe {@link Connection} to the Database. + * @return A Thread-safe {@link Connection} to the Database. */ synchronized public static Connection getConnection() { try { diff --git a/src/main/java/de/hitec/nhplus/datastorage/Dao.java b/src/main/java/de/hitec/nhplus/datastorage/Dao.java index 477faf5..8f70e87 100644 --- a/src/main/java/de/hitec/nhplus/datastorage/Dao.java +++ b/src/main/java/de/hitec/nhplus/datastorage/Dao.java @@ -5,44 +5,46 @@ import java.util.List; /** * {@link Dao} is the Abbreviation of Data-Access-Object. - * This Interface has the Basic Methods which are needed on any DAO to work as expected. + * This Interface has the Basic Methods which are needed on any {@link Dao} to work as expected. * - * @param The Model for which that DAO is implemented + * @param The Model for which that {@link Dao} is implemented. * @author Bernd Heidemann + * @author Dominik Säume * @version 1.0 - * @implSpec The Implementations should be added to the {@link DaoFactory} + * @implSpec The Implementations should be added to the {@link DaoFactory}. */ public interface Dao { + /** * Create a Database Entry from a Model object. * - * @param t the Model instance + * @param t The Model instance. */ void create(T t) throws SQLException; /** * Read a Database Entry to a Model object. * - * @param id of the Element in the Database + * @param id The ID of the Element in the Database. */ T read(int id) throws SQLException; /** - * Read all Database Entries to a {@link List} of Model objects. + * @return All Database Entries as a {@link List} of Model instances */ List readAll() throws SQLException; /** * Update the Database according to the Values of the Model object. * - * @param t the Model instance. + * @param t The Model instance. */ void update(T t) throws SQLException; /** * Delete a Database Entry. * - * @param id of the Element in the Database. + * @param id The ID of the Element in the Database. */ void delete(int id) throws SQLException; } diff --git a/src/main/java/de/hitec/nhplus/datastorage/DaoFactory.java b/src/main/java/de/hitec/nhplus/datastorage/DaoFactory.java index 5fcebc7..1bdbab9 100644 --- a/src/main/java/de/hitec/nhplus/datastorage/DaoFactory.java +++ b/src/main/java/de/hitec/nhplus/datastorage/DaoFactory.java @@ -6,9 +6,10 @@ import de.hitec.nhplus.patient.database.PatientDao; import de.hitec.nhplus.treatment.database.TreatmentDao; /** - * The {@link DaoFactory} is a Singleton({@link DaoFactory#getInstance}) which should be used to get {@link Dao}s. + * The {@link DaoFactory} is a Singleton({@link #getInstance}) which should be used to get {@link Dao}s. * * @author Bernd Heidemann + * @author Dominik Säume * @version 1.0 */ public class DaoFactory { @@ -22,7 +23,7 @@ public class DaoFactory { } /** - * @return {@link DaoFactory}, the Singleton Instance + * @return The Singleton Instance. */ public static DaoFactory getInstance() { if (DaoFactory.instance == null) { @@ -32,28 +33,32 @@ public class DaoFactory { } /** - * @return a {@link TreatmentDao} + * @return A new {@link TreatmentDao} Instance with a Database Connection. + * @see de.hitec.nhplus.treatment.Treatment Treatment */ public TreatmentDao createTreatmentDao() { return new TreatmentDao(ConnectionBuilder.getConnection()); } /** - * @return a {@link PatientDao} + * @return A new {@link PatientDao} Instance with a Database Connection. + * @see de.hitec.nhplus.patient.Patient Patient */ public PatientDao createPatientDAO() { return new PatientDao(ConnectionBuilder.getConnection()); } /** - * @return a {@link NurseDao} + * @return A new {@link NurseDao} Instance with a Database Connection. + * @see de.hitec.nhplus.nurse.Nurse Nurse */ public NurseDao createNurseDAO() { return new NurseDao(ConnectionBuilder.getConnection()); } /** - * @return a {@link MedicationDao} + * @return A new {@link MedicationDao} Instance with a Database Connection. + * @see de.hitec.nhplus.medication.Medication Medication */ public MedicationDao createMedicationDAO() { return new MedicationDao(ConnectionBuilder.getConnection()); diff --git a/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java b/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java index a9c7ff6..0d3af03 100644 --- a/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java +++ b/src/main/java/de/hitec/nhplus/datastorage/DaoImp.java @@ -10,16 +10,18 @@ import java.util.List; * The {@link DaoImp} is a Generic Base Implementation of the {@link Dao}, * which should fit most use cases. * - * @param The Model for which that DAO is implemented + * @param The Model for which that {@link Dao} is implemented. * @author Bernd Heidemann + * @author Dominik Säume * @version 1.0 - * @implSpec The Implementations should be added to the {@link DaoFactory} + * @implSpec The Implementations should be added to the {@link DaoFactory}. */ public abstract class DaoImp implements Dao { protected final Connection connection; /** - * @param connection a Database Connection, which should be gotten from {@link ConnectionBuilder} + * @param connection The Database Connection to use + * @implSpec The Connection should be Received from the {@link ConnectionBuilder}. */ public DaoImp(Connection connection) { this.connection = connection; @@ -28,7 +30,7 @@ public abstract class DaoImp implements Dao { /** * Creates a new Database Entry from a Model object. * - * @param t the Model instance + * @param t The Model instance. */ @Override public void create(T t) throws SQLException { @@ -38,7 +40,7 @@ public abstract class DaoImp implements Dao { /** * Read a Database Entry to a Model object. * - * @param id of the Element in the Database + * @param id The ID of the Element in the Database. */ @Override public T read(int id) throws SQLException { @@ -61,7 +63,7 @@ public abstract class DaoImp implements Dao { /** * Update the Database according to the Values of the Model object. * - * @param t the Model instance. + * @param t The Model instance. */ @Override public void update(T t) throws SQLException { @@ -71,7 +73,7 @@ public abstract class DaoImp implements Dao { /** * Delete a Database Entry. * - * @param id of the Element in the Database. + * @param id The ID of the Element in the Database. */ @Override public void delete(int id) throws SQLException { diff --git a/src/main/java/de/hitec/nhplus/fixtures/Fixture.java b/src/main/java/de/hitec/nhplus/fixtures/Fixture.java index 69d300e..4a2e03d 100644 --- a/src/main/java/de/hitec/nhplus/fixtures/Fixture.java +++ b/src/main/java/de/hitec/nhplus/fixtures/Fixture.java @@ -1,12 +1,44 @@ package de.hitec.nhplus.fixtures; +import de.hitec.nhplus.datastorage.ConnectionBuilder; + import java.sql.Connection; import java.sql.SQLException; import java.util.Map; -public interface Fixture -{ +/** + * A Fixture is a Class, which can be used to set up a specific set of Data. + * + * @param The Model for which the {@link Fixture} is implemented. + * @author Dominik Säume + * @version 1.0 + * @implSpec The Implementations should be added to the {@link Fixtures#main}. + */ +public interface Fixture { + + /** + * Drop all Dependent Tables. + * + * @param connection A Database {@link Connection}, which should be received from + * the {@link ConnectionBuilder#getConnection} + * @implSpec Use {@code IF EXISTS}, to ensure that it doesn't throw an {@link Exception}. + */ void dropTable(Connection connection) throws SQLException; + + /** + * Set up the Empty Tables with the Schema. + * + * @param connection A Database {@link Connection}, which should be received from + * the {@link ConnectionBuilder#getConnection} + */ void setupTable(Connection connection) throws SQLException; + + /** + * Loads all Model specific Data to the Database. + * + * @return A Map of Models with a {@link String} key, to be used by other {@link Fixture} + * @implSpec The {@link de.hitec.nhplus.datastorage.Dao Dao} should be received + * from {@link de.hitec.nhplus.datastorage.DaoFactory DaoFactory}. + */ Map load() throws SQLException; } diff --git a/src/main/java/de/hitec/nhplus/fixtures/Fixtures.java b/src/main/java/de/hitec/nhplus/fixtures/Fixtures.java index 9497632..d179ad5 100644 --- a/src/main/java/de/hitec/nhplus/fixtures/Fixtures.java +++ b/src/main/java/de/hitec/nhplus/fixtures/Fixtures.java @@ -6,14 +6,23 @@ import de.hitec.nhplus.patient.Patient; import java.sql.Connection; import java.util.Map; -public class Fixtures -{ - public static void main(String[] args) - { +/** + * A Class, Implementing an Entrypoint({@link #main}), for loading a Specific set of Data. + * + * @author Dominik Säume + * @version 1.0 + */ +public class Fixtures { + + /** + * An Entrypoint, for loading a Specific set of Data. + * + * @param args unused. + */ + public static void main(String[] args) { Connection connection = ConnectionBuilder.getConnection(); - try - { + try { PatientFixture patientFixture = new PatientFixture(); patientFixture.dropTable(connection); patientFixture.setupTable(connection); @@ -34,7 +43,7 @@ public class Fixtures medicationFixture.setupTable(connection); medicationFixture.load(); - } catch (Exception exception){ + } catch (Exception exception) { System.out.println(exception.getMessage()); }