Revision 45499
Added by Alessia Bardi over 7 years ago
MongoPublisherStore.java | ||
---|---|---|
13 | 13 |
import java.util.zip.ZipEntry; |
14 | 14 |
import java.util.zip.ZipOutputStream; |
15 | 15 |
|
16 |
import com.google.common.base.Predicate; |
|
17 | 16 |
import com.google.common.base.Stopwatch; |
18 | 17 |
import com.google.common.collect.Iterables; |
19 | 18 |
import com.google.common.collect.Lists; |
... | ... | |
121 | 120 |
public RecordInfo getRecord(final String recordId) { |
122 | 121 |
final Bson query = Filters.eq(OAIConfigurationReader.ID_FIELD, recordId); |
123 | 122 |
final DBObject result = this.collection.find(query).first(); |
124 |
log.debug(result); |
|
125 | 123 |
return this.recordInfoGenerator.transformDBObject(result, true); |
126 | 124 |
} |
127 | 125 |
|
... | ... | |
377 | 375 |
final PublisherRecordParser parser = new PublisherRecordParser(this.mongoFields); |
378 | 376 |
log.debug("configured parser for fields: "+this.mongoFields); |
379 | 377 |
final Multimap<String, String> recordProperties = parser.parseRecord(record, source); |
380 |
String id = "";
|
|
381 |
String oaiID = "";
|
|
378 |
String id; |
|
379 |
String oaiID; |
|
382 | 380 |
if (recordProperties.containsKey(OAIConfigurationReader.ID_FIELD)) { |
383 | 381 |
id = recordProperties.get(OAIConfigurationReader.ID_FIELD).iterator().next(); |
384 | 382 |
oaiID = getOAIIdentifier(id); |
... | ... | |
395 | 393 |
} |
396 | 394 |
} else { |
397 | 395 |
log.error("parsed record seems invalid -- no identifier property with name: " + OAIConfigurationReader.ID_FIELD); |
398 |
log.debug("Extracted property map: \n"+recordProperties);
|
|
396 |
log.error("Extracted property map: \n"+recordProperties);
|
|
399 | 397 |
log.debug("from: \n"+record); |
400 | 398 |
this.discardedCollection |
401 | 399 |
.insertOne(new BasicDBObject(OAIConfigurationReader.SET_FIELD, source).append(OAIConfigurationReader.BODY_FIELD, record).append( |
... | ... | |
415 | 413 |
|
416 | 414 |
final Iterable<String> setSpecs = |
417 | 415 |
values.stream().map(s -> MongoPublisherStore.this.mongoSetCollection.normalizeSetSpec(s)).collect(Collectors.toList()); |
418 |
|
|
419 | 416 |
obj.put(key, setSpecs); |
420 | 417 |
} else { |
421 | 418 |
// let's check if the key is the name of a repeatable field or not |
422 |
final PublisherField keyField = Iterables.find(this.mongoFields, new Predicate<PublisherField>() { |
|
423 |
|
|
424 |
@Override |
|
425 |
public boolean apply(final PublisherField field) { |
|
426 |
return field.getFieldName().equals(key); |
|
427 |
} |
|
428 |
}, null); |
|
419 |
final PublisherField keyField = Iterables.find(this.mongoFields, field -> field.getFieldName().equals(key), null); |
|
429 | 420 |
if (keyField == null) { |
430 | 421 |
log.warn("Expected field to index: " + key + " could not be found, but we keep going..."); |
431 | 422 |
} |
Also available in: Unified diff
Basically adjusted logs for debugging