Skip to content

Commit

Permalink
Merge branch 'feature/434678_add_participant_id' into 'develop'
Browse files Browse the repository at this point in the history
feature/434678_add_participant_id

See merge request upm-inesdata/inesdata-connector!25
  • Loading branch information
ralconada-gmv committed Jun 27, 2024
2 parents 8a41239 + 1673f63 commit 8c8cc26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions extensions/federated-catalog-cache-sql/docs/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS edc_dataset (
properties JSON DEFAULT '{}',
catalog_id VARCHAR,
FOREIGN KEY (catalog_id) REFERENCES edc_catalog(id),
PRIMARY KEY (id)
PRIMARY KEY (id, catalog_id)
);

-- Tabla para DataService
Expand All @@ -31,8 +31,9 @@ CREATE TABLE IF NOT EXISTS edc_distribution (
format VARCHAR(255),
data_service_id VARCHAR,
dataset_id VARCHAR,
catalog_id VARCHAR,
FOREIGN KEY (data_service_id) REFERENCES edc_data_service(id),
FOREIGN KEY (dataset_id) REFERENCES edc_dataset(id)
FOREIGN KEY (dataset_id, catalog_id) REFERENCES edc_dataset(id, catalog_id)
);

-- Tabla de relación entre Catalog y DataService (para la lista de dataServices en Catalog)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.eclipse.edc.connector.controlplane.catalog.spi.Dataset;
import org.eclipse.edc.connector.controlplane.catalog.spi.Distribution;
import org.eclipse.edc.policy.model.Policy;
import org.eclipse.edc.spi.constants.CoreConstants;
import org.eclipse.edc.spi.persistence.EdcPersistenceException;
import org.eclipse.edc.spi.query.Criterion;
import org.eclipse.edc.spi.query.QuerySpec;
Expand Down Expand Up @@ -318,6 +319,7 @@ private void insertDataServices(Catalog catalog, Connection connection) {
private void insertDatasets(Catalog catalog, Connection connection) throws SQLException {
if (catalog.getDatasets() != null) {
for (Dataset dataset : catalog.getDatasets()) {
dataset.getProperties().put(CoreConstants.EDC_NAMESPACE + "participantId", catalog.getParticipantId());
queryExecutor.execute(connection, databaseStatements.getInsertDatasetTemplate(), dataset.getId(),
toJson(dataset.getOffers()), toJson(dataset.getProperties()), catalog.getId());

Expand Down
5 changes: 3 additions & 2 deletions resources/sql/federated-catalog-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS edc_dataset (
properties JSON DEFAULT '{}',
catalog_id VARCHAR,
FOREIGN KEY (catalog_id) REFERENCES edc_catalog(id),
PRIMARY KEY (id)
PRIMARY KEY (id, catalog_id)
);

-- Tabla para DataService
Expand All @@ -31,8 +31,9 @@ CREATE TABLE IF NOT EXISTS edc_distribution (
format VARCHAR(255),
data_service_id VARCHAR,
dataset_id VARCHAR,
catalog_id VARCHAR,
FOREIGN KEY (data_service_id) REFERENCES edc_data_service(id),
FOREIGN KEY (dataset_id) REFERENCES edc_dataset(id)
FOREIGN KEY (dataset_id, catalog_id) REFERENCES edc_dataset(id, catalog_id)
);

-- Tabla de relación entre Catalog y DataService (para la lista de dataServices en Catalog)
Expand Down

0 comments on commit 8c8cc26

Please sign in to comment.