@Test public void test_extractMetaInfo() { final Datastore datastore = new Morphia().createDatastore(publisherConfig.getSourceMongoConfig().connectToMongo(), publisherConfig.getSourceMongoConfig().getDbName() ); final SourceDocumentReferenceMetaInfoDao metaInfoDao = new SourceDocumentReferenceMetaInfoDaoImpl(datastore); final List<String> ids = Arrays.asList("902b31943b4e66f5578539bfa60f2b82", "75a47a2953516381bd9d4d1220bdcfc3", "46787456ff68f404835064723a4d1cd9", "cc6103bee8aa27bfa11b851a2377a015", "764fff8f4654274f9cff28280d7e0008", "2d74ba5b07344f9587b5c67693fcb3a5" ); final List<SourceDocumentReferenceMetaInfo> metaInfos = europeanaDao.retrieveMetaInfo(ids); assertEquals(ids.size(), metaInfos.size()); for (final SourceDocumentReferenceMetaInfo metaInfo: metaInfos) { final SourceDocumentReferenceMetaInfo correctMetaInfo = metaInfoDao.read(metaInfo.getId()); ReflectionAssert.assertReflectionEquals(correctMetaInfo, metaInfo); } }
public List<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds) { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Retrieving metainfo for #" + sourceDocumentReferenceIds.size()); final Timer.Context context = PublisherMetrics.Publisher.Read.Mongo.mongoGetMetaInfoDuration.time(); try { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } return sourceDocumentReferenceMetaInfoDao.read(sourceDocumentReferenceIds); } finally { context.close(); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Done retrieving"); } }
PublisherEuropeanaDao { public List<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds) { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Retrieving metainfo for #" + sourceDocumentReferenceIds.size()); final Timer.Context context = PublisherMetrics.Publisher.Read.Mongo.mongoGetMetaInfoDuration.time(); try { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } return sourceDocumentReferenceMetaInfoDao.read(sourceDocumentReferenceIds); } finally { context.close(); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Done retrieving"); } } }
PublisherEuropeanaDao { public List<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds) { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Retrieving metainfo for #" + sourceDocumentReferenceIds.size()); final Timer.Context context = PublisherMetrics.Publisher.Read.Mongo.mongoGetMetaInfoDuration.time(); try { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } return sourceDocumentReferenceMetaInfoDao.read(sourceDocumentReferenceIds); } finally { context.close(); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Done retrieving"); } } PublisherEuropeanaDao(MongoConfig mongoConfig); }
PublisherEuropeanaDao { public List<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds) { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Retrieving metainfo for #" + sourceDocumentReferenceIds.size()); final Timer.Context context = PublisherMetrics.Publisher.Read.Mongo.mongoGetMetaInfoDuration.time(); try { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } return sourceDocumentReferenceMetaInfoDao.read(sourceDocumentReferenceIds); } finally { context.close(); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Done retrieving"); } } 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<SourceDocumentReferenceMetaInfo> retrieveMetaInfo(final Collection<String> sourceDocumentReferenceIds) { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Retrieving metainfo for #" + sourceDocumentReferenceIds.size()); final Timer.Context context = PublisherMetrics.Publisher.Read.Mongo.mongoGetMetaInfoDuration.time(); try { if (null == sourceDocumentReferenceIds || sourceDocumentReferenceIds.isEmpty()) { return Collections.EMPTY_LIST; } return sourceDocumentReferenceMetaInfoDao.read(sourceDocumentReferenceIds); } finally { context.close(); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA), "Done retrieving"); } } 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);  }