@Test (expected = IllegalArgumentException.class) public void test_extractDocuments_NullCursor () { europeanaDao.retrieveRecords(null, ""); }
public List<HarvesterRecord> retrieveRecords(final DBCursor cursor, final String publishingBatchId) { if (null == cursor) { throw new IllegalArgumentException("cursor cannot be null"); } final Map <String, List<HarvesterDocument>> harvesterDocuments = readingStatistics(cursor, publishingBatchId); final Map <String, List<HarvesterDocument>> lastStatsDocuments = readingStatistics(buildCursorLastStats (harvesterDocuments), publishingBatchId); for (final Map.Entry<String, List<HarvesterDocument>> documents: lastStatsDocuments.entrySet()) { if (!harvesterDocuments.containsKey(documents.getKey())) { harvesterDocuments.put(documents.getKey(), new ArrayList<HarvesterDocument>()); } for (final HarvesterDocument document: documents.getValue()) { harvesterDocuments.get(documents.getKey()).add(document.withUpdatedAt(null)); } } final Map<String, List<HarvesterDocument>> groupByRecordId = new HashMap<>(); for (final List<HarvesterDocument> documents: harvesterDocuments.values()) { for (final HarvesterDocument document: documents) { final String recordId = document.getReferenceOwner().getRecordId(); if (!groupByRecordId.containsKey(recordId)) { groupByRecordId.put(recordId, new ArrayList<HarvesterDocument>()); } groupByRecordId.get(recordId).add(document); } } final List<HarvesterRecord> records = new ArrayList<>(); for (final Map.Entry<String, List<HarvesterDocument>> entry: groupByRecordId.entrySet()) { HarvesterRecord record = new HarvesterRecord(); final List<HarvesterDocument> hasViewDocuments = new ArrayList<>(); for (final HarvesterDocument document: entry.getValue()) { if (URLSourceType.HASVIEW == document.getUrlSourceType()) hasViewDocuments.add(document); else record = record.with(document.getUrlSourceType(), document); } records.add(record.withHasViewDocuments(hasViewDocuments)); } return records; }
PublisherEuropeanaDao { public List<HarvesterRecord> retrieveRecords(final DBCursor cursor, final String publishingBatchId) { if (null == cursor) { throw new IllegalArgumentException("cursor cannot be null"); } final Map <String, List<HarvesterDocument>> harvesterDocuments = readingStatistics(cursor, publishingBatchId); final Map <String, List<HarvesterDocument>> lastStatsDocuments = readingStatistics(buildCursorLastStats (harvesterDocuments), publishingBatchId); for (final Map.Entry<String, List<HarvesterDocument>> documents: lastStatsDocuments.entrySet()) { if (!harvesterDocuments.containsKey(documents.getKey())) { harvesterDocuments.put(documents.getKey(), new ArrayList<HarvesterDocument>()); } for (final HarvesterDocument document: documents.getValue()) { harvesterDocuments.get(documents.getKey()).add(document.withUpdatedAt(null)); } } final Map<String, List<HarvesterDocument>> groupByRecordId = new HashMap<>(); for (final List<HarvesterDocument> documents: harvesterDocuments.values()) { for (final HarvesterDocument document: documents) { final String recordId = document.getReferenceOwner().getRecordId(); if (!groupByRecordId.containsKey(recordId)) { groupByRecordId.put(recordId, new ArrayList<HarvesterDocument>()); } groupByRecordId.get(recordId).add(document); } } final List<HarvesterRecord> records = new ArrayList<>(); for (final Map.Entry<String, List<HarvesterDocument>> entry: groupByRecordId.entrySet()) { HarvesterRecord record = new HarvesterRecord(); final List<HarvesterDocument> hasViewDocuments = new ArrayList<>(); for (final HarvesterDocument document: entry.getValue()) { if (URLSourceType.HASVIEW == document.getUrlSourceType()) hasViewDocuments.add(document); else record = record.with(document.getUrlSourceType(), document); } records.add(record.withHasViewDocuments(hasViewDocuments)); } return records; } }
PublisherEuropeanaDao { public List<HarvesterRecord> retrieveRecords(final DBCursor cursor, final String publishingBatchId) { if (null == cursor) { throw new IllegalArgumentException("cursor cannot be null"); } final Map <String, List<HarvesterDocument>> harvesterDocuments = readingStatistics(cursor, publishingBatchId); final Map <String, List<HarvesterDocument>> lastStatsDocuments = readingStatistics(buildCursorLastStats (harvesterDocuments), publishingBatchId); for (final Map.Entry<String, List<HarvesterDocument>> documents: lastStatsDocuments.entrySet()) { if (!harvesterDocuments.containsKey(documents.getKey())) { harvesterDocuments.put(documents.getKey(), new ArrayList<HarvesterDocument>()); } for (final HarvesterDocument document: documents.getValue()) { harvesterDocuments.get(documents.getKey()).add(document.withUpdatedAt(null)); } } final Map<String, List<HarvesterDocument>> groupByRecordId = new HashMap<>(); for (final List<HarvesterDocument> documents: harvesterDocuments.values()) { for (final HarvesterDocument document: documents) { final String recordId = document.getReferenceOwner().getRecordId(); if (!groupByRecordId.containsKey(recordId)) { groupByRecordId.put(recordId, new ArrayList<HarvesterDocument>()); } groupByRecordId.get(recordId).add(document); } } final List<HarvesterRecord> records = new ArrayList<>(); for (final Map.Entry<String, List<HarvesterDocument>> entry: groupByRecordId.entrySet()) { HarvesterRecord record = new HarvesterRecord(); final List<HarvesterDocument> hasViewDocuments = new ArrayList<>(); for (final HarvesterDocument document: entry.getValue()) { if (URLSourceType.HASVIEW == document.getUrlSourceType()) hasViewDocuments.add(document); else record = record.with(document.getUrlSourceType(), document); } records.add(record.withHasViewDocuments(hasViewDocuments)); } return records; } PublisherEuropeanaDao(MongoConfig mongoConfig); }
PublisherEuropeanaDao { public List<HarvesterRecord> retrieveRecords(final DBCursor cursor, final String publishingBatchId) { if (null == cursor) { throw new IllegalArgumentException("cursor cannot be null"); } final Map <String, List<HarvesterDocument>> harvesterDocuments = readingStatistics(cursor, publishingBatchId); final Map <String, List<HarvesterDocument>> lastStatsDocuments = readingStatistics(buildCursorLastStats (harvesterDocuments), publishingBatchId); for (final Map.Entry<String, List<HarvesterDocument>> documents: lastStatsDocuments.entrySet()) { if (!harvesterDocuments.containsKey(documents.getKey())) { harvesterDocuments.put(documents.getKey(), new ArrayList<HarvesterDocument>()); } for (final HarvesterDocument document: documents.getValue()) { harvesterDocuments.get(documents.getKey()).add(document.withUpdatedAt(null)); } } final Map<String, List<HarvesterDocument>> groupByRecordId = new HashMap<>(); for (final List<HarvesterDocument> documents: harvesterDocuments.values()) { for (final HarvesterDocument document: documents) { final String recordId = document.getReferenceOwner().getRecordId(); if (!groupByRecordId.containsKey(recordId)) { groupByRecordId.put(recordId, new ArrayList<HarvesterDocument>()); } groupByRecordId.get(recordId).add(document); } } final List<HarvesterRecord> records = new ArrayList<>(); for (final Map.Entry<String, List<HarvesterDocument>> entry: groupByRecordId.entrySet()) { HarvesterRecord record = new HarvesterRecord(); final List<HarvesterDocument> hasViewDocuments = new ArrayList<>(); for (final HarvesterDocument document: entry.getValue()) { if (URLSourceType.HASVIEW == document.getUrlSourceType()) hasViewDocuments.add(document); else record = record.with(document.getUrlSourceType(), document); } records.add(record.withHasViewDocuments(hasViewDocuments)); } return records; } PublisherEuropeanaDao(MongoConfig mongoConfig); DB getMongoDB(); List<HarvesterRecord> retrieveRecords(final DBCursor cursor, final String publishingBatchId); @Deprecated long countNumberOfDocumentUpdatedBefore(final DateTime dateFilter); List<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds); DBCursor buildCursorForDocumentStatistics(final int batchSize, final DateTime dateFilter); }
PublisherEuropeanaDao { public List<HarvesterRecord> retrieveRecords(final DBCursor cursor, final String publishingBatchId) { if (null == cursor) { throw new IllegalArgumentException("cursor cannot be null"); } final Map <String, List<HarvesterDocument>> harvesterDocuments = readingStatistics(cursor, publishingBatchId); final Map <String, List<HarvesterDocument>> lastStatsDocuments = readingStatistics(buildCursorLastStats (harvesterDocuments), publishingBatchId); for (final Map.Entry<String, List<HarvesterDocument>> documents: lastStatsDocuments.entrySet()) { if (!harvesterDocuments.containsKey(documents.getKey())) { harvesterDocuments.put(documents.getKey(), new ArrayList<HarvesterDocument>()); } for (final HarvesterDocument document: documents.getValue()) { harvesterDocuments.get(documents.getKey()).add(document.withUpdatedAt(null)); } } final Map<String, List<HarvesterDocument>> groupByRecordId = new HashMap<>(); for (final List<HarvesterDocument> documents: harvesterDocuments.values()) { for (final HarvesterDocument document: documents) { final String recordId = document.getReferenceOwner().getRecordId(); if (!groupByRecordId.containsKey(recordId)) { groupByRecordId.put(recordId, new ArrayList<HarvesterDocument>()); } groupByRecordId.get(recordId).add(document); } } final List<HarvesterRecord> records = new ArrayList<>(); for (final Map.Entry<String, List<HarvesterDocument>> entry: groupByRecordId.entrySet()) { HarvesterRecord record = new HarvesterRecord(); final List<HarvesterDocument> hasViewDocuments = new ArrayList<>(); for (final HarvesterDocument document: entry.getValue()) { if (URLSourceType.HASVIEW == document.getUrlSourceType()) hasViewDocuments.add(document); else record = record.with(document.getUrlSourceType(), document); } records.add(record.withHasViewDocuments(hasViewDocuments)); } return records; } PublisherEuropeanaDao(MongoConfig mongoConfig); DB getMongoDB(); List<HarvesterRecord> retrieveRecords(final DBCursor cursor, final String publishingBatchId); @Deprecated long countNumberOfDocumentUpdatedBefore(final DateTime dateFilter); List<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds); DBCursor buildCursorForDocumentStatistics(final int batchSize, final DateTime dateFilter);  }