use of org.graylog.plugins.pipelineprocessor.parser.errors.ParseError in project graylog2-server by Graylog2.
the class PipelineSource method fromDao.
public static PipelineSource fromDao(PipelineRuleParser parser, PipelineDao dao) {
Set<ParseError> errors = null;
Pipeline pipeline = null;
try {
pipeline = parser.parsePipeline(dao.id(), dao.source());
} catch (ParseException e) {
errors = e.getErrors();
}
final List<StageSource> stageSources = (pipeline == null) ? Collections.emptyList() : pipeline.stages().stream().map(stage -> StageSource.builder().match(stage.match()).rules(stage.ruleReferences()).stage(stage.stage()).build()).collect(Collectors.toList());
return builder().id(dao.id()).title(dao.title()).description(dao.description()).source(dao.source()).createdAt(dao.createdAt()).modifiedAt(dao.modifiedAt()).stages(stageSources).errors(errors).build();
}
Aggregations