diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cf8544c1782b0d775cb6cec5694167219ec47e9b..0d7e94a35f3f37a2c92a8d0c17e278b59389dbcd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,9 @@ # ** end header # +# TODO set DEPLOY_REF to dev after merge of f-feature-branch-pipeline variables: + DEPLOY_REF: f-feature-branch-pipeline CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/caosdb-server/caosdb-server-testenv:latest image: $CI_REGISTRY_IMAGE @@ -69,7 +71,8 @@ trigger_build: script: - /usr/bin/curl -X POST -F token=$DEPLOY_TRIGGER_TOKEN + -F "variables[F_BRANCH]=$CI_COMMIT_REF_NAME" -F "variables[SERVER]=$CI_COMMIT_REF_NAME" -F "variables[TriggerdBy]=SERVER" -F "variables[TriggerdByHash]=$CI_COMMIT_SHORT_SHA" - -F ref=dev https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline + -F ref=$DEPLOY_REF https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline diff --git a/conf/core/server.conf b/conf/core/server.conf index 66d59c276eba895c7f7885292dc004634c7d20f3..358f6b5c14106b87d7a676e2262474772ae98512 100644 --- a/conf/core/server.conf +++ b/conf/core/server.conf @@ -67,7 +67,7 @@ MYSQL_USER_NAME=caosdb # Password for the user MYSQL_USER_PASSWORD=caosdb # Schema of mysql procedures and tables which is required by this CaosDB instance -MYSQL_SCHEMA_VERSION=v2.1.2 +MYSQL_SCHEMA_VERSION=v3.0.0-rc1 # -------------------------------------------------- diff --git a/pom.xml b/pom.xml index be9279b6e1e927339d1c044b4cbc4313f992fba5..c8f79b3dcc43759cc941244283d13b248d811bb8 100644 --- a/pom.xml +++ b/pom.xml @@ -115,7 +115,7 @@ <dependency> <groupId>org.antlr</groupId> <artifactId>antlr4</artifactId> - <version>4.7.2</version> + <version>4.8-1</version> </dependency> <dependency> <groupId>org.restlet.jse</groupId> @@ -212,7 +212,7 @@ <plugin> <groupId>org.antlr</groupId> <artifactId>antlr4-maven-plugin</artifactId> - <version>4.7.2</version> + <version>4.8-1</version> <configuration> <sourceDirectory>${basedir}/src/main/java</sourceDirectory> </configuration> diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetAllNames.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetAllNames.java index d7c641cadebcde93b97187aa7a0ea2ded72d4678..c7d9c02067e0420590058476aad55b2542e4497f 100644 --- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetAllNames.java +++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetAllNames.java @@ -18,6 +18,7 @@ public class MySQLGetAllNames extends MySQLTransaction implements GetAllNamesImp super(access); } + // TODO public static final String STMT_GET_ALL_NAMES = "Select e.name as EntityName, e.role as EntityRole, a.acl as ACL FROM entities as e JOIN entity_acl as a ON (a.id=e.acl) WHERE e.name IS NOT NULL and e.role!='ROLE'"; diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetIDByName.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetIDByName.java index ff6d2b53d4e142cd634848d1c2edbccbe30892ad..6e5a55b5e4baa2c830d1f0ad116d7021c588ac66 100644 --- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetIDByName.java +++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLGetIDByName.java @@ -36,9 +36,10 @@ public class MySQLGetIDByName extends MySQLTransaction implements GetIDByNameImp super(access); } - public static final String STMT_GET_ID_BY_NAME = "Select id from entities where name=?"; - public static final String STMT_AND_ROLE = " AND role=?"; - public static final String STMT_NOT_ROLE = " AND role!='ROLE'"; + public static final String STMT_GET_ID_BY_NAME = + "Select n.entity_id AS id from name_data as n JOIN entities as e ON (n.domain_id=0 and n.property_id=20 and e.id = n.entity_id) and n.value=?"; + public static final String STMT_AND_ROLE = " AND e.role=?"; + public static final String STMT_NOT_ROLE = " AND e.role!='ROLE'"; public static final String STMT_LIMIT = " LIMIT "; @Override @@ -55,17 +56,13 @@ public class MySQLGetIDByName extends MySQLTransaction implements GetIDByNameImp if (role != null) { stmt.setString(2, role); } - ResultSet rs = null; - try { - rs = stmt.executeQuery(); + try (ResultSet rs = stmt.executeQuery()) { final ArrayList<Integer> ret = new ArrayList<Integer>(); while (rs.next()) { ret.add(rs.getInt("id")); } return ret; - } finally { - rs.close(); } } catch (final Exception e) { throw new TransactionException(e); diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLInsertEntityDatatype.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLInsertEntityDatatype.java index a2682e80b1997b53496e3ac2f8e6147726fb77c9..78b93ff8bf92386ecd287368a484960d3c5a46c8 100644 --- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLInsertEntityDatatype.java +++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLInsertEntityDatatype.java @@ -16,7 +16,7 @@ public class MySQLInsertEntityDatatype extends MySQLTransaction } public static final String STMT_INSERT_ENTITY_DATATYPE = - "INSERT INTO data_type (domain_id, entity_id, property_id, datatype) SELECT 0, 0, ?, ( SELECT id from entities where name = ? LIMIT 1);"; + "INSERT INTO data_type (domain_id, entity_id, property_id, datatype) SELECT 0, 0, ?, ( SELECT entity_id from name_data where domain_id = 0 and property_id = 20 and value = ? LIMIT 1);"; public static final String STMT_INSERT_ENTITY_COLLECTION = "INSERT INTO collection_type (domain_id, entity_id, property_id, collection) SELECT 0, 0, ?, ?;"; diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveAll.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveAll.java index b93615ea529291b967ef1fc22206b8d953e408d0..7ae921315f55e94994a2868d5b0a9b8d8406542b 100644 --- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveAll.java +++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveAll.java @@ -38,17 +38,17 @@ public class MySQLRetrieveAll extends MySQLTransaction implements RetrieveAllImp super(access); } - public static final String STMT_GET_ALL_HEAD = "Select id from entities where "; + public static final String STMT_GET_ALL_HEAD = "Select id from entities where id > 99"; public static final String STMT_ENTITY_WHERE_CLAUSE = - " ( role=? OR role='" + " AND ( role=? OR role='" + Role.RecordType + "' OR role='" + Role.Property + "' OR role='" + Role.File + "'" - + " ) AND ( NOT name=role OR name IS NULL)"; - public static final String STMT_OTHER_ROLES = " role=? AND ( NOT name=role OR name IS NULL)"; + + " )"; + public static final String STMT_OTHER_ROLES = " AND role=?"; @Override public List<Integer> execute(final String role) throws TransactionException { diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveDatatypes.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveDatatypes.java index 1c7609cc5ddf4eaff9bf2c742b43dd2bd27b0337..5ae7759339b88006c2c0f5d8d5a13d6a19d357a2 100644 --- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveDatatypes.java +++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLRetrieveDatatypes.java @@ -39,7 +39,7 @@ public class MySQLRetrieveDatatypes extends MySQLTransaction implements Retrieve } private static final String STMT_GET_DATATYPE = - "select id AS ParentID, name AS ParentName, description as ParentDescription, role as ParentRole, (SELECT acl FROM entity_acl as a WHERE a.id=e.acl) as ACL from entities as e where e.role='DATATYPE'"; + "select id AS ParentID, (SELECT value FROM name_data WHERE domain_id = 0 AND entity_ID = e.id AND property_id = 20) AS ParentName, description as ParentDescription, role as ParentRole, (SELECT acl FROM entity_acl as a WHERE a.id=e.acl) as ACL from entities as e where e.role='DATATYPE'"; @Override public ArrayList<VerySparseEntity> execute() throws TransactionException {