@Test public void should_find_collection_by_processid_tenant() { populateDatabase(auditReportEntryKO); MongoCursor<Document> iterator = repository.findCollectionByProcessIdTenant(processId, TENANT_ID); List<Document> documents = new ArrayList<>(); while (iterator.hasNext()) { Document reportModel = iterator.next(); documents.add(reportModel); } assertThat(documents.size()).isEqualTo(1); }
public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return objectGroupReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(reportProjection()))) .allowDiskUse(true).iterator(); }
AuditReportRepository extends ReportCommonRepository { public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return objectGroupReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(reportProjection()))) .allowDiskUse(true).iterator(); } }
AuditReportRepository extends ReportCommonRepository { public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return objectGroupReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(reportProjection()))) .allowDiskUse(true).iterator(); } @VisibleForTesting  AuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  AuditReportRepository(MongoDbAccess mongoDbAccess); }
AuditReportRepository extends ReportCommonRepository { public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return objectGroupReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(reportProjection()))) .allowDiskUse(true).iterator(); } @VisibleForTesting  AuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  AuditReportRepository(MongoDbAccess mongoDbAccess); void bulkAppendReport(List<AuditObjectGroupModel> reports); void deleteReportByIdAndTenant(String processId, int tenantId); ReportResults computeVitamResults(String processId, Integer tenantId); MongoCursor<Document> findCollectionByProcessIdTenantAndStatus(String processId, int tenantId,
            String... status); MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId); AuditStatsModel stats(String processId, int tenantId); }
AuditReportRepository extends ReportCommonRepository { public MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId) { Bson eqProcessId = eq(AuditObjectGroupModel.PROCESS_ID, processId); Bson eqTenant = eq(AuditObjectGroupModel.TENANT, tenantId); return objectGroupReportCollection .aggregate(Arrays.asList(Aggregates.match(and(eqProcessId, eqTenant)), Aggregates.project(reportProjection()))) .allowDiskUse(true).iterator(); } @VisibleForTesting  AuditReportRepository(MongoDbAccess mongoDbAccess, String collectionName);  AuditReportRepository(MongoDbAccess mongoDbAccess); void bulkAppendReport(List<AuditObjectGroupModel> reports); void deleteReportByIdAndTenant(String processId, int tenantId); ReportResults computeVitamResults(String processId, Integer tenantId); MongoCursor<Document> findCollectionByProcessIdTenantAndStatus(String processId, int tenantId,
            String... status); MongoCursor<Document> findCollectionByProcessIdTenant(String processId, int tenantId); AuditStatsModel stats(String processId, int tenantId); static final String AUDIT_OBJECT_GROUP; }