Revision 49891
Added by Alessia Bardi almost 7 years ago
OaiFeedMapper.java | ||
---|---|---|
161 | 161 |
private void handleRecord(final Context context, final String oaiID, final String record, final Multimap<String, String> recordProperties) { |
162 | 162 |
DBObject obj = this.createBasicObject(oaiID, record, recordProperties,context); |
163 | 163 |
if (obj != null) { // it can be null if the compression did not succeeded: counter is updated in the compress method in that case |
164 |
obj.put(OAIConfigurationReader.LAST_COLLECTION_DATE_FIELD, feedDate); |
|
165 |
obj.put(OAIConfigurationReader.DATESTAMP_FIELD, feedDate); |
|
164 |
//let's use the date of collection and transformation for those records that have them. |
|
165 |
//for the rest, we'll keep the feedDate... |
|
166 |
Collection<String> collectionDates = recordProperties.get("dateOfCollection"); |
|
167 |
Collection<String> transDates = recordProperties.get("dateOfTransformation"); |
|
168 |
if(collectionDates != null && !collectionDates.isEmpty()){ |
|
169 |
obj.put(OAIConfigurationReader.LAST_COLLECTION_DATE_FIELD, collectionDates.iterator().next()); |
|
170 |
} |
|
171 |
else |
|
172 |
obj.put(OAIConfigurationReader.LAST_COLLECTION_DATE_FIELD, feedDate); |
|
173 |
if(transDates != null && !transDates.isEmpty()){ |
|
174 |
obj.put(OAIConfigurationReader.DATESTAMP_FIELD, transDates.iterator().next()); |
|
175 |
} |
|
176 |
else |
|
177 |
obj.put(OAIConfigurationReader.DATESTAMP_FIELD, feedDate); |
|
178 |
//the updated_field must stay false, as the oai store is empty. |
|
166 | 179 |
obj.put(OAIConfigurationReader.UPDATED_FIELD, false); |
167 | 180 |
collection.insertOne(obj); |
168 | 181 |
context.getCounter("oai", "total").increment(1); |
Also available in: Unified diff
#3110 Support incremental harvesting: setting dateOfTransformation as datestamp whenever available