Search in sources :

Example 36 with ModelId

use of org.graylog2.contentpacks.model.ModelId in project graylog2-server by Graylog2.

the class EventDefinitionFacade method resolveNativeEntity.

@Override
public Graph<EntityDescriptor> resolveNativeEntity(EntityDescriptor entityDescriptor) {
    final MutableGraph<EntityDescriptor> mutableGraph = GraphBuilder.directed().build();
    mutableGraph.addNode(entityDescriptor);
    final ModelId modelId = entityDescriptor.id();
    final Optional<EventDefinitionDto> eventDefinition = eventDefinitionService.get(modelId.id());
    if (eventDefinition.isPresent()) {
        eventDefinition.get().resolveNativeEntity(entityDescriptor, mutableGraph);
    } else {
        LOG.debug("Couldn't find event definition {}", entityDescriptor);
    }
    return ImmutableGraph.copyOf(mutableGraph);
}
Also used : EntityDescriptor(org.graylog2.contentpacks.model.entities.EntityDescriptor) NativeEntityDescriptor(org.graylog2.contentpacks.model.entities.NativeEntityDescriptor) EventDefinitionDto(org.graylog.events.processor.EventDefinitionDto) ModelId(org.graylog2.contentpacks.model.ModelId)

Aggregations

ModelId (org.graylog2.contentpacks.model.ModelId)31 EntityDescriptor (org.graylog2.contentpacks.model.entities.EntityDescriptor)16 NativeEntityDescriptor (org.graylog2.contentpacks.model.entities.NativeEntityDescriptor)16 Entity (org.graylog2.contentpacks.model.entities.Entity)11 EntityV1 (org.graylog2.contentpacks.model.entities.EntityV1)11 NativeEntity (org.graylog2.contentpacks.model.entities.NativeEntity)11 Map (java.util.Map)10 Set (java.util.Set)10 EntityDescriptorIds (org.graylog2.contentpacks.EntityDescriptorIds)10 Test (org.junit.Test)10 Optional (java.util.Optional)9 ContentPack (org.graylog2.contentpacks.model.ContentPack)9 Collectors (java.util.stream.Collectors)8 Inject (javax.inject.Inject)8 ContentPackInstallation (org.graylog2.contentpacks.model.ContentPackInstallation)8 NotFoundException (org.graylog2.database.NotFoundException)8 JsonNode (com.fasterxml.jackson.databind.JsonNode)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)7 Graph (com.google.common.graph.Graph)7 GraphBuilder (com.google.common.graph.GraphBuilder)7