@Test public void test_GenerateCursor_NoFiltering() { final DBCursor cursor = europeanaDao.buildRecordsRetrievalCursorByFilter(null,1,migrationBatchId); assertEquals(new BasicDBObject(), cursor.getQuery()); }
public final DBCursor buildRecordsRetrievalCursorByFilter(Date moreRecentThan,int batchSize,final String migratingBatchId) { final DBCollection recordCollection = database.getCollection("record"); DBObject filterByTimestampQuery = new BasicDBObject(); final BasicDBObject recordFields = new BasicDBObject(); if (null != moreRecentThan) { filterByTimestampQuery.put("timestampUpdated", new BasicDBObject("$gt", moreRecentThan)); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId,null,null), "Query: " + filterByTimestampQuery); } recordFields.put("about", 1); recordFields.put("timestampUpdated", 1); recordFields.put("europeanaCollectionName", 1); recordFields.put("_id", 0); final BasicDBObject sortOrder = new BasicDBObject(); sortOrder.put("timestampUpdated", 1); final DBCursor recordCursor = recordCollection.find(filterByTimestampQuery, recordFields).sort(sortOrder).limit(batchSize); return recordCursor; }
MigratorEuropeanaDao { public final DBCursor buildRecordsRetrievalCursorByFilter(Date moreRecentThan,int batchSize,final String migratingBatchId) { final DBCollection recordCollection = database.getCollection("record"); DBObject filterByTimestampQuery = new BasicDBObject(); final BasicDBObject recordFields = new BasicDBObject(); if (null != moreRecentThan) { filterByTimestampQuery.put("timestampUpdated", new BasicDBObject("$gt", moreRecentThan)); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId,null,null), "Query: " + filterByTimestampQuery); } recordFields.put("about", 1); recordFields.put("timestampUpdated", 1); recordFields.put("europeanaCollectionName", 1); recordFields.put("_id", 0); final BasicDBObject sortOrder = new BasicDBObject(); sortOrder.put("timestampUpdated", 1); final DBCursor recordCursor = recordCollection.find(filterByTimestampQuery, recordFields).sort(sortOrder).limit(batchSize); return recordCursor; } }
MigratorEuropeanaDao { public final DBCursor buildRecordsRetrievalCursorByFilter(Date moreRecentThan,int batchSize,final String migratingBatchId) { final DBCollection recordCollection = database.getCollection("record"); DBObject filterByTimestampQuery = new BasicDBObject(); final BasicDBObject recordFields = new BasicDBObject(); if (null != moreRecentThan) { filterByTimestampQuery.put("timestampUpdated", new BasicDBObject("$gt", moreRecentThan)); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId,null,null), "Query: " + filterByTimestampQuery); } recordFields.put("about", 1); recordFields.put("timestampUpdated", 1); recordFields.put("europeanaCollectionName", 1); recordFields.put("_id", 0); final BasicDBObject sortOrder = new BasicDBObject(); sortOrder.put("timestampUpdated", 1); final DBCursor recordCursor = recordCollection.find(filterByTimestampQuery, recordFields).sort(sortOrder).limit(batchSize); return recordCursor; } MigratorEuropeanaDao(MongoConfig mongoConfig); }
MigratorEuropeanaDao { public final DBCursor buildRecordsRetrievalCursorByFilter(Date moreRecentThan,int batchSize,final String migratingBatchId) { final DBCollection recordCollection = database.getCollection("record"); DBObject filterByTimestampQuery = new BasicDBObject(); final BasicDBObject recordFields = new BasicDBObject(); if (null != moreRecentThan) { filterByTimestampQuery.put("timestampUpdated", new BasicDBObject("$gt", moreRecentThan)); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId,null,null), "Query: " + filterByTimestampQuery); } recordFields.put("about", 1); recordFields.put("timestampUpdated", 1); recordFields.put("europeanaCollectionName", 1); recordFields.put("_id", 0); final BasicDBObject sortOrder = new BasicDBObject(); sortOrder.put("timestampUpdated", 1); final DBCursor recordCursor = recordCollection.find(filterByTimestampQuery, recordFields).sort(sortOrder).limit(batchSize); return recordCursor; } 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 DBCursor buildRecordsRetrievalCursorByFilter(Date moreRecentThan,int batchSize,final String migratingBatchId) { final DBCollection recordCollection = database.getCollection("record"); DBObject filterByTimestampQuery = new BasicDBObject(); final BasicDBObject recordFields = new BasicDBObject(); if (null != moreRecentThan) { filterByTimestampQuery.put("timestampUpdated", new BasicDBObject("$gt", moreRecentThan)); LOG.debug(LoggingComponent.appendAppFields(LoggingComponent.Migrator.PERSISTENCE_EUROPEANA,migratingBatchId,null,null), "Query: " + filterByTimestampQuery); } recordFields.put("about", 1); recordFields.put("timestampUpdated", 1); recordFields.put("europeanaCollectionName", 1); recordFields.put("_id", 0); final BasicDBObject sortOrder = new BasicDBObject(); sortOrder.put("timestampUpdated", 1); final DBCursor recordCursor = recordCollection.find(filterByTimestampQuery, recordFields).sort(sortOrder).limit(batchSize); return recordCursor; } 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);  }