in metacat-main/src/main/java/com/netflix/metacat/main/api/v1/TagController.java [414:469]
public void removeTableTags(
@Parameter(description = "The name of the catalog", required = true)
@PathVariable("catalog-name") final String catalogName,
@Parameter(description = "The name of the database", required = true)
@PathVariable("database-name") final String databaseName,
@Parameter(description = "The name of the table", required = true)
@PathVariable("table-name") final String tableName,
@Parameter(description = "True if all tags need to be removed")
@RequestParam(name = "all", defaultValue = "false") final boolean deleteAll,
@Parameter(description = "Tags to be removed from the given table")
@Nullable @RequestBody(required = false) final Set<String> tags
) {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final QualifiedName name = this.requestWrapper.qualifyName(
() -> QualifiedName.ofTable(catalogName, databaseName, tableName)
);
this.requestWrapper.processRequest(
name,
"TagV1Resource.removeTableTags",
() -> {
//TODO: Business logic in API tier...
if (!this.tableService.exists(name)) {
// Delete tags if exists
this.tagService.delete(name, false);
throw new TableNotFoundException(name);
}
final TableDto oldTable = this.tableService
.get(name, GetTableServiceParameters.builder()
.includeInfo(true)
.includeDataMetadata(true)
.includeDefinitionMetadata(true)
.disableOnReadMetadataIntercetor(false)
.build())
.orElseThrow(IllegalStateException::new);
this.tagService.removeTags(name, deleteAll, tags, true);
final TableDto currentTable = this.tableService
.get(name, GetTableServiceParameters.builder().includeInfo(true)
.includeDataMetadata(true)
.includeDefinitionMetadata(true)
.disableOnReadMetadataIntercetor(false)
.build())
.orElseThrow(IllegalStateException::new);
this.eventBus.post(
new MetacatUpdateTablePostEvent(
name,
metacatRequestContext,
this,
oldTable,
currentTable
)
);
return null;
}
);
}