@Test public void should_find_collection_by_processid_tenant() { populateDatabase(evidenceAuditReportEntryKO, evidenceAuditReportEntryOK, evidenceAuditReportEntryWARN); MongoCursor<Document> iterator = evidenceAuditRepository .findCollectionByProcessIdTenant(processId, TENANT_ID); List<Document> documents = new ArrayList<>(); while (iterator.hasNext()) { Document reportModel = iterator.next(); documents.add(reportModel); } assertThat(documents.size()).isEqualTo(3); }
public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return evidenceAuditReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(evidenceReportProjection()))) .allowDiskUse(true).iterator(); }
EvidenceAuditReportRepository extends ReportCommonRepository { public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return evidenceAuditReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(evidenceReportProjection()))) .allowDiskUse(true).iterator(); } }
EvidenceAuditReportRepository extends ReportCommonRepository { public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return evidenceAuditReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(evidenceReportProjection()))) .allowDiskUse(true).iterator(); } @VisibleForTesting  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  EvidenceAuditReportRepository(MongoDbAccess mongoDbAccess); }
EvidenceAuditReportRepository extends ReportCommonRepository { public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return evidenceAuditReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(evidenceReportProjection()))) .allowDiskUse(true).iterator(); } @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 MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return evidenceAuditReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(evidenceReportProjection()))) .allowDiskUse(true).iterator(); } @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; }