Search in sources :

Example 1 with UpdateSecondaryId

use of com.bakdata.conquery.models.messages.namespaces.specific.UpdateSecondaryId in project conquery by bakdata.

the class AdminDatasetProcessor method addSecondaryId.

/**
 * Add SecondaryId if it doesn't already exist.
 */
public synchronized void addSecondaryId(Namespace namespace, SecondaryIdDescription secondaryId) {
    final Dataset dataset = namespace.getDataset();
    secondaryId.setDataset(dataset);
    if (namespace.getStorage().getSecondaryId(secondaryId.getId()) != null) {
        throw new WebApplicationException("SecondaryId already exists", Response.Status.CONFLICT);
    }
    log.info("Received new SecondaryId[{}]", secondaryId.getId());
    namespace.getStorage().addSecondaryId(secondaryId);
    namespace.sendToAll(new UpdateSecondaryId(secondaryId));
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) UpdateSecondaryId(com.bakdata.conquery.models.messages.namespaces.specific.UpdateSecondaryId) Dataset(com.bakdata.conquery.models.datasets.Dataset)

Aggregations

Dataset (com.bakdata.conquery.models.datasets.Dataset)1 UpdateSecondaryId (com.bakdata.conquery.models.messages.namespaces.specific.UpdateSecondaryId)1 WebApplicationException (javax.ws.rs.WebApplicationException)1