use of com.evolveum.midpoint.repo.sql.data.common.RObjectTextInfo in project midpoint by Evolveum.
the class ObjectDeltaUpdater method handleObjectTextInfoChanges.
private void handleObjectTextInfoChanges(Class<? extends ObjectType> type, Collection<? extends ItemDelta<?, ?>> modifications, PrismObject<?> prismObject, RObject object) {
FullTextSearchConfigurationType config = repositoryService.getFullTextSearchConfiguration();
if (!FullTextSearchUtil.isObjectTextInfoRecomputationNeeded(config, type, modifications)) {
return;
}
Set<RObjectTextInfo> newInfos = RObjectTextInfo.createItemsSet((ObjectType) prismObject.asObjectable(), object, new RepositoryContext(repositoryService, prismContext, relationRegistry, extItemDictionary, repositoryConfiguration));
if (newInfos == null || newInfos.isEmpty()) {
object.getTextInfoItems().clear();
} else {
Set<String> existingTexts = object.getTextInfoItems().stream().map(info -> info.getText()).collect(Collectors.toSet());
Set<String> newTexts = newInfos.stream().map(info -> info.getText()).collect(Collectors.toSet());
object.getTextInfoItems().removeIf(existingInfo -> !newTexts.contains(existingInfo.getText()));
for (RObjectTextInfo newInfo : newInfos) {
if (!existingTexts.contains(newInfo.getText())) {
object.getTextInfoItems().add(newInfo);
}
}
}
}
Aggregations