use of org.graylog.events.contentpack.entities.EventDefinitionEntity in project graylog2-server by Graylog2.
the class EventDefinitionFacade method decode.
private NativeEntity<EventDefinitionDto> decode(EntityV1 entity, Map<String, ValueReference> parameters, Map<EntityDescriptor, Object> nativeEntities, User user) {
final EventDefinitionEntity eventDefinitionEntity = objectMapper.convertValue(entity.data(), EventDefinitionEntity.class);
final EventDefinitionDto eventDefinition = eventDefinitionEntity.toNativeEntity(parameters, nativeEntities);
final EventDefinitionDto savedDto;
if (eventDefinitionEntity.isScheduled().asBoolean(parameters)) {
savedDto = eventDefinitionHandler.create(eventDefinition, Optional.ofNullable(user));
} else {
savedDto = eventDefinitionHandler.createWithoutSchedule(eventDefinition, Optional.ofNullable(user));
}
return NativeEntity.create(entity.id(), savedDto.id(), ModelTypes.EVENT_DEFINITION_V1, savedDto.title(), savedDto);
}
Aggregations