Search in sources :

Example 1 with MetacatService

use of com.netflix.metacat.main.services.MetacatService in project metacat by Netflix.

the class MetadataV1Resource method deleteDefinitionMetadata.

/**
     * {@inheritDoc}
     */
@Override
public void deleteDefinitionMetadata(final QualifiedName name, final Boolean force) {
    final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
    requestWrapper.processRequest("deleteDefinitionMetadata", () -> {
        final MetacatService service = helper.getService(name);
        BaseDto dto = null;
        try {
            dto = service.get(name);
        } catch (NotFoundException ignored) {
        }
        if ((force || dto == null) && !"rds".equalsIgnoreCase(name.getCatalogName())) {
            helper.postPreUpdateEvent(name, metacatRequestContext, dto);
            userMetadataService.deleteDefinitionMetadatas(Lists.newArrayList(name));
            if (dto instanceof HasDefinitionMetadata) {
                ((HasDefinitionMetadata) dto).setDefinitionMetadata(null);
            }
            final BaseDto newDto = service.get(name);
            helper.postPostUpdateEvent(name, metacatRequestContext, dto, newDto);
        }
        return null;
    });
}
Also used : MetacatRequestContext(com.netflix.metacat.common.MetacatRequestContext) MetacatService(com.netflix.metacat.main.services.MetacatService) NotFoundException(com.netflix.metacat.common.server.connectors.exception.NotFoundException) BaseDto(com.netflix.metacat.common.dto.BaseDto) HasDefinitionMetadata(com.netflix.metacat.common.dto.HasDefinitionMetadata)

Aggregations

MetacatRequestContext (com.netflix.metacat.common.MetacatRequestContext)1 BaseDto (com.netflix.metacat.common.dto.BaseDto)1 HasDefinitionMetadata (com.netflix.metacat.common.dto.HasDefinitionMetadata)1 NotFoundException (com.netflix.metacat.common.server.connectors.exception.NotFoundException)1 MetacatService (com.netflix.metacat.main.services.MetacatService)1