#22 story/medikamente-modul-grundimplementierung #34
4 changed files with 0 additions and 19 deletions
|
@ -21,7 +21,6 @@ public class ConnectionBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a Thread-safe {@link Connection} to the Database.
|
* @return a Thread-safe {@link Connection} to the Database.
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
synchronized public static Connection getConnection() {
|
synchronized public static Connection getConnection() {
|
||||||
try {
|
try {
|
||||||
|
@ -39,8 +38,6 @@ public class ConnectionBuilder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the Connection to the Database.
|
* Closes the Connection to the Database.
|
||||||
*
|
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
synchronized public static void closeConnection() {
|
synchronized public static void closeConnection() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -17,7 +17,6 @@ public interface Dao<T> {
|
||||||
* Create a Database Entry from a Model object.
|
* Create a Database Entry from a Model object.
|
||||||
*
|
*
|
||||||
* @param t the Model instance
|
* @param t the Model instance
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
void create(T t) throws SQLException;
|
void create(T t) throws SQLException;
|
||||||
|
|
||||||
|
@ -25,14 +24,11 @@ public interface Dao<T> {
|
||||||
* Read a Database Entry to a Model object.
|
* Read a Database Entry to a Model object.
|
||||||
*
|
*
|
||||||
* @param id of the Element in the Database
|
* @param id of the Element in the Database
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
T read(int id) throws SQLException;
|
T read(int id) throws SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read all Database Entries to a {@link List} of Model objects.
|
* Read all Database Entries to a {@link List} of Model objects.
|
||||||
*
|
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
List<T> readAll() throws SQLException;
|
List<T> readAll() throws SQLException;
|
||||||
|
|
||||||
|
@ -40,7 +36,6 @@ public interface Dao<T> {
|
||||||
* Update the Database according to the Values of the Model object.
|
* Update the Database according to the Values of the Model object.
|
||||||
*
|
*
|
||||||
* @param t the Model instance.
|
* @param t the Model instance.
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
void update(T t) throws SQLException;
|
void update(T t) throws SQLException;
|
||||||
|
|
||||||
|
@ -48,7 +43,6 @@ public interface Dao<T> {
|
||||||
* Delete a Database Entry.
|
* Delete a Database Entry.
|
||||||
*
|
*
|
||||||
* @param id of the Element in the Database.
|
* @param id of the Element in the Database.
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
void delete(int id) throws SQLException;
|
void delete(int id) throws SQLException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,12 @@ public class DaoFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Private Constructor according to the Singleton Pattern.
|
* A Private Constructor according to the Singleton Pattern.
|
||||||
*
|
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
private DaoFactory() {
|
private DaoFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@link DaoFactory}, the Singleton Instance
|
* @return {@link DaoFactory}, the Singleton Instance
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
public static DaoFactory getInstance() {
|
public static DaoFactory getInstance() {
|
||||||
if (DaoFactory.instance == null) {
|
if (DaoFactory.instance == null) {
|
||||||
|
@ -36,7 +33,6 @@ public class DaoFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a {@link TreatmentDao}
|
* @return a {@link TreatmentDao}
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
public TreatmentDao createTreatmentDao() {
|
public TreatmentDao createTreatmentDao() {
|
||||||
return new TreatmentDao(ConnectionBuilder.getConnection());
|
return new TreatmentDao(ConnectionBuilder.getConnection());
|
||||||
|
@ -44,7 +40,6 @@ public class DaoFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a {@link PatientDao}
|
* @return a {@link PatientDao}
|
||||||
* @author Bernd Heidemann
|
|
||||||
*/
|
*/
|
||||||
public PatientDao createPatientDAO() {
|
public PatientDao createPatientDAO() {
|
||||||
return new PatientDao(ConnectionBuilder.getConnection());
|
return new PatientDao(ConnectionBuilder.getConnection());
|
||||||
|
@ -52,7 +47,6 @@ public class DaoFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a {@link NurseDao}
|
* @return a {@link NurseDao}
|
||||||
* @author Dominik Säume
|
|
||||||
*/
|
*/
|
||||||
public NurseDao createNurseDAO() {
|
public NurseDao createNurseDAO() {
|
||||||
return new NurseDao(ConnectionBuilder.getConnection());
|
return new NurseDao(ConnectionBuilder.getConnection());
|
||||||
|
@ -60,7 +54,6 @@ public class DaoFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a {@link MedicationDao}
|
* @return a {@link MedicationDao}
|
||||||
* @author Dominik Säume
|
|
||||||
*/
|
*/
|
||||||
public MedicationDao createMedicationDAO() {
|
public MedicationDao createMedicationDAO() {
|
||||||
return new MedicationDao(ConnectionBuilder.getConnection());
|
return new MedicationDao(ConnectionBuilder.getConnection());
|
||||||
|
|
|
@ -3,9 +3,6 @@ package de.hitec.nhplus.medication.database;
|
||||||
import de.hitec.nhplus.datastorage.Dao;
|
import de.hitec.nhplus.datastorage.Dao;
|
||||||
import de.hitec.nhplus.medication.Ingredient;
|
import de.hitec.nhplus.medication.Ingredient;
|
||||||
import de.hitec.nhplus.medication.Medication;
|
import de.hitec.nhplus.medication.Medication;
|
||||||
|
|
||||||
import javax.sql.rowset.CachedRowSet;
|
|
||||||
import javax.sql.rowset.RowSetProvider;
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
Loading…
Reference in a new issue