NOTICKET: Javadoc for Dao Implementations
Some checks failed
Quality Check / Linting Check (push) Failing after 16s
Quality Check / Linting Check (pull_request) Failing after 21s
Quality Check / Javadoc Check (push) Successful in 34s
Quality Check / Javadoc Check (pull_request) Successful in 32s

This commit is contained in:
Dominik Säume 2024-05-14 23:22:31 +02:00
parent 7145f41be3
commit 817447239f
Signed by: SZUT-Dominik
GPG key ID: DACB4B96EB59ABA8
4 changed files with 39 additions and 5 deletions

View file

@ -13,6 +13,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The {@link MedicationDao} is an implementation of the {@link de.hitec.nhplus.datastorage.Dao Dao} for the {@link Medication} model.
*
* @author Bernd Heidemann
* @author Dominik Säume
*/
public class MedicationDao implements Dao<Medication> {
protected final Connection connection;
@ -153,6 +159,13 @@ public class MedicationDao implements Dao<Medication> {
preparedStatement.executeUpdate();
}
/**
* Constructs a {@link Medication} object from the {@link ResultSet} obtained after executing a database query.
* This method is used internally to map the {@link ResultSet} data to a {@link Medication} object.
*
* @param result The {@link ResultSet} containing the data retrieved from the database.
* @return A {@link Medication} object constructed from the {@link ResultSet} data.
*/
private Medication getInstanceFromResultSet(ResultSet result) throws SQLException {
Medication medication = new Medication(
result.getInt(1),

View file

@ -10,6 +10,11 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* The {@link NurseDao} is an implementation of the {@link de.hitec.nhplus.datastorage.Dao Dao} for the {@link Nurse} model.
*
* @author Dominik Säume
*/
public class NurseDao extends DaoImp<Nurse> {
public NurseDao(Connection connection) {
super(connection);

View file

@ -11,6 +11,12 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* The {@link PatientDao} is an implementation of the {@link de.hitec.nhplus.datastorage.Dao Dao} for the {@link Patient} model.
*
* @author Bernd Heidemann
* @author Dominik Säume
*/
public class PatientDao extends DaoImp<Patient> {
public PatientDao(Connection connection) {

View file

@ -2,6 +2,7 @@ package de.hitec.nhplus.treatment.database;
import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.datastorage.DaoImp;
import de.hitec.nhplus.patient.Patient;
import de.hitec.nhplus.treatment.Treatment;
import de.hitec.nhplus.utils.DateConverter;
@ -12,6 +13,12 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* The {@link TreatmentDao} is an implementation of the {@link de.hitec.nhplus.datastorage.Dao Dao} for the {@link Treatment} model.
*
* @author Bernd Heidemann
* @author Dominik Säume
*/
public class TreatmentDao extends DaoImp<Treatment> {
public TreatmentDao(Connection connection) {
@ -71,15 +78,18 @@ public class TreatmentDao extends DaoImp<Treatment> {
return list;
}
private PreparedStatement getReadAllTreatmentsOfOnePatientByPid(int patientId) throws SQLException {
/**
* Retrieves a list of {@link Treatment}s associated with a specific {@link Patient#id patient ID} from the database.
*
* @param patientId The {@link Patient#id ID} of the {@link Patient} whose {@link Treatment}s are to be retrieved.
* @return A {@link List} of {@link Treatment} objects associated with the specified {@link Patient} ID.
*/
public List<Treatment> readTreatmentsByPid(int patientId) throws SQLException {
final String SQL = "SELECT * FROM treatment WHERE patientId = ?";
PreparedStatement statement = this.connection.prepareStatement(SQL);
statement.setInt(1, patientId);
return statement;
}
public List<Treatment> readTreatmentsByPid(int patientId) throws SQLException {
ResultSet result = getReadAllTreatmentsOfOnePatientByPid(patientId).executeQuery();
ResultSet result = statement.executeQuery();
return getListFromResultSet(result);
}