use of com.bakdata.conquery.models.messages.namespaces.specific.UpdateTable in project conquery by bakdata.
the class AdminDatasetProcessor method addTable.
/**
* Add table to Dataset if it doesn't already exist.
*/
@SneakyThrows
public synchronized void addTable(@NonNull Table table, Namespace namespace) {
Dataset dataset = namespace.getDataset();
if (table.getDataset() == null) {
table.setDataset(dataset);
} else if (!table.getDataset().equals(dataset)) {
throw new IllegalArgumentException();
}
if (namespace.getStorage().getTable(table.getId()) != null) {
throw new WebApplicationException("Table already exists", Response.Status.CONFLICT);
}
ValidatorHelper.failOnError(log, validator.validate(table));
namespace.getStorage().addTable(table);
namespace.sendToAll(new UpdateTable(table));
}
Aggregations