Class LookupCacheFacade
java.lang.Object
org.graylog2.contentpacks.facades.LookupCacheFacade
- All Implemented Interfaces:
EntityFacade<CacheDto>,EntityWithExcerptFacade<CacheDto,CacheDto>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLookupCacheFacade(com.fasterxml.jackson.databind.ObjectMapper objectMapper, DBCacheService cacheService, Set<PluginMetaData> pluginMetaData) -
Method Summary
Modifier and TypeMethodDescriptioncreateExcerpt(CacheDto cacheDto) Create an excerpt (id, type, title) of a native entity for display purposes.createNativeEntity(Entity entity, Map<String, ValueReference> parameters, Map<EntityDescriptor, Object> nativeEntities, String username) Create a native entity of typeTfrom an entity model.voidDelete the given native entity.exportEntity(EntityDescriptor entityDescriptor, EntityDescriptorIds entityDescriptorIds) Create an exportable model of a native entity referenced by anEntityDescriptorincluding optional constraints.findExisting(Entity entity, Map<String, ValueReference> parameters) Find an existing instance of the native entity described by the entity model.Create entity excerpts of all native entities of typeT.loadNativeEntity(NativeEntityDescriptor nativeEntityDescriptor) Loads the native entity instance for the given native entity descriptor.booleanThe implementing facade should return true if the corresponding database entity supports scopes by extendingScopedEntity.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.graylog2.contentpacks.facades.EntityWithExcerptFacade
resolveForInstallation, resolveNativeEntity
-
Field Details
-
TYPE_V1
-
-
Constructor Details
-
LookupCacheFacade
@Inject public LookupCacheFacade(com.fasterxml.jackson.databind.ObjectMapper objectMapper, DBCacheService cacheService, Set<PluginMetaData> pluginMetaData)
-
-
Method Details
-
createNativeEntity
public NativeEntity<CacheDto> createNativeEntity(Entity entity, Map<String, ValueReference> parameters, Map<EntityDescriptor, Object> nativeEntities, String username) Description copied from interface:EntityWithExcerptFacadeCreate a native entity of typeTfrom an entity model.- Specified by:
createNativeEntityin interfaceEntityWithExcerptFacade<CacheDto,CacheDto> - Parameters:
entity- the entity model from which a native entity should be createdparameters- user-provided parameters to resolve parameters in the entity modelnativeEntities- existing native entities to reference during the creation of the native entityusername- the name of the user creating the entity- Returns:
- the created native entity wrapped in
- See Also:
-
findExisting
public Optional<NativeEntity<CacheDto>> findExisting(Entity entity, Map<String, ValueReference> parameters) Description copied from interface:EntityWithExcerptFacadeFind an existing instance of the native entity described by the entity model.- Specified by:
findExistingin interfaceEntityWithExcerptFacade<CacheDto,CacheDto> - Parameters:
entity- the entity model from which a native entity should be createdparameters- user-provided parameters to resolve parameters in the entity model- Returns:
- the existing native entity in the database wrapped in
NativeEntity<T>, orOptional.empty()if the entity couldn't be found. - See Also:
-
loadNativeEntity
public Optional<NativeEntity<CacheDto>> loadNativeEntity(NativeEntityDescriptor nativeEntityDescriptor) Description copied from interface:EntityWithExcerptFacadeLoads the native entity instance for the given native entity descriptor.- Specified by:
loadNativeEntityin interfaceEntityWithExcerptFacade<CacheDto,CacheDto> - Parameters:
nativeEntityDescriptor- the native entity descriptor- Returns:
- the existing native entity in the database wrapped in
NativeEntity<T>, orOptional.empty()if the native entity doesn't exist.
-
delete
Description copied from interface:EntityWithExcerptFacadeDelete the given native entity.- Specified by:
deletein interfaceEntityWithExcerptFacade<CacheDto,CacheDto> - Parameters:
nativeEntity- The native entity to delete
-
createExcerpt
Description copied from interface:EntityWithExcerptFacadeCreate an excerpt (id, type, title) of a native entity for display purposes.- Specified by:
createExcerptin interfaceEntityWithExcerptFacade<CacheDto,CacheDto> - Parameters:
cacheDto- The native entity to create an excerpt of- Returns:
- The entity excerpt of the native entity
- See Also:
-
listEntityExcerpts
Description copied from interface:EntityWithExcerptFacadeCreate entity excerpts of all native entities of typeT.- Specified by:
listEntityExcerptsin interfaceEntityWithExcerptFacade<CacheDto,CacheDto> - Returns:
- A collection of entity excerpts of all native entities of type
T - See Also:
-
exportEntity
public Optional<Entity> exportEntity(EntityDescriptor entityDescriptor, EntityDescriptorIds entityDescriptorIds) Description copied from interface:EntityWithExcerptFacadeCreate an exportable model of a native entity referenced by anEntityDescriptorincluding optional constraints.- Specified by:
exportEntityin interfaceEntityWithExcerptFacade<CacheDto,CacheDto> - Parameters:
entityDescriptor- the descriptor of the native entity to exportentityDescriptorIds- the IDs for all entity descriptors- Returns:
- an exportable (serializable) model of the entity including optional constraints,
or
Optional.empty()if the entity couldn't be found.
-
usesScopedEntities
public boolean usesScopedEntities()Description copied from interface:EntityWithExcerptFacadeThe implementing facade should return true if the corresponding database entity supports scopes by extendingScopedEntity. This provides scope awareness within the implementing facade.- Specified by:
usesScopedEntitiesin interfaceEntityWithExcerptFacade<CacheDto,CacheDto>
-