@Test public void should_generate_statistic() { populateDatabase(evidenceAuditReportEntryKO); EvidenceAuditStatsModel stats = evidenceAuditRepository.stats(processId, TENANT_ID); assertThat(stats.getNbObjectGroups()).isEqualTo(1); }
public EvidenceAuditStatsModel stats(String processId, int tenantId) { Bson eqProcessId = eq(EvidenceAuditObjectModel.PROCESS_ID, processId); Bson eqTenant = eq(EvidenceAuditObjectModel.TENANT, tenantId); EvidenceAuditFullStatusCount globalResults = new EvidenceAuditFullStatusCount(new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount()); getNbObjects(match(and(eqProcessId, eqTenant)), globalResults); getMetadataTypeStats(globalResults, eqProcessId, eqTenant); return new EvidenceAuditStatsModel(globalResults.getObjectGroupsCount().getTotal(), globalResults.getUnitsCount().getTotal(), globalResults.getObjectsCount().getTotal(), globalResults); }
EvidenceAuditReportRepository extends ReportCommonRepository { public EvidenceAuditStatsModel stats(String processId, int tenantId) { Bson eqProcessId = eq(EvidenceAuditObjectModel.PROCESS_ID, processId); Bson eqTenant = eq(EvidenceAuditObjectModel.TENANT, tenantId); EvidenceAuditFullStatusCount globalResults = new EvidenceAuditFullStatusCount(new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount()); getNbObjects(match(and(eqProcessId, eqTenant)), globalResults); getMetadataTypeStats(globalResults, eqProcessId, eqTenant); return new EvidenceAuditStatsModel(globalResults.getObjectGroupsCount().getTotal(), globalResults.getUnitsCount().getTotal(), globalResults.getObjectsCount().getTotal(), globalResults); } }
EvidenceAuditReportRepository extends ReportCommonRepository { public EvidenceAuditStatsModel stats(String processId, int tenantId) { Bson eqProcessId = eq(EvidenceAuditObjectModel.PROCESS_ID, processId); Bson eqTenant = eq(EvidenceAuditObjectModel.TENANT, tenantId); EvidenceAuditFullStatusCount globalResults = new EvidenceAuditFullStatusCount(new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount()); getNbObjects(match(and(eqProcessId, eqTenant)), globalResults); getMetadataTypeStats(globalResults, eqProcessId, eqTenant); return new EvidenceAuditStatsModel(globalResults.getObjectGroupsCount().getTotal(), globalResults.getUnitsCount().getTotal(), globalResults.getObjectsCount().getTotal(), globalResults); } @VisibleForTesting  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess); }
EvidenceAuditReportRepository extends ReportCommonRepository { public EvidenceAuditStatsModel stats(String processId, int tenantId) { Bson eqProcessId = eq(EvidenceAuditObjectModel.PROCESS_ID, processId); Bson eqTenant = eq(EvidenceAuditObjectModel.TENANT, tenantId); EvidenceAuditFullStatusCount globalResults = new EvidenceAuditFullStatusCount(new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount()); getNbObjects(match(and(eqProcessId, eqTenant)), globalResults); getMetadataTypeStats(globalResults, eqProcessId, eqTenant); return new EvidenceAuditStatsModel(globalResults.getObjectGroupsCount().getTotal(), globalResults.getUnitsCount().getTotal(), globalResults.getObjectsCount().getTotal(), globalResults); } @VisibleForTesting  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess); void bulkAppendReport(List<EvidenceAuditObjectModel> reports); void deleteReportByIdAndTenant(String processId, int tenantId); ReportResults computeVitamResults(String processId, Integer tenantId); MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId); MongoCursor<Document> findCollectionByProcessIdTenantAndStatus(String processId, int tenantId,
        String... status); EvidenceAuditStatsModel stats(String processId, int tenantId); }
EvidenceAuditReportRepository extends ReportCommonRepository { public EvidenceAuditStatsModel stats(String processId, int tenantId) { Bson eqProcessId = eq(EvidenceAuditObjectModel.PROCESS_ID, processId); Bson eqTenant = eq(EvidenceAuditObjectModel.TENANT, tenantId); EvidenceAuditFullStatusCount globalResults = new EvidenceAuditFullStatusCount(new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount(), new EvidenceAuditStatusCount()); getNbObjects(match(and(eqProcessId, eqTenant)), globalResults); getMetadataTypeStats(globalResults, eqProcessId, eqTenant); return new EvidenceAuditStatsModel(globalResults.getObjectGroupsCount().getTotal(), globalResults.getUnitsCount().getTotal(), globalResults.getObjectsCount().getTotal(), globalResults); } @VisibleForTesting  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess); void bulkAppendReport(List<EvidenceAuditObjectModel> reports); void deleteReportByIdAndTenant(String processId, int tenantId); ReportResults computeVitamResults(String processId, Integer tenantId); MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId); MongoCursor<Document> findCollectionByProcessIdTenantAndStatus(String processId, int tenantId,
        String... status); EvidenceAuditStatsModel stats(String processId, int tenantId); static final String EVIDENCE_AUDIT; }