test_class.declarator: patientDao
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private PatientDao patientDao;
test_class.type: PatientDao
test_class.var_name: patientDao
test_class.file: pipeline/src/test/java/uk/ac/kcl/iop/brc/core/pipeline/dncpipeline/data/PatientDaoTest.java
test_class.identifier: PatientDaoTest
test_class.superclass: extends IntegrationTest
test_case.body: @Test
      public void shouldFetchPatientById() {
          patientDao.executeSQLQueryForSource("insert into tblPatient values(1, '123123', '1990-05-09')");
          patientDao.executeSQLQueryForSource("insert into tbldateOfBirths values(1, '1990-05-09')");
          patientDao.executeSQLQueryForSource("insert into tbldateOfBirths values(1, '1990-05-10')");
          patientDao.executeSQLQueryForSource("insert into tblnhsNumbers values(1, '123123')");
          patientDao.executeSQLQueryForSource("insert into tblnhsNumbers values(1, '444444')");
          patientDao.executeSQLQueryForSource("insert into tblPatientNames values('michael', 'gregorski', 1)");
          patientDao.executeSQLQueryForSource("insert into tblPatientNames values('micha', 'gregor', 1)");
          patientDao.executeSQLQueryForSource("insert into tblPatientAddresses values('address1', 'cb4 2za', 1)");
          patientDao.executeSQLQueryForSource("insert into tblPatientAddresses values('address2', 'cb1 2za', 1)");
          patientDao.executeSQLQueryForSource("insert into tblPatientPhoneNumbers values('213123', 1)");
          patientDao.executeSQLQueryForSource("insert into tblPatientPhoneNumbers values('0778', 1)");
          patientDao.executeSQLQueryForSource("insert into tblPatientCarers values('Richard', 'Jackson', 1)");
          patientDao.executeSQLQueryForSource("insert into tblPatientCarers values('Ismail', 'Kartoglu', 1)");
  
          Patient patient = patientDao.getPatient(1L);
  
          assertThat(patient.getForeNames().contains("michael"), equalTo(true));
          assertThat(patient.getSurnames().contains("gregorski"), equalTo(true));
          assertThat(patient.getNhsNumbers().contains("123123"), equalTo(true));
          assertThat(patient.getNhsNumbers().contains("444444"), equalTo(true));
          assertThat(patient.getPhoneNumbers().contains("0778"), equalTo(true));
          assertThat(patient.getAddresses().get(0).getAddress(), equalTo("address1"));
          assertThat(patient.getAddresses().get(0).getPostCode(), equalTo("cb4 2za"));
          assertThat(patient.getAddresses().get(1).getPostCode(), equalTo("cb1 2za"));
          assertThat(TimeUtil.getFormattedDate(patient.getDateOfBirths().get(0), "dd/MM/yyyy"), equalTo("09/05/1990"));
          assertThat(TimeUtil.getFormattedDate(patient.getDateOfBirths().get(1), "dd/MM/yyyy"), equalTo("10/05/1990"));
          List<PatientCarer> carers = patient.getCarers();
          assertThat(carers.size(), equalTo(2));
          assertThat(carers.get(0).getFirstName(), equalTo("Richard"));
          assertThat(carers.get(1).getFirstName(), equalTo("Ismail"));
          assertThat(carers.get(0).getLastName(), equalTo("Jackson"));
          assertThat(carers.get(1).getLastName(), equalTo("Kartoglu"));
      }
test_case.class_method_signature: PatientDaoTest.shouldFetchPatientById()
test_case.full_signature: @Test public void shouldFetchPatientById()
test_case.identifier: shouldFetchPatientById
test_case.invocations: executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource executeSQLQueryForSource getPatient assertThat contains getForeNames equalTo assertThat contains getSurnames equalTo assertThat contains getNhsNumbers equalTo assertThat contains getNhsNumbers equalTo assertThat contains getPhoneNumbers equalTo assertThat getAddress get getAddresses equalTo assertThat getPostCode get getAddresses equalTo assertThat getPostCode get getAddresses equalTo assertThat getFormattedDate get getDateOfBirths equalTo assertThat getFormattedDate get getDateOfBirths equalTo getCarers assertThat size equalTo assertThat getFirstName get equalTo assertThat getFirstName get equalTo assertThat getLastName get equalTo assertThat getLastName get equalTo
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldFetchPatientById()
focal_class.declarator: clobHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ClobHelper clobHelper;
focal_class.type: ClobHelper
focal_class.var_name: clobHelper
focal_class.declarator: logger = Logger.getLogger(PatientDao.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = Logger.getLogger(PatientDao.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: pipeline/src/main/java/uk/ac/kcl/iop/brc/core/pipeline/dncpipeline/data/PatientDao.java
focal_class.identifier: PatientDao
focal_class.class_method_signature: PatientDao.getPatient(Long id)
focal_class.full_signature: @Cacheable(value = "patients", key = "#id") public Patient getPatient(Long id)
focal_class.identifier: getPatient
focal_class.modifiers: @Cacheable(value = "patients", key = "#id") public
focal_class.parameters: (Long id)
focal_class.return: Patient
focal_class.signature: Patient getPatient(Long id)
focal_class.class_method_signature: PatientDao.setNhsNumbers(Patient patient)
focal_class.full_signature: private void setNhsNumbers(Patient patient)
focal_class.identifier: setNhsNumbers
focal_class.modifiers: private
focal_class.parameters: (Patient patient)
focal_class.return: void
focal_class.signature: void setNhsNumbers(Patient patient)
focal_class.class_method_signature: PatientDao.setDateOfBirths(Patient patient)
focal_class.full_signature: private void setDateOfBirths(Patient patient)
focal_class.identifier: setDateOfBirths
focal_class.modifiers: private
focal_class.parameters: (Patient patient)
focal_class.return: void
focal_class.signature: void setDateOfBirths(Patient patient)
focal_class.class_method_signature: PatientDao.setCarers(Patient patient)
focal_class.full_signature: private void setCarers(Patient patient)
focal_class.identifier: setCarers
focal_class.modifiers: private
focal_class.parameters: (Patient patient)
focal_class.return: void
focal_class.signature: void setCarers(Patient patient)
focal_class.class_method_signature: PatientDao.setPhoneNumbers(Patient patient)
focal_class.full_signature: private void setPhoneNumbers(Patient patient)
focal_class.identifier: setPhoneNumbers
focal_class.modifiers: private
focal_class.parameters: (Patient patient)
focal_class.return: void
focal_class.signature: void setPhoneNumbers(Patient patient)
focal_class.class_method_signature: PatientDao.setAddresses(Patient patient)
focal_class.full_signature: private void setAddresses(Patient patient)
focal_class.identifier: setAddresses
focal_class.modifiers: private
focal_class.parameters: (Patient patient)
focal_class.return: void
focal_class.signature: void setAddresses(Patient patient)
focal_class.class_method_signature: PatientDao.setNames(Patient patient)
focal_class.full_signature: private void setNames(Patient patient)
focal_class.identifier: setNames
focal_class.modifiers: private
focal_class.parameters: (Patient patient)
focal_class.return: void
focal_class.signature: void setNames(Patient patient)
focal_class.superclass: extends BaseDao
focal_method.body: @Cacheable(value = "patients", key = "#id")
      public Patient getPatient(Long id) {
          SessionWrapper sessionWrapper = getCurrentSourceSession();
          try {
              Query getPatient = sessionWrapper.getNamedQuery("getPatient");
              getPatient.setParameter("patientId", id);
              logger.info("Loading patient " + id);
              Patient patient = (Patient) getPatient.
                      setFirstResult(0).setMaxResults(1).
                      setResultTransformer(Transformers.aliasToBean(Patient.class)).uniqueResult();
  
              setNames(patient);
              setPhoneNumbers(patient);
              setAddresses(patient);
              setCarers(patient);
              setNhsNumbers(patient);
              setDateOfBirths(patient);
  
              return patient;
          } finally {
              sessionWrapper.closeSession();
          }
      }
focal_method.class_method_signature: PatientDao.getPatient(Long id)
focal_method.full_signature: @Cacheable(value = "patients", key = "#id") public Patient getPatient(Long id)
focal_method.identifier: getPatient
focal_method.invocations: getCurrentSourceSession getNamedQuery setParameter info uniqueResult setResultTransformer setMaxResults setFirstResult aliasToBean setNames setPhoneNumbers setAddresses setCarers setNhsNumbers setDateOfBirths closeSession
focal_method.modifiers: @Cacheable(value = "patients", key = "#id") public
focal_method.parameters: (Long id)
focal_method.return: Patient
focal_method.signature: Patient getPatient(Long id)