Search in sources :

Example 1 with LookupDataAdapterConfiguration

use of org.graylog2.plugin.lookup.LookupDataAdapterConfiguration in project graylog2-server by Graylog2.

the class LookupDataAdapterFacade method decode.

private NativeEntity<DataAdapterDto> decode(EntityV1 entity, final Map<String, ValueReference> parameters) {
    final LookupDataAdapterEntity lookupDataAdapterEntity = objectMapper.convertValue(entity.data(), LookupDataAdapterEntity.class);
    final LookupDataAdapterConfiguration configuration = objectMapper.convertValue(toValueMap(lookupDataAdapterEntity.configuration(), parameters), LookupDataAdapterConfiguration.class);
    final DataAdapterDto dataAdapterDto = DataAdapterDto.builder().name(lookupDataAdapterEntity.name().asString(parameters)).title(lookupDataAdapterEntity.title().asString(parameters)).description(lookupDataAdapterEntity.description().asString(parameters)).config(configuration).build();
    final DataAdapterDto savedDataAdapterDto = dataAdapterService.save(dataAdapterDto);
    return NativeEntity.create(entity.id(), savedDataAdapterDto.id(), TYPE_V1, savedDataAdapterDto.title(), savedDataAdapterDto);
}
Also used : LookupDataAdapterEntity(org.graylog2.contentpacks.model.entities.LookupDataAdapterEntity) DataAdapterDto(org.graylog2.lookup.dto.DataAdapterDto) LookupDataAdapterConfiguration(org.graylog2.plugin.lookup.LookupDataAdapterConfiguration)

Aggregations

LookupDataAdapterEntity (org.graylog2.contentpacks.model.entities.LookupDataAdapterEntity)1 DataAdapterDto (org.graylog2.lookup.dto.DataAdapterDto)1 LookupDataAdapterConfiguration (org.graylog2.plugin.lookup.LookupDataAdapterConfiguration)1