@Test public void test_RetrieveSourceDocumentReferences_OneRecords() { final String recordId = "/04202/BibliographicResource_2000068285812"; final String collectionName = "04202_L_BE_UniLibGent_googlebooks"; final Map<String, EuropeanaRecord> record = new HashMap<>(); record.put(recordId, new EuropeanaRecord(recordId,"",collectionName, new Date())); final List<EuropeanaEDMObject> edmObjects = europeanaDao.retrieveAggregationEDMInformation(record,migrationBatchId); assertEquals (1, edmObjects.size()); final EuropeanaEDMObject edmObject = edmObjects.get(0); assertNull (edmObject.getEdmIsShownBy()); assertEquals ("http: assertEquals("http: assertNull(edmObject.getEdmHasViews()); }
public final List<EuropeanaEDMObject> retrieveAggregationEDMInformation(final Map<String, EuropeanaRecord> records,final String migratingBatchId) { final List<EuropeanaEDMObject> results = new ArrayList<>(); for (final Map.Entry<String, EuropeanaRecord> record : records.entrySet()) { final ReferenceOwner referenceOwner = getReferenceOwner(record,migratingBatchId); final DBObject aggregation = getAggregation("/aggregation/provider" + record.getKey(),migratingBatchId); if (null == aggregation) { MigrationMetrics.Migrator.Overall.invalidAggregationCounter.inc(); LOG.error(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId, "", referenceOwner), "Missing aggregation: /aggregation/provider" + record.getKey()); continue; } final String edmObject = (String) aggregation.get("edmObject"); final BasicDBList hasViews = (BasicDBList) aggregation.get("hasView"); final String edmIsShownBy = (String) aggregation.get("edmIsShownBy"); final String edmIsShownAt = (String) aggregation.get("edmIsShownAt"); final List<String> edmHasViews = null == hasViews ? null : Arrays.asList(hasViews.toArray(new String[hasViews.size()])); results.add(new EuropeanaEDMObject(referenceOwner, edmObject, edmIsShownBy, edmIsShownAt, edmHasViews)); } return results; }
MigratorEuropeanaDao { public final List<EuropeanaEDMObject> retrieveAggregationEDMInformation(final Map<String, EuropeanaRecord> records,final String migratingBatchId) { final List<EuropeanaEDMObject> results = new ArrayList<>(); for (final Map.Entry<String, EuropeanaRecord> record : records.entrySet()) { final ReferenceOwner referenceOwner = getReferenceOwner(record,migratingBatchId); final DBObject aggregation = getAggregation("/aggregation/provider" + record.getKey(),migratingBatchId); if (null == aggregation) { MigrationMetrics.Migrator.Overall.invalidAggregationCounter.inc(); LOG.error(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId, "", referenceOwner), "Missing aggregation: /aggregation/provider" + record.getKey()); continue; } final String edmObject = (String) aggregation.get("edmObject"); final BasicDBList hasViews = (BasicDBList) aggregation.get("hasView"); final String edmIsShownBy = (String) aggregation.get("edmIsShownBy"); final String edmIsShownAt = (String) aggregation.get("edmIsShownAt"); final List<String> edmHasViews = null == hasViews ? null : Arrays.asList(hasViews.toArray(new String[hasViews.size()])); results.add(new EuropeanaEDMObject(referenceOwner, edmObject, edmIsShownBy, edmIsShownAt, edmHasViews)); } return results; } }
MigratorEuropeanaDao { public final List<EuropeanaEDMObject> retrieveAggregationEDMInformation(final Map<String, EuropeanaRecord> records,final String migratingBatchId) { final List<EuropeanaEDMObject> results = new ArrayList<>(); for (final Map.Entry<String, EuropeanaRecord> record : records.entrySet()) { final ReferenceOwner referenceOwner = getReferenceOwner(record,migratingBatchId); final DBObject aggregation = getAggregation("/aggregation/provider" + record.getKey(),migratingBatchId); if (null == aggregation) { MigrationMetrics.Migrator.Overall.invalidAggregationCounter.inc(); LOG.error(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId, "", referenceOwner), "Missing aggregation: /aggregation/provider" + record.getKey()); continue; } final String edmObject = (String) aggregation.get("edmObject"); final BasicDBList hasViews = (BasicDBList) aggregation.get("hasView"); final String edmIsShownBy = (String) aggregation.get("edmIsShownBy"); final String edmIsShownAt = (String) aggregation.get("edmIsShownAt"); final List<String> edmHasViews = null == hasViews ? null : Arrays.asList(hasViews.toArray(new String[hasViews.size()])); results.add(new EuropeanaEDMObject(referenceOwner, edmObject, edmIsShownBy, edmIsShownAt, edmHasViews)); } return results; } MigratorEuropeanaDao(MongoConfig mongoConfig); }
MigratorEuropeanaDao { public final List<EuropeanaEDMObject> retrieveAggregationEDMInformation(final Map<String, EuropeanaRecord> records,final String migratingBatchId) { final List<EuropeanaEDMObject> results = new ArrayList<>(); for (final Map.Entry<String, EuropeanaRecord> record : records.entrySet()) { final ReferenceOwner referenceOwner = getReferenceOwner(record,migratingBatchId); final DBObject aggregation = getAggregation("/aggregation/provider" + record.getKey(),migratingBatchId); if (null == aggregation) { MigrationMetrics.Migrator.Overall.invalidAggregationCounter.inc(); LOG.error(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId, "", referenceOwner), "Missing aggregation: /aggregation/provider" + record.getKey()); continue; } final String edmObject = (String) aggregation.get("edmObject"); final BasicDBList hasViews = (BasicDBList) aggregation.get("hasView"); final String edmIsShownBy = (String) aggregation.get("edmIsShownBy"); final String edmIsShownAt = (String) aggregation.get("edmIsShownAt"); final List<String> edmHasViews = null == hasViews ? null : Arrays.asList(hasViews.toArray(new String[hasViews.size()])); results.add(new EuropeanaEDMObject(referenceOwner, edmObject, edmIsShownBy, edmIsShownAt, edmHasViews)); } return results; } MigratorEuropeanaDao(MongoConfig mongoConfig); final Map<String, EuropeanaRecord> retrieveRecordsIdsFromCursor(final DBCursor recordCursor,final String migratingBatchId); final DBCursor buildRecordsRetrievalCursorByFilter(Date moreRecentThan,int batchSize,final String migratingBatchId); final List<EuropeanaEDMObject> retrieveAggregationEDMInformation(final Map<String, EuropeanaRecord> records,final String migratingBatchId); }
MigratorEuropeanaDao { public final List<EuropeanaEDMObject> retrieveAggregationEDMInformation(final Map<String, EuropeanaRecord> records,final String migratingBatchId) { final List<EuropeanaEDMObject> results = new ArrayList<>(); for (final Map.Entry<String, EuropeanaRecord> record : records.entrySet()) { final ReferenceOwner referenceOwner = getReferenceOwner(record,migratingBatchId); final DBObject aggregation = getAggregation("/aggregation/provider" + record.getKey(),migratingBatchId); if (null == aggregation) { MigrationMetrics.Migrator.Overall.invalidAggregationCounter.inc(); LOG.error(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId, "", referenceOwner), "Missing aggregation: /aggregation/provider" + record.getKey()); continue; } final String edmObject = (String) aggregation.get("edmObject"); final BasicDBList hasViews = (BasicDBList) aggregation.get("hasView"); final String edmIsShownBy = (String) aggregation.get("edmIsShownBy"); final String edmIsShownAt = (String) aggregation.get("edmIsShownAt"); final List<String> edmHasViews = null == hasViews ? null : Arrays.asList(hasViews.toArray(new String[hasViews.size()])); results.add(new EuropeanaEDMObject(referenceOwner, edmObject, edmIsShownBy, edmIsShownAt, edmHasViews)); } return results; } MigratorEuropeanaDao(MongoConfig mongoConfig); final Map<String, EuropeanaRecord> retrieveRecordsIdsFromCursor(final DBCursor recordCursor,final String migratingBatchId); final DBCursor buildRecordsRetrievalCursorByFilter(Date moreRecentThan,int batchSize,final String migratingBatchId); final List<EuropeanaEDMObject> retrieveAggregationEDMInformation(final Map<String, EuropeanaRecord> records,final String migratingBatchId);  }