Search in sources :

Example 1 with MetacatUpdateMViewPreEvent

use of com.netflix.metacat.common.server.events.MetacatUpdateMViewPreEvent in project metacat by Netflix.

the class MViewServiceImpl method updateAndReturn.

@Override
public TableDto updateAndReturn(@Nonnull final QualifiedName name, @Nonnull final TableDto tableDto) {
    final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
    eventBus.postSync(new MetacatUpdateMViewPreEvent(name, metacatRequestContext, this, tableDto));
    final QualifiedName viewQName = QualifiedName.ofTable(name.getCatalogName(), VIEW_DB_NAME, createViewName(name));
    log.info("Updating view {}.", viewQName);
    tableService.update(viewQName, tableDto);
    final TableDto updatedDto = getOpt(name).orElseThrow(() -> new IllegalStateException("should exist"));
    eventBus.postAsync(new MetacatUpdateMViewPostEvent(name, metacatRequestContext, this, updatedDto));
    return updatedDto;
}
Also used : MetacatRequestContext(com.netflix.metacat.common.MetacatRequestContext) MetacatUpdateMViewPreEvent(com.netflix.metacat.common.server.events.MetacatUpdateMViewPreEvent) QualifiedName(com.netflix.metacat.common.QualifiedName) TableDto(com.netflix.metacat.common.dto.TableDto) MetacatUpdateMViewPostEvent(com.netflix.metacat.common.server.events.MetacatUpdateMViewPostEvent)

Aggregations

MetacatRequestContext (com.netflix.metacat.common.MetacatRequestContext)1 QualifiedName (com.netflix.metacat.common.QualifiedName)1 TableDto (com.netflix.metacat.common.dto.TableDto)1 MetacatUpdateMViewPostEvent (com.netflix.metacat.common.server.events.MetacatUpdateMViewPostEvent)1 MetacatUpdateMViewPreEvent (com.netflix.metacat.common.server.events.MetacatUpdateMViewPreEvent)1