adding record identifier among the originalIds regardless of what IdentifierFactory produces

This commit is contained in:
Claudio Atzori 2021-07-19 17:52:24 +02:00
parent 0977baf41d
commit 65934888a1
1 changed files with 4 additions and 3 deletions

View File

@ -202,12 +202,13 @@ public abstract class AbstractMdRecordToOafMapper {
final OafEntity entity = createEntity(doc, type, instances, collectedFrom, info, lastUpdateTimestamp);
final Set<String> originalId = Sets.newHashSet(entity.getOriginalId());
originalId.add(entity.getId());
entity.setOriginalId(Lists.newArrayList(originalId));
if (!forceOriginalId) {
final String id = IdentifierFactory.createIdentifier(entity, shouldHashId);
if (!id.equals(entity.getId())) {
final Set<String> originalId = Sets.newHashSet(entity.getOriginalId());
originalId.add(entity.getId());
entity.setOriginalId(Lists.newArrayList(originalId));
entity.setId(id);
}
}