Search in sources :

Example 1 with LookupCacheConfiguration

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

the class LookupCacheFacade method decode.

private NativeEntity<CacheDto> decode(EntityV1 entity, Map<String, ValueReference> parameters) {
    final LookupCacheEntity lookupCacheEntity = objectMapper.convertValue(entity.data(), LookupCacheEntity.class);
    final LookupCacheConfiguration configuration = objectMapper.convertValue(toValueMap(lookupCacheEntity.configuration(), parameters), LookupCacheConfiguration.class);
    final CacheDto cacheDto = CacheDto.builder().name(lookupCacheEntity.name().asString(parameters)).title(lookupCacheEntity.title().asString(parameters)).description(lookupCacheEntity.description().asString(parameters)).config(configuration).build();
    final CacheDto savedCacheDto = cacheService.save(cacheDto);
    return NativeEntity.create(entity.id(), savedCacheDto.id(), TYPE_V1, savedCacheDto.title(), savedCacheDto);
}
Also used : LookupCacheConfiguration(org.graylog2.plugin.lookup.LookupCacheConfiguration) LookupCacheEntity(org.graylog2.contentpacks.model.entities.LookupCacheEntity) CacheDto(org.graylog2.lookup.dto.CacheDto)

Aggregations

LookupCacheEntity (org.graylog2.contentpacks.model.entities.LookupCacheEntity)1 CacheDto (org.graylog2.lookup.dto.CacheDto)1 LookupCacheConfiguration (org.graylog2.plugin.lookup.LookupCacheConfiguration)1