diff --git a/CHANGELOG.md b/CHANGELOG.md index df5b85f849385868b6eb8e1d7daa605bc1b4e8d8..b8362aff3682a130e28f40286fcb6ce2f0f703cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* Related to #146, a new flag for entities and complete transactions: + `force-missing-obligatory=[ignore|warn|error]`. The flag overrides the + default behavior of the server (throwing an error when an obligatory property + is missing). `ignore` just discards the consistency check, `warn` only issues + a warning when obligatory properties are missing and `error` throws an error + in that case. The flag can be set for the complete transaction and each + single entity, while the entity flag takes precedence. * New EntityState plug-in. The plug-in disabled by default and can be enabled by setting the server property `EXT_ENTITY_STATE=ENABLED`. See [!62](https://gitlab.com/caosdb/caosdb-server/-/merge_requests/62) for more @@ -31,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +* #146 - Default behavior for missing obligatory properties * #131 - CQL Parsing error when white space characters before some units. * #134 - CQL Parsing error when multiple white space characters after `FROM`. * #130 - Error during `FIND ENTITY` when diff --git a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLRuleLoader.java b/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLRuleLoader.java deleted file mode 100644 index 8b34fe2aee9a28a3fdeb56c7c7cbc03e53233982..0000000000000000000000000000000000000000 --- a/src/main/java/org/caosdb/server/database/backend/implementation/MySQL/MySQLRuleLoader.java +++ /dev/null @@ -1,81 +0,0 @@ -/// * -// * ** header v3.0 -// * This file is a part of the CaosDB Project. -// * -// * Copyright (C) 2018 Research Group Biomedical Physics, -// * Max-Planck-Institute for Dynamics and Self-Organization Göttingen -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU Affero General Public License as -// * published by the Free Software Foundation, either version 3 of the -// * License, or (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU Affero General Public License for more details. -// * -// * You should have received a copy of the GNU Affero General Public License -// * along with this program. If not, see <https://www.gnu.org/licenses/>. -// * -// * ** end header -// */ -// package org.caosdb.server.database.backend.implementation.MySQL; -// -// import static org.caosdb.server.database.DatabaseUtils.bytes2UTF8; -// -// import java.sql.PreparedStatement; -// import java.sql.ResultSet; -// import java.sql.SQLException; -// import java.util.ArrayList; -// import org.caosdb.server.database.access.Access; -// import org.caosdb.server.database.backend.interfaces.RuleLoaderImpl; -// import org.caosdb.server.database.exceptions.TransactionException; -// import org.caosdb.server.database.proto.Rule; -// import org.caosdb.server.jobs.core.Mode; -// -// public class MySQLRuleLoader extends MySQLTransaction implements RuleLoaderImpl { -// -// public MySQLRuleLoader(final Access access) { -// super(access); -// } -// -// public static final String STMT_GET_RULES = -// "SELECT rules.transaction, rules.criterion, rules.modus from rules where rules.domain_id=? -// AND rules.entity_id=? AND rules.transaction=?"; -// -// @Override -// public ArrayList<Rule> executeNoCache( -// final Integer domain, final Integer entity, final String transaction) -// throws TransactionException { -// try { -// final PreparedStatement stmt = prepareStatement(STMT_GET_RULES); -// -// stmt.setInt(1, domain); -// stmt.setInt(2, entity); -// stmt.setString(3, transaction); -// stmt.execute(); -// -// final ResultSet rs = stmt.executeQuery(); -// try { -// final ArrayList<Rule> ret = new ArrayList<Rule>(); -// while (rs.next()) { -// final Rule r = new Rule(); -// r.mode = Mode.valueOf(bytes2UTF8(rs.getBytes("modus"))); -// r.job = bytes2UTF8(rs.getBytes("criterion")); -// r.domain = domain; -// r.entity = entity; -// r.transaction = transaction; -// ret.add(r); -// } -// return ret; -// } finally { -// rs.close(); -// } -// } catch (final SQLException e) { -// throw new TransactionException(e); -// } catch (final ConnectionException e) { -// throw new TransactionException(e); -// } -// } -// } diff --git a/src/main/java/org/caosdb/server/database/backend/interfaces/RuleLoaderImpl.java b/src/main/java/org/caosdb/server/database/backend/interfaces/RuleLoaderImpl.java deleted file mode 100644 index 66fd1abd9286d34964fc0f00096a17eba8dd56e3..0000000000000000000000000000000000000000 --- a/src/main/java/org/caosdb/server/database/backend/interfaces/RuleLoaderImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/// * -// * ** header v3.0 -// * This file is a part of the CaosDB Project. -// * -// * Copyright (C) 2018 Research Group Biomedical Physics, -// * Max-Planck-Institute for Dynamics and Self-Organization Göttingen -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU Affero General Public License as -// * published by the Free Software Foundation, either version 3 of the -// * License, or (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU Affero General Public License for more details. -// * -// * You should have received a copy of the GNU Affero General Public License -// * along with this program. If not, see <https://www.gnu.org/licenses/>. -// * -// * ** end header -// */ -// package org.caosdb.server.database.backend.interfaces; -// -// import java.util.ArrayList; -// import org.caosdb.server.database.exceptions.TransactionException; -// import org.caosdb.server.database.proto.Rule; -// -// public interface RuleLoaderImpl extends BackendTransactionImpl { -// -// public ArrayList<Rule> executeNoCache(Integer domain, Integer entity, String transaction) -// throws TransactionException; -// } diff --git a/src/main/java/org/caosdb/server/database/backend/transaction/RuleLoader.java b/src/main/java/org/caosdb/server/database/backend/transaction/RuleLoader.java deleted file mode 100644 index 753265f0fb6007de47c0b03e0b8bb5f6a7f47a5c..0000000000000000000000000000000000000000 --- a/src/main/java/org/caosdb/server/database/backend/transaction/RuleLoader.java +++ /dev/null @@ -1,96 +0,0 @@ -/// * -// * ** header v3.0 -// * This file is a part of the CaosDB Project. -// * -// * Copyright (C) 2018 Research Group Biomedical Physics, -// * Max-Planck-Institute for Dynamics and Self-Organization Göttingen -// * Copyright (C) 2019 IndiScale GmbH -// * Copyright (C) 2019 Timm Fitschen (t.fitschen@indiscale.com) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU Affero General Public License as -// * published by the Free Software Foundation, either version 3 of the -// * License, or (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU Affero General Public License for more details. -// * -// * You should have received a copy of the GNU Affero General Public License -// * along with this program. If not, see <https://www.gnu.org/licenses/>. -// * -// * ** end header -// */ -// package org.caosdb.server.database.backend.transaction; -// -// import java.util.ArrayList; -// import org.apache.commons.jcs.access.behavior.ICacheAccess; -// import org.caosdb.server.caching.Cache; -// import org.caosdb.server.database.CacheableBackendTransaction; -// import org.caosdb.server.database.backend.interfaces.RuleLoaderImpl; -// import org.caosdb.server.database.exceptions.TransactionException; -// import org.caosdb.server.database.proto.Rule; -// import org.caosdb.server.entity.EntityInterface; -// import org.caosdb.server.entity.container.TransactionContainer; -// import org.caosdb.server.entity.wrapper.Property; -// import org.caosdb.server.jobs.Job; -// import org.caosdb.server.transaction.Transaction; -// -/// ** -// * Load transaction rules (e.g. "Referenced entities must always exist") and their configuration -// * from the back-end. -// * -// * @author Timm Fitschen (t.fitschen@indiscale.com) -// */ -// public class RuleLoader extends CacheableBackendTransaction<String, ArrayList<Rule>> { -// -// private static final ICacheAccess<String, ArrayList<Rule>> cache = -// Cache.getCache("BACKEND_JobRules"); -// private final Transaction<? extends TransactionContainer> transaction; -// private final EntityInterface e; -// private final Integer entity; -// private final Integer domain; -// private ArrayList<Job> jobs; -// private String transactionType; -// -// public RuleLoader( -// final Integer domain, -// final Integer entity, -// final EntityInterface e, -// final Transaction<? extends TransactionContainer> transaction) { -// super(cache); -// this.domain = domain; -// this.entity = entity; -// this.e = e; -// if (e instanceof Property) { -// this.transactionType = getTransactionType(((Property) e).getDomainEntity()); -// } else { -// this.transactionType = getTransactionType(e); -// } -// this.transaction = transaction; -// } -// -// @Override -// protected String getKey() { -// return "<" + this.domain + "," + this.entity + "," + this.transactionType + ">"; -// } -// -// public ArrayList<Job> getJobs() { -// return this.jobs; -// } -// -// @Override -// public ArrayList<Rule> executeNoCache() throws TransactionException { -// final RuleLoaderImpl t = getImplementation(RuleLoaderImpl.class); -// return t.executeNoCache(this.domain, this.entity, this.transactionType); -// } -// -// @Override -// protected void process(final ArrayList<Rule> t) throws TransactionException { -// this.jobs = new ArrayList<Job>(); -// for (final Rule r : t) { -// this.jobs.add(Job.getJob(r.job, r.mode, this.e, this.transaction)); -// } -// } -// }