@Test public void patientDataSummaryTagFilter() { persistMultipleTestEntities(PATIENT_DATA_COUNT); Filter filter = new Filter(); Set<String> tags = new HashSet<String>(); tags.add("NO_SUCH"); filter.setTags(tags); Summary summary = getTestDao().getPatientDataSummary(filter); verifyTotalSummary(summary); assertEquals(0, summary.getFilteredFileCount()); assertEquals(0, summary.getFilteredFileSize()); assertEquals(FileSizeUnit.B, summary.getFilteredFileSizeUnit()); assertEquals(0, summary.getFilteredPGUIDCount()); tags.add("Experimental"); filter.setTags(tags); summary = getTestDao().getPatientDataSummary(filter); verifyTotalSummary(summary); assertEquals(PATIENT_DATA_COUNT, summary.getFilteredFileCount()); assertEquals(2, summary.getFilteredFileSize()); assertEquals(FileSizeUnit.KB, summary.getFilteredFileSizeUnit()); assertEquals(PATIENT_DATA_COUNT, summary.getFilteredPGUIDCount()); }
@Transactional @Override public Summary getPatientDataSummary(Filter filter) { Summary summary = new Summary(); StringBuilder builder = generateQuery(filter, true, false); Query query = getEntityManager().createQuery(builder.toString()); PatientDataStats stats = (PatientDataStats) query.getSingleResult(); summary.setTotalFileCount(stats.getFileCount()); summary.setTotalPGUIDCount(stats.getGuidCount()); summary.setTotalFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setTotalFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); if (filter.valuesProvided()) { builder = generateQuery(filter, true, true); query = getEntityManager().createQuery(builder.toString()); populateQueryParams(filter, query); stats = (PatientDataStats) query.getSingleResult(); summary.setFilteredFileCount(stats.getFileCount()); summary.setFilteredPGUIDCount(stats.getGuidCount()); summary.setFilteredFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setFilteredFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); } return summary; }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @Transactional @Override public Summary getPatientDataSummary(Filter filter) { Summary summary = new Summary(); StringBuilder builder = generateQuery(filter, true, false); Query query = getEntityManager().createQuery(builder.toString()); PatientDataStats stats = (PatientDataStats) query.getSingleResult(); summary.setTotalFileCount(stats.getFileCount()); summary.setTotalPGUIDCount(stats.getGuidCount()); summary.setTotalFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setTotalFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); if (filter.valuesProvided()) { builder = generateQuery(filter, true, true); query = getEntityManager().createQuery(builder.toString()); populateQueryParams(filter, query); stats = (PatientDataStats) query.getSingleResult(); summary.setFilteredFileCount(stats.getFileCount()); summary.setFilteredPGUIDCount(stats.getGuidCount()); summary.setFilteredFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setFilteredFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); } return summary; } }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @Transactional @Override public Summary getPatientDataSummary(Filter filter) { Summary summary = new Summary(); StringBuilder builder = generateQuery(filter, true, false); Query query = getEntityManager().createQuery(builder.toString()); PatientDataStats stats = (PatientDataStats) query.getSingleResult(); summary.setTotalFileCount(stats.getFileCount()); summary.setTotalPGUIDCount(stats.getGuidCount()); summary.setTotalFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setTotalFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); if (filter.valuesProvided()) { builder = generateQuery(filter, true, true); query = getEntityManager().createQuery(builder.toString()); populateQueryParams(filter, query); stats = (PatientDataStats) query.getSingleResult(); summary.setFilteredFileCount(stats.getFileCount()); summary.setFilteredPGUIDCount(stats.getGuidCount()); summary.setFilteredFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setFilteredFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); } return summary; } @Inject  PatientDataJPADao(EntityManager em); }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @Transactional @Override public Summary getPatientDataSummary(Filter filter) { Summary summary = new Summary(); StringBuilder builder = generateQuery(filter, true, false); Query query = getEntityManager().createQuery(builder.toString()); PatientDataStats stats = (PatientDataStats) query.getSingleResult(); summary.setTotalFileCount(stats.getFileCount()); summary.setTotalPGUIDCount(stats.getGuidCount()); summary.setTotalFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setTotalFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); if (filter.valuesProvided()) { builder = generateQuery(filter, true, true); query = getEntityManager().createQuery(builder.toString()); populateQueryParams(filter, query); stats = (PatientDataStats) query.getSingleResult(); summary.setFilteredFileCount(stats.getFileCount()); summary.setFilteredPGUIDCount(stats.getGuidCount()); summary.setFilteredFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setFilteredFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); } return summary; } @Inject  PatientDataJPADao(EntityManager em); @SuppressWarnings("unchecked") @Transactional List<PatientData> getByAccountId(Long id); @Transactional @Override Summary getPatientDataSummary(Filter filter); @SuppressWarnings("unchecked") @Override List<FileInfo> getPatientData(Filter filter); @Override long normalizeFileSize(long size); }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @Transactional @Override public Summary getPatientDataSummary(Filter filter) { Summary summary = new Summary(); StringBuilder builder = generateQuery(filter, true, false); Query query = getEntityManager().createQuery(builder.toString()); PatientDataStats stats = (PatientDataStats) query.getSingleResult(); summary.setTotalFileCount(stats.getFileCount()); summary.setTotalPGUIDCount(stats.getGuidCount()); summary.setTotalFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setTotalFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); if (filter.valuesProvided()) { builder = generateQuery(filter, true, true); query = getEntityManager().createQuery(builder.toString()); populateQueryParams(filter, query); stats = (PatientDataStats) query.getSingleResult(); summary.setFilteredFileCount(stats.getFileCount()); summary.setFilteredPGUIDCount(stats.getGuidCount()); summary.setFilteredFileSize(normalizeFileSize(stats.getFileDataSize())); summary.setFilteredFileSizeUnit(FileSizeUnit.getUnit(stats.getFileDataSize())); } return summary; } @Inject  PatientDataJPADao(EntityManager em); @SuppressWarnings("unchecked") @Transactional List<PatientData> getByAccountId(Long id); @Transactional @Override Summary getPatientDataSummary(Filter filter); @SuppressWarnings("unchecked") @Override List<FileInfo> getPatientData(Filter filter); @Override long normalizeFileSize(long size);  }