@Test public void testComputeInitialStatistics() throws Exception { List<DocumentModel> folders = session.query("SELECT * FROM Document where ecm:mixinType = 'Folderish'"); for (DocumentModel folder : folders) { if (folder.hasFacet(DOCUMENTS_COUNT_STATISTICS_FACET)) { folder.removeFacet(DOCUMENTS_COUNT_STATISTICS_FACET); session.saveDocument(folder); } } String updaterName = "documentsCountUpdater"; quotaStatsService.launchInitialStatisticsComputation(updaterName, session.getRepositoryName(), null); TransactionHelper.commitOrRollbackTransaction(); WorkManager workManager = Framework.getService(WorkManager.class); String queueId = workManager.getCategoryQueueId(QuotaStatsInitialWork.CATEGORY_QUOTA_INITIAL); workManager.awaitCompletion(queueId, 10, TimeUnit.SECONDS); TransactionHelper.startTransaction(); testDocumentsCount(); }
@Override public void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path) { Map<String, String> folders = getFolders(session); Map<String, Count> documentsCountByFolder = computeDocumentsCountByFolder(session, folders); saveDocumentsCount(session, documentsCountByFolder); }
DocumentsCountUpdater extends AbstractQuotaStatsUpdater { @Override public void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path) { Map<String, String> folders = getFolders(session); Map<String, Count> documentsCountByFolder = computeDocumentsCountByFolder(session, folders); saveDocumentsCount(session, documentsCountByFolder); } }
DocumentsCountUpdater extends AbstractQuotaStatsUpdater { @Override public void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path) { Map<String, String> folders = getFolders(session); Map<String, Count> documentsCountByFolder = computeDocumentsCountByFolder(session, folders); saveDocumentsCount(session, documentsCountByFolder); }  }
DocumentsCountUpdater extends AbstractQuotaStatsUpdater { @Override public void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path) { Map<String, String> folders = getFolders(session); Map<String, Count> documentsCountByFolder = computeDocumentsCountByFolder(session, folders); saveDocumentsCount(session, documentsCountByFolder); }  @Override void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path); }
DocumentsCountUpdater extends AbstractQuotaStatsUpdater { @Override public void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path) { Map<String, String> folders = getFolders(session); Map<String, Count> documentsCountByFolder = computeDocumentsCountByFolder(session, folders); saveDocumentsCount(session, documentsCountByFolder); }  @Override void computeInitialStatistics(CoreSession session, QuotaStatsInitialWork currentWorker, String path); static final int BATCH_SIZE; }