public EditReferralsAction(DAOFactory factory, long hcpid, String pidString) throws iTrustException { super(factory, hcpid, pidString); referralDAO = factory.getReferralDAO(); patientDAO = factory.getPatientDAO(); personnelDAO = factory.getPersonnelDAO(); }
/** * The super class validates the patient id * * @param factory The DAOFactory used to create the DAOs for this action. * @param loggedInMID The MID of the user who is authorizing this action. * @param pidString The MID of the patient being edited. * @throws ITrustException */ public EditPatientAction(DAOFactory factory, long loggedInMID, String pidString) throws ITrustException { super(factory, pidString); this.patientDAO = factory.getPatientDAO(); this.personnelDAO = factory.getPersonnelDAO(); this.authDAO = factory.getAuthDAO(); this.loggedInMID = loggedInMID; emailutil = new EmailUtil(factory); }
@Override protected void setUp() throws Exception { factor = new ChildhoodInfectionFactor(factory, 2L, 250.3, 487); gen = new TestDataGenerator(); gen.clearAllTables(); gen.hospitals(); gen.hcp0(); gen.patient2(); p = factory.getPatientDAO().getPatient(2L); }
public class PersonnelReportFilterTest extends TestCase { private DAOFactory factory = TestDAOFactory.getTestInstance(); private PatientDAO pDAO = factory.getPatientDAO(); private List<PatientBean> allPatients; private PersonnelReportFilter filter; private TestDataGenerator gen = new TestDataGenerator(); protected void setUp() throws Exception { gen.clearAllTables(); gen.standardData(); allPatients = pDAO.getAllPatients(); } public void testFilterByProcedure() throws Exception { filter = new PersonnelReportFilter(PersonnelReportFilterType.DLHCP, "Beaker Beaker", factory); List<PatientBean> res = filter.filter(allPatients); assertEquals(2, res.size()); assertTrue(res.get(0).getMID() == 22L); assertTrue(res.get(1).getMID() == 23L); } public void testFilterByProcedureNoResult() { filter = new PersonnelReportFilter(PersonnelReportFilterType.DLHCP, "Dalpe", factory); List<PatientBean> res = filter.filter(allPatients); assertTrue(res.isEmpty()); } public void testToString() { String expected = ""; filter = new PersonnelReportFilter(PersonnelReportFilterType.DLHCP, "val", factory); expected = "Filter by DECLARED HCP with value val"; assertEquals(expected, filter.toString()); } public void testFilterTypeFromString() { PersonnelReportFilterType expected = PersonnelReportFilterType.DLHCP; PersonnelReportFilterType actual = PersonnelReportFilter.filterTypeFromString("dLhCP"); assertEquals(expected, actual); } public void testGetFilterType() { filter = new PersonnelReportFilter(PersonnelReportFilterType.DLHCP, "city!", factory); PersonnelReportFilterType expected = PersonnelReportFilterType.DLHCP; assertEquals(expected, filter.getFilterType()); } public void testGetFilterValue() { filter = new PersonnelReportFilter(PersonnelReportFilterType.DLHCP, "city!", factory); String expected = "city!"; assertEquals(expected, filter.getFilterValue()); } }
/** * Accepts the DAO factory and the CSV stream from the view and parses it. * * @param factory The DAO factory * @param loggedInMID The MID of the HCP * @param CSVStream The CSV stream uploaded by the user * @throws CSVFormatException * @throws AddPatientFileExceptionTest */ public AddPatientFileAction(InputStream CSVStream, DAOFactory factory, long loggedInMID) throws CSVFormatException, AddPatientFileException { if (factory != null) { this.patientDAO = factory.getPatientDAO(); this.loggedInMID = loggedInMID; this.authDAO = factory.getAuthDAO(); } CSVParser parser = new CSVParser(CSVStream); CSVHeader = parser.getHeader(); CSVData = parser.getData(); errors = parser.getErrors(); buildMappings(CSVHeader); try { createPatients(); } catch (DBException e) { throw new AddPatientFileException("Database error while adding new patients!"); } }
/** * Super class validates the patient id * * @param factory The DAOFactory to be used in creating DAOs for this action. * @param loggedInMID The MID of the currently logged in user who is authorizing this action. * @param pidString The MID of the patient whose personal health records are being added. * @throws ITrustException * @throws NoHealthRecordsException */ public EditPHRAction(DAOFactory factory, long loggedInMID, String pidString) throws ITrustException { super(factory, pidString); this.patientDAO = factory.getPatientDAO(); this.allergyDAO = factory.getAllergyDAO(); this.familyDAO = factory.getFamilyDAO(); this.hrDAO = factory.getHealthRecordsDAO(); this.ovDAO = factory.getOfficeVisitDAO(); this.icdDAO = factory.getICDCodesDAO(); this.personnelDAO = factory.getPersonnelDAO(); this.HCPUAP = personnelDAO.getPersonnel(loggedInMID); this.patient = patientDAO.getPatient(pid); this.procDAO = factory.getProceduresDAO(); this.ndcodesDAO = factory.getNDCodesDAO(); // NEW this.loggingAction = new EventLoggingAction(factory); emailutil = new EmailUtil(factory); this.factory = factory; }
/** * Set up * * @param factory The DAOFactory used to create the DAOs used in this action. * @param loggedInMID The MID of the person retrieving the logs. */ public ViewMyAccessLogAction(DAOFactory factory, long loggedInMID) { this.loggedInMID = loggedInMID; this.transDAO = factory.getTransactionDAO(); this.patientDAO = factory.getPatientDAO(); }