NOTICKET: Javadoc for Dao Implementations
This commit is contained in:
parent
7145f41be3
commit
817447239f
4 changed files with 39 additions and 5 deletions
|
@ -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),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue