@Test public void should_generate_vitamResults() throws InvalidParseOperationException { populateDatabase(evidenceAuditReportEntryKO, evidenceAuditReportEntryOK, evidenceAuditReportEntryWARN); ReportResults reportResult = evidenceAuditRepository.computeVitamResults(processId, TENANT_ID); assertThat(reportResult.getNbOk()).isEqualTo(2); assertThat(reportResult.getNbWarning()).isEqualTo(2); assertThat(reportResult.getNbKo()).isEqualTo(2); assertThat(reportResult.getTotal()).isEqualTo(6); }
public ReportResults computeVitamResults(String processId, Integer tenantId) { ReportResults reportResult = new ReportResults(); 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); reportResult.setNbOk(globalResults.getObjectGroupsCount().getNbOK() + globalResults.getUnitsCount().getNbOK() + globalResults.getObjectsCount().getNbOK()); reportResult.setNbKo(globalResults.getObjectGroupsCount().getNbKO() + globalResults.getUnitsCount().getNbKO() + globalResults.getObjectsCount().getNbKO()); reportResult.setNbWarning(globalResults.getObjectGroupsCount().getNbWARNING() + globalResults.getUnitsCount().getNbWARNING() + globalResults.getObjectsCount().getNbWARNING()); reportResult.setTotal(reportResult.getNbKo() + reportResult.getNbOk() + reportResult.getNbWarning()); return reportResult; }
EvidenceAuditReportRepository extends ReportCommonRepository { public ReportResults computeVitamResults(String processId, Integer tenantId) { ReportResults reportResult = new ReportResults(); 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); reportResult.setNbOk(globalResults.getObjectGroupsCount().getNbOK() + globalResults.getUnitsCount().getNbOK() + globalResults.getObjectsCount().getNbOK()); reportResult.setNbKo(globalResults.getObjectGroupsCount().getNbKO() + globalResults.getUnitsCount().getNbKO() + globalResults.getObjectsCount().getNbKO()); reportResult.setNbWarning(globalResults.getObjectGroupsCount().getNbWARNING() + globalResults.getUnitsCount().getNbWARNING() + globalResults.getObjectsCount().getNbWARNING()); reportResult.setTotal(reportResult.getNbKo() + reportResult.getNbOk() + reportResult.getNbWarning()); return reportResult; } }
EvidenceAuditReportRepository extends ReportCommonRepository { public ReportResults computeVitamResults(String processId, Integer tenantId) { ReportResults reportResult = new ReportResults(); 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); reportResult.setNbOk(globalResults.getObjectGroupsCount().getNbOK() + globalResults.getUnitsCount().getNbOK() + globalResults.getObjectsCount().getNbOK()); reportResult.setNbKo(globalResults.getObjectGroupsCount().getNbKO() + globalResults.getUnitsCount().getNbKO() + globalResults.getObjectsCount().getNbKO()); reportResult.setNbWarning(globalResults.getObjectGroupsCount().getNbWARNING() + globalResults.getUnitsCount().getNbWARNING() + globalResults.getObjectsCount().getNbWARNING()); reportResult.setTotal(reportResult.getNbKo() + reportResult.getNbOk() + reportResult.getNbWarning()); return reportResult; } @VisibleForTesting  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess); }
EvidenceAuditReportRepository extends ReportCommonRepository { public ReportResults computeVitamResults(String processId, Integer tenantId) { ReportResults reportResult = new ReportResults(); 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); reportResult.setNbOk(globalResults.getObjectGroupsCount().getNbOK() + globalResults.getUnitsCount().getNbOK() + globalResults.getObjectsCount().getNbOK()); reportResult.setNbKo(globalResults.getObjectGroupsCount().getNbKO() + globalResults.getUnitsCount().getNbKO() + globalResults.getObjectsCount().getNbKO()); reportResult.setNbWarning(globalResults.getObjectGroupsCount().getNbWARNING() + globalResults.getUnitsCount().getNbWARNING() + globalResults.getObjectsCount().getNbWARNING()); reportResult.setTotal(reportResult.getNbKo() + reportResult.getNbOk() + reportResult.getNbWarning()); return reportResult; } @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 ReportResults computeVitamResults(String processId, Integer tenantId) { ReportResults reportResult = new ReportResults(); 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); reportResult.setNbOk(globalResults.getObjectGroupsCount().getNbOK() + globalResults.getUnitsCount().getNbOK() + globalResults.getObjectsCount().getNbOK()); reportResult.setNbKo(globalResults.getObjectGroupsCount().getNbKO() + globalResults.getUnitsCount().getNbKO() + globalResults.getObjectsCount().getNbKO()); reportResult.setNbWarning(globalResults.getObjectGroupsCount().getNbWARNING() + globalResults.getUnitsCount().getNbWARNING() + globalResults.getObjectsCount().getNbWARNING()); reportResult.setTotal(reportResult.getNbKo() + reportResult.getNbOk() + reportResult.getNbWarning()); return reportResult; } @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; }