use of org.graylog2.contentpacks.model.entities.LookupCacheEntity in project graylog2-server by Graylog2.
the class LookupCacheFacade method exportNativeEntity.
@VisibleForTesting
Entity exportNativeEntity(CacheDto cacheDto, EntityDescriptorIds entityDescriptorIds) {
// TODO: Create independent representation of entity?
final Map<String, Object> configuration = objectMapper.convertValue(cacheDto.config(), TypeReferences.MAP_STRING_OBJECT);
final LookupCacheEntity lookupCacheEntity = LookupCacheEntity.create(ValueReference.of(cacheDto.name()), ValueReference.of(cacheDto.title()), ValueReference.of(cacheDto.description()), toReferenceMap(configuration));
final JsonNode data = objectMapper.convertValue(lookupCacheEntity, JsonNode.class);
final Set<Constraint> constraints = versionConstraints(cacheDto);
return EntityV1.builder().id(ModelId.of(entityDescriptorIds.getOrThrow(cacheDto.id(), ModelTypes.LOOKUP_CACHE_V1))).type(ModelTypes.LOOKUP_CACHE_V1).constraints(ImmutableSet.copyOf(constraints)).data(data).build();
}
Aggregations