use of org.graylog2.contentpacks.model.entities.GrokPatternEntity in project graylog2-server by Graylog2.
the class GrokPatternFacade method findExisting.
private Optional<NativeEntity<GrokPattern>> findExisting(EntityV1 entity) {
final GrokPatternEntity grokPatternEntity = objectMapper.convertValue(entity.data(), GrokPatternEntity.class);
final String name = grokPatternEntity.name();
final String pattern = grokPatternEntity.pattern();
final Optional<GrokPattern> grokPattern = grokPatternService.loadByName(name);
grokPattern.ifPresent(existingPattern -> compareGrokPatterns(name, pattern, existingPattern.pattern()));
return grokPattern.map(gp -> NativeEntity.create(entity.id(), gp.id(), TYPE_V1, gp.name(), gp));
}
Aggregations