use of com.netflix.metacat.common.server.events.MetacatDeleteDatabasePostEvent in project metacat by Netflix.
the class DatabaseServiceImpl method delete.
/**
* {@inheritDoc}
*/
@Override
public void delete(final QualifiedName name) {
validate(name);
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
this.authorizationService.checkPermission(metacatRequestContext.getUserName(), name, MetacatOperation.DELETE);
log.info("Dropping schema {}", name);
final DatabaseDto dto = get(name, GetDatabaseServiceParameters.builder().disableOnReadMetadataIntercetor(false).includeUserMetadata(true).includeTableNames(true).build());
eventBus.post(new MetacatDeleteDatabasePreEvent(name, metacatRequestContext, this, dto));
final ConnectorRequestContext connectorRequestContext = converterUtil.toConnectorContext(metacatRequestContext);
connectorManager.getDatabaseService(name).delete(connectorRequestContext, name);
// Delete definition metadata if it exists
if (userMetadataService.getDefinitionMetadata(name).isPresent()) {
log.info("Deleting user metadata for schema {}", name);
userMetadataService.deleteDefinitionMetadata(ImmutableList.of(name));
}
eventBus.post(new MetacatDeleteDatabasePostEvent(name, metacatRequestContext, this, dto));
}
Aggregations