From 85cfe4fff9db3238a9a2005aa1863ac5f056d5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Tue, 7 May 2024 15:37:46 +0200 Subject: [PATCH] NOTICKET: Fix Javadoc Generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- pom.xml | 15 ++++++-- .../nhplus/datastorage/ConnectionBuilder.java | 3 +- .../java/de/hitec/nhplus/datastorage/Dao.java | 18 +++++----- .../hitec/nhplus/datastorage/DaoFactory.java | 17 +++++---- .../de/hitec/nhplus/datastorage/DaoImp.java | 16 +++++---- .../de/hitec/nhplus/fixtures/Fixture.java | 36 +++++++++++++++++-- .../de/hitec/nhplus/fixtures/Fixtures.java | 23 ++++++++---- 7 files changed, 94 insertions(+), 34 deletions(-) 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()); }