private void setOwnerIfNull(final TableDto tableDto, final String user) { if (!Strings.isNullOrEmpty(user)) { StorageDto serde = tableDto.getSerde(); if (serde == null) { serde = new StorageDto(); tableDto.setSerde(serde); } if (Strings.isNullOrEmpty(serde.getOwner())) { serde.setOwner(user); } } }
protected StorageDto toStorageDto(final ConnectorPartition connectorPartition) { if (connectorPartition != null && connectorPartition instanceof ConnectorPartitionDetail) { final ConnectorPartitionDetail detailMetadata = (ConnectorPartitionDetail) connectorPartition; final StorageDto storageDto = toStorageDto(detailMetadata.getStorageInfo()); if (detailMetadata.getAuditInfo() != null) { storageDto.setOwner(detailMetadata.getAuditInfo().getCreatedBy()); } return storageDto; } return null; }
protected StorageDto toStorageDto(final ConnectorTableMetadata connectorTableMetadata) { if (connectorTableMetadata != null && connectorTableMetadata instanceof ConnectorTableDetailMetadata) { final ConnectorTableDetailMetadata detailMetadata = (ConnectorTableDetailMetadata) connectorTableMetadata; final StorageDto storageDto = toStorageDto(detailMetadata.getStorageInfo()); storageDto.setOwner(detailMetadata.getOwner()); return storageDto; } return null; }
private StorageDto toStorageDto(@Nullable final StorageDescriptor sd, final String owner) { final StorageDto result = new StorageDto(); if (sd != null) { result.setOwner(owner); result.setUri(sd.getLocation()); result.setInputFormat(sd.getInputFormat()); result.setOutputFormat(sd.getOutputFormat()); result.setParameters(sd.getParameters()); final SerDeInfo serde = sd.getSerdeInfo(); if (serde != null) { result.setSerializationLib(serde.getSerializationLib()); result.setSerdeInfoParameters(serde.getParameters()); } } return result; }
private StorageDto toStorageDto(@Nullable final StorageDescriptor sd, final String owner) { final StorageDto result = new StorageDto(); if (sd != null) { result.setOwner(owner); result.setUri(sd.getLocation()); result.setInputFormat(sd.getInputFormat()); result.setOutputFormat(sd.getOutputFormat()); result.setParameters(sd.getParameters()); final SerDeInfo serde = sd.getSerdeInfo(); if (serde != null) { result.setSerializationLib(serde.getSerializationLib()); result.setSerdeInfoParameters(serde.getParameters()); } } return result; }
private StorageDto toStorageDto(final StorageDescriptor sd, final String owner) { final StorageDto result = new StorageDto(); if (sd != null) { result.setOwner(owner); result.setUri(sd.getLocation()); result.setInputFormat(sd.getInputFormat()); result.setOutputFormat(sd.getOutputFormat()); result.setParameters(sd.getParameters()); final SerDeInfo serde = sd.getSerdeInfo(); if (serde != null) { result.setSerializationLib(serde.getSerializationLib()); result.setSerdeInfoParameters(serde.getParameters()); } } return result; }
/** * {@inheritDoc} */ @Override public TableDto copy(final TableDto tableDto, final QualifiedName targetName) { final QualifiedName databaseName = QualifiedName.ofDatabase(targetName.getCatalogName(), targetName.getDatabaseName()); if (!databaseService.exists(databaseName)) { final DatabaseDto databaseDto = new DatabaseDto(); databaseDto.setName(databaseName); databaseService.create(databaseName, databaseDto); } final TableDto targetTableDto = new TableDto(); targetTableDto.setName(targetName); targetTableDto.setFields(tableDto.getFields()); targetTableDto.setPartition_keys(tableDto.getPartition_keys()); final StorageDto storageDto = tableDto.getSerde(); if (storageDto != null) { final StorageDto targetStorageDto = new StorageDto(); targetStorageDto.setInputFormat(storageDto.getInputFormat()); targetStorageDto.setOwner(storageDto.getOwner()); targetStorageDto.setOutputFormat(storageDto.getOutputFormat()); targetStorageDto.setParameters(storageDto.getParameters()); targetStorageDto.setUri(storageDto.getUri()); targetStorageDto.setSerializationLib(storageDto.getSerializationLib()); targetTableDto.setSerde(targetStorageDto); } create(targetName, targetTableDto); return targetTableDto; }