From b8e9c12a5bd7a9fdb246de8dccfaa943ece13d5d Mon Sep 17 00:00:00 2001 From: andrii0lomakin Date: Tue, 21 Jan 2025 10:45:04 +0100 Subject: [PATCH] YTDB upgrade. p2. --- .../exodus/entitystore/DualCompatibility.kt | 18 +- .../iterate/binop/OConcatEntityIterable.kt | 34 --- .../binop/OIntersectionEntityIterable.kt | 33 --- .../iterate/binop/OMinusEntityIterable.kt | 33 --- .../iterate/binop/OUnionEntityIterable.kt | 33 --- .../iterate/link/OLinkExistsEntityIterable.kt | 34 --- .../iterate/link/OLinkIsNullEntityIterable.kt | 34 --- .../link/OLinkIterableToEntityIterable.kt | 34 --- .../OLinkIterableToEntityIterableFiltered.kt | 37 ---- .../link/OLinkOfTypeToEntityIterable.kt | 35 ---- .../iterate/link/OLinkSelectEntityIterable.kt | 34 --- .../iterate/link/OLinkSortEntityIterable.kt | 37 ---- .../iterate/link/OLinkToEntityIterable.kt | 34 --- .../iterate/link/OLinksFromEntityIterable.kt | 34 --- .../property/OPropertyExistsSortedIterable.kt | 36 ---- .../RIDEntityId.kt} | 16 +- .../YTDBComparableSet.kt} | 4 +- .../YTDBDatabaseCompacter.kt} | 8 +- .../YTDBDatabaseConfig.kt} | 12 +- .../YTDBDatabaseConnectionConfig.kt} | 6 +- .../YTDBDatabaseProvider.kt} | 10 +- .../YTDBDatabaseProviderImpl.kt} | 10 +- .../OEntity.kt => youtrackdb/YTDBEntity.kt} | 8 +- .../YTDBEntityId.kt} | 4 +- .../YTDBEntityIterable.kt} | 8 +- .../YTDBEntityIterableHandle.kt} | 6 +- .../YTDBEntityIterables.kt} | 6 +- .../YTDBEntityStore.kt} | 10 +- .../YTDBPersistentEntityStore.kt} | 38 ++-- .../YTDBReadonlyVertexEntity.kt} | 6 +- .../YTDBSchemaBuddy.kt} | 36 ++-- .../YTDBStoreTransaction.kt} | 14 +- .../YTDBStoreTransactionImpl.kt} | 90 ++++---- .../YTDBVertexEntity.kt} | 67 +++--- .../iterate/YTDBDistinctEntityIterable.kt} | 22 +- .../iterate/YTDBEntityIterableBase.kt} | 70 +++---- .../iterate/YTDBEntityOfTypeIterable.kt} | 18 +- .../iterate/YTDBQueryEntityIterator.kt} | 26 +-- .../iterate/YTDBReversedEntityIterable.kt} | 22 +- .../iterate/YTDBSkipEntityIterable.kt} | 18 +- .../iterate/YTDBTakeEntityIterable.kt} | 18 +- .../iterate/binop/YTDBConcatEntityIterable.kt | 34 +++ .../binop/YTDBIntersectionEntityIterable.kt | 33 +++ .../iterate/binop/YTDBMinusEntityIterable.kt | 33 +++ .../iterate/binop/YTDBUnionEntityIterable.kt | 33 +++ .../link/YTDBLinkExistsEntityIterable.kt | 34 +++ .../link/YTDBLinkIsNullEntityIterable.kt | 34 +++ .../link/YTDBLinkIterableToEntityIterable.kt | 34 +++ ...TDBLinkIterableToEntityIterableFiltered.kt | 37 ++++ .../link/YTDBLinkOfTypeToEntityIterable.kt | 35 ++++ .../link/YTDBLinkSelectEntityIterable.kt | 34 +++ .../link/YTDBLinkSortEntityIterable.kt | 37 ++++ .../iterate/link/YTDBLinkToEntityIterable.kt | 34 +++ .../link/YTDBLinksFromEntityIterable.kt | 34 +++ .../link/YTDBMultipleEntitiesIterable.kt} | 42 ++-- .../iterate/link/YTDBVertexEntityIterable.kt} | 22 +- .../property/YTDBInstanceOfIterable.kt} | 22 +- .../YTDBPropertyBlobExistsEntityIterable.kt} | 22 +- .../property/YTDBPropertyContainsIterable.kt} | 24 +-- .../property/YTDBPropertyEqualIterable.kt} | 22 +- .../property/YTDBPropertyExistsIterable.kt} | 22 +- .../YTDBPropertyExistsSortedIterable.kt | 36 ++++ .../property/YTDBPropertyIsNullIterable.kt} | 22 +- .../property/YTDBPropertyRangeIterable.kt} | 24 +-- .../property/YTDBPropertySortedIterable.kt} | 28 +-- .../YTDBPropertyStartsWithIterable.kt} | 24 +-- .../iterate/property/YTDBSequenceImpl.kt} | 8 +- .../query/YTDBCondition.kt} | 64 +++--- .../query/YTDBConditions.kt} | 20 +- .../query/YTDBLimit.kt} | 24 +-- .../query/YTDBOrder.kt} | 30 +-- .../query/YTDBQuery.kt} | 4 +- .../query/YTDBQueryCancellingPolicy.kt} | 10 +- .../query/YTDBQueryExecution.kt} | 14 +- .../query/YTDBQueryFunctions.kt} | 72 +++---- .../query/YTDBQueryTimeout.kt} | 6 +- .../query/YTDBSelect.kt} | 196 +++++++++--------- .../OSkip.kt => youtrackdb/query/YTDBSkip.kt} | 24 +-- .../OSql.kt => youtrackdb/query/YTDBSql.kt} | 4 +- .../exodus/entitystore/WrongUsernameTest.kt | 6 +- .../{orientdb => youtrackdb}/DBCompactTest.kt | 8 +- .../EncryptedDBTest.kt | 16 +- .../OPersistentStoreTest.kt | 32 +-- .../OTransactionLifecycleTest.kt | 6 +- .../RIDEntityIdTest.kt} | 18 +- .../YTDBDatabaseConfigTest.kt} | 12 +- .../YTDBDatabaseProviderTest.kt} | 8 +- .../YTDBEntityTest.kt} | 26 +-- .../YTDBSchemaBuddyTest.kt} | 28 +-- .../YTDBSequenceImplTest.kt} | 8 +- .../YTDBStoreTransactionLifecycleTest.kt} | 8 +- .../YTDBStoreTransactionTest.kt} | 44 ++-- .../iterate/YTDBEntityIterableTest.kt} | 82 ++++---- .../query/YTDBQueryTest.kt} | 20 +- .../testutil/InMemoryYouTrackDB.kt | 30 +-- .../testutil/OTaskTrackerTestCase.kt | 26 +-- .../testutil/OTestMixin.kt | 24 +-- .../testutil/OUsersWithInheritanceTestCase.kt | 24 +-- .../testutil/OrientDBIssues.kt | 44 ++-- .../testutil/OrientDBUsers.kt | 10 +- .../java/jetbrains/exodus/query/GetAll.java | 4 +- .../java/jetbrains/exodus/query/GetLinks.java | 8 +- .../jetbrains/exodus/query/InstanceOf.java | 4 +- .../jetbrains/exodus/query/LinkEqual.java | 10 +- .../jetbrains/exodus/query/LinkNotNull.java | 4 +- .../exodus/query/PropertyContains.java | 4 +- .../jetbrains/exodus/query/PropertyEqual.java | 8 +- .../exodus/query/PropertyNotNull.java | 4 +- .../jetbrains/exodus/query/PropertyRange.java | 4 +- .../exodus/query/PropertyStartsWith.java | 4 +- .../java/jetbrains/exodus/query/UnaryNot.java | 12 +- .../exodus/query/LinksEqualDecorator.kt | 4 +- .../jetbrains/exodus/query/QueryEngine.kt | 42 ++-- .../jetbrains/exodus/query/SortEngine.kt | 22 +- .../query/metadata/CountingTransaction.kt | 16 +- .../metadata/DataAfterMigrationChecker.kt | 14 +- .../exodus/query/metadata/IndicesCreator.kt | 24 ++- .../query/metadata/MigrateXodusToOrient.kt | 14 +- .../metadata/XodusToOrientDataMigrator.kt | 24 +-- .../XodusToOrientDataMigratorLauncher.kt | 12 +- ...OModelMetaData.kt => YTDBModelMetaData.kt} | 12 +- .../metadata/YouTrackDbSchemaInitializer.kt | 16 +- .../query/OBinaryOperationsWithSortTest.kt | 10 +- ...ryEngineTest.kt => YTDBQueryEngineTest.kt} | 22 +- .../exodus/query/metadata/MigrateDataTest.kt | 22 +- .../MigrateXodusToOrientDbSmokeTest.kt | 20 +- .../query/metadata/MigrateYourDatabaseTest.kt | 14 +- .../query/metadata/OModelMetaDataTest.kt | 20 +- .../exodus/query/metadata/SchemaTestUtils.kt | 14 +- ...TrackDbSchemaInitializerLinkIndicesTest.kt | 8 +- .../YouTrackDbSchemaInitializerTest.kt | 12 +- 131 files changed, 1588 insertions(+), 1585 deletions(-) delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OConcatEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OIntersectionEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OMinusEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OUnionEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkExistsEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIsNullEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterableFiltered.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkOfTypeToEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSelectEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSortEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkToEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinksFromEntityIterable.kt delete mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyExistsSortedIterable.kt rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/ORIDEntityId.kt => youtrackdb/RIDEntityId.kt} (86%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OComparableSet.kt => youtrackdb/YTDBComparableSet.kt} (85%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/ODatabaseCompacter.kt => youtrackdb/YTDBDatabaseCompacter.kt} (93%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/ODatabaseConfig.kt => youtrackdb/YTDBDatabaseConfig.kt} (90%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/ODatabaseConnectionConfig.kt => youtrackdb/YTDBDatabaseConnectionConfig.kt} (92%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/ODatabaseProvider.kt => youtrackdb/YTDBDatabaseProvider.kt} (93%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/ODatabaseProviderImpl.kt => youtrackdb/YTDBDatabaseProviderImpl.kt} (95%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OEntity.kt => youtrackdb/YTDBEntity.kt} (83%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OEntityId.kt => youtrackdb/YTDBEntityId.kt} (90%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OEntityIterable.kt => youtrackdb/YTDBEntityIterable.kt} (78%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OEntityIterableHandle.kt => youtrackdb/YTDBEntityIterableHandle.kt} (95%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OEntityIterables.kt => youtrackdb/YTDBEntityIterables.kt} (78%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OEntityStore.kt => youtrackdb/YTDBEntityStore.kt} (74%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OPersistentEntityStore.kt => youtrackdb/YTDBPersistentEntityStore.kt} (85%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OReadonlyVertexEntity.kt => youtrackdb/YTDBReadonlyVertexEntity.kt} (79%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OSchemaBuddy.kt => youtrackdb/YTDBSchemaBuddy.kt} (91%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OStoreTransaction.kt => youtrackdb/YTDBStoreTransaction.kt} (84%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OStoreTransactionImpl.kt => youtrackdb/YTDBStoreTransactionImpl.kt} (83%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/OVertexEntity.kt => youtrackdb/YTDBVertexEntity.kt} (88%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/ODistinctEntityIterable.kt => youtrackdb/iterate/YTDBDistinctEntityIterable.kt} (52%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/OEntityIterableBase.kt => youtrackdb/iterate/YTDBEntityIterableBase.kt} (67%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/OEntityOfTypeIterable.kt => youtrackdb/iterate/YTDBEntityOfTypeIterable.kt} (60%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/OQueryEntityIterator.kt => youtrackdb/iterate/YTDBQueryEntityIterator.kt} (60%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/OReversedEntityIterable.kt => youtrackdb/iterate/YTDBReversedEntityIterable.kt} (52%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/OSkipEntityIterable.kt => youtrackdb/iterate/YTDBSkipEntityIterable.kt} (61%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/OTakeEntityIterable.kt => youtrackdb/iterate/YTDBTakeEntityIterable.kt} (61%) create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBConcatEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBIntersectionEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBMinusEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBUnionEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkExistsEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIsNullEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterableFiltered.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkOfTypeToEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSelectEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSortEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkToEntityIterable.kt create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinksFromEntityIterable.kt rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/link/OMultipleEntitiesIterable.kt => youtrackdb/iterate/link/YTDBMultipleEntitiesIterable.kt} (60%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/link/OVertexEntityIterable.kt => youtrackdb/iterate/link/YTDBVertexEntityIterable.kt} (86%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OInstanceOfIterable.kt => youtrackdb/iterate/property/YTDBInstanceOfIterable.kt} (53%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertyBlobExistsEntityIterable.kt => youtrackdb/iterate/property/YTDBPropertyBlobExistsEntityIterable.kt} (51%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertyContainsIterable.kt => youtrackdb/iterate/property/YTDBPropertyContainsIterable.kt} (52%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertyEqualIterable.kt => youtrackdb/iterate/property/YTDBPropertyEqualIterable.kt} (53%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertyExistsIterable.kt => youtrackdb/iterate/property/YTDBPropertyExistsIterable.kt} (51%) create mode 100644 entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyExistsSortedIterable.kt rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertyIsNullIterable.kt => youtrackdb/iterate/property/YTDBPropertyIsNullIterable.kt} (51%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertyRangeIterable.kt => youtrackdb/iterate/property/YTDBPropertyRangeIterable.kt} (53%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertySortedIterable.kt => youtrackdb/iterate/property/YTDBPropertySortedIterable.kt} (51%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OPropertyStartsWithIterable.kt => youtrackdb/iterate/property/YTDBPropertyStartsWithIterable.kt} (51%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/property/OSequenceImpl.kt => youtrackdb/iterate/property/YTDBSequenceImpl.kt} (85%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OCondition.kt => youtrackdb/query/YTDBCondition.kt} (76%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OConditions.kt => youtrackdb/query/YTDBConditions.kt} (59%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OLimit.kt => youtrackdb/query/YTDBLimit.kt} (63%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OOrder.kt => youtrackdb/query/YTDBOrder.kt} (72%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OQuery.kt => youtrackdb/query/YTDBQuery.kt} (88%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OQueryCancellingPolicy.kt => youtrackdb/query/YTDBQueryCancellingPolicy.kt} (78%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OQueryExecution.kt => youtrackdb/query/YTDBQueryExecution.kt} (74%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OQueryFunctions.kt => youtrackdb/query/YTDBQueryFunctions.kt} (60%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OQueryTimeout.kt => youtrackdb/query/YTDBQueryTimeout.kt} (88%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OSelect.kt => youtrackdb/query/YTDBSelect.kt} (68%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OSkip.kt => youtrackdb/query/YTDBSkip.kt} (64%) rename entity-store/src/main/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OSql.kt => youtrackdb/query/YTDBSql.kt} (94%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/DBCompactTest.kt (81%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/EncryptedDBTest.kt (90%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/OPersistentStoreTest.kt (93%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/OTransactionLifecycleTest.kt (98%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/ORIDEntityIdTest.kt => youtrackdb/RIDEntityIdTest.kt} (79%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/ODatabaseConfigTest.kt => youtrackdb/YTDBDatabaseConfigTest.kt} (86%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/ODatabaseProviderTest.kt => youtrackdb/YTDBDatabaseProviderTest.kt} (87%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/OEntityTest.kt => youtrackdb/YTDBEntityTest.kt} (96%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/OSchemaBuddyTest.kt => youtrackdb/YTDBSchemaBuddyTest.kt} (83%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/OSequenceImplTest.kt => youtrackdb/YTDBSequenceImplTest.kt} (92%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/OStoreTransactionLifecycleTest.kt => youtrackdb/YTDBStoreTransactionLifecycleTest.kt} (94%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/OStoreTransactionTest.kt => youtrackdb/YTDBStoreTransactionTest.kt} (94%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/iterate/OEntityIterableTest.kt => youtrackdb/iterate/YTDBEntityIterableTest.kt} (86%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb/query/OQueryTest.kt => youtrackdb/query/YTDBQueryTest.kt} (79%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/testutil/InMemoryYouTrackDB.kt (79%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/testutil/OTaskTrackerTestCase.kt (63%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/testutil/OTestMixin.kt (64%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/testutil/OUsersWithInheritanceTestCase.kt (73%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/testutil/OrientDBIssues.kt (66%) rename entity-store/src/test/kotlin/jetbrains/exodus/entitystore/{orientdb => youtrackdb}/testutil/OrientDBUsers.kt (76%) rename query/src/main/kotlin/jetbrains/exodus/query/metadata/{OModelMetaData.kt => YTDBModelMetaData.kt} (90%) rename query/src/test/kotlin/jetbrains/exodus/query/{OQueryEngineTest.kt => YTDBQueryEngineTest.kt} (96%) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/DualCompatibility.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/DualCompatibility.kt index af8a9ca8c..4119919ca 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/DualCompatibility.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/DualCompatibility.kt @@ -15,9 +15,9 @@ */ package jetbrains.exodus.entitystore -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OEntityStore -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityStore +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction /** @@ -35,16 +35,16 @@ fun PersistentEntityStore.asPersistent(): PersistentEntityStoreImpl { return this as PersistentEntityStoreImpl } -fun StoreTransaction.asOStoreTransaction(): OStoreTransaction { - return this as OStoreTransaction +fun StoreTransaction.asOStoreTransaction(): YTDBStoreTransaction { + return this as YTDBStoreTransaction } -fun EntityIterable.asOQueryIterable(): OEntityIterable { - require(this is OEntityIterable) { "Only OEntityIterableBase is supported, but was ${this.javaClass.simpleName}" } +fun EntityIterable.asOQueryIterable(): YTDBEntityIterable { + require(this is YTDBEntityIterable) { "Only OEntityIterableBase is supported, but was ${this.javaClass.simpleName}" } return this } -fun EntityStore.asOStore(): OEntityStore { - require(this is OEntityStore) { "Only OEntityStore is supported, but was ${this.javaClass.simpleName}" } +fun EntityStore.asOStore(): YTDBEntityStore { + require(this is YTDBEntityStore) { "Only OEntityStore is supported, but was ${this.javaClass.simpleName}" } return this } \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OConcatEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OConcatEntityIterable.kt deleted file mode 100644 index 7280ff6ed..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OConcatEntityIterable.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.binop - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OSelect -import jetbrains.exodus.entitystore.orientdb.query.OUnionSelect - -class OConcatEntityIterable( - txn: OStoreTransaction, - private val iterable1: OEntityIterable, - private val iterable2: OEntityIterable -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OUnionSelect(iterable1.query(), iterable2.query(), false) - } -} - diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OIntersectionEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OIntersectionEntityIterable.kt deleted file mode 100644 index a988d4014..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OIntersectionEntityIterable.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.binop - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OQueryFunctions -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OIntersectionEntityIterable( - txn: OStoreTransaction, - private val left: OEntityIterable, - private val right: OEntityIterable -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OQueryFunctions.intersect(left.query(), right.query()) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OMinusEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OMinusEntityIterable.kt deleted file mode 100644 index 40c925aa4..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OMinusEntityIterable.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.binop - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OQueryFunctions -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OMinusEntityIterable( - txn: OStoreTransaction, - private val left: OEntityIterable, - private val right: OEntityIterable -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OQueryFunctions.difference(left.query(), right.query()) - } -} \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OUnionEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OUnionEntityIterable.kt deleted file mode 100644 index 88e221ae1..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/binop/OUnionEntityIterable.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.binop - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OQueryFunctions -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OUnionEntityIterable( - txn: OStoreTransaction, - private val left: OEntityIterable, - private val right: OEntityIterable -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OQueryFunctions.union(left.query(), right.query()) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkExistsEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkExistsEntityIterable.kt deleted file mode 100644 index 5ed71522c..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkExistsEntityIterable.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OEdgeExistsCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkExistsEntityIterable( - txn: OStoreTransaction, - private val entityType: String, - private val linkName: String, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OClassSelect(entityType, OEdgeExistsCondition(linkName.asEdgeClass)) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIsNullEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIsNullEntityIterable.kt deleted file mode 100644 index 4cc49d63f..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIsNullEntityIterable.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OEdgeIsNullCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkIsNullEntityIterable( - txn: OStoreTransaction, - private val entityType: String, - private val linkName: String, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OClassSelect(entityType, OEdgeIsNullCondition(linkName.asEdgeClass)) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterable.kt deleted file mode 100644 index d1b540e1c..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterable.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OLinkInFromSubQuerySelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkIterableToEntityIterable( - txn: OStoreTransaction, - private val linkIterable: OEntityIterable, - private val linkName: String -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OLinkInFromSubQuerySelect(linkName.asEdgeClass, linkIterable.query()) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterableFiltered.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterableFiltered.kt deleted file mode 100644 index bc2dd8cf7..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkIterableToEntityIterableFiltered.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OIntersectSelect -import jetbrains.exodus.entitystore.orientdb.query.OLinkInFromSubQuerySelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkIterableToEntityIterableFiltered( - txn: OStoreTransaction, - private val linkIterable: OEntityIterable, - private val linkName: String, - private val source: OEntityIterable, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - val byLinkSelect = OLinkInFromSubQuerySelect(linkName.asEdgeClass, linkIterable.query()) - return OIntersectSelect(source.query(), byLinkSelect) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkOfTypeToEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkOfTypeToEntityIterable.kt deleted file mode 100644 index a5b6aa978..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkOfTypeToEntityIterable.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OEntityId -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OLinkOfTypeInFromIdsSelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkOfTypeToEntityIterable( - txn: OStoreTransaction, - private val linkName: String, - private val linkEntityId: OEntityId, - private val targetEntityType: String, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OLinkOfTypeInFromIdsSelect(linkName.asEdgeClass, listOf(linkEntityId.asOId()), targetEntityType) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSelectEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSelectEntityIterable.kt deleted file mode 100644 index 63830b120..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSelectEntityIterable.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OLinkOutFromSubQuerySelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkSelectEntityIterable( - txn: OStoreTransaction, - private val source: OEntityIterable, - private val linkName: String, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OLinkOutFromSubQuerySelect(linkName.asEdgeClass, source.query()) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSortEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSortEntityIterable.kt deleted file mode 100644 index 1bbfb1697..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkSortEntityIterable.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OLinkInFromSubQuerySelect -import jetbrains.exodus.entitystore.orientdb.query.OQueryFunctions -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkSortEntityIterable( - txn: OStoreTransaction, - private val linkOrder: OEntityIterable, - private val linkName: String, - private val sourceOrder: OEntityIterable, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - val linkQuery = OLinkInFromSubQuerySelect(linkName.asEdgeClass, linkOrder.query()) - return OQueryFunctions.intersect(linkQuery, sourceOrder.query()) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkToEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkToEntityIterable.kt deleted file mode 100644 index 3ca673b6f..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinkToEntityIterable.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OEntityId -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OLinkInFromIdsSelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinkToEntityIterable( - txn: OStoreTransaction, - private val linkName: String, - private val linkEntityId: OEntityId, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OLinkInFromIdsSelect(linkName.asEdgeClass, listOf(linkEntityId.asOId())) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinksFromEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinksFromEntityIterable.kt deleted file mode 100644 index d3144f328..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OLinksFromEntityIterable.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.link - -import jetbrains.exodus.entitystore.orientdb.OEntityId -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.asEdgeClass -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OLinkOutFromIdSelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OLinksFromEntityIterable( - txn: OStoreTransaction, - private val linkName: String, - private val fromEntityId: OEntityId, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - return OLinkOutFromIdSelect(linkName.asEdgeClass, listOf(fromEntityId.asOId())) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyExistsSortedIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyExistsSortedIterable.kt deleted file mode 100644 index d87c34dca..000000000 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyExistsSortedIterable.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright ${inceptionYear} - ${year} ${owner} - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package jetbrains.exodus.entitystore.orientdb.iterate.property - -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OFieldExistsCondition -import jetbrains.exodus.entitystore.orientdb.query.OOrderByFields -import jetbrains.exodus.entitystore.orientdb.query.OSelect - -class OPropertyExistsSortedIterable( - txn: OStoreTransaction, - private val entityType: String, - private val propertyName: String, -) : OEntityIterableBase(txn) { - - override fun query(): OSelect { - val condition = OFieldExistsCondition(propertyName) - val order = OOrderByFields(propertyName) - return OClassSelect(entityType, condition, order) - } -} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ORIDEntityId.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/RIDEntityId.kt similarity index 86% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ORIDEntityId.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/RIDEntityId.kt index d10cf5e34..616cf7ca8 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ORIDEntityId.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/RIDEntityId.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.record.RID import com.jetbrains.youtrack.db.api.record.Vertex @@ -21,23 +21,23 @@ import com.jetbrains.youtrack.db.api.schema.SchemaClass import com.jetbrains.youtrack.db.internal.core.id.ImmutableRecordId import jetbrains.exodus.entitystore.EntityId -class ORIDEntityId( +class RIDEntityId( private val classId: Int, private val localEntityId: Long, private val oId: RID, private val schemaClass: SchemaClass? -) : OEntityId { +) : YTDBEntityId { companion object { @JvmStatic - val EMPTY_ID: ORIDEntityId = ORIDEntityId(-1, -1, + val EMPTY_ID: RIDEntityId = RIDEntityId(-1, -1, ImmutableRecordId.EMPTY_RECORD_ID, null) - fun fromVertex(vertex: Vertex): ORIDEntityId { + fun fromVertex(vertex: Vertex): RIDEntityId { val oClass = vertex.requireSchemaClass() val classId = oClass.requireClassId() val localEntityId = vertex.requireLocalEntityId() - return ORIDEntityId(classId, localEntityId, vertex.identity, oClass) + return RIDEntityId(classId, localEntityId, vertex.identity, oClass) } } @@ -58,7 +58,7 @@ class ORIDEntityId( } override fun compareTo(other: EntityId?): Int { - if (other !is ORIDEntityId) { + if (other !is RIDEntityId) { throw IllegalArgumentException("Cannot compare ORIDEntityId with ${other?.javaClass?.name}") } return oId.compareTo(other.oId) @@ -76,7 +76,7 @@ class ORIDEntityId( if (this === other) return true if (javaClass != other?.javaClass) return false - other as ORIDEntityId + other as RIDEntityId return this.classId == other.classId && this.localEntityId == other.localEntityId } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OComparableSet.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBComparableSet.kt similarity index 85% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OComparableSet.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBComparableSet.kt index 9f860c514..a7c4159dc 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OComparableSet.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBComparableSet.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.internal.core.db.record.TrackedSet -class OComparableSet(val source: MutableSet) : MutableSet by source, Comparable> { +class YTDBComparableSet(val source: MutableSet) : MutableSet by source, Comparable> { val isDirty: Boolean get() { return if (source is TrackedSet) { diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseCompacter.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseCompacter.kt similarity index 93% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseCompacter.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseCompacter.kt index 2e0ed5e67..2b808a77b 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseCompacter.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseCompacter.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.YouTrackDB import com.jetbrains.youtrack.db.internal.core.command.CommandOutputListener @@ -23,10 +23,10 @@ import com.jetbrains.youtrack.db.internal.core.db.tool.DatabaseImport import mu.KLogging import java.io.File -class ODatabaseCompacter( +class YTDBDatabaseCompacter( private val db: YouTrackDB, - private val dbProvider: ODatabaseProvider, - private val config: ODatabaseConfig + private val dbProvider: YTDBDatabaseProvider, + private val config: YTDBDatabaseConfig ) { companion object : KLogging() diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConfig.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConfig.kt similarity index 90% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConfig.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConfig.kt index 20df682e8..361ec61af 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConfig.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConfig.kt @@ -14,14 +14,14 @@ * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseType import com.jetbrains.youtrack.db.api.config.YouTrackDBConfigBuilder import kotlin.math.min -class ODatabaseConfig private constructor( - val connectionConfig: ODatabaseConnectionConfig, +class YTDBDatabaseConfig private constructor( + val connectionConfig: YTDBDatabaseConnectionConfig, val databaseName: String, val databaseType: DatabaseType, val closeAfterDelayTimeout: Int, @@ -37,7 +37,7 @@ class ODatabaseConfig private constructor( @Suppress("unused") class Builder internal constructor() { - private lateinit var connectionConfig: ODatabaseConnectionConfig + private lateinit var connectionConfig: YTDBDatabaseConnectionConfig private var databaseName: String = "" private var databaseType: DatabaseType? = null private var closeAfterDelayTimeout: Int? = null @@ -46,7 +46,7 @@ class ODatabaseConfig private constructor( private var tweakConfig: YouTrackDBConfigBuilder.() -> Unit = {} fun withDatabaseName(databaseName: String) = apply { this.databaseName = databaseName } - fun withConnectionConfig(connectionConfig: ODatabaseConnectionConfig) = + fun withConnectionConfig(connectionConfig: YTDBDatabaseConnectionConfig) = apply { this.connectionConfig = connectionConfig } fun withDatabaseType(databaseType: DatabaseType) = apply { this.databaseType = databaseType } @@ -65,7 +65,7 @@ class ODatabaseConfig private constructor( fun tweakConfig(tweakConfig: YouTrackDBConfigBuilder.() -> Unit) = apply { this.tweakConfig = tweakConfig } - fun build() = ODatabaseConfig( + fun build() = YTDBDatabaseConfig( connectionConfig, databaseName, databaseType ?: connectionConfig.databaseType, closeAfterDelayTimeout ?: connectionConfig.closeAfterDelayTimeout, cipherKey, closeDatabaseInDbProvider, tweakConfig ) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConnectionConfig.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConnectionConfig.kt similarity index 92% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConnectionConfig.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConnectionConfig.kt index 0177f8326..94019634c 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConnectionConfig.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConnectionConfig.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseType -class ODatabaseConnectionConfig private constructor( +class YTDBDatabaseConnectionConfig private constructor( val databaseRoot: String, val userName: String, val password: String, @@ -45,7 +45,7 @@ class ODatabaseConnectionConfig private constructor( fun withCloseAfterDelayTimeout(closeAfterDelayTimeout: Int) = apply { this.closeAfterDelayTimeout = closeAfterDelayTimeout } - fun build() = ODatabaseConnectionConfig( + fun build() = YTDBDatabaseConnectionConfig( databaseRoot, userName, password, databaseType, closeAfterDelayTimeout ) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProvider.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProvider.kt similarity index 93% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProvider.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProvider.kt index cb2860be8..2158eed5c 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProvider.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProvider.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.YouTrackDB @@ -23,7 +23,7 @@ import com.jetbrains.youtrack.db.api.config.YouTrackDBConfig import com.jetbrains.youtrack.db.api.exception.RecordDuplicatedException import com.jetbrains.youtrack.db.internal.core.db.DatabaseRecordThreadLocal -interface ODatabaseProvider { +interface YTDBDatabaseProvider { val databaseLocation: String fun acquireSession(): DatabaseSession @@ -48,13 +48,13 @@ interface ODatabaseProvider { fun close() } -fun ODatabaseProvider.withSession(block: (DatabaseSession) -> R): R { +fun YTDBDatabaseProvider.withSession(block: (DatabaseSession) -> R): R { acquireSession().use { session -> return block(session) } } -fun ODatabaseProvider.withCurrentOrNewSession( +fun YTDBDatabaseProvider.withCurrentOrNewSession( requireNoActiveTransaction: Boolean = false, block: (DatabaseSession) -> R ): R { @@ -92,7 +92,7 @@ internal fun hasActiveSession(): Boolean { return db != null } -fun iniYouTrackDb(config: ODatabaseConnectionConfig): YouTrackDB { +fun iniYouTrackDb(config: YTDBDatabaseConnectionConfig): YouTrackDB { val orientConfig = YouTrackDBConfig.builder().apply { addGlobalConfigurationParameter(GlobalConfiguration.AUTO_CLOSE_AFTER_DELAY, true) addGlobalConfigurationParameter( diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProviderImpl.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProviderImpl.kt similarity index 95% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProviderImpl.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProviderImpl.kt index 52c3b95cd..249740cf5 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProviderImpl.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProviderImpl.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.YouTrackDB @@ -24,10 +24,10 @@ import java.util.* //username and password are considered to be same for all databases //todo this params also should be collected in some config entity -class ODatabaseProviderImpl( - private val config: ODatabaseConfig, +class YTDBDatabaseProviderImpl( + private val config: YTDBDatabaseConfig, private val database: YouTrackDB -) : ODatabaseProvider { +) : YTDBDatabaseProvider { private val youTrackDBConfig: YouTrackDBConfig init { @@ -59,7 +59,7 @@ class ODatabaseProviderImpl( } fun compact() { - ODatabaseCompacter( + YTDBDatabaseCompacter( database, this, config diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntity.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntity.kt similarity index 83% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntity.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntity.kt index b6d989cc0..1d4176ff5 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntity.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntity.kt @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import jetbrains.exodus.entitystore.Entity -interface OEntity : Entity { +interface YTDBEntity : Entity { - override fun getId(): OEntityId + override fun getId(): YTDBEntityId - fun save(): OEntity + fun save(): YTDBEntity fun resetToNew() diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityId.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityId.kt similarity index 90% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityId.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityId.kt index e025a28e7..027a169cf 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityId.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityId.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.record.RID import jetbrains.exodus.entitystore.EntityId -interface OEntityId : EntityId { +interface YTDBEntityId : EntityId { fun asOId(): RID fun getTypeName(): String diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterable.kt similarity index 78% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterable.kt index d465a066f..3e1ea57e7 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterable.kt @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import jetbrains.exodus.entitystore.EntityIterable -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -interface OEntityIterable : EntityIterable { +interface YTDBEntityIterable : EntityIterable { - fun query(): OSelect + fun query(): YTDBSelect override fun unwrap() = this } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterableHandle.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterableHandle.kt similarity index 95% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterableHandle.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterableHandle.kt index 6a4b1a0fa..6f1937161 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterableHandle.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterableHandle.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import jetbrains.exodus.entitystore.EntityId import jetbrains.exodus.entitystore.EntityIterableHandle @@ -22,13 +22,13 @@ import jetbrains.exodus.entitystore.iterate.EntityAddedOrDeletedHandleChecker import jetbrains.exodus.entitystore.iterate.LinkChangedHandleChecker import jetbrains.exodus.entitystore.iterate.PropertyChangedHandleChecker -class OEntityIterableHandle(private val query: String) : EntityIterableHandle { +class YTDBEntityIterableHandle(private val query: String) : EntityIterableHandle { override fun hashCode(): Int { return 0 } override fun equals(other: Any?): Boolean { - return other is OEntityIterableHandle + return other is YTDBEntityIterableHandle } override fun getType(): EntityIterableType { diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterables.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterables.kt similarity index 78% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterables.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterables.kt index e1eab1a53..510dda76d 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityIterables.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityIterables.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.query.ResultSet import jetbrains.exodus.entitystore.Entity -fun ResultSet.toEntityIterator(store: OEntityStore): Iterator { - return this.vertexStream().map { OVertexEntity(it, store) }.iterator() +fun ResultSet.toEntityIterator(store: YTDBEntityStore): Iterator { + return this.vertexStream().map { YTDBVertexEntity(it, store) }.iterator() } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityStore.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityStore.kt similarity index 74% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityStore.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityStore.kt index 80205d05a..fda61ad8e 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityStore.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityStore.kt @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import jetbrains.exodus.entitystore.EntityStore import jetbrains.exodus.entitystore.PersistentEntityId -interface OEntityStore : EntityStore { +interface YTDBEntityStore : EntityStore { val databaseSession: DatabaseSession - fun requireActiveTransaction(): OStoreTransaction + fun requireActiveTransaction(): YTDBStoreTransaction - fun requireActiveWritableTransaction(): OStoreTransaction + fun requireActiveWritableTransaction(): YTDBStoreTransaction - fun getOEntityId(entityId: PersistentEntityId): OEntityId + fun getOEntityId(entityId: PersistentEntityId): YTDBEntityId } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OPersistentEntityStore.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBPersistentEntityStore.kt similarity index 85% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OPersistentEntityStore.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBPersistentEntityStore.kt index 07d22046d..2e1ef7d76 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OPersistentEntityStore.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBPersistentEntityStore.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.internal.core.db.DatabaseRecordThreadLocal @@ -21,13 +21,13 @@ import jetbrains.exodus.backup.BackupStrategy import jetbrains.exodus.bindings.ComparableBinding import jetbrains.exodus.entitystore.* -class OPersistentEntityStore( - private val databaseProvider: ODatabaseProvider, +class YTDBPersistentEntityStore( + private val databaseProvider: YTDBDatabaseProvider, private val name: String, - private val schemaBuddy: OSchemaBuddy = OSchemaBuddyImpl(databaseProvider) -) : PersistentEntityStore, OEntityStore { + private val schemaBuddy: YTDBSchemaBuddy = YTDBSchemaBuddyImpl(databaseProvider) +) : PersistentEntityStore, YTDBEntityStore { - private val currentTransaction = ThreadLocal() + private val currentTransaction = ThreadLocal() override val databaseSession: DatabaseSession get() { @@ -60,12 +60,12 @@ class OPersistentEntityStore( } private fun beginTransactionImpl(readOnly: Boolean): StoreTransaction { - var currentTx: OStoreTransaction? = currentTransaction.get() + var currentTx: YTDBStoreTransaction? = currentTransaction.get() check(currentTx == null) { "EntityStore has a transaction on the current thread. Finish it before starting a new one." } val session = databaseProvider.acquireSession() - currentTx = OStoreTransactionImpl( + currentTx = YTDBStoreTransactionImpl( session, store = this, schemaBuddy, @@ -80,14 +80,14 @@ class OPersistentEntityStore( return currentTx } - private fun onTransactionFinished(session: DatabaseSession, tx: OStoreTransaction) { + private fun onTransactionFinished(session: DatabaseSession, tx: YTDBStoreTransaction) { check(currentTransaction.get() == tx) { "The current transaction at EntityStore is different for one that just has finished. It must not happen." } check(!session.isClosed) { "The session should not be closed at this point." } currentTransaction.remove() session.close() } - private fun onTransactionDeactivated(session: DatabaseSession, tx: OStoreTransaction) { + private fun onTransactionDeactivated(session: DatabaseSession, tx: YTDBStoreTransaction) { check(currentTransaction.get() == tx) { "Impossible to deactivate the transaction. The transaction on the current thread is different from one that wants to suspend. It must not ever happen." } check(!tx.isFinished) { "Cannot deactivate a finished transaction" } check(!session.isClosed) { "Cannot deactivate a closed session" } @@ -95,7 +95,7 @@ class OPersistentEntityStore( DatabaseRecordThreadLocal.instance().remove() } - private fun onTransactionActivated(session: DatabaseSession, tx: OStoreTransaction) { + private fun onTransactionActivated(session: DatabaseSession, tx: YTDBStoreTransaction) { check(currentTransaction.get() == null) { "Impossible to activate the transaction. There is already an active transaction on the current thread." } check(!hasActiveSession()) { "There is an active session on the current thread" } check(!tx.isFinished) { "Cannot activate a finished transaction" } @@ -125,7 +125,7 @@ class OPersistentEntityStore( executeInTransaction(executable) override fun computeInTransaction(computable: StoreTransactionalComputable): T { - val tx = beginTransaction() as OStoreTransactionImpl + val tx = beginTransaction() as YTDBStoreTransactionImpl try { val result = computable.compute(tx) tx.commit() @@ -176,31 +176,31 @@ class OPersistentEntityStore( return requireActiveTransaction() } - override fun requireActiveTransaction(): OStoreTransaction { + override fun requireActiveTransaction(): YTDBStoreTransaction { val tx = currentTransaction.get() check(tx != null) { "No active transactions on the current thread" } tx.requireActiveTransaction() return tx } - override fun requireActiveWritableTransaction(): OStoreTransaction { + override fun requireActiveWritableTransaction(): YTDBStoreTransaction { val tx = currentTransaction.get() check(tx != null) { "No active transactions on the current thread" } tx.requireActiveWritableTransaction() return tx } - override fun getOEntityId(entityId: PersistentEntityId): OEntityId { + override fun getOEntityId(entityId: PersistentEntityId): YTDBEntityId { return requireActiveTransaction().getOEntityId(entityId) } } -internal fun OEntityStore.requireOEntityId(id: EntityId): OEntityId { +internal fun YTDBEntityStore.requireOEntityId(id: EntityId): YTDBEntityId { return when (id) { - is ORIDEntityId -> id - PersistentEntityId.EMPTY_ID -> ORIDEntityId.EMPTY_ID + is RIDEntityId -> id + PersistentEntityId.EMPTY_ID -> RIDEntityId.EMPTY_ID is PersistentEntityId -> { - val oEntityStore = this as? OPersistentEntityStore ?: throw IllegalArgumentException("OPersistentEntityStore is required to get OEntityId, the provided type is ${this.javaClass.simpleName}") + val oEntityStore = this as? YTDBPersistentEntityStore ?: throw IllegalArgumentException("OPersistentEntityStore is required to get OEntityId, the provided type is ${this.javaClass.simpleName}") oEntityStore.getOEntityId(id) } else -> throw IllegalArgumentException("${id.javaClass.simpleName} is not supported") diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OReadonlyVertexEntity.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBReadonlyVertexEntity.kt similarity index 79% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OReadonlyVertexEntity.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBReadonlyVertexEntity.kt index 17fc4e51c..19acd0346 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OReadonlyVertexEntity.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBReadonlyVertexEntity.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.record.Vertex -class OReadonlyVertexEntity(vertex: Vertex, store: OEntityStore) : OVertexEntity(vertex, store) { - override fun requireActiveWritableTransaction(): OStoreTransaction { +class YTDBReadonlyVertexEntity(vertex: Vertex, store: YTDBEntityStore) : YTDBVertexEntity(vertex, store) { + override fun requireActiveWritableTransaction(): YTDBStoreTransaction { throw IllegalArgumentException("Can't update readonly entity (id=${id})") } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OSchemaBuddy.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSchemaBuddy.kt similarity index 91% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OSchemaBuddy.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSchemaBuddy.kt index 5abb2143e..6a17992ce 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OSchemaBuddy.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSchemaBuddy.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.query.ResultSet @@ -23,16 +23,16 @@ import com.jetbrains.youtrack.db.internal.core.db.DatabaseSessionInternal import com.jetbrains.youtrack.db.internal.core.metadata.sequence.DBSequence import jetbrains.exodus.entitystore.EntityRemovedInDatabaseException import jetbrains.exodus.entitystore.PersistentEntityId -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.CLASS_ID_CUSTOM_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.CLASS_ID_SEQUENCE_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.localEntityIdSequenceName +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.CLASS_ID_CUSTOM_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.CLASS_ID_SEQUENCE_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.localEntityIdSequenceName import java.util.concurrent.ConcurrentHashMap -interface OSchemaBuddy { +interface YTDBSchemaBuddy { fun initialize(session: DatabaseSession) - fun getOEntityId(session: DatabaseSession, entityId: PersistentEntityId): ORIDEntityId + fun getOEntityId(session: DatabaseSession, entityId: PersistentEntityId): RIDEntityId /** * If the class has not been found, returns -1. It is how it was in the Classic Xodus. @@ -65,10 +65,10 @@ interface OSchemaBuddy { ): SchemaClass } -class OSchemaBuddyImpl( - private val dbProvider: ODatabaseProvider, +class YTDBSchemaBuddyImpl( + private val dbProvider: YTDBDatabaseProvider, autoInitialize: Boolean = true, -) : OSchemaBuddy { +) : YTDBSchemaBuddy { companion object { val INTERNAL_CLASS_NAMES = hashSetOf(SchemaClass.VERTEX_CLASS_NAME) } @@ -125,7 +125,7 @@ class OSchemaBuddyImpl( outClassName: String, inClassName: String ): SchemaClass { - val edgeClassName = OVertexEntity.edgeClassName(linkName) + val edgeClassName = YTDBVertexEntity.edgeClassName(linkName) val oClass = session.getClass(edgeClassName) if (oClass != null) return oClass @@ -166,15 +166,15 @@ class OSchemaBuddyImpl( override fun getOEntityId( session: DatabaseSession, entityId: PersistentEntityId - ): ORIDEntityId { + ): RIDEntityId { // Keep in mind that it is possible that we are given an entityId that is not in the database. // It is a valid case. val classId = entityId.typeId val localEntityId = entityId.localId - val oClassId = classIdToOClassId[classId]?.first ?: return ORIDEntityId.EMPTY_ID + val oClassId = classIdToOClassId[classId]?.first ?: return RIDEntityId.EMPTY_ID val schema = session.schema - val oClass = schema.getClassByClusterId(oClassId) ?: return ORIDEntityId.EMPTY_ID + val oClass = schema.getClassByClusterId(oClassId) ?: return RIDEntityId.EMPTY_ID val resultSet: ResultSet = session.query( "SELECT FROM ${oClass.name} WHERE $LOCAL_ENTITY_ID_PROPERTY_NAME = ?", @@ -182,12 +182,12 @@ class OSchemaBuddyImpl( ) val oid = if (resultSet.hasNext()) { val result = resultSet.next() - result.toVertex()?.identity ?: return ORIDEntityId.EMPTY_ID + result.toVertex()?.identity ?: return RIDEntityId.EMPTY_ID } else { - return ORIDEntityId.EMPTY_ID + return RIDEntityId.EMPTY_ID } - return ORIDEntityId(classId, localEntityId, oid, oClass) + return RIDEntityId(classId, localEntityId, oid, oClass) } override fun getTypeId(session: DatabaseSession, entityType: String): Int { @@ -215,7 +215,7 @@ class OSchemaBuddyImpl( } fun DatabaseSession.executeInASeparateSessionIfCurrentHasTransaction( - dbProvider: ODatabaseProvider, + dbProvider: YTDBDatabaseProvider, action: (DatabaseSession) -> T ): T { return if (this.hasActiveTransaction()) { diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransaction.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransaction.kt similarity index 84% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransaction.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransaction.kt index 6cc624e64..512fd1c95 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransaction.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransaction.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.query.ResultSet @@ -24,10 +24,10 @@ import com.jetbrains.youtrack.db.internal.core.metadata.sequence.DBSequence import jetbrains.exodus.entitystore.PersistentEntityId import jetbrains.exodus.entitystore.StoreTransaction -interface OStoreTransaction : StoreTransaction { +interface YTDBStoreTransaction : StoreTransaction { val databaseSession: DatabaseSession - fun getOEntityStore(): OEntityStore + fun getOEntityStore(): YTDBEntityStore fun getTransactionId(): Long @@ -40,20 +40,20 @@ interface OStoreTransaction : StoreTransaction { fun activateOnCurrentThread() - fun getRecord(id: OEntityId): T + fun getRecord(id: YTDBEntityId): T where T : DBRecord - fun newEntity(entityType: String, localEntityId: Long): OVertexEntity + fun newEntity(entityType: String, localEntityId: Long): YTDBVertexEntity fun generateEntityId(entityType: String, vertex: Vertex) fun bindToSession(vertex: Vertex): Vertex - fun bindToSession(entity: OVertexEntity): OVertexEntity + fun bindToSession(entity: YTDBVertexEntity): YTDBVertexEntity fun query(sql: String, params: Map): ResultSet - fun getOEntityId(entityId: PersistentEntityId): OEntityId + fun getOEntityId(entityId: PersistentEntityId): YTDBEntityId /** * If the class has not been found, returns -1. It is how it was in the Classic Xodus. diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionImpl.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionImpl.kt similarity index 83% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionImpl.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionImpl.kt index d96050a27..69a6d0ba8 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionImpl.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionImpl.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.exception.ModificationOperationProhibitedException @@ -27,25 +27,25 @@ import com.jetbrains.youtrack.db.internal.core.id.ImmutableRecordId import com.jetbrains.youtrack.db.internal.core.metadata.sequence.DBSequence import com.jetbrains.youtrack.db.internal.core.tx.FrontendTransaction import jetbrains.exodus.entitystore.* -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityOfTypeIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.* -import jetbrains.exodus.entitystore.orientdb.iterate.property.* -import jetbrains.exodus.entitystore.orientdb.query.OQueryCancellingPolicy +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityOfTypeIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.* +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.* +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryCancellingPolicy import jetbrains.exodus.env.ReadonlyTransactionException -internal typealias TransactionEventHandler = (DatabaseSession, OStoreTransaction) -> Unit +internal typealias TransactionEventHandler = (DatabaseSession, YTDBStoreTransaction) -> Unit -class OStoreTransactionImpl( +class YTDBStoreTransactionImpl( private val session: DatabaseSession, - private val store: OPersistentEntityStore, - private val schemaBuddy: OSchemaBuddy, + private val store: YTDBPersistentEntityStore, + private val schemaBuddy: YTDBSchemaBuddy, private val onFinished: TransactionEventHandler, private val onDeactivated: TransactionEventHandler, private val onActivated: TransactionEventHandler, private val readOnly: Boolean = false -) : OStoreTransaction { - private var queryCancellingPolicy: OQueryCancellingPolicy? = null +) : YTDBStoreTransaction { + private var queryCancellingPolicy: YTDBQueryCancellingPolicy? = null /** * The Orient transaction gets changed on flush(), so its id gets changed too. @@ -65,7 +65,7 @@ class OStoreTransactionImpl( return transactionIdImpl } - override fun getRecord(id: OEntityId): T + override fun getRecord(id: YTDBEntityId): T where T : DBRecord { requireActiveTransaction() try { @@ -104,7 +104,7 @@ class OStoreTransactionImpl( override val databaseSession: DatabaseSession get() = session - override fun getOEntityStore(): OEntityStore { + override fun getOEntityStore(): YTDBEntityStore { return store } @@ -189,11 +189,11 @@ class OStoreTransactionImpl( return session.bindToSession(vertex) } - override fun bindToSession(entity: OVertexEntity): OVertexEntity { + override fun bindToSession(entity: YTDBVertexEntity): YTDBVertexEntity { requireActiveTransaction() if (entity.isUnloaded) { - return OVertexEntity(bindToSession(entity.vertex), store) + return YTDBVertexEntity(bindToSession(entity.vertex), store) } return entity @@ -227,16 +227,16 @@ class OStoreTransactionImpl( val vertex = session.newVertex(entityType) session.setLocalEntityId(entityType, vertex) vertex.save() - return OVertexEntity(vertex, store) + return YTDBVertexEntity(vertex, store) } - override fun newEntity(entityType: String, localEntityId: Long): OVertexEntity { + override fun newEntity(entityType: String, localEntityId: Long): YTDBVertexEntity { requireActiveWritableTransaction() schemaBuddy.requireTypeExists(session, entityType) val vertex = session.newVertex(entityType) vertex.setProperty(LOCAL_ENTITY_ID_PROPERTY_NAME, localEntityId) vertex.save() - return OVertexEntity(vertex, store) + return YTDBVertexEntity(vertex, store) } override fun generateEntityId(entityType: String, vertex: Vertex) { @@ -245,7 +245,7 @@ class OStoreTransactionImpl( } override fun saveEntity(entity: Entity) { - require(entity is OVertexEntity) { "Only OVertexEntity is supported, but was ${entity.javaClass.simpleName}" } + require(entity is YTDBVertexEntity) { "Only OVertexEntity is supported, but was ${entity.javaClass.simpleName}" } requireActiveWritableTransaction() entity.save() } @@ -253,12 +253,12 @@ class OStoreTransactionImpl( override fun getEntity(id: EntityId): Entity { requireActiveTransaction() val oId = store.requireOEntityId(id) - if (oId == ORIDEntityId.EMPTY_ID) { + if (oId == RIDEntityId.EMPTY_ID) { throw EntityRemovedInDatabaseException(oId.getTypeName(), id) } try { val vertex: Vertex = session.load(oId.asOId()) - return OVertexEntity(vertex, store) + return YTDBVertexEntity(vertex, store) } catch (_: RecordNotFoundException) { throw EntityRemovedInDatabaseException(oId.getTypeName(), id) } @@ -271,12 +271,12 @@ class OStoreTransactionImpl( override fun getAll(entityType: String): EntityIterable { requireActiveTransaction() - return OEntityOfTypeIterable(this, entityType) + return YTDBEntityOfTypeIterable(this, entityType) } override fun getSingletonIterable(entity: Entity): EntityIterable { requireActiveTransaction() - return OMultipleEntitiesIterable(this, listOf(entity)) + return YTDBMultipleEntitiesIterable(this, listOf(entity)) } override fun find( @@ -285,7 +285,7 @@ class OStoreTransactionImpl( value: Comparable ): EntityIterable { requireActiveTransaction() - return OPropertyEqualIterable(this, entityType, propertyName, value) + return YTDBPropertyEqualIterable(this, entityType, propertyName, value) } override fun find( @@ -295,7 +295,7 @@ class OStoreTransactionImpl( maxValue: Comparable ): EntityIterable { requireActiveTransaction() - return OPropertyRangeIterable(this, entityType, propertyName, minValue, maxValue) + return YTDBPropertyRangeIterable(this, entityType, propertyName, minValue, maxValue) } override fun findContaining( @@ -305,7 +305,7 @@ class OStoreTransactionImpl( ignoreCase: Boolean ): EntityIterable { requireActiveTransaction() - return OPropertyContainsIterable(this, entityType, propertyName, value, ignoreCase) + return YTDBPropertyContainsIterable(this, entityType, propertyName, value, ignoreCase) } override fun findStartingWith( @@ -314,12 +314,12 @@ class OStoreTransactionImpl( value: String ): EntityIterable { requireActiveTransaction() - return OPropertyStartsWithIterable(this, entityType, propertyName, value) + return YTDBPropertyStartsWithIterable(this, entityType, propertyName, value) } override fun findIds(entityType: String, minValue: Long, maxValue: Long): EntityIterable { requireActiveTransaction() - return OPropertyRangeIterable( + return YTDBPropertyRangeIterable( this, entityType, LOCAL_ENTITY_ID_PROPERTY_NAME, @@ -330,7 +330,7 @@ class OStoreTransactionImpl( override fun findWithProp(entityType: String, propertyName: String): EntityIterable { requireActiveTransaction() - return OPropertyExistsIterable(this, entityType, propertyName) + return YTDBPropertyExistsIterable(this, entityType, propertyName) } override fun findWithPropSortedByValue( @@ -338,17 +338,17 @@ class OStoreTransactionImpl( propertyName: String ): EntityIterable { requireActiveTransaction() - return OPropertyExistsSortedIterable(this, entityType, propertyName) + return YTDBPropertyExistsSortedIterable(this, entityType, propertyName) } override fun findWithBlob(entityType: String, blobName: String): EntityIterable { requireActiveTransaction() - return OPropertyBlobExistsEntityIterable(this, entityType, blobName) + return YTDBPropertyBlobExistsEntityIterable(this, entityType, blobName) } override fun findLinks(entityType: String, entity: Entity, linkName: String): EntityIterable { requireActiveTransaction() - return OLinkOfTypeToEntityIterable(this, linkName, entity.id as OEntityId, entityType) + return YTDBLinkOfTypeToEntityIterable(this, linkName, entity.id as YTDBEntityId, entityType) } override fun findLinks( @@ -357,12 +357,12 @@ class OStoreTransactionImpl( linkName: String ): EntityIterable { requireActiveTransaction() - return OLinkIterableToEntityIterable(this, entities.asOQueryIterable(), linkName) + return YTDBLinkIterableToEntityIterable(this, entities.asOQueryIterable(), linkName) } override fun findWithLinks(entityType: String, linkName: String): EntityIterable { requireActiveTransaction() - return OLinkExistsEntityIterable(this, entityType, linkName) + return YTDBLinkExistsEntityIterable(this, entityType, linkName) } override fun findWithLinks( @@ -372,7 +372,7 @@ class OStoreTransactionImpl( oppositeLinkName: String ): EntityIterable { requireActiveTransaction() - return OLinkExistsEntityIterable(this, entityType, linkName) + return YTDBLinkExistsEntityIterable(this, entityType, linkName) } override fun sort( @@ -381,7 +381,7 @@ class OStoreTransactionImpl( ascending: Boolean ): EntityIterable { requireActiveTransaction() - return OPropertySortedIterable(this, entityType, propertyName, null, ascending) + return YTDBPropertySortedIterable(this, entityType, propertyName, null, ascending) } override fun sort( @@ -391,7 +391,7 @@ class OStoreTransactionImpl( ascending: Boolean ): EntityIterable { requireActiveTransaction() - return OPropertySortedIterable( + return YTDBPropertySortedIterable( this, entityType, propertyName, @@ -408,7 +408,7 @@ class OStoreTransactionImpl( rightOrder: EntityIterable ): EntityIterable { requireActiveTransaction() - return OLinkSortEntityIterable( + return YTDBLinkSortEntityIterable( this, sortedLinks.asOQueryIterable(), linkName, @@ -427,7 +427,7 @@ class OStoreTransactionImpl( ): EntityIterable { requireActiveTransaction() // Not sure about skipping oppositeEntityType and oppositeLinkName values - return OLinkSortEntityIterable( + return YTDBLinkSortEntityIterable( this, sortedLinks.asOQueryIterable(), linkName, @@ -455,8 +455,8 @@ class OStoreTransactionImpl( requireActiveTransaction() val legacyId = PersistentEntityId.toEntityId(representation) val oEntityId = store.requireOEntityId(legacyId) - return if (oEntityId == ORIDEntityId.EMPTY_ID) { - ORIDEntityId( + return if (oEntityId == RIDEntityId.EMPTY_ID) { + RIDEntityId( legacyId.typeId, legacyId.localId, ImmutableRecordId.EMPTY_RECORD_ID, null ) @@ -473,7 +473,7 @@ class OStoreTransactionImpl( requireActiveTransaction() // make sure the OSequence created schemaBuddy.getOrCreateSequence(session, sequenceName, initialValue) - return OSequenceImpl(sequenceName, store) + return YTDBSequenceImpl(sequenceName, store) } override fun getOSequence(sequenceName: String): DBSequence { @@ -501,13 +501,13 @@ class OStoreTransactionImpl( } override fun setQueryCancellingPolicy(policy: QueryCancellingPolicy?) { - require(policy is OQueryCancellingPolicy) { "Only OQueryCancellingPolicy is supported, but was ${policy?.javaClass?.simpleName}" } + require(policy is YTDBQueryCancellingPolicy) { "Only OQueryCancellingPolicy is supported, but was ${policy?.javaClass?.simpleName}" } this.queryCancellingPolicy = policy } override fun getQueryCancellingPolicy() = this.queryCancellingPolicy - override fun getOEntityId(entityId: PersistentEntityId): OEntityId { + override fun getOEntityId(entityId: PersistentEntityId): YTDBEntityId { requireActiveTransaction() return schemaBuddy.getOEntityId(session, entityId) } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OVertexEntity.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBVertexEntity.kt similarity index 88% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OVertexEntity.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBVertexEntity.kt index 026ece4ef..8d7f4b1a3 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/OVertexEntity.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBVertexEntity.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.record.Direction import com.jetbrains.youtrack.db.api.record.Edge @@ -24,15 +24,14 @@ import com.jetbrains.youtrack.db.internal.core.db.DatabaseSessionInternal import com.jetbrains.youtrack.db.internal.core.db.record.TrackedSet import com.jetbrains.youtrack.db.internal.core.db.record.ridbag.RidBag import com.jetbrains.youtrack.db.internal.core.id.RecordId -import com.jetbrains.youtrack.db.internal.core.record.RecordAbstract import com.jetbrains.youtrack.db.internal.core.record.impl.RecordBytes import jetbrains.exodus.ByteIterable import jetbrains.exodus.entitystore.* -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.CLASS_ID_CUSTOM_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.linkTargetEntityIdPropertyName -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinksFromEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.OVertexEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.CLASS_ID_CUSTOM_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.linkTargetEntityIdPropertyName +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinksFromEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBVertexEntityIterable import jetbrains.exodus.util.LightByteArrayOutputStream import jetbrains.exodus.util.UTFUtil import mu.KLogging @@ -41,7 +40,7 @@ import java.io.File import java.io.InputStream import kotlin.jvm.optionals.getOrNull -open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEntity { +open class YTDBVertexEntity(vertex: Vertex, private val store: YTDBEntityStore) : YTDBEntity { companion object : KLogging() { const val EDGE_CLASS_SUFFIX = "_link" @@ -83,7 +82,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt } private var vertexRecord: Vertex - private var oEntityId: ORIDEntityId + private var oEntityId: RIDEntityId init { val v = if (vertex.isUnloaded) { @@ -93,7 +92,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt vertex } - oEntityId = ORIDEntityId.fromVertex(v) + oEntityId = RIDEntityId.fromVertex(v) vertexRecord = v } @@ -113,7 +112,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt override fun getStore() = store - override fun getId(): OEntityId = oEntityId + override fun getId(): YTDBEntityId = oEntityId override fun toIdString(): String = oEntityId.toString() @@ -137,10 +136,10 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt override fun generateId() { val type = oEntityId.getTypeName() store.requireActiveTransaction().generateEntityId(type, vertexRecord) - oEntityId = ORIDEntityId.fromVertex(vertexRecord) + oEntityId = RIDEntityId.fromVertex(vertexRecord) } - private fun requireActiveTx(): OStoreTransaction { + private fun requireActiveTx(): YTDBStoreTransaction { return store.requireActiveTransaction() } @@ -155,7 +154,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt return if (value == null || value !is MutableSet<*>) { value as Comparable<*>? } else { - OComparableSet(value) + YTDBComparableSet(value) } } @@ -163,8 +162,8 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt requireActiveWritableTransaction() val oldProperty = vertex.getProperty(propertyName) - if (value is OComparableSet<*> || oldProperty is MutableSet<*>) { - return setPropertyAsSet(propertyName, value as OComparableSet<*>) + if (value is YTDBComparableSet<*> || oldProperty is MutableSet<*>) { + return setPropertyAsSet(propertyName, value as YTDBComparableSet<*>) } else if (oldProperty == value) { return false } else { @@ -175,7 +174,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt } private fun setPropertyAsSet(propertyName: String, value: Any?): Boolean { - if (value is OComparableSet<*>) { + if (value is YTDBComparableSet<*>) { vertex.setProperty(propertyName, value.source) } else { vertex.setProperty(propertyName, value) @@ -297,14 +296,14 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt override fun addLink(linkName: String, target: Entity): Boolean { val currentTx = requireActiveWritableTransaction() - require(target is OVertexEntity) { "Only OVertexEntity is supported, but was ${target.javaClass.simpleName}" } + require(target is YTDBVertexEntity) { "Only OVertexEntity is supported, but was ${target.javaClass.simpleName}" } return currentTx.addLinkImpl(linkName, target.vertex) } override fun addLink(linkName: String, targetId: EntityId): Boolean { val currentTx = requireActiveWritableTransaction() val targetOId = store.requireOEntityId(targetId) - if (targetOId == ORIDEntityId.EMPTY_ID) { + if (targetOId == RIDEntityId.EMPTY_ID) { return false } try { @@ -315,7 +314,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt } } - private fun OStoreTransaction.addLinkImpl(linkName: String, target: Vertex): Boolean { + private fun YTDBStoreTransaction.addLinkImpl(linkName: String, target: Vertex): Boolean { val outClassName = vertex.requireSchemaClass().name val inClassName = target.requireSchemaClass().name val edgeClass = getOrCreateEdgeClass(linkName, outClassName, inClassName) @@ -369,7 +368,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt override fun deleteLink(linkName: String, target: Entity): Boolean { val currentTx = requireActiveWritableTransaction() - target as OVertexEntity + target as YTDBVertexEntity val targetOId = target.oEntityId.asOId() return currentTx.deleteLinkImpl(linkName, targetOId) } @@ -390,7 +389,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt vertex.save() } - private fun OStoreTransaction.deleteLinkImpl(linkName: String, targetId: RID): Boolean { + private fun YTDBStoreTransaction.deleteLinkImpl(linkName: String, targetId: RID): Boolean { val edgeClassName = edgeClassName(linkName) val edge = findEdge(edgeClassName, targetId) @@ -427,14 +426,14 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt override fun setLink(linkName: String, target: Entity?): Boolean { val currentTx = requireActiveWritableTransaction() - require(target is OVertexEntity?) { "Only OVertexEntity is supported, but was ${target?.javaClass?.simpleName}" } + require(target is YTDBVertexEntity?) { "Only OVertexEntity is supported, but was ${target?.javaClass?.simpleName}" } return currentTx.setLinkImpl(linkName, target?.vertex) } override fun setLink(linkName: String, targetId: EntityId): Boolean { val currentTx = requireActiveWritableTransaction() val targetOId = store.requireOEntityId(targetId) - if (targetOId == ORIDEntityId.EMPTY_ID) { + if (targetOId == RIDEntityId.EMPTY_ID) { return false } try { @@ -445,7 +444,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt } } - private fun OStoreTransaction.setLinkImpl(linkName: String, target: Vertex?): Boolean { + private fun YTDBStoreTransaction.setLinkImpl(linkName: String, target: Vertex?): Boolean { val currentLink = getLinkImpl(linkName) if (currentLink == target) { @@ -476,7 +475,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt val txn = requireActiveTx() val edgeClassName = edgeClassName(linkName) val links = vertex.getVertices(Direction.OUT, edgeClassName) - return OVertexEntityIterable(txn, links, store, linkName, this.oEntityId) + return YTDBVertexEntityIterable(txn, links, store, linkName, this.oEntityId) } //todo this method should return iterable of different type @@ -488,13 +487,13 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt } else { linkNames.drop(1) .fold( - OLinksFromEntityIterable( + YTDBLinksFromEntityIterable( tx, linkNames.first(), this.oEntityId ) as EntityIterable ) { res, edgeName -> - res.union(OLinksFromEntityIterable(tx, edgeName, this.oEntityId)) + res.union(YTDBLinksFromEntityIterable(tx, edgeName, this.oEntityId)) } } } @@ -507,7 +506,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt .map { it.substringBefore(EDGE_CLASS_SUFFIX) }) } - private fun OStoreTransaction.findEdge(edgeClassName: String, targetId: RID): Edge? { + private fun YTDBStoreTransaction.findEdge(edgeClassName: String, targetId: RID): Edge? { val query = "SELECT FROM $edgeClassName WHERE ${Edge.DIRECTION_OUT} = :outId AND ${Edge.DIRECTION_IN} = :inId" val result = query(query, mapOf("outId" to vertex.identity, "inId" to targetId)) @@ -519,7 +518,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is OEntity) return false + if (other !is YTDBEntity) return false if (javaClass != other.javaClass) return false return this.id == other.id @@ -529,7 +528,7 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt return id.hashCode() } - override fun save(): OVertexEntity { + override fun save(): YTDBVertexEntity { requireActiveWritableTransaction() vertex.save() return this @@ -537,11 +536,11 @@ open class OVertexEntity(vertex: Vertex, private val store: OEntityStore) : OEnt override val isLoaded = !vertex.isUnloaded - protected open fun requireActiveWritableTransaction(): OStoreTransaction { + protected open fun requireActiveWritableTransaction(): YTDBStoreTransaction { return store.requireActiveWritableTransaction() } - private fun Vertex?.toOEntityOrNull(): OEntity? = this?.let { OVertexEntity(this, store) } + private fun Vertex?.toOEntityOrNull(): YTDBEntity? = this?.let { YTDBVertexEntity(this, store) } } fun SchemaClass.requireClassId(): Int { @@ -568,4 +567,4 @@ fun Vertex.requireLocalEntityId(): Long { } -val String.asEdgeClass get() = OVertexEntity.edgeClassName(this) +val String.asEdgeClass get() = YTDBVertexEntity.edgeClassName(this) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/ODistinctEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBDistinctEntityIterable.kt similarity index 52% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/ODistinctEntityIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBDistinctEntityIterable.kt index e4cd21a6a..9f0088e4a 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/ODistinctEntityIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBDistinctEntityIterable.kt @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.query.OQueryFunctions -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryFunctions +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class ODistinctEntityIterable( - txn: OStoreTransaction, - private val source: OEntityIterable, -) : OEntityIterableBase(txn) { +class YTDBDistinctEntityIterable( + txn: YTDBStoreTransaction, + private val source: YTDBEntityIterable, +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OQueryFunctions.distinct(source.query()) + override fun query(): YTDBSelect { + return YTDBQueryFunctions.distinct(source.query()) } } \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityIterableBase.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityIterableBase.kt similarity index 67% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityIterableBase.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityIterableBase.kt index 96097cb83..d5fe47965 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityIterableBase.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityIterableBase.kt @@ -13,32 +13,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate import jetbrains.exodus.entitystore.* -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OEntityStore -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OConcatEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OIntersectionEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OMinusEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OUnionEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkIterableToEntityIterableFiltered -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkSelectEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.OMultipleEntitiesIterable -import jetbrains.exodus.entitystore.orientdb.query.* +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityStore +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBConcatEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBIntersectionEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBMinusEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBUnionEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkIterableToEntityIterableFiltered +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkSelectEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBMultipleEntitiesIterable +import jetbrains.exodus.entitystore.youtrackdb.query.* import jetbrains.exodus.entitystore.util.unsupported -abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { +abstract class YTDBEntityIterableBase(tx: YTDBStoreTransaction) : YTDBEntityIterable { - private val oStore: OEntityStore = tx.getOEntityStore() + private val oStore: YTDBEntityStore = tx.getOEntityStore() companion object { - val EMPTY = object : OEntityIterable { + val EMPTY = object : YTDBEntityIterable { - override fun iterator(): EntityIterator = OQueryEntityIterator.EMPTY - override fun query(): OSelect = unsupported { "Should never be called" } + override fun iterator(): EntityIterator = YTDBQueryEntityIterator.EMPTY + override fun query(): YTDBSelect = unsupported { "Should never be called" } override fun getTransaction(): StoreTransaction = unsupported { "Should never be called" } override fun isEmpty(): Boolean = true override fun indexOf(entity: Entity): Int = -1 @@ -69,7 +69,7 @@ abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { override fun iterator(): EntityIterator { val currentTx = oStore.requireActiveTransaction() val query = query() - return OQueryEntityIterator.executeAndCreate(query, currentTx) + return YTDBQueryEntityIterator.executeAndCreate(query, currentTx) } override fun getTransaction(): StoreTransaction { @@ -102,7 +102,7 @@ abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { if (right == EMPTY) { return this } - return OUnionEntityIterable(transaction as OStoreTransaction, this, right.asOQueryIterable()) + return YTDBUnionEntityIterable(transaction as YTDBStoreTransaction, this, right.asOQueryIterable()) } override fun intersectSavingOrder(right: EntityIterable): EntityIterable { @@ -116,48 +116,48 @@ abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { if (right == EMPTY) { return this } - return OIntersectionEntityIterable(transaction as OStoreTransaction, this, right.asOQueryIterable()) + return YTDBIntersectionEntityIterable(transaction as YTDBStoreTransaction, this, right.asOQueryIterable()) } override fun concat(right: EntityIterable): EntityIterable { if (right == EMPTY) { return this } - return OConcatEntityIterable(transaction as OStoreTransaction, this, right.asOQueryIterable()) + return YTDBConcatEntityIterable(transaction as YTDBStoreTransaction, this, right.asOQueryIterable()) } override fun distinct(): EntityIterable { - return ODistinctEntityIterable(transaction as OStoreTransaction, this) + return YTDBDistinctEntityIterable(transaction as YTDBStoreTransaction, this) } override fun minus(right: EntityIterable): EntityIterable { if (right == EMPTY) { return this } - return OMinusEntityIterable(transaction as OStoreTransaction, this, right.asOQueryIterable()) + return YTDBMinusEntityIterable(transaction as YTDBStoreTransaction, this, right.asOQueryIterable()) } override fun take(number: Int): EntityIterable { - return OTakeEntityIterable(transaction as OStoreTransaction, this, number) + return YTDBTakeEntityIterable(transaction as YTDBStoreTransaction, this, number) } override fun skip(number: Int): EntityIterable { - return OSkipEntityIterable(transaction as OStoreTransaction, this, number) + return YTDBSkipEntityIterable(transaction as YTDBStoreTransaction, this, number) } override fun getFirst(): Entity? { - val lastSelect = OFirstSelect(query()) + val lastSelect = YTDBFirstSelect(query()) return querySingleEntity(lastSelect) } override fun getLast(): Entity? { - val lastSelect = OLastSelect(query()) + val lastSelect = YTDBLastSelect(query()) return querySingleEntity(lastSelect) } - private fun querySingleEntity(query: OQuery): Entity? { + private fun querySingleEntity(query: YTDBQuery): Entity? { val currentTx = oStore.requireActiveTransaction() - val iterator = OQueryEntityIterator.executeAndCreate(query, currentTx) + val iterator = YTDBQueryEntityIterator.executeAndCreate(query, currentTx) return if (iterator.hasNext()) { iterator.next() } else { @@ -169,11 +169,11 @@ abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { * **Note:** Takes effect only if the iterable is sorted. */ override fun reverse(): EntityIterable { - return OReversedEntityIterable(transaction as OStoreTransaction, this) + return YTDBReversedEntityIterable(transaction as YTDBStoreTransaction, this) } fun selectMany(linkName: String): EntityIterable { - return OLinkSelectEntityIterable(transaction as OStoreTransaction, this, linkName) + return YTDBLinkSelectEntityIterable(transaction as YTDBStoreTransaction, this, linkName) } override fun selectManyDistinct(linkName: String): EntityIterable { @@ -188,11 +188,11 @@ abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { if (entities == EMPTY) { return EMPTY } - return OLinkIterableToEntityIterableFiltered(transaction as OStoreTransaction, entities.asOQueryIterable(), linkName, this) + return YTDBLinkIterableToEntityIterableFiltered(transaction as YTDBStoreTransaction, entities.asOQueryIterable(), linkName, this) } fun findLinks(entities: Iterable, linkName: String): EntityIterable { - if (entities !is OEntityIterable) { + if (entities !is YTDBEntityIterable) { unsupported { "findLinks with non-OrientDB entity iterable" } } return findLinks(entities, linkName) @@ -204,7 +204,7 @@ abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { override fun size(): Long { val currentTx = oStore.requireActiveTransaction() val sourceQuery = query() - val countQuery = OCountSelect(sourceQuery.withOrder(EmptyOrder)) + val countQuery = YTDBCountSelect(sourceQuery.withOrder(EmptyOrder)) cachedSize = countQuery.count(currentTx) return cachedSize } @@ -224,7 +224,7 @@ abstract class OEntityIterableBase(tx: OStoreTransaction) : OEntityIterable { override fun contains(entity: Entity): Boolean { val currentTx = oStore.requireActiveTransaction() - return OIntersectionEntityIterable(currentTx, this, OMultipleEntitiesIterable(currentTx, listOf(entity))).iterator().hasNext() + return YTDBIntersectionEntityIterable(currentTx, this, YTDBMultipleEntitiesIterable(currentTx, listOf(entity))).iterator().hasNext() } override fun unwrap() = this diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityOfTypeIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityOfTypeIterable.kt similarity index 60% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityOfTypeIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityOfTypeIterable.kt index b3869e54f..fffc8cb78 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityOfTypeIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityOfTypeIterable.kt @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OEntityOfTypeIterable( - txn: OStoreTransaction, +class YTDBEntityOfTypeIterable( + txn: YTDBStoreTransaction, private val entityType: String, -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OClassSelect(entityType) + override fun query(): YTDBSelect { + return YTDBClassSelect(entityType) } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OQueryEntityIterator.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBQueryEntityIterator.kt similarity index 60% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OQueryEntityIterator.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBQueryEntityIterator.kt index 8de7564e5..358951988 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OQueryEntityIterator.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBQueryEntityIterator.kt @@ -13,37 +13,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate import jetbrains.exodus.entitystore.Entity import jetbrains.exodus.entitystore.EntityId import jetbrains.exodus.entitystore.EntityIterator -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.query.OQuery -import jetbrains.exodus.entitystore.orientdb.query.OQueryExecution -import jetbrains.exodus.entitystore.orientdb.query.OQueryTimeoutException -import jetbrains.exodus.entitystore.orientdb.toEntityIterator +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQuery +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryExecution +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryTimeoutException +import jetbrains.exodus.entitystore.youtrackdb.toEntityIterator -class OQueryEntityIterator(private val source: Iterator) : EntityIterator { +class YTDBQueryEntityIterator(private val source: Iterator) : EntityIterator { companion object { - val EMPTY = OQueryEntityIterator(emptyList().iterator()) + val EMPTY = YTDBQueryEntityIterator(emptyList().iterator()) - fun executeAndCreate(query: OQuery, txn: OStoreTransaction): OQueryEntityIterator { - val resultSet = OQueryExecution.execute(query, txn) + fun executeAndCreate(query: YTDBQuery, txn: YTDBStoreTransaction): YTDBQueryEntityIterator { + val resultSet = YTDBQueryExecution.execute(query, txn) val iterator = resultSet.toEntityIterator(txn.getOEntityStore()) - return OQueryEntityIterator(iterator) + return YTDBQueryEntityIterator(iterator) } } override fun next(): Entity { - return OQueryTimeoutException.withTimeoutWrap { source.next() } + return YTDBQueryTimeoutException.withTimeoutWrap { source.next() } } override fun hasNext(): Boolean { - return OQueryTimeoutException.withTimeoutWrap { source.hasNext() } + return YTDBQueryTimeoutException.withTimeoutWrap { source.hasNext() } } override fun skip(number: Int): Boolean { diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OReversedEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBReversedEntityIterable.kt similarity index 52% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OReversedEntityIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBReversedEntityIterable.kt index ea1f9096c..2a207013f 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OReversedEntityIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBReversedEntityIterable.kt @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.query.OQueryFunctions -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryFunctions +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OReversedEntityIterable( - txn: OStoreTransaction, - private val source: OEntityIterable, -) : OEntityIterableBase(txn) { +class YTDBReversedEntityIterable( + txn: YTDBStoreTransaction, + private val source: YTDBEntityIterable, +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OQueryFunctions.reverse(source.query()) + override fun query(): YTDBSelect { + return YTDBQueryFunctions.reverse(source.query()) } } \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OSkipEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBSkipEntityIterable.kt similarity index 61% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OSkipEntityIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBSkipEntityIterable.kt index 4d1c42aa1..aff4c590c 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OSkipEntityIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBSkipEntityIterable.kt @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OSkipEntityIterable( - txn: OStoreTransaction, - private val source: OEntityIterable, +class YTDBSkipEntityIterable( + txn: YTDBStoreTransaction, + private val source: YTDBEntityIterable, private val skip: Int -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { + override fun query(): YTDBSelect { return source.query().withSkip(skip) } } \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OTakeEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBTakeEntityIterable.kt similarity index 61% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OTakeEntityIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBTakeEntityIterable.kt index d566d1d03..97bb00106 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OTakeEntityIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBTakeEntityIterable.kt @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OTakeEntityIterable( - txn: OStoreTransaction, - private val source: OEntityIterable, +class YTDBTakeEntityIterable( + txn: YTDBStoreTransaction, + private val source: YTDBEntityIterable, private val take: Int -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { + override fun query(): YTDBSelect { return source.query().withLimit(take) } } \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBConcatEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBConcatEntityIterable.kt new file mode 100644 index 000000000..9ca218b91 --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBConcatEntityIterable.kt @@ -0,0 +1,34 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.binop + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBUnionSelect + +class YTDBConcatEntityIterable( + txn: YTDBStoreTransaction, + private val iterable1: YTDBEntityIterable, + private val iterable2: YTDBEntityIterable +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBUnionSelect(iterable1.query(), iterable2.query(), false) + } +} + diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBIntersectionEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBIntersectionEntityIterable.kt new file mode 100644 index 000000000..77e61065b --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBIntersectionEntityIterable.kt @@ -0,0 +1,33 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.binop + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryFunctions +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBIntersectionEntityIterable( + txn: YTDBStoreTransaction, + private val left: YTDBEntityIterable, + private val right: YTDBEntityIterable +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBQueryFunctions.intersect(left.query(), right.query()) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBMinusEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBMinusEntityIterable.kt new file mode 100644 index 000000000..f34426ebe --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBMinusEntityIterable.kt @@ -0,0 +1,33 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.binop + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryFunctions +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBMinusEntityIterable( + txn: YTDBStoreTransaction, + private val left: YTDBEntityIterable, + private val right: YTDBEntityIterable +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBQueryFunctions.difference(left.query(), right.query()) + } +} \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBUnionEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBUnionEntityIterable.kt new file mode 100644 index 000000000..b4c09eeca --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/binop/YTDBUnionEntityIterable.kt @@ -0,0 +1,33 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.binop + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryFunctions +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBUnionEntityIterable( + txn: YTDBStoreTransaction, + private val left: YTDBEntityIterable, + private val right: YTDBEntityIterable +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBQueryFunctions.union(left.query(), right.query()) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkExistsEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkExistsEntityIterable.kt new file mode 100644 index 000000000..0b3e6459a --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkExistsEntityIterable.kt @@ -0,0 +1,34 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBEdgeExistsCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkExistsEntityIterable( + txn: YTDBStoreTransaction, + private val entityType: String, + private val linkName: String, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBClassSelect(entityType, YTDBEdgeExistsCondition(linkName.asEdgeClass)) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIsNullEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIsNullEntityIterable.kt new file mode 100644 index 000000000..3b02fe597 --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIsNullEntityIterable.kt @@ -0,0 +1,34 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBEdgeIsNullCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkIsNullEntityIterable( + txn: YTDBStoreTransaction, + private val entityType: String, + private val linkName: String, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBClassSelect(entityType, YTDBEdgeIsNullCondition(linkName.asEdgeClass)) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterable.kt new file mode 100644 index 000000000..02e5ba4bf --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterable.kt @@ -0,0 +1,34 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBLinkInFromSubQuerySelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkIterableToEntityIterable( + txn: YTDBStoreTransaction, + private val linkIterable: YTDBEntityIterable, + private val linkName: String +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBLinkInFromSubQuerySelect(linkName.asEdgeClass, linkIterable.query()) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterableFiltered.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterableFiltered.kt new file mode 100644 index 000000000..9e5fc28dc --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkIterableToEntityIterableFiltered.kt @@ -0,0 +1,37 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBIntersectSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBLinkInFromSubQuerySelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkIterableToEntityIterableFiltered( + txn: YTDBStoreTransaction, + private val linkIterable: YTDBEntityIterable, + private val linkName: String, + private val source: YTDBEntityIterable, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + val byLinkSelect = YTDBLinkInFromSubQuerySelect(linkName.asEdgeClass, linkIterable.query()) + return YTDBIntersectSelect(source.query(), byLinkSelect) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkOfTypeToEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkOfTypeToEntityIterable.kt new file mode 100644 index 000000000..08357a1fe --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkOfTypeToEntityIterable.kt @@ -0,0 +1,35 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityId +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBLinkOfTypeInFromIdsSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkOfTypeToEntityIterable( + txn: YTDBStoreTransaction, + private val linkName: String, + private val linkEntityId: YTDBEntityId, + private val targetEntityType: String, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBLinkOfTypeInFromIdsSelect(linkName.asEdgeClass, listOf(linkEntityId.asOId()), targetEntityType) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSelectEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSelectEntityIterable.kt new file mode 100644 index 000000000..79416216f --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSelectEntityIterable.kt @@ -0,0 +1,34 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBLinkOutFromSubQuerySelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkSelectEntityIterable( + txn: YTDBStoreTransaction, + private val source: YTDBEntityIterable, + private val linkName: String, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBLinkOutFromSubQuerySelect(linkName.asEdgeClass, source.query()) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSortEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSortEntityIterable.kt new file mode 100644 index 000000000..8c4e40bae --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkSortEntityIterable.kt @@ -0,0 +1,37 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBLinkInFromSubQuerySelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryFunctions +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkSortEntityIterable( + txn: YTDBStoreTransaction, + private val linkOrder: YTDBEntityIterable, + private val linkName: String, + private val sourceOrder: YTDBEntityIterable, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + val linkQuery = YTDBLinkInFromSubQuerySelect(linkName.asEdgeClass, linkOrder.query()) + return YTDBQueryFunctions.intersect(linkQuery, sourceOrder.query()) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkToEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkToEntityIterable.kt new file mode 100644 index 000000000..5c1a71c2e --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinkToEntityIterable.kt @@ -0,0 +1,34 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityId +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBLinkInFromIdsSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinkToEntityIterable( + txn: YTDBStoreTransaction, + private val linkName: String, + private val linkEntityId: YTDBEntityId, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBLinkInFromIdsSelect(linkName.asEdgeClass, listOf(linkEntityId.asOId())) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinksFromEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinksFromEntityIterable.kt new file mode 100644 index 000000000..68a36f5c3 --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBLinksFromEntityIterable.kt @@ -0,0 +1,34 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.link + +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityId +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.asEdgeClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBLinkOutFromIdSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBLinksFromEntityIterable( + txn: YTDBStoreTransaction, + private val linkName: String, + private val fromEntityId: YTDBEntityId, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + return YTDBLinkOutFromIdSelect(linkName.asEdgeClass, listOf(fromEntityId.asOId())) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OMultipleEntitiesIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBMultipleEntitiesIterable.kt similarity index 60% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OMultipleEntitiesIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBMultipleEntitiesIterable.kt index 8c2168a0f..f6a1a6430 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OMultipleEntitiesIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBMultipleEntitiesIterable.kt @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.link +package jetbrains.exodus.entitystore.youtrackdb.iterate.link import jetbrains.exodus.entitystore.Entity import jetbrains.exodus.entitystore.EntityIterable -import jetbrains.exodus.entitystore.orientdb.OEntityId -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.ORecordIdSelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityId +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBRecordIdSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OMultipleEntitiesIterable(tx: OStoreTransaction, val entities: List) : OEntityIterableBase(tx) { - override fun query(): OSelect { - return ORecordIdSelect(entities.map { (it.id as OEntityId).asOId() }) +class YTDBMultipleEntitiesIterable(tx: YTDBStoreTransaction, val entities: List) : YTDBEntityIterableBase(tx) { + override fun query(): YTDBSelect { + return YTDBRecordIdSelect(entities.map { (it.id as YTDBEntityId).asOId() }) } override fun contains(entity: Entity): Boolean { @@ -52,57 +52,57 @@ class OMultipleEntitiesIterable(tx: OStoreTransaction, val entities: List entities.size){ EMPTY } else { - OMultipleEntitiesIterable(transaction as OStoreTransaction, entities.drop(number)) + YTDBMultipleEntitiesIterable(transaction as YTDBStoreTransaction, entities.drop(number)) } } override fun take(number: Int): EntityIterable { - return OMultipleEntitiesIterable(transaction as OStoreTransaction, entities.take(number) ) + return YTDBMultipleEntitiesIterable(transaction as YTDBStoreTransaction, entities.take(number) ) } override fun union(right: EntityIterable): EntityIterable { - return if (right is OMultipleEntitiesIterable) { - OMultipleEntitiesIterable(transaction as OStoreTransaction, entities.union(right.entities).toList()) + return if (right is YTDBMultipleEntitiesIterable) { + YTDBMultipleEntitiesIterable(transaction as YTDBStoreTransaction, entities.union(right.entities).toList()) } else super.union(right) } override fun intersect(right: EntityIterable): EntityIterable { - return if (right is OMultipleEntitiesIterable) { + return if (right is YTDBMultipleEntitiesIterable) { val otherEntitiesAsSet = right.entities.toSet() val intersect = entities.filter { otherEntitiesAsSet.contains(it) } if (intersect.isEmpty()){ EMPTY } else { - OMultipleEntitiesIterable(transaction as OStoreTransaction, intersect) + YTDBMultipleEntitiesIterable(transaction as YTDBStoreTransaction, intersect) } } else super.intersect(right) } override fun intersectSavingOrder(right: EntityIterable): EntityIterable { - return if (right is OMultipleEntitiesIterable) { + return if (right is YTDBMultipleEntitiesIterable) { val otherEntitiesAsSet = right.entities.toSet() val intersect = entities.filter { otherEntitiesAsSet.contains(it) } if (intersect.isEmpty()){ EMPTY } else { - OMultipleEntitiesIterable(transaction as OStoreTransaction, intersect) + YTDBMultipleEntitiesIterable(transaction as YTDBStoreTransaction, intersect) } } else super.intersectSavingOrder(right) } override fun concat(right: EntityIterable): EntityIterable { - return if (right is OMultipleEntitiesIterable) { - OMultipleEntitiesIterable(transaction as OStoreTransaction, entities + right.entities) + return if (right is YTDBMultipleEntitiesIterable) { + YTDBMultipleEntitiesIterable(transaction as YTDBStoreTransaction, entities + right.entities) } else super.concat(right) } override fun minus(right: EntityIterable): EntityIterable { - return if (right is OMultipleEntitiesIterable) { + return if (right is YTDBMultipleEntitiesIterable) { val minus = entities.toSet().minus(right.entities) if (minus.isEmpty()){ EMPTY } else { - OMultipleEntitiesIterable(transaction as OStoreTransaction, entities + right.entities) + YTDBMultipleEntitiesIterable(transaction as YTDBStoreTransaction, entities + right.entities) } } else super.minus(right) } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OVertexEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBVertexEntityIterable.kt similarity index 86% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OVertexEntityIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBVertexEntityIterable.kt index 4cdfabce1..879f28f24 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/link/OVertexEntityIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/link/YTDBVertexEntityIterable.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.link +package jetbrains.exodus.entitystore.youtrackdb.iterate.link import com.jetbrains.youtrack.db.api.record.Vertex import com.jetbrains.youtrack.db.internal.common.util.Sizeable @@ -21,21 +21,21 @@ import jetbrains.exodus.entitystore.Entity import jetbrains.exodus.entitystore.EntityIterable import jetbrains.exodus.entitystore.EntityIterator import jetbrains.exodus.entitystore.PersistentEntityId -import jetbrains.exodus.entitystore.orientdb.OEntityId -import jetbrains.exodus.entitystore.orientdb.OEntityStore -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.OVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityId +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityStore +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity import jetbrains.exodus.entitystore.util.unsupported import org.apache.commons.collections4.IterableUtils import org.apache.commons.collections4.IteratorUtils import org.apache.commons.collections4.functors.EqualPredicate -class OVertexEntityIterable( - private val tx: OStoreTransaction, +class YTDBVertexEntityIterable( + private val tx: YTDBStoreTransaction, private val vertices: Iterable, - private val store: OEntityStore, + private val store: YTDBEntityStore, private val linkName: String, - private val targetEntityID: OEntityId + private val targetEntityID: YTDBEntityId ) : EntityIterable { override fun iterator() = object : EntityIterator { @@ -53,7 +53,7 @@ class OVertexEntityIterable( override fun hasNext() = iterator.hasNext() - override fun next() = OVertexEntity(iterator.next(), store) + override fun next() = YTDBVertexEntity(iterator.next(), store) override fun remove() = unsupported() } @@ -119,5 +119,5 @@ class OVertexEntityIterable( return asQueryIterable().findLinks(entities, linkName) } - private fun asQueryIterable() = OLinksFromEntityIterable(tx, linkName, this.targetEntityID) + private fun asQueryIterable() = YTDBLinksFromEntityIterable(tx, linkName, this.targetEntityID) } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OInstanceOfIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBInstanceOfIterable.kt similarity index 53% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OInstanceOfIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBInstanceOfIterable.kt index 1eaa86448..547f808a8 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OInstanceOfIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBInstanceOfIterable.kt @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OInstanceOfCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBInstanceOfCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OInstanceOfIterable( - txn: OStoreTransaction, +class YTDBInstanceOfIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val instanceOf: String, private val invert: Boolean -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OClassSelect(entityType, OInstanceOfCondition(instanceOf, invert)) + override fun query(): YTDBSelect { + return YTDBClassSelect(entityType, YTDBInstanceOfCondition(instanceOf, invert)) } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyBlobExistsEntityIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyBlobExistsEntityIterable.kt similarity index 51% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyBlobExistsEntityIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyBlobExistsEntityIterable.kt index 0e1202805..6f17a701d 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyBlobExistsEntityIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyBlobExistsEntityIterable.kt @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OFieldExistsCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBFieldExistsCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OPropertyBlobExistsEntityIterable( - txn: OStoreTransaction, +class YTDBPropertyBlobExistsEntityIterable( + txn: YTDBStoreTransaction, private val className: String, private val blobName: String, -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OClassSelect(className, OFieldExistsCondition(blobName)) + override fun query(): YTDBSelect { + return YTDBClassSelect(className, YTDBFieldExistsCondition(blobName)) } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyContainsIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyContainsIterable.kt similarity index 52% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyContainsIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyContainsIterable.kt index fbb6891df..3494a486a 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyContainsIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyContainsIterable.kt @@ -13,24 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OContainsCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBContainsCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OPropertyContainsIterable( - txn: OStoreTransaction, +class YTDBPropertyContainsIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val propertyName: String, private val value: String, private val ignoreCase: Boolean -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - val condition = OContainsCondition(propertyName, value, ignoreCase) - return OClassSelect(entityType, condition) + override fun query(): YTDBSelect { + val condition = YTDBContainsCondition(propertyName, value, ignoreCase) + return YTDBClassSelect(entityType, condition) } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyEqualIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyEqualIterable.kt similarity index 53% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyEqualIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyEqualIterable.kt index 60511dfb7..7cb63cf35 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyEqualIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyEqualIterable.kt @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OEqualCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBEqualCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OPropertyEqualIterable( - txn: OStoreTransaction, +class YTDBPropertyEqualIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val propertyName: String, private val value: Comparable<*> -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OClassSelect(entityType, OEqualCondition(propertyName, value)) + override fun query(): YTDBSelect { + return YTDBClassSelect(entityType, YTDBEqualCondition(propertyName, value)) } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyExistsIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyExistsIterable.kt similarity index 51% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyExistsIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyExistsIterable.kt index 0be8a0cf4..68b5f60eb 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyExistsIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyExistsIterable.kt @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OFieldExistsCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBFieldExistsCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OPropertyExistsIterable( - txn: OStoreTransaction, +class YTDBPropertyExistsIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val propertyName: String, -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OClassSelect(entityType, OFieldExistsCondition(propertyName)) + override fun query(): YTDBSelect { + return YTDBClassSelect(entityType, YTDBFieldExistsCondition(propertyName)) } } \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyExistsSortedIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyExistsSortedIterable.kt new file mode 100644 index 000000000..630381ed1 --- /dev/null +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyExistsSortedIterable.kt @@ -0,0 +1,36 @@ +/* + * Copyright ${inceptionYear} - ${year} ${owner} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jetbrains.exodus.entitystore.youtrackdb.iterate.property + +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBFieldExistsCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBOrderByFields +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect + +class YTDBPropertyExistsSortedIterable( + txn: YTDBStoreTransaction, + private val entityType: String, + private val propertyName: String, +) : YTDBEntityIterableBase(txn) { + + override fun query(): YTDBSelect { + val condition = YTDBFieldExistsCondition(propertyName) + val order = YTDBOrderByFields(propertyName) + return YTDBClassSelect(entityType, condition, order) + } +} diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyIsNullIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyIsNullIterable.kt similarity index 51% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyIsNullIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyIsNullIterable.kt index 0fd29d311..f3dcab3aa 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyIsNullIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyIsNullIterable.kt @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OFieldIsNullCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBFieldIsNullCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OPropertyIsNullIterable( - txn: OStoreTransaction, +class YTDBPropertyIsNullIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val propertyName: String, -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - return OClassSelect(entityType, OFieldIsNullCondition(propertyName)) + override fun query(): YTDBSelect { + return YTDBClassSelect(entityType, YTDBFieldIsNullCondition(propertyName)) } } \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyRangeIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyRangeIterable.kt similarity index 53% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyRangeIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyRangeIterable.kt index 3d15b58ba..d91d48953 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyRangeIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyRangeIterable.kt @@ -13,24 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.ORangeCondition -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBRangeCondition +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OPropertyRangeIterable( - txn: OStoreTransaction, +class YTDBPropertyRangeIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val propertyName: String, private val min: Comparable<*>, private val max: Comparable<*>, -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - val condition = ORangeCondition(propertyName, min, max) - return OClassSelect(entityType, condition) + override fun query(): YTDBSelect { + val condition = YTDBRangeCondition(propertyName, min, max) + return YTDBClassSelect(entityType, condition) } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertySortedIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertySortedIterable.kt similarity index 51% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertySortedIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertySortedIterable.kt index ae097eace..e884842c0 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertySortedIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertySortedIterable.kt @@ -13,29 +13,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OOrderByFields -import jetbrains.exodus.entitystore.orientdb.query.OSelect +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBOrderByFields +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect -class OPropertySortedIterable( - txn: OStoreTransaction, +class YTDBPropertySortedIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val propertyName: String, - private val source: OEntityIterable? = null, + private val source: YTDBEntityIterable? = null, private val ascending: Boolean, -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - val order = OOrderByFields(propertyName, ascending) + override fun query(): YTDBSelect { + val order = YTDBOrderByFields(propertyName, ascending) return if (source != null) { source.query().withOrder(order) } else { - OClassSelect(entityType, order = order) + YTDBClassSelect(entityType, order = order) } } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyStartsWithIterable.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyStartsWithIterable.kt similarity index 51% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyStartsWithIterable.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyStartsWithIterable.kt index a88846e91..8c8b8869f 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OPropertyStartsWithIterable.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBPropertyStartsWithIterable.kt @@ -13,23 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.query.OClassSelect -import jetbrains.exodus.entitystore.orientdb.query.OSelect -import jetbrains.exodus.entitystore.orientdb.query.OStartsWithCondition +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBClassSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBSelect +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBStartsWithCondition -class OPropertyStartsWithIterable( - txn: OStoreTransaction, +class YTDBPropertyStartsWithIterable( + txn: YTDBStoreTransaction, private val entityType: String, private val propertyName: String, private val value: String, -) : OEntityIterableBase(txn) { +) : YTDBEntityIterableBase(txn) { - override fun query(): OSelect { - val condition = OStartsWithCondition(propertyName, value) - return OClassSelect(entityType, condition) + override fun query(): YTDBSelect { + val condition = YTDBStartsWithCondition(propertyName, value) + return YTDBClassSelect(entityType, condition) } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OSequenceImpl.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBSequenceImpl.kt similarity index 85% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OSequenceImpl.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBSequenceImpl.kt index 691103d4e..1adf15e96 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/property/OSequenceImpl.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/property/YTDBSequenceImpl.kt @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate.property +package jetbrains.exodus.entitystore.youtrackdb.iterate.property import com.jetbrains.youtrack.db.internal.core.metadata.sequence.DBSequence import jetbrains.exodus.entitystore.Sequence -import jetbrains.exodus.entitystore.orientdb.OPersistentEntityStore +import jetbrains.exodus.entitystore.youtrackdb.YTDBPersistentEntityStore -internal class OSequenceImpl( +internal class YTDBSequenceImpl( private val sequenceName: String, - private val store: OPersistentEntityStore + private val store: YTDBPersistentEntityStore ) : Sequence { override fun increment(): Long { return getOSequence().next() diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OCondition.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBCondition.kt similarity index 76% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OCondition.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBCondition.kt index 5adb83f19..95b99acda 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OCondition.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBCondition.kt @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query // Where -sealed interface OCondition : OQuery +sealed interface YTDBCondition : YTDBQuery // Property -class OEqualCondition( +class YTDBEqualCondition( val field: String, val value: Any, -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { val param = builder.addParam(field, value) @@ -31,11 +31,11 @@ class OEqualCondition( } } -class OContainsCondition( +class YTDBContainsCondition( val field: String, val value: String, val ignoreCase: Boolean, -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { val param = if (ignoreCase){ @@ -47,10 +47,10 @@ class OContainsCondition( } } -class OStartsWithCondition( +class YTDBStartsWithCondition( val field: String, val value: String, -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { val param = builder.addParam(field, "${value.lowercase()}%") @@ -58,18 +58,18 @@ class OStartsWithCondition( } } -class OFieldExistsCondition( +class YTDBFieldExistsCondition( val field: String -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { builder.append("not(").append(field).append(" is null)") } } -class OFieldIsNullCondition( +class YTDBFieldIsNullCondition( val field: String -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { builder.append(field).append(" is null") @@ -77,18 +77,18 @@ class OFieldIsNullCondition( } // Edge -class OEdgeExistsCondition( +class YTDBEdgeExistsCondition( val edge: String -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { builder.append("outE('").append(edge).append("').size() > 0") } } -class OEdgeIsNullCondition( +class YTDBEdgeIsNullCondition( val edge: String -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { builder.append("outE('").append(edge).append("').size() == 0") @@ -96,11 +96,11 @@ class OEdgeIsNullCondition( } // Binary -sealed class OBiCondition( +sealed class YTDBBiCondition( val operation: String, - val left: OCondition, - val right: OCondition -) : OCondition { + val left: YTDBCondition, + val right: YTDBCondition +) : YTDBCondition { override fun sql(builder: SqlBuilder) { builder.append("(") @@ -111,13 +111,13 @@ sealed class OBiCondition( } } -class OAndCondition(left: OCondition, right: OCondition) : OBiCondition("AND", left, right) -class OOrCondition(left: OCondition, right: OCondition) : OBiCondition("OR", left, right) +class YTDBAndCondition(left: YTDBCondition, right: YTDBCondition) : YTDBBiCondition("AND", left, right) +class YTDBOrCondition(left: YTDBCondition, right: YTDBCondition) : YTDBBiCondition("OR", left, right) // Negation class NotCondition( - val condition: OCondition -) : OCondition { + val condition: YTDBCondition +) : YTDBCondition { override fun sql(builder: SqlBuilder) { builder.append("NOT (") @@ -126,10 +126,10 @@ class NotCondition( } } -class OAndNotCondition( - val left: OCondition, - val right: OCondition -) : OCondition { +class YTDBAndNotCondition( + val left: YTDBCondition, + val right: YTDBCondition +) : YTDBCondition { override fun sql(builder: SqlBuilder) { builder.append("(") @@ -141,11 +141,11 @@ class OAndNotCondition( } // Others -class ORangeCondition( +class YTDBRangeCondition( val field: String, val minInclusive: Any, val maxInclusive: Any -) : OCondition { +) : YTDBCondition { // https://orientdb.com/docs/3.2.x/sql/SQL-Where.html#between override fun sql(builder: SqlBuilder) { @@ -155,10 +155,10 @@ class ORangeCondition( } } -class OInstanceOfCondition( +class YTDBInstanceOfCondition( val className: String, val invert: Boolean -) : OCondition { +) : YTDBCondition { override fun sql(builder: SqlBuilder) { if (invert) { diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OConditions.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBConditions.kt similarity index 59% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OConditions.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBConditions.kt index 879ddecb9..be6590a3e 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OConditions.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBConditions.kt @@ -13,28 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query -fun OCondition?.and(other: OCondition?): OCondition? { +fun YTDBCondition?.and(other: YTDBCondition?): YTDBCondition? { if (this == null) return other if (other == null) return this - return OAndCondition(this, other) + return YTDBAndCondition(this, other) } -fun OCondition?.or(other: OCondition?): OCondition? { +fun YTDBCondition?.or(other: YTDBCondition?): YTDBCondition? { if (this == null) return other if (other == null) return this - return OOrCondition(this, other) + return YTDBOrCondition(this, other) } -fun OCondition?.andNot(other: OCondition?): OCondition? { +fun YTDBCondition?.andNot(other: YTDBCondition?): YTDBCondition? { if (this == null && other == null) return null if (this == null && other != null) return NotCondition(other) if (other == null && this != null) return NotCondition(this) - if (this != null && other != null) return OAndNotCondition(this, other) + if (this != null && other != null) return YTDBAndNotCondition(this, other) return null } -fun equal(field: String, value: Any) = OEqualCondition(field, value) -fun or(left: OCondition, right: OCondition) = OOrCondition(left, right) -fun and(left: OCondition, right: OCondition) = OAndCondition(left, right) \ No newline at end of file +fun equal(field: String, value: Any) = YTDBEqualCondition(field, value) +fun or(left: YTDBCondition, right: YTDBCondition) = YTDBOrCondition(left, right) +fun and(left: YTDBCondition, right: YTDBCondition) = YTDBAndCondition(left, right) \ No newline at end of file diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OLimit.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBLimit.kt similarity index 63% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OLimit.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBLimit.kt index a816ac450..d13d78936 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OLimit.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBLimit.kt @@ -13,41 +13,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query -sealed interface OLimit : OSql { - fun min(other: OLimit): OLimit - fun max(other: OLimit): OLimit +sealed interface YTDBLimit : YTDBSql { + fun min(other: YTDBLimit): YTDBLimit + fun max(other: YTDBLimit): YTDBLimit } -class OLimitValue( +class YTDBLimitValue( val value: Int -) : OLimit { +) : YTDBLimit { override fun sql(builder: SqlBuilder) { builder.append(value) } - override fun min(other: OLimit): OLimit { + override fun min(other: YTDBLimit): YTDBLimit { return when (other) { - is OLimitValue -> if (this.value < other.value) this else other + is YTDBLimitValue -> if (this.value < other.value) this else other } } - override fun max(other: OLimit): OLimit { + override fun max(other: YTDBLimit): YTDBLimit { return when (other) { - is OLimitValue -> if (this.value > other.value) this else other + is YTDBLimitValue -> if (this.value > other.value) this else other } } } -fun OLimit?.min(other: OLimit?): OLimit? { +fun YTDBLimit?.min(other: YTDBLimit?): YTDBLimit? { if (this == null) return other if (other == null) return this return this.min(other) } -fun OLimit?.max(other: OLimit?): OLimit? { +fun YTDBLimit?.max(other: YTDBLimit?): YTDBLimit? { if (this == null) return other if (other == null) return this return this.max(other) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OOrder.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBOrder.kt similarity index 72% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OOrder.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBOrder.kt index 1db264ef0..07cb308e7 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OOrder.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBOrder.kt @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query -sealed interface OOrder : OSql { - fun merge(newOrder: OOrder): OOrder - fun reverse(): OOrder +sealed interface YTDBOrder : YTDBSql { + fun merge(newOrder: YTDBOrder): YTDBOrder + fun reverse(): YTDBOrder } data class FieldOrder(val field: String, val ascending: Boolean = true) -class OOrderByFields( +class YTDBOrderByFields( private val fields: List -) : OOrder { +) : YTDBOrder { constructor(field: String, ascending: Boolean = true) : this( listOf( @@ -47,29 +47,29 @@ class OOrderByFields( } } - override fun merge(newOrder: OOrder): OOrder { + override fun merge(newOrder: YTDBOrder): YTDBOrder { return when (newOrder) { - is OOrderByFields -> { + is YTDBOrderByFields -> { val newFields = (newOrder.fields + fields) .distinctBy { it.field } // filter out duplicates in favor of the new order fields .reversed() // reverse to keep the original order of fields - OOrderByFields(newFields) + YTDBOrderByFields(newFields) } is EmptyOrder -> newOrder } } - override fun reverse(): OOrder { - return OOrderByFields(fields.map { FieldOrder(it.field, !it.ascending) }) + override fun reverse(): YTDBOrder { + return YTDBOrderByFields(fields.map { FieldOrder(it.field, !it.ascending) }) } } -data object EmptyOrder : OOrder { - override fun merge(newOrder: OOrder): OOrder { +data object EmptyOrder : YTDBOrder { + override fun merge(newOrder: YTDBOrder): YTDBOrder { return this } - override fun reverse(): OOrder { + override fun reverse(): YTDBOrder { return this } @@ -78,7 +78,7 @@ data object EmptyOrder : OOrder { } } -fun OOrder?.merge(order: OOrder?): OOrder? { +fun YTDBOrder?.merge(order: YTDBOrder?): YTDBOrder? { if (this == null) return order if (order == null) return this return this.merge(order) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQuery.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQuery.kt similarity index 88% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQuery.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQuery.kt index 8fa566c0f..fd02729a8 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQuery.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQuery.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query /** * Implementations must be immutable. */ -interface OQuery : OSql +interface YTDBQuery : YTDBSql diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryCancellingPolicy.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryCancellingPolicy.kt similarity index 78% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryCancellingPolicy.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryCancellingPolicy.kt index 9bd53cb25..cceed9211 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryCancellingPolicy.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryCancellingPolicy.kt @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query import com.jetbrains.youtrack.db.internal.common.concur.TimeoutException import jetbrains.exodus.entitystore.QueryCancellingPolicy -class OQueryTimeoutException(message: String, source: Throwable) : RuntimeException(message, source) { +class YTDBQueryTimeoutException(message: String, source: Throwable) : RuntimeException(message, source) { companion object { @@ -26,17 +26,17 @@ class OQueryTimeoutException(message: String, source: Throwable) : RuntimeExcept try { return block() } catch (e: TimeoutException) { - throw OQueryTimeoutException("Query execution timed out", e) + throw YTDBQueryTimeoutException("Query execution timed out", e) } } } } -interface OQueryCancellingPolicy : QueryCancellingPolicy { +interface YTDBQueryCancellingPolicy : QueryCancellingPolicy { companion object { - fun timeout(timeoutMillis: Long): OQueryCancellingPolicy = object : OQueryCancellingPolicy { + fun timeout(timeoutMillis: Long): YTDBQueryCancellingPolicy = object : YTDBQueryCancellingPolicy { override val timeoutMillis: Long = timeoutMillis } } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryExecution.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryExecution.kt similarity index 74% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryExecution.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryExecution.kt index 3dd04e725..818b2e7be 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryExecution.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryExecution.kt @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query import com.jetbrains.youtrack.db.api.query.ResultSet -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction import mu.KLogging -object OQueryExecution : KLogging() { +object YTDBQueryExecution : KLogging() { - fun execute(query: OQuery, tx: OStoreTransaction): ResultSet { + fun execute(query: YTDBQuery, tx: YTDBStoreTransaction): ResultSet { val sqlQuery = tx.buildSql(query) val resultSet = tx.query(sqlQuery.sql, sqlQuery.params) @@ -36,12 +36,12 @@ object OQueryExecution : KLogging() { } } -internal fun OStoreTransaction.buildSql(query: OQuery): SqlQuery { +internal fun YTDBStoreTransaction.buildSql(query: YTDBQuery): SqlQuery { val builder = SqlBuilder() query.sql(builder) this.queryCancellingPolicy?.let { - check(it is OQueryCancellingPolicy) { "Unsupported query cancelling policy: $it" } - val timeoutQuery = OQueryTimeout(it.timeoutMillis) + check(it is YTDBQueryCancellingPolicy) { "Unsupported query cancelling policy: $it" } + val timeoutQuery = YTDBQueryTimeout(it.timeoutMillis) timeoutQuery.sql(builder) } diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryFunctions.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryFunctions.kt similarity index 60% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryFunctions.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryFunctions.kt index 4957c60ac..fa726ad3a 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryFunctions.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryFunctions.kt @@ -13,110 +13,110 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction -object OQueryFunctions { +object YTDBQueryFunctions { - fun intersect(left: OSelect, right: OSelect): OSelect { + fun intersect(left: YTDBSelect, right: YTDBSelect): YTDBSelect { return when { - left is ORecordIdSelect && right is ORecordIdSelect -> { + left is YTDBRecordIdSelect && right is YTDBRecordIdSelect -> { ensureLimitIsNotUsed(left, right) ensureSkipIsNotUsed(left, right) val newOrder = left.order.merge(right.order) val ids = left.recordIds.intersect(right.recordIds.toSet()) - ORecordIdSelect(ids, newOrder) + YTDBRecordIdSelect(ids, newOrder) } - left is OClassSelect && right is OClassSelect && isSameClassName(left, right) -> { + left is YTDBClassSelect && right is YTDBClassSelect && isSameClassName(left, right) -> { ensureInvariants(left, right) val newCondition = left.condition.and(right.condition) val newOrder = left.order.merge(right.order) - OClassSelect(left.className, newCondition, newOrder) + YTDBClassSelect(left.className, newCondition, newOrder) } else -> { - OIntersectSelect(left, right) + YTDBIntersectSelect(left, right) } } } - fun union(left: OSelect, right: OSelect): OSelect { + fun union(left: YTDBSelect, right: YTDBSelect): YTDBSelect { return when { - left is ORecordIdSelect && right is ORecordIdSelect -> { + left is YTDBRecordIdSelect && right is YTDBRecordIdSelect -> { ensureLimitIsNotUsed(left, right) ensureSkipIsNotUsed(left, right) val newOrder = left.order.merge(right.order) val ids = (left.recordIds + right.recordIds).toSet() - ORecordIdSelect(ids, newOrder) + YTDBRecordIdSelect(ids, newOrder) } - left is OClassSelect && right is OClassSelect && isSameClassName(left, right) -> { + left is YTDBClassSelect && right is YTDBClassSelect && isSameClassName(left, right) -> { ensureInvariants(left, right) val newCondition = left.condition.or(right.condition) val newOrder = left.order.merge(right.order) - OClassSelect(left.className, newCondition, newOrder) + YTDBClassSelect(left.className, newCondition, newOrder) } else -> { - OUnionSelect(left, right) + YTDBUnionSelect(left, right) } } } - fun difference(left: OSelect, right: OSelect): OSelect { + fun difference(left: YTDBSelect, right: YTDBSelect): YTDBSelect { return when { - left is OClassSelect && right is OClassSelect && isSameClassName(left, right) -> { + left is YTDBClassSelect && right is YTDBClassSelect && isSameClassName(left, right) -> { ensureInvariants(left, right) val newCondition = left.condition.andNot(right.condition) val newOrder = left.order.merge(right.order) - OClassSelect(left.className, newCondition, newOrder) + YTDBClassSelect(left.className, newCondition, newOrder) } else -> { - ODifferenceSelect(left, right) + YTDBDifferenceSelect(left, right) } } } - fun distinct(source: OSelect): OSelect { - return ODistinctSelect(source) + fun distinct(source: YTDBSelect): YTDBSelect { + return YTDBDistinctSelect(source) } - fun reverse(query: OSelect): OSelect { + fun reverse(query: YTDBSelect): YTDBSelect { val order = query.order?.reverse() ?: return query return query.withOrder(order) } - private fun ensureInvariants(left: OClassSelect, right: OClassSelect) { + private fun ensureInvariants(left: YTDBClassSelect, right: YTDBClassSelect) { ensureSkipIsNotUsed(left, right) ensureLimitIsNotUsed(left, right) } - private fun ensureSkipIsNotUsed(left: OSelect, right: OSelect) { + private fun ensureSkipIsNotUsed(left: YTDBSelect, right: YTDBSelect) { val lazyMessage = { "Skip can not be used for sub-query" } check(left.skip == null, lazyMessage) check(right.skip == null, lazyMessage) } - private fun ensureLimitIsNotUsed(left: OSelect, right: OSelect) { + private fun ensureLimitIsNotUsed(left: YTDBSelect, right: YTDBSelect) { val lazyMessage = { "Take can not be used for sub-query" } check(left.limit == null, lazyMessage) check(right.limit == null, lazyMessage) } - private fun isSameClassName(left: OClassSelect, right: OClassSelect): Boolean { + private fun isSameClassName(left: YTDBClassSelect, right: YTDBClassSelect): Boolean { return left.className == right.className } } -class OCountSelect( - val source: OSelect, -) : OQuery { +class YTDBCountSelect( + val source: YTDBSelect, +) : YTDBQuery { override fun sql(builder: SqlBuilder) { builder.append("SELECT count(*) as count FROM (") @@ -124,12 +124,12 @@ class OCountSelect( builder.append(")") } - fun count(tx: OStoreTransaction): Long = OQueryExecution.execute(this, tx).next().getProperty("count") + fun count(tx: YTDBStoreTransaction): Long = YTDBQueryExecution.execute(this, tx).next().getProperty("count") } -class OFirstSelect( - val source: OSelect, -) : OQuery { +class YTDBFirstSelect( + val source: YTDBSelect, +) : YTDBQuery { override fun sql(builder: SqlBuilder) { val index = builder.nextVarIndex() @@ -140,9 +140,9 @@ class OFirstSelect( } -class OLastSelect( - val source: OSelect, -) : OQuery { +class YTDBLastSelect( + val source: YTDBSelect, +) : YTDBQuery { override fun sql(builder: SqlBuilder) { val index = builder.nextVarIndex() diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryTimeout.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryTimeout.kt similarity index 88% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryTimeout.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryTimeout.kt index 93fe40d87..590bae74b 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryTimeout.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryTimeout.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query -class OQueryTimeout( +class YTDBQueryTimeout( val timeoutMillis: Long -) : OQuery { +) : YTDBQuery { override fun sql(builder: SqlBuilder) { builder.append(" TIMEOUT $timeoutMillis") diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSelect.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSelect.kt similarity index 68% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSelect.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSelect.kt index 88f6aba0d..1ce5116d5 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSelect.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSelect.kt @@ -13,57 +13,57 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query import com.jetbrains.youtrack.db.api.record.RID interface OConditional { - val condition: OCondition? + val condition: YTDBCondition? } interface OSortable { - val order: OOrder? + val order: YTDBOrder? - fun withOrder(order: OOrder): OSelect + fun withOrder(order: YTDBOrder): YTDBSelect } interface OSizable { - val skip: OSkip? - val limit: OLimit? + val skip: YTDBSkip? + val limit: YTDBLimit? - fun withSkip(skip: Int): OSelect - fun withLimit(limit: Int): OSelect + fun withSkip(skip: Int): YTDBSelect + fun withLimit(limit: Int): YTDBSelect } -sealed interface OSelect : OQuery, OSortable, OSizable +sealed interface YTDBSelect : YTDBQuery, OSortable, OSizable -abstract class OSelectStub( - override var order: OOrder? = null, - override var skip: OSkip? = null, - override var limit: OLimit? = null -) : OSelect { +abstract class YTDBSelectStub( + override var order: YTDBOrder? = null, + override var skip: YTDBSkip? = null, + override var limit: YTDBLimit? = null +) : YTDBSelect { - override fun withOrder(order: OOrder): OSelect { + override fun withOrder(order: YTDBOrder): YTDBSelect { this.order = this.order?.merge(order) ?: order return this } - override fun withSkip(skip: Int): OSelect { - this.skip = OSkipValue(skip) + override fun withSkip(skip: Int): YTDBSelect { + this.skip = YTDBSkipValue(skip) return this } - override fun withLimit(limit: Int): OSelect { - this.limit = OLimitValue(limit) + override fun withLimit(limit: Int): YTDBSelect { + this.limit = YTDBLimitValue(limit) return this } } -abstract class OSelectBase( - override var order: OOrder? = null, - override var skip: OSkip? = null, - override var limit: OLimit? = null -) : OSelectStub(order, skip, limit) { +abstract class YTDBSelectBase( + override var order: YTDBOrder? = null, + override var skip: YTDBSkip? = null, + override var limit: YTDBLimit? = null +) : YTDBSelectStub(order, skip, limit) { override fun sql(builder: SqlBuilder) { selectSql(builder) @@ -76,13 +76,13 @@ abstract class OSelectBase( } -class OClassSelect( +class YTDBClassSelect( val className: String, - override val condition: OCondition? = null, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectBase(order, skip, limit), OConditional { + override val condition: YTDBCondition? = null, + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectBase(order, skip, limit), OConditional { override fun sql(builder: SqlBuilder) { selectSql(builder) @@ -98,13 +98,13 @@ class OClassSelect( } } -class OLinkInFromSubQuerySelect( +class YTDBLinkInFromSubQuerySelect( val linkName: String, - val subQuery: OSelect, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectBase(order, skip, limit) { + val subQuery: YTDBSelect, + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectBase(order, skip, limit) { override fun selectSql(builder: SqlBuilder) { builder.append("SELECT expand(in('").append(linkName).append("')) FROM (") @@ -113,13 +113,13 @@ class OLinkInFromSubQuerySelect( } } -class OLinkInFromIdsSelect( +class YTDBLinkInFromIdsSelect( val linkName: String, val targetIds: List, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectBase(order, skip, limit) { + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectBase(order, skip, limit) { override fun selectSql(builder: SqlBuilder) { builder.append("SELECT expand(in('").append(linkName).append("')) FROM ") @@ -130,14 +130,14 @@ class OLinkInFromIdsSelect( } -class OLinkOfTypeInFromIdsSelect( +class YTDBLinkOfTypeInFromIdsSelect( val linkName: String, val targetIds: List, val targetEntityType: String, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectBase(order, skip, limit) { + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectBase(order, skip, limit) { override fun selectSql(builder: SqlBuilder) { builder @@ -151,13 +151,13 @@ class OLinkOfTypeInFromIdsSelect( private val targetIdsSql get() = "[${targetIds.map(RID::toString).joinToString(", ")}]" } -class OLinkOutFromIdSelect( +class YTDBLinkOutFromIdSelect( val linkName: String, private val targetIds: List, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectBase(order, skip, limit) { + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectBase(order, skip, limit) { override fun selectSql(builder: SqlBuilder) { builder.append("SELECT expand(out('").append(linkName).append("')) FROM ") @@ -169,13 +169,13 @@ class OLinkOutFromIdSelect( -class OLinkOutFromSubQuerySelect( +class YTDBLinkOutFromSubQuerySelect( val linkName: String, - val subQuery: OSelect, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectBase(order, skip, limit) { + val subQuery: YTDBSelect, + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectBase(order, skip, limit) { override fun selectSql(builder: SqlBuilder) { builder.append("SELECT expand(out('").append(linkName).append("')) FROM (") @@ -185,13 +185,13 @@ class OLinkOutFromSubQuerySelect( } -abstract class OBinaryOperationSelect( - val left: OSelect, - val right: OSelect, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectStub(order, skip, limit) { +abstract class YTDBBinaryOperationSelect( + val left: YTDBSelect, + val right: YTDBSelect, + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectStub(order, skip, limit) { abstract fun applyOperatorNoOrder(builder: SqlBuilder, leftArgName: String, rightArgName: String) open fun applyOperator(builder: SqlBuilder, leftArgName: String, rightArgName: String) = applyOperatorNoOrder(builder, leftArgName, rightArgName) @@ -251,13 +251,13 @@ abstract class OBinaryOperationSelect( } } -class OIntersectSelect( - left: OSelect, - right: OSelect, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OBinaryOperationSelect(left, right, order, skip, limit) { +class YTDBIntersectSelect( + left: YTDBSelect, + right: YTDBSelect, + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBBinaryOperationSelect(left, right, order, skip, limit) { // https://orientdb.com/docs/3.2.x/sql/SQL-Functions.html#intersect // intersect returns projection thus needs to expand it into collection @@ -266,14 +266,14 @@ class OIntersectSelect( } } -class OUnionSelect( - left: OSelect, - right: OSelect, +class YTDBUnionSelect( + left: YTDBSelect, + right: YTDBSelect, val distinct: Boolean = true, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OBinaryOperationSelect(left, right, order, skip, limit) { + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBBinaryOperationSelect(left, right, order, skip, limit) { // https://orientdb.com/docs/3.2.x/sql/SQL-Functions.html#unionall // intersect returns projection thus needs to expand it into collection @@ -298,12 +298,12 @@ class OUnionSelect( } } -class ODistinctSelect( - val subQuery: OSelect, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OSelectBase(order, skip, limit) { +class YTDBDistinctSelect( + val subQuery: YTDBSelect, + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBSelectBase(order, skip, limit) { override fun selectSql(builder: SqlBuilder) { builder.append("SELECT DISTINCT * FROM (") @@ -312,23 +312,23 @@ class ODistinctSelect( } } -class ODifferenceSelect( - left: OSelect, - right: OSelect, - order: OOrder? = null, - skip: OSkip? = null, - limit: OLimit? = null -) : OBinaryOperationSelect(left, right, order, skip, limit) { +class YTDBDifferenceSelect( + left: YTDBSelect, + right: YTDBSelect, + order: YTDBOrder? = null, + skip: YTDBSkip? = null, + limit: YTDBLimit? = null +) : YTDBBinaryOperationSelect(left, right, order, skip, limit) { override fun applyOperatorNoOrder(builder: SqlBuilder, leftArgName: String, rightArgName: String) { builder.append("difference($leftArgName, $rightArgName)") } } -class ORecordIdSelect( +class YTDBRecordIdSelect( val recordIds: Collection, - order: OOrder? = null -) : OSelectBase(order) { + order: YTDBOrder? = null +) : YTDBSelectBase(order) { override fun selectSql(builder: SqlBuilder) { builder.append("SELECT FROM ") @@ -338,28 +338,28 @@ class ORecordIdSelect( } } -fun OCondition?.where(builder: SqlBuilder) { +fun YTDBCondition?.where(builder: SqlBuilder) { this?.let { builder.append(" WHERE ") it.sql(builder) } ?: builder.append("") } -fun OOrder?.orderBy(builder: SqlBuilder) { +fun YTDBOrder?.orderBy(builder: SqlBuilder) { if (this != null && this != EmptyOrder) { builder.append(" ORDER BY ") this.sql(builder) } } -fun OSkip?.skip(builder: SqlBuilder) { +fun YTDBSkip?.skip(builder: SqlBuilder) { this?.let { builder.append(" SKIP ") it.sql(builder) } ?: builder.append("") } -fun OLimit?.limit(builder: SqlBuilder) { +fun YTDBLimit?.limit(builder: SqlBuilder) { this?.let { builder.append(" LIMIT ") it.sql(builder) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSkip.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSkip.kt similarity index 64% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSkip.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSkip.kt index 4cc4190b4..16ef85d2a 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSkip.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSkip.kt @@ -13,43 +13,43 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query -sealed interface OSkip : OSql { - fun min(other: OSkip): OSkip - fun max(other: OSkip): OSkip +sealed interface YTDBSkip : YTDBSql { + fun min(other: YTDBSkip): YTDBSkip + fun max(other: YTDBSkip): YTDBSkip } -class OSkipValue( +class YTDBSkipValue( val value: Int -) : OSkip { +) : YTDBSkip { override fun sql(builder: SqlBuilder) { builder.append(value) } - override fun min(other: OSkip): OSkip { + override fun min(other: YTDBSkip): YTDBSkip { return when (other) { - is OSkipValue -> if (this.value < other.value) this else other + is YTDBSkipValue -> if (this.value < other.value) this else other } } - override fun max(other: OSkip): OSkip { + override fun max(other: YTDBSkip): YTDBSkip { return when (other) { - is OSkipValue -> if (this.value > other.value) this else other + is YTDBSkipValue -> if (this.value > other.value) this else other } } } -fun OSkip?.min(other: OSkip?): OSkip? { +fun YTDBSkip?.min(other: YTDBSkip?): YTDBSkip? { if (this == null) return other if (other == null) return this return this.min(other) } -fun OSkip?.max(other: OSkip?): OSkip? { +fun YTDBSkip?.max(other: YTDBSkip?): YTDBSkip? { if (this == null) return other if (other == null) return this return this.max(other) diff --git a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSql.kt b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSql.kt similarity index 94% rename from entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSql.kt rename to entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSql.kt index 9ee43e801..5d84a9d5a 100644 --- a/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/orientdb/query/OSql.kt +++ b/entity-store/src/main/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBSql.kt @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query -interface OSql { +interface YTDBSql { fun sql(builder: SqlBuilder) } diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/WrongUsernameTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/WrongUsernameTest.kt index d078a21b4..86e0b0270 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/WrongUsernameTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/WrongUsernameTest.kt @@ -16,8 +16,8 @@ package jetbrains.exodus.entitystore import com.jetbrains.youtrack.db.api.DatabaseType -import jetbrains.exodus.entitystore.orientdb.ODatabaseConnectionConfig -import jetbrains.exodus.entitystore.orientdb.iniYouTrackDb +import jetbrains.exodus.entitystore.youtrackdb.YTDBDatabaseConnectionConfig +import jetbrains.exodus.entitystore.youtrackdb.iniYouTrackDb import java.nio.file.Files import kotlin.io.path.absolutePathString import kotlin.test.Test @@ -26,7 +26,7 @@ class WrongUsernameTest { @Test(expected = IllegalArgumentException::class) fun cannotCreateDatabaseWithWrongUsername() { - val cfg = ODatabaseConnectionConfig + val cfg = YTDBDatabaseConnectionConfig .builder() .withPassword("hello") .withUserName(";drop database users") diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/DBCompactTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/DBCompactTest.kt similarity index 81% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/DBCompactTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/DBCompactTest.kt index 462e6360f..e87756511 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/DBCompactTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/DBCompactTest.kt @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.Issues -import jetbrains.exodus.entitystore.orientdb.testutil.createIssueImpl +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues +import jetbrains.exodus.entitystore.youtrackdb.testutil.createIssueImpl import org.junit.Assert import org.junit.Rule import org.junit.Test diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/EncryptedDBTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/EncryptedDBTest.kt similarity index 90% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/EncryptedDBTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/EncryptedDBTest.kt index 44cf79b46..871062dd9 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/EncryptedDBTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/EncryptedDBTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseType import com.jetbrains.youtrack.db.api.YouTrackDB @@ -41,22 +41,22 @@ class EncryptedDBTest(val number: Int) { } } - lateinit var provider: ODatabaseProviderImpl + lateinit var provider: YTDBDatabaseProviderImpl lateinit var db: YouTrackDB - private fun createConfig(key: ByteArray?): ODatabaseConfig { + private fun createConfig(key: ByteArray?): YTDBDatabaseConfig { val password = "admin" val username = "admin" val dbName = "test" - val connConfig = ODatabaseConnectionConfig.builder() + val connConfig = YTDBDatabaseConnectionConfig.builder() .withPassword(password) .withUserName(username) .withDatabaseType(DatabaseType.PLOCAL) .withDatabaseRoot(Files.createTempDirectory("oxigenDB_test$number").absolutePathString()) .build() - return ODatabaseConfig.builder() + return YTDBDatabaseConfig.builder() .withConnectionConfig(connConfig) .withDatabaseType(DatabaseType.PLOCAL) .withDatabaseName(dbName) @@ -74,7 +74,7 @@ class EncryptedDBTest(val number: Int) { val noEncryptionConfig = createConfig(null) logger.info("Connect to db and create test vertex class") db = iniYouTrackDb(config.connectionConfig) - provider = ODatabaseProviderImpl(config, db) + provider = YTDBDatabaseProviderImpl(config, db) provider.withSession { session -> session.createVertexClass("TEST") } @@ -91,7 +91,7 @@ class EncryptedDBTest(val number: Int) { Thread.sleep(1000) logger.info("Connect to db one more time and read") db = iniYouTrackDb(config.connectionConfig) - provider = ODatabaseProviderImpl(config, db) + provider = YTDBDatabaseProviderImpl(config, db) provider.withSession { session -> session.executeInTx { val vertex = session.query("SELECT FROM TEST").vertexStream().toList() @@ -104,7 +104,7 @@ class EncryptedDBTest(val number: Int) { logger.info("Connect to db one more time without encryption") db = iniYouTrackDb(config.connectionConfig) try { - ODatabaseProviderImpl(noEncryptionConfig, db).apply { + YTDBDatabaseProviderImpl(noEncryptionConfig, db).apply { withSession { session -> session.executeInTx { val vertex = session.query("SELECT FROM TEST").vertexStream().toList() diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OPersistentStoreTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/OPersistentStoreTest.kt similarity index 93% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OPersistentStoreTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/OPersistentStoreTest.kt index d51d39a96..0b1cc2c71 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OPersistentStoreTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/OPersistentStoreTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.exception.RecordDuplicatedException import com.jetbrains.youtrack.db.api.schema.PropertyType @@ -22,11 +22,11 @@ import com.jetbrains.youtrack.db.internal.core.id.ChangeableRecordId import jetbrains.exodus.entitystore.EntityRemovedInDatabaseException import jetbrains.exodus.entitystore.PersistentEntityId import jetbrains.exodus.entitystore.StoreTransaction -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.Issues -import jetbrains.exodus.entitystore.orientdb.testutil.Issues.CLASS -import jetbrains.exodus.entitystore.orientdb.testutil.OTestMixin -import jetbrains.exodus.entitystore.orientdb.testutil.createIssue +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues.CLASS +import jetbrains.exodus.entitystore.youtrackdb.testutil.OTestMixin +import jetbrains.exodus.entitystore.youtrackdb.testutil.createIssue import org.junit.Assert import org.junit.Assert.assertEquals import org.junit.Rule @@ -179,7 +179,7 @@ class OPersistentStoreTest : OTestMixin { youTrackDb.store.getEntity(PersistentEntityId.EMPTY_ID) } assertFailsWith { - youTrackDb.store.getEntity(ORIDEntityId.EMPTY_ID) + youTrackDb.store.getEntity(RIDEntityId.EMPTY_ID) } } } @@ -192,13 +192,13 @@ class OPersistentStoreTest : OTestMixin { val partiallyExistingEntityId2 = PersistentEntityId(300, issueId.localId) val totallyExistingEntityId = PersistentEntityId(issueId.typeId, issueId.localId) youTrackDb.store.executeInTransaction { - assertEquals(ORIDEntityId.EMPTY_ID, youTrackDb.store.getOEntityId(notExistingEntityId)) + assertEquals(RIDEntityId.EMPTY_ID, youTrackDb.store.getOEntityId(notExistingEntityId)) assertEquals( - ORIDEntityId.EMPTY_ID, + RIDEntityId.EMPTY_ID, youTrackDb.store.getOEntityId(partiallyExistingEntityId1) ) assertEquals( - ORIDEntityId.EMPTY_ID, + RIDEntityId.EMPTY_ID, youTrackDb.store.getOEntityId(partiallyExistingEntityId2) ) assertEquals(issueId, youTrackDb.store.getOEntityId(totallyExistingEntityId)) @@ -214,25 +214,25 @@ class OPersistentStoreTest : OTestMixin { val totallyExistingEntityId = PersistentEntityId(issueId.typeId, issueId.localId) val empty = ChangeableRecordId() youTrackDb.store.executeInTransaction { txn -> - with(txn.toEntityId(notExistingEntityId.toString()) as OEntityId) { + with(txn.toEntityId(notExistingEntityId.toString()) as YTDBEntityId) { assertEquals(notExistingEntityId.localId, localId) assertEquals(notExistingEntityId.typeId, typeId) assertEquals(empty.clusterId, asOId().clusterId) assertEquals(empty.clusterPosition, asOId().clusterPosition) } - with(txn.toEntityId(partiallyExistingEntityId1.toString()) as OEntityId) { + with(txn.toEntityId(partiallyExistingEntityId1.toString()) as YTDBEntityId) { assertEquals(partiallyExistingEntityId1.localId, localId) assertEquals(partiallyExistingEntityId1.typeId, typeId) assertEquals(empty.clusterId, asOId().clusterId) assertEquals(empty.clusterPosition, asOId().clusterPosition) } - with(txn.toEntityId(partiallyExistingEntityId2.toString()) as OEntityId) { + with(txn.toEntityId(partiallyExistingEntityId2.toString()) as YTDBEntityId) { assertEquals(partiallyExistingEntityId2.localId, localId) assertEquals(partiallyExistingEntityId2.typeId, typeId) assertEquals(empty.clusterId, asOId().clusterId) assertEquals(empty.clusterPosition, asOId().clusterPosition) } - with(txn.toEntityId(totallyExistingEntityId.toString()) as OEntityId) { + with(txn.toEntityId(totallyExistingEntityId.toString()) as YTDBEntityId) { assertEquals(totallyExistingEntityId.localId, localId) assertEquals(totallyExistingEntityId.typeId, typeId) assertEquals(issueId.asOId(), asOId()) @@ -243,7 +243,7 @@ class OPersistentStoreTest : OTestMixin { @Test fun `propertyNames does not count internal properties`() { val issue = youTrackDb.store.computeInTransaction { txn -> - txn as OStoreTransaction + txn as YTDBStoreTransaction val issue = txn.createIssue("Hello", "Critical") val project = txn.createProject("World") txn.addIssueToProject(issue, project) @@ -276,7 +276,7 @@ class OPersistentStoreTest : OTestMixin { ) ) assertEquals( - ORIDEntityId.EMPTY_ID, + RIDEntityId.EMPTY_ID, youTrackDb.store.requireOEntityId(PersistentEntityId.EMPTY_ID) ) } diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OTransactionLifecycleTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/OTransactionLifecycleTest.kt similarity index 98% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OTransactionLifecycleTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/OTransactionLifecycleTest.kt index a28f48bf1..d4b0bbdbe 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OTransactionLifecycleTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/OTransactionLifecycleTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.exception.DatabaseException @@ -27,8 +27,8 @@ import com.jetbrains.youtrack.db.api.schema.SchemaClass import com.jetbrains.youtrack.db.internal.core.db.DatabaseSessionInternal import com.jetbrains.youtrack.db.internal.core.tx.FrontendTransaction.TXSTATUS import com.jetbrains.youtrack.db.internal.core.tx.FrontendTransactionNoTx -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.OTestMixin +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.OTestMixin import junit.framework.TestCase.assertFalse import org.junit.Assert import org.junit.Rule diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ORIDEntityIdTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/RIDEntityIdTest.kt similarity index 79% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ORIDEntityIdTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/RIDEntityIdTest.kt index e06c9a0d1..1ef280895 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ORIDEntityIdTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/RIDEntityIdTest.kt @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.record.Vertex import jetbrains.exodus.entitystore.PersistentEntityId -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.createIssue +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.createIssue import org.junit.Assert.assertEquals import org.junit.Rule import org.junit.Test import kotlin.test.assertFailsWith -class ORIDEntityIdTest { +class RIDEntityIdTest { @Rule @JvmField val youTrackDb = InMemoryYouTrackDB() @@ -42,21 +42,21 @@ class ORIDEntityIdTest { youTrackDb.withTxSession { assertFailsWith { vertex = it.bindToSession(vertex) - ORIDEntityId.fromVertex(vertex) + RIDEntityId.fromVertex(vertex) } } youTrackDb.provider.withSession { - oClass.setCustom(it, OVertexEntity.CLASS_ID_CUSTOM_PROPERTY_NAME, 300.toString()) + oClass.setCustom(it, YTDBVertexEntity.CLASS_ID_CUSTOM_PROPERTY_NAME, 300.toString()) } youTrackDb.withTxSession { vertex = it.bindToSession(vertex) assertFailsWith { - ORIDEntityId.fromVertex(vertex) + RIDEntityId.fromVertex(vertex) } - vertex.setProperty(OVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 200L) - ORIDEntityId.fromVertex(vertex) + vertex.setProperty(YTDBVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 200L) + RIDEntityId.fromVertex(vertex) } } diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConfigTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConfigTest.kt similarity index 86% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConfigTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConfigTest.kt index 23b7e8693..e25971b93 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseConfigTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseConfigTest.kt @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import org.junit.Assert import org.junit.Test -class ODatabaseConfigTest { +class YTDBDatabaseConfigTest { @Test fun `cypher key is trunked to 24 bytes from bigger one`() { val key1 = Array(60) { "aa" }.joinToString(separator = "") - val connConfig = ODatabaseConnectionConfig + val connConfig = YTDBDatabaseConnectionConfig .builder() .withUserName("testUrl") .withPassword("testPassword") @@ -31,7 +31,7 @@ class ODatabaseConfigTest { .build() - val cfg = ODatabaseConfig + val cfg = YTDBDatabaseConfig .builder() .withConnectionConfig(connConfig) .withStringHexAndIV(key1, 10L) @@ -45,13 +45,13 @@ class ODatabaseConfigTest { fun `cypher key is not trunked if key is smaller than 24`() { val key1 = "aabbccddaabbccdd" - val connConfig = ODatabaseConnectionConfig.builder() + val connConfig = YTDBDatabaseConnectionConfig.builder() .withUserName("testUrl") .withPassword("testPassword") .withDatabaseRoot("aa") .build() - val cfg = ODatabaseConfig + val cfg = YTDBDatabaseConfig .builder() .withConnectionConfig(connConfig) .withStringHexAndIV(key1, 10L) diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProviderTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProviderTest.kt similarity index 87% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProviderTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProviderTest.kt index 65988387a..0e9181b57 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/ODatabaseProviderTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBDatabaseProviderTest.kt @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.exception.ModificationOperationProhibitedException -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.OTestMixin +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.OTestMixin import org.junit.Rule import org.junit.Test import kotlin.test.assertFailsWith -class ODatabaseProviderTest: OTestMixin { +class YTDBDatabaseProviderTest: OTestMixin { @Rule @JvmField diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityTest.kt similarity index 96% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityTest.kt index 19a63c537..084bdd7ce 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OEntityTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBEntityTest.kt @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.schema.PropertyType import jetbrains.exodus.entitystore.EntityRemovedInDatabaseException import jetbrains.exodus.entitystore.PersistentEntityId -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.linkTargetEntityIdPropertyName -import jetbrains.exodus.entitystore.orientdb.testutil.* +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.linkTargetEntityIdPropertyName +import jetbrains.exodus.entitystore.youtrackdb.testutil.* import org.junit.Rule import org.junit.Test import java.io.ByteArrayInputStream @@ -27,7 +27,7 @@ import java.util.* import kotlin.random.Random import kotlin.test.* -class OEntityTest : OTestMixin { +class YTDBEntityTest : OTestMixin { @Rule @JvmField val youTrackDbRule = InMemoryYouTrackDB() @@ -111,7 +111,7 @@ class OEntityTest : OTestMixin { val issueC = youTrackDb.createIssue("C") val linkName = "link" youTrackDb.withSession { session -> - session.createEdgeClass(OVertexEntity.edgeClassName(linkName)) + session.createEdgeClass(YTDBVertexEntity.edgeClassName(linkName)) } youTrackDb.withStoreTx { @@ -301,7 +301,7 @@ class OEntityTest : OTestMixin { fun `delete links`() { val linkName = "link" youTrackDb.withSession { session -> - session.createEdgeClass(OVertexEntity.edgeClassName(linkName)) + session.createEdgeClass(YTDBVertexEntity.edgeClassName(linkName)) val oClass = session.getClass(Issues.CLASS)!! // pretend that the link is indexed oClass.createProperty( @@ -340,7 +340,7 @@ class OEntityTest : OTestMixin { fun `set links`() { val linkName = "link" youTrackDb.withSession { session -> - session.createEdgeClass(OVertexEntity.edgeClassName(linkName)) + session.createEdgeClass(YTDBVertexEntity.edgeClassName(linkName)) val oClass = session.getClass(Issues.CLASS)!! // pretend that the link is indexed oClass.createProperty( @@ -388,7 +388,7 @@ class OEntityTest : OTestMixin { fun `should delete all links`() { val linkName = "link" youTrackDb.withSession { session -> - session.createEdgeClass(OVertexEntity.edgeClassName(linkName)) + session.createEdgeClass(YTDBVertexEntity.edgeClassName(linkName)) val oClass = session.getClass(Issues.CLASS)!! // pretend that the link is indexed oClass.createProperty( @@ -421,7 +421,7 @@ class OEntityTest : OTestMixin { fun `should replace a link correctly`() { val linkName = "link" youTrackDb.withSession { session -> - session.createEdgeClass(OVertexEntity.edgeClassName(linkName)) + session.createEdgeClass(YTDBVertexEntity.edgeClassName(linkName)) } val issueA = youTrackDb.createIssue("A") @@ -446,7 +446,7 @@ class OEntityTest : OTestMixin { fun `setLink() and addLink() should work correctly with PersistentEntityId`() { val linkName = "link" youTrackDb.withSession { session -> - session.createEdgeClass(OVertexEntity.edgeClassName(linkName)) + session.createEdgeClass(YTDBVertexEntity.edgeClassName(linkName)) } val issueA = youTrackDb.createIssue("A") @@ -473,7 +473,7 @@ class OEntityTest : OTestMixin { fun `setLink() and addLink() return false if the target entity is not found`() { val linkName = "link" youTrackDb.withSession { session -> - session.createEdgeClass(OVertexEntity.edgeClassName(linkName)) + session.createEdgeClass(YTDBVertexEntity.edgeClassName(linkName)) } val issueB = youTrackDb.createIssue("A") @@ -484,14 +484,14 @@ class OEntityTest : OTestMixin { youTrackDb.withStoreTx { assertFalse(issueB.addLink(linkName, issueB.id)) - assertFalse(issueB.addLink(linkName, ORIDEntityId.EMPTY_ID)) + assertFalse(issueB.addLink(linkName, RIDEntityId.EMPTY_ID)) assertFalse(issueB.addLink(linkName, PersistentEntityId.EMPTY_ID)) assertFalse(issueB.addLink(linkName, PersistentEntityId(300, 300))) } youTrackDb.withStoreTx { assertFalse(issueB.setLink(linkName, issueB.id)) - assertFalse(issueB.setLink(linkName, ORIDEntityId.EMPTY_ID)) + assertFalse(issueB.setLink(linkName, RIDEntityId.EMPTY_ID)) assertFalse(issueB.setLink(linkName, PersistentEntityId.EMPTY_ID)) assertFalse(issueB.setLink(linkName, PersistentEntityId(300, 300))) } diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OSchemaBuddyTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSchemaBuddyTest.kt similarity index 83% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OSchemaBuddyTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSchemaBuddyTest.kt index 17a79231c..0ffacaaa8 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OSchemaBuddyTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSchemaBuddyTest.kt @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.internal.core.db.DatabaseSessionInternal import com.jetbrains.youtrack.db.internal.core.metadata.sequence.DBSequence import jetbrains.exodus.entitystore.PersistentEntityId -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.Issues -import jetbrains.exodus.entitystore.orientdb.testutil.OTestMixin +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues +import jetbrains.exodus.entitystore.youtrackdb.testutil.OTestMixin import org.junit.Assert.assertEquals import org.junit.Assert.assertNull import org.junit.Rule @@ -29,7 +29,7 @@ import kotlin.test.assertFailsWith import kotlin.test.assertNotNull import kotlin.test.assertTrue -class OSchemaBuddyTest : OTestMixin { +class YTDBSchemaBuddyTest : OTestMixin { @Rule @JvmField @@ -45,11 +45,11 @@ class OSchemaBuddyTest : OTestMixin { val issueId = withStoreTx { tx -> tx.createIssue("trista").id } - val buddy = OSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false) + val buddy = YTDBSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false) val totallyExistingEntityId = PersistentEntityId(issueId.typeId, issueId.localId) withSession { - assertEquals(ORIDEntityId.EMPTY_ID, buddy.getOEntityId(it, totallyExistingEntityId)) + assertEquals(RIDEntityId.EMPTY_ID, buddy.getOEntityId(it, totallyExistingEntityId)) } withSession { @@ -63,7 +63,7 @@ class OSchemaBuddyTest : OTestMixin { @Test fun `requireTypeExists() fails if the class is absent`() { - val buddy = OSchemaBuddyImpl(youTrackDb.provider) + val buddy = YTDBSchemaBuddyImpl(youTrackDb.provider) val className = "trista" withSession { session -> assertNull(session.getClass(className)) @@ -79,16 +79,16 @@ class OSchemaBuddyTest : OTestMixin { val issueId = withStoreTx { tx -> tx.createIssue("trista").id } - val buddy = OSchemaBuddyImpl(youTrackDb.provider, autoInitialize = true) + val buddy = YTDBSchemaBuddyImpl(youTrackDb.provider, autoInitialize = true) val notExistingEntityId = PersistentEntityId(300, 301) val partiallyExistingEntityId1 = PersistentEntityId(issueId.typeId, 301) val partiallyExistingEntityId2 = PersistentEntityId(300, issueId.localId) val totallyExistingEntityId = PersistentEntityId(issueId.typeId, issueId.localId) withSession { - assertEquals(ORIDEntityId.EMPTY_ID, buddy.getOEntityId(it, notExistingEntityId)) - assertEquals(ORIDEntityId.EMPTY_ID, buddy.getOEntityId(it, partiallyExistingEntityId1)) - assertEquals(ORIDEntityId.EMPTY_ID, buddy.getOEntityId(it, partiallyExistingEntityId2)) + assertEquals(RIDEntityId.EMPTY_ID, buddy.getOEntityId(it, notExistingEntityId)) + assertEquals(RIDEntityId.EMPTY_ID, buddy.getOEntityId(it, partiallyExistingEntityId1)) + assertEquals(RIDEntityId.EMPTY_ID, buddy.getOEntityId(it, partiallyExistingEntityId2)) assertEquals(issueId, buddy.getOEntityId(it, totallyExistingEntityId)) } } @@ -126,8 +126,8 @@ class OSchemaBuddyTest : OTestMixin { @Test fun `can create an edge class in a transaction`() { - val buddy = OSchemaBuddyImpl(youTrackDb.provider) - val edgeClassName = OVertexEntity.edgeClassName("trista") + val buddy = YTDBSchemaBuddyImpl(youTrackDb.provider) + val edgeClassName = YTDBVertexEntity.edgeClassName("trista") // the edge class is not there withSession { session -> diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OSequenceImplTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSequenceImplTest.kt similarity index 92% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OSequenceImplTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSequenceImplTest.kt index abd76a029..eeaf11402 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OSequenceImplTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBSequenceImplTest.kt @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.exception.RecordNotFoundException import com.jetbrains.youtrack.db.internal.core.db.DatabaseSessionInternal import com.jetbrains.youtrack.db.internal.core.metadata.sequence.DBSequence import jetbrains.exodus.entitystore.Sequence -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.OTestMixin +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.OTestMixin import org.junit.Assert import org.junit.Rule import org.junit.Test import kotlin.test.assertFailsWith -class OSequenceImplTest : OTestMixin { +class YTDBSequenceImplTest : OTestMixin { @Rule @JvmField val orientDbRule = InMemoryYouTrackDB() diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionLifecycleTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionLifecycleTest.kt similarity index 94% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionLifecycleTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionLifecycleTest.kt index ecb86c1ec..a8a3d74b2 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionLifecycleTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionLifecycleTest.kt @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.jetbrains.youtrack.db.api.exception.RecordDuplicatedException import com.jetbrains.youtrack.db.api.schema.PropertyType import com.jetbrains.youtrack.db.api.schema.SchemaClass import jetbrains.exodus.entitystore.StoreTransaction -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.OTestMixin +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.OTestMixin import junit.framework.TestCase.assertFalse import junit.framework.TestCase.assertTrue import org.junit.Rule @@ -29,7 +29,7 @@ import kotlin.test.assertFailsWith private typealias TxAction = (StoreTransaction) -> Unit -class OStoreTransactionLifecycleTest : OTestMixin { +class YTDBStoreTransactionLifecycleTest : OTestMixin { @Rule @JvmField diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionTest.kt similarity index 94% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionTest.kt index 05b5afa64..869bb0431 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/OStoreTransactionTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/YTDBStoreTransactionTest.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb +package jetbrains.exodus.entitystore.youtrackdb import com.google.common.truth.Truth.assertThat import com.jetbrains.youtrack.db.api.exception.DatabaseException @@ -23,12 +23,12 @@ import com.jetbrains.youtrack.db.api.record.Vertex import com.jetbrains.youtrack.db.internal.core.db.DatabaseRecordThreadLocal import jetbrains.exodus.entitystore.EntityRemovedInDatabaseException import jetbrains.exodus.entitystore.PersistentEntityId -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityOfTypeIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkToEntityIterable -import jetbrains.exodus.entitystore.orientdb.query.OQueryCancellingPolicy -import jetbrains.exodus.entitystore.orientdb.query.OQueryTimeoutException -import jetbrains.exodus.entitystore.orientdb.testutil.* +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityOfTypeIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkToEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryCancellingPolicy +import jetbrains.exodus.entitystore.youtrackdb.query.YTDBQueryTimeoutException +import jetbrains.exodus.entitystore.youtrackdb.testutil.* import org.junit.Assert import org.junit.Ignore import org.junit.Rule @@ -36,7 +36,7 @@ import org.junit.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith -class OStoreTransactionTest : OTestMixin { +class YTDBStoreTransactionTest : OTestMixin { @Rule @JvmField @@ -94,7 +94,7 @@ class OStoreTransactionTest : OTestMixin { 2, test.issue1.vertex.getEdges( Direction.IN, - OVertexEntity.edgeClassName(Boards.Links.HAS_ISSUE) + YTDBVertexEntity.edgeClassName(Boards.Links.HAS_ISSUE) ) .toList().size ) @@ -516,7 +516,7 @@ class OStoreTransactionTest : OTestMixin { // When withStoreTx { tx -> - val issues = tx.getAll(Issues.CLASS) as OEntityIterableBase + val issues = tx.getAll(Issues.CLASS) as YTDBEntityIterableBase val boards = issues.selectMany(Issues.Links.ON_BOARD) // Then @@ -538,7 +538,7 @@ class OStoreTransactionTest : OTestMixin { // When withStoreTx { tx -> - val issues = tx.getAll(Issues.CLASS) as OEntityIterableBase + val issues = tx.getAll(Issues.CLASS) as YTDBEntityIterableBase val boards = issues.selectDistinct(Issues.Links.ON_BOARD) // Then @@ -551,14 +551,14 @@ class OStoreTransactionTest : OTestMixin { // Given val test = givenTestCase() withStoreTx { - test.issue1.setProperty(OVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 0L) - test.issue2.setProperty(OVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 3L) - test.issue3.setProperty(OVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 99L) + test.issue1.setProperty(YTDBVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 0L) + test.issue2.setProperty(YTDBVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 3L) + test.issue3.setProperty(YTDBVertexEntity.LOCAL_ENTITY_ID_PROPERTY_NAME, 99L) } // When withStoreTx { tx -> - val issues = tx.findIds(Issues.CLASS, 2, 100) as OEntityIterableBase + val issues = tx.findIds(Issues.CLASS, 2, 100) as YTDBEntityIterableBase // Then assertNamesExactlyInOrder( issues, @@ -615,7 +615,7 @@ class OStoreTransactionTest : OTestMixin { tx.getEntity(PersistentEntityId.EMPTY_ID) } assertFailsWith { - tx.getEntity(ORIDEntityId.EMPTY_ID) + tx.getEntity(RIDEntityId.EMPTY_ID) } } } @@ -645,7 +645,7 @@ class OStoreTransactionTest : OTestMixin { fun `entity id should be valid and accessible just after creation`() { youTrackDb.store.executeInTransaction { tx -> val entity = tx.newEntity(Issues.CLASS) - val orid = (entity.id as OEntityId).asOId() + val orid = (entity.id as YTDBEntityId).asOId() Assert.assertTrue(orid.clusterId > 0) } } @@ -686,9 +686,9 @@ class OStoreTransactionTest : OTestMixin { // When youTrackDb.store.executeInTransaction { transaction -> - transaction.queryCancellingPolicy = OQueryCancellingPolicy.timeout(0) + transaction.queryCancellingPolicy = YTDBQueryCancellingPolicy.timeout(0) - val exception = Assert.assertThrows(OQueryTimeoutException::class.java) { + val exception = Assert.assertThrows(YTDBQueryTimeoutException::class.java) { transaction.getAll(Issues.CLASS).toList() } assertThat(exception.message).contains("Query execution timed out") @@ -707,7 +707,7 @@ class OStoreTransactionTest : OTestMixin { withStoreTx { tx -> val boards = - OEntityOfTypeIterable(tx, Issues.CLASS).selectManyDistinct(Issues.Links.ON_BOARD) + YTDBEntityOfTypeIterable(tx, Issues.CLASS).selectManyDistinct(Issues.Links.ON_BOARD) .toList() //selectManyDistinct Assert.assertEquals(2, boards.size) @@ -728,9 +728,9 @@ class OStoreTransactionTest : OTestMixin { } withStoreTx { tx -> - val issues = OEntityOfTypeIterable(tx, Issues.CLASS) + val issues = YTDBEntityOfTypeIterable(tx, Issues.CLASS) Assert.assertTrue(issues.contains(test.issue1)) - val issuesOnBoard = OLinkToEntityIterable(tx, Issues.Links.ON_BOARD, test.board1.id) + val issuesOnBoard = YTDBLinkToEntityIterable(tx, Issues.Links.ON_BOARD, test.board1.id) Assert.assertEquals(1, issuesOnBoard.toList().size) Assert.assertFalse(issuesOnBoard.contains(test.issue2)) Assert.assertTrue(issuesOnBoard.contains(test.issue1)) diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityIterableTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityIterableTest.kt similarity index 86% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityIterableTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityIterableTest.kt index 2054d122c..30726266a 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/iterate/OEntityIterableTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/iterate/YTDBEntityIterableTest.kt @@ -13,30 +13,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.iterate +package jetbrains.exodus.entitystore.youtrackdb.iterate import com.google.common.truth.Truth.assertThat -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.getOrCreateVertexClass -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OConcatEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OIntersectionEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OMinusEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OUnionEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkIsNullEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkOfTypeToEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.property.OInstanceOfIterable -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyEqualIterable -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyIsNullIterable -import jetbrains.exodus.entitystore.orientdb.query.buildSql -import jetbrains.exodus.entitystore.orientdb.testutil.* +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.getOrCreateVertexClass +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBConcatEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBIntersectionEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBMinusEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBUnionEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkIsNullEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkOfTypeToEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBInstanceOfIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyEqualIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyIsNullIterable +import jetbrains.exodus.entitystore.youtrackdb.query.buildSql +import jetbrains.exodus.entitystore.youtrackdb.testutil.* import org.junit.Rule import org.junit.Test import kotlin.test.assertContentEquals import kotlin.test.assertEquals import kotlin.test.assertFailsWith -class OEntityIterableTest : OTestMixin { +class YTDBEntityIterableTest : OTestMixin { @Rule @JvmField @@ -54,7 +54,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val issues = OPropertyIsNullIterable(tx, Issues.CLASS, "none") + val issues = YTDBPropertyIsNullIterable(tx, Issues.CLASS, "none") // Then tx.checkSql( @@ -76,7 +76,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val issues = OLinkIsNullEntityIterable(tx, Issues.CLASS, Issues.Links.IN_PROJECT) + val issues = YTDBLinkIsNullEntityIterable(tx, Issues.CLASS, Issues.Links.IN_PROJECT) // Then tx.checkSql( @@ -100,7 +100,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val issues = OPropertyEqualIterable(tx, Issues.CLASS, "opca", 300) + val issues = YTDBPropertyEqualIterable(tx, Issues.CLASS, "opca", 300) // Then tx.checkSql( @@ -122,7 +122,7 @@ class OEntityIterableTest : OTestMixin { val equal1 = tx.find(Issues.CLASS, "name", test.issue1.name()) val equal2 = tx.find(Issues.CLASS, "name", test.issue2.name()) - val issues = equal1.union(equal2) as OUnionEntityIterable + val issues = equal1.union(equal2) as YTDBUnionEntityIterable // Then tx.checkSql( @@ -144,7 +144,7 @@ class OEntityIterableTest : OTestMixin { val equal1 = tx.find(Issues.CLASS, "name", test.issue1.name()) val equal2 = tx.find(Issues.CLASS, "name", test.issue1.name()) - val issues = equal1.union(equal2) as OUnionEntityIterable + val issues = equal1.union(equal2) as YTDBUnionEntityIterable // Then tx.checkSql( @@ -169,7 +169,7 @@ class OEntityIterableTest : OTestMixin { withStoreTx { tx -> val nameEqual = tx.find(Issues.CLASS, "name", test.issue2.name()) val priorityEqual = tx.find(Issues.CLASS, Issues.Props.PRIORITY, "normal") - val issues = nameEqual.intersect(priorityEqual) as OIntersectionEntityIterable + val issues = nameEqual.intersect(priorityEqual) as YTDBIntersectionEntityIterable // Then tx.checkSql( @@ -197,7 +197,7 @@ class OEntityIterableTest : OTestMixin { withStoreTx { tx -> val issue1 = tx.find(Issues.CLASS, "name", "issue1") val issue2 = tx.find(Issues.CLASS, "name", "issue2") - val concat = issue1.concat(issue2) as OConcatEntityIterable + val concat = issue1.concat(issue2) as YTDBConcatEntityIterable // Then tx.checkSql( @@ -228,7 +228,7 @@ class OEntityIterableTest : OTestMixin { Issues.CLASS, test.board1, Issues.Links.ON_BOARD - ) as OLinkOfTypeToEntityIterable + ) as YTDBLinkOfTypeToEntityIterable println(test.board1.id.asOId()) // Then @@ -256,7 +256,7 @@ class OEntityIterableTest : OTestMixin { withStoreTx { tx -> val issuesOnBoard1 = tx.findLinks(Issues.CLASS, test.board1, Issues.Links.ON_BOARD) val issuesOnBoard2 = tx.findLinks(Issues.CLASS, test.board2, Issues.Links.ON_BOARD) - val concat = issuesOnBoard1.concat(issuesOnBoard2) as OConcatEntityIterable + val concat = issuesOnBoard1.concat(issuesOnBoard2) as YTDBConcatEntityIterable // Then tx.checkSql( @@ -284,7 +284,7 @@ class OEntityIterableTest : OTestMixin { val issuesOnBoard1 = tx.findLinks(Issues.CLASS, test.board1, Issues.Links.ON_BOARD) val issuesOnBoard2 = tx.findLinks(Issues.CLASS, test.board2, Issues.Links.ON_BOARD) val issues = issuesOnBoard1.union(issuesOnBoard2) - val issuesDistinct = issues.distinct() as ODistinctEntityIterable + val issuesDistinct = issues.distinct() as YTDBDistinctEntityIterable // Then tx.checkSql( @@ -309,7 +309,7 @@ class OEntityIterableTest : OTestMixin { withStoreTx { tx -> val issues = tx.getAll(Issues.CLASS) val complexIssues = tx.find(Issues.CLASS, "complex", "true") - val simpleIssues = issues.minus(complexIssues) as OMinusEntityIterable + val simpleIssues = issues.minus(complexIssues) as YTDBMinusEntityIterable // Then tx.checkSql( @@ -341,7 +341,7 @@ class OEntityIterableTest : OTestMixin { withStoreTx { tx -> val complexIssues = tx.find(Issues.CLASS, "complex", "true") val blockedIssues = tx.find(Issues.CLASS, "blocked", "true") - val complexUnblockedIssues = complexIssues.minus(blockedIssues) as OMinusEntityIterable + val complexUnblockedIssues = complexIssues.minus(blockedIssues) as YTDBMinusEntityIterable // Then tx.checkSql( @@ -369,7 +369,7 @@ class OEntityIterableTest : OTestMixin { withStoreTx { tx -> val issuesOnBoard1 = tx.findLinks(Issues.CLASS, test.board1, Issues.Links.ON_BOARD) val issuesOnBoard2 = tx.findLinks(Issues.CLASS, test.board2, Issues.Links.ON_BOARD) - val issues = issuesOnBoard1.minus(issuesOnBoard2) as OMinusEntityIterable + val issues = issuesOnBoard1.minus(issuesOnBoard2) as YTDBMinusEntityIterable // Then tx.checkSql( @@ -388,7 +388,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val issues = tx.getAll(Issues.CLASS).skip(1) as OSkipEntityIterable + val issues = tx.getAll(Issues.CLASS).skip(1) as YTDBSkipEntityIterable // Then tx.checkSql( @@ -406,7 +406,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val issues = tx.getAll(Issues.CLASS).take(2) as OTakeEntityIterable + val issues = tx.getAll(Issues.CLASS).take(2) as YTDBTakeEntityIterable // Then tx.checkSql( @@ -424,7 +424,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val issues = tx.getAll(Issues.CLASS).skip(1).take(2) as OTakeEntityIterable + val issues = tx.getAll(Issues.CLASS).skip(1).take(2) as YTDBTakeEntityIterable // Then tx.checkSql( @@ -443,7 +443,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> val reversedByName = - tx.sort(Issues.CLASS, "name", true).reverse() as OReversedEntityIterable + tx.sort(Issues.CLASS, "name", true).reverse() as YTDBReversedEntityIterable // Then tx.checkSql( @@ -471,9 +471,9 @@ class OEntityIterableTest : OTestMixin { // boards 1 and 2 val boards = tx.find(Boards.CLASS, "name", test.board1.name()) .union(tx.find(Boards.CLASS, "name", test.board2.name())) - val allIssues = tx.getAll(Issues.CLASS) as OEntityIterableBase + val allIssues = tx.getAll(Issues.CLASS) as YTDBEntityIterableBase val issuesOnBoards = - allIssues.findLinks(boards, Issues.Links.ON_BOARD) as OEntityIterable + allIssues.findLinks(boards, Issues.Links.ON_BOARD) as YTDBEntityIterable // Then tx.checkSql( @@ -524,7 +524,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val sortedIssues = tx.sort(Issues.CLASS, "name", true) as OEntityIterable + val sortedIssues = tx.sort(Issues.CLASS, "name", true) as YTDBEntityIterable val firstIssue = sortedIssues.first!! // Then @@ -565,7 +565,7 @@ class OEntityIterableTest : OTestMixin { // When withStoreTx { tx -> - val allIssues = tx.getAll(Issues.CLASS) as OEntityIterableBase + val allIssues = tx.getAll(Issues.CLASS) as YTDBEntityIterableBase assertEquals(3, allIssues.roughCount) assertEquals(3, allIssues.roughSize) @@ -602,15 +602,15 @@ class OEntityIterableTest : OTestMixin { } withStoreTx { txn -> - val childIssues = OInstanceOfIterable(txn, "Issue", "ChildIssue", false) - val notChildIssues = OInstanceOfIterable(txn, "Issue", "ChildIssue", true) + val childIssues = YTDBInstanceOfIterable(txn, "Issue", "ChildIssue", false) + val notChildIssues = YTDBInstanceOfIterable(txn, "Issue", "ChildIssue", true) assertEquals(10, notChildIssues.toList().size) assertEquals(1, childIssues.toList().size) } } - private fun OStoreTransaction.checkSql( - iterable: OEntityIterable, + private fun YTDBStoreTransaction.checkSql( + iterable: YTDBEntityIterable, expectedSql: String, expectedParams: Map = mapOf() ) { diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryTest.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryTest.kt similarity index 79% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryTest.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryTest.kt index a78df5d0d..37881e3c3 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/query/OQueryTest.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/query/YTDBQueryTest.kt @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.query +package jetbrains.exodus.entitystore.youtrackdb.query import com.google.common.truth.Truth.assertThat import org.junit.Test -class OQueryTest { +class YTDBQueryTest { @Test fun `should select by property`() { - val query = OClassSelect("Person", OEqualCondition("name", "John")) + val query = YTDBClassSelect("Person", YTDBEqualCondition("name", "John")) val builder = SqlBuilder() query.sql(builder) @@ -32,8 +32,8 @@ class OQueryTest { @Test fun `should select by property OR property`() { // Given - val condition = OEqualCondition("name", "John").or(OEqualCondition("project", "Sample")) - val oQuery = OClassSelect("Person", condition) + val condition = YTDBEqualCondition("name", "John").or(YTDBEqualCondition("project", "Sample")) + val oQuery = YTDBClassSelect("Person", condition) // When val query = buildSql(oQuery) @@ -46,8 +46,8 @@ class OQueryTest { @Test fun `should select by property AND property`() { // Given - val condition = OEqualCondition("name", "John").and(OEqualCondition("project", "Sample")) - val oQuery = OClassSelect("Person", condition) + val condition = YTDBEqualCondition("name", "John").and(YTDBEqualCondition("project", "Sample")) + val oQuery = YTDBClassSelect("Person", condition) // When val query = buildSql(oQuery) @@ -71,7 +71,7 @@ class OQueryTest { ), equal("project", "Sample3") ) - val oQuery = OClassSelect("Person", condition) + val oQuery = YTDBClassSelect("Person", condition) // When val query = buildSql(oQuery) @@ -88,9 +88,9 @@ class OQueryTest { ) } - private fun buildSql(oSql: OSql): SqlQuery { + private fun buildSql(YTDBSql: YTDBSql): SqlQuery { val builder = SqlBuilder() - oSql.sql(builder) + YTDBSql.sql(builder) return builder.build() } } \ No newline at end of file diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/InMemoryYouTrackDB.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/InMemoryYouTrackDB.kt similarity index 79% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/InMemoryYouTrackDB.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/InMemoryYouTrackDB.kt index 1dd778ed6..0590193c5 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/InMemoryYouTrackDB.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/InMemoryYouTrackDB.kt @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.testutil +package jetbrains.exodus.entitystore.youtrackdb.testutil import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.DatabaseType import com.jetbrains.youtrack.db.api.YouTrackDB import com.jetbrains.youtrack.db.api.config.GlobalConfiguration import com.jetbrains.youtrack.db.api.config.YouTrackDBConfig -import jetbrains.exodus.entitystore.orientdb.* -import jetbrains.exodus.entitystore.orientdb.testutil.Issues.Links.IN_PROJECT -import jetbrains.exodus.entitystore.orientdb.testutil.Issues.Links.ON_BOARD -import jetbrains.exodus.entitystore.orientdb.testutil.Projects.Links.HAS_ISSUE +import jetbrains.exodus.entitystore.youtrackdb.* +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues.Links.IN_PROJECT +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues.Links.ON_BOARD +import jetbrains.exodus.entitystore.youtrackdb.testutil.Projects.Links.HAS_ISSUE import org.junit.rules.ExternalResource import java.nio.file.Files import kotlin.io.path.absolutePathString @@ -34,32 +34,32 @@ class InMemoryYouTrackDB( ) : ExternalResource() { private lateinit var db: YouTrackDB - lateinit var store: OPersistentEntityStore + lateinit var store: YTDBPersistentEntityStore private set - lateinit var provider: ODatabaseProviderImpl - lateinit var schemaBuddy: OSchemaBuddyImpl + lateinit var provider: YTDBDatabaseProviderImpl + lateinit var schemaBuddy: YTDBSchemaBuddyImpl val username = "admin" val password = "password" val dbName = "testDB" override fun before() { - val connConfig = ODatabaseConnectionConfig.builder() + val connConfig = YTDBDatabaseConnectionConfig.builder() .withDatabaseType(DatabaseType.MEMORY) .withDatabaseRoot(Files.createTempDirectory("youTrackDB_test").absolutePathString()) .withPassword(password) .withUserName(username) .build() - val config = ODatabaseConfig.builder() + val config = YTDBDatabaseConfig.builder() .withConnectionConfig(connConfig) .withDatabaseName(dbName) .build() val builder = YouTrackDBConfig.builder() builder.addGlobalConfigurationParameter(GlobalConfiguration.NON_TX_READS_WARNING_MODE, "SILENT") db = iniYouTrackDb(connConfig) - provider = ODatabaseProviderImpl(config, db) + provider = YTDBDatabaseProviderImpl(config, db) if (initializeIssueSchema) { provider.withSession { session -> @@ -73,8 +73,8 @@ class InMemoryYouTrackDB( } } - schemaBuddy = OSchemaBuddyImpl(provider, autoInitialize = autoInitializeSchemaBuddy) - store = OPersistentEntityStore(provider, dbName, + schemaBuddy = YTDBSchemaBuddyImpl(provider, autoInitialize = autoInitializeSchemaBuddy) + store = YTDBPersistentEntityStore(provider, dbName, schemaBuddy = schemaBuddy ) } @@ -85,9 +85,9 @@ class InMemoryYouTrackDB( val database get() = db - fun withStoreTx(block: (OStoreTransaction) -> R): R { + fun withStoreTx(block: (YTDBStoreTransaction) -> R): R { return store.computeInTransaction { tx -> - block(tx as OStoreTransaction) + block(tx as YTDBStoreTransaction) } } diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OTaskTrackerTestCase.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OTaskTrackerTestCase.kt similarity index 63% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OTaskTrackerTestCase.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OTaskTrackerTestCase.kt index ff449e462..586452918 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OTaskTrackerTestCase.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OTaskTrackerTestCase.kt @@ -13,27 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.testutil +package jetbrains.exodus.entitystore.youtrackdb.testutil -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.OVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity class OTaskTrackerTestCase(val orientDB: InMemoryYouTrackDB) { - val project1: OVertexEntity - val project2: OVertexEntity - val project3: OVertexEntity + val project1: YTDBVertexEntity + val project2: YTDBVertexEntity + val project3: YTDBVertexEntity - val issue1: OVertexEntity = orientDB.createIssue("issue1") - val issue2: OVertexEntity = orientDB.createIssue("issue2") - val issue3: OVertexEntity = orientDB.createIssue("issue3") + val issue1: YTDBVertexEntity = orientDB.createIssue("issue1") + val issue2: YTDBVertexEntity = orientDB.createIssue("issue2") + val issue3: YTDBVertexEntity = orientDB.createIssue("issue3") - val board1: OVertexEntity - val board2: OVertexEntity - val board3: OVertexEntity + val board1: YTDBVertexEntity + val board2: YTDBVertexEntity + val board3: YTDBVertexEntity init { - val tx = orientDB.store.beginTransaction() as OStoreTransaction + val tx = orientDB.store.beginTransaction() as YTDBStoreTransaction project1 = tx.createProjectImpl("project1") project2 = tx.createProjectImpl("project2") project3 = tx.createProjectImpl("project3") diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OTestMixin.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OTestMixin.kt similarity index 64% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OTestMixin.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OTestMixin.kt index cd3bd8131..2a8d6f6b8 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OTestMixin.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OTestMixin.kt @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.testutil +package jetbrains.exodus.entitystore.youtrackdb.testutil import com.google.common.truth.Ordered import com.google.common.truth.Truth.assertThat import com.jetbrains.youtrack.db.api.DatabaseSession import jetbrains.exodus.entitystore.Entity -import jetbrains.exodus.entitystore.orientdb.OEntity -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.OStoreTransactionImpl -import jetbrains.exodus.entitystore.orientdb.OVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransactionImpl +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity interface OTestMixin { @@ -36,12 +36,12 @@ interface OTestMixin { assertNamesExactly(result, *names).inOrder() } - fun beginTransaction(): OStoreTransactionImpl { + fun beginTransaction(): YTDBStoreTransactionImpl { val store = youTrackDb.store - return store.beginTransaction() as OStoreTransactionImpl + return store.beginTransaction() as YTDBStoreTransactionImpl } - fun withStoreTx(block: (OStoreTransaction) -> R): R { + fun withStoreTx(block: (YTDBStoreTransaction) -> R): R { return youTrackDb.withStoreTx(block) } @@ -55,13 +55,13 @@ interface OTestMixin { fun givenTestCase() = OTaskTrackerTestCase(youTrackDb) - fun OStoreTransaction.createIssue(name: String, priority: String? = null): OVertexEntity = createIssueImpl(name, priority) + fun YTDBStoreTransaction.createIssue(name: String, priority: String? = null): YTDBVertexEntity = createIssueImpl(name, priority) - fun OStoreTransaction.createProject(name: String): OVertexEntity = createProjectImpl(name) + fun YTDBStoreTransaction.createProject(name: String): YTDBVertexEntity = createProjectImpl(name) - fun OStoreTransaction.addIssueToProject(issue: OEntity, project: OEntity) = + fun YTDBStoreTransaction.addIssueToProject(issue: YTDBEntity, project: YTDBEntity) = addIssueToProjectImpl(issue, project) - fun OStoreTransaction.addIssueToBoard(issue: OEntity, board: OEntity) = + fun YTDBStoreTransaction.addIssueToBoard(issue: YTDBEntity, board: YTDBEntity) = addIssueToBoardImpl(issue, board) } \ No newline at end of file diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OUsersWithInheritanceTestCase.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OUsersWithInheritanceTestCase.kt similarity index 73% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OUsersWithInheritanceTestCase.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OUsersWithInheritanceTestCase.kt index 0623bb585..5316154ee 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OUsersWithInheritanceTestCase.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OUsersWithInheritanceTestCase.kt @@ -13,25 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.testutil +package jetbrains.exodus.entitystore.youtrackdb.testutil -import jetbrains.exodus.entitystore.orientdb.OStoreTransactionImpl -import jetbrains.exodus.entitystore.orientdb.OVertexEntity -import jetbrains.exodus.entitystore.orientdb.getOrCreateVertexClass +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransactionImpl +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.getOrCreateVertexClass class OUsersWithInheritanceTestCase(youTrackDB: InMemoryYouTrackDB) { - val user1: OVertexEntity - val user2: OVertexEntity + val user1: YTDBVertexEntity + val user2: YTDBVertexEntity - val agent1: OVertexEntity - val agent2: OVertexEntity + val agent1: YTDBVertexEntity + val agent2: YTDBVertexEntity - val guest: OVertexEntity + val guest: YTDBVertexEntity - val admin1: OVertexEntity - val admin2: OVertexEntity + val admin1: YTDBVertexEntity + val admin2: YTDBVertexEntity init { @@ -49,7 +49,7 @@ class OUsersWithInheritanceTestCase(youTrackDB: InMemoryYouTrackDB) { } } - val tx = youTrackDB.store.beginTransaction() as OStoreTransactionImpl + val tx = youTrackDB.store.beginTransaction() as YTDBStoreTransactionImpl user1 = tx.createUser(User.CLASS, "u1") user2 = tx.createUser(User.CLASS, "u2") diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OrientDBIssues.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OrientDBIssues.kt similarity index 66% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OrientDBIssues.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OrientDBIssues.kt index b7fcb7123..240e53852 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OrientDBIssues.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OrientDBIssues.kt @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.testutil +package jetbrains.exodus.entitystore.youtrackdb.testutil import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.record.Direction import com.jetbrains.youtrack.db.api.record.Vertex import com.jetbrains.youtrack.db.api.schema.PropertyType import jetbrains.exodus.entitystore.Entity -import jetbrains.exodus.entitystore.orientdb.OEntity -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.OVertexEntity -import jetbrains.exodus.entitystore.orientdb.testutil.Issues.CLASS -import jetbrains.exodus.entitystore.orientdb.testutil.Issues.Links.IN_PROJECT -import jetbrains.exodus.entitystore.orientdb.testutil.Issues.Links.ON_BOARD -import jetbrains.exodus.entitystore.orientdb.testutil.Issues.Props.PRIORITY -import jetbrains.exodus.entitystore.orientdb.testutil.Projects.Links.HAS_ISSUE +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues.CLASS +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues.Links.IN_PROJECT +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues.Links.ON_BOARD +import jetbrains.exodus.entitystore.youtrackdb.testutil.Issues.Props.PRIORITY +import jetbrains.exodus.entitystore.youtrackdb.testutil.Projects.Links.HAS_ISSUE object Issues { const val CLASS = "Issue" @@ -58,18 +58,18 @@ object Boards { } } -fun InMemoryYouTrackDB.createIssue(name: String, priority: String? = null): OVertexEntity { +fun InMemoryYouTrackDB.createIssue(name: String, priority: String? = null): YTDBVertexEntity { return withStoreTx { tx -> tx.createIssueImpl(name, priority) } } -fun OEntity.name(): Comparable<*> { +fun YTDBEntity.name(): Comparable<*> { return getProperty("name") ?: throw IllegalStateException("Entity has no name property") } -internal fun OStoreTransaction.createProjectImpl(name: String): OVertexEntity { - val e = newEntity(Projects.CLASS) as OVertexEntity +internal fun YTDBStoreTransaction.createProjectImpl(name: String): YTDBVertexEntity { + val e = newEntity(Projects.CLASS) as YTDBVertexEntity e.setName(name) return e } @@ -78,28 +78,28 @@ private fun Entity.setName(name: String) { setProperty("name", name) } -internal fun OStoreTransaction.createIssueImpl( +internal fun YTDBStoreTransaction.createIssueImpl( name: String, priority: String? = null -): OVertexEntity { - val issue = newEntity(CLASS) as OVertexEntity +): YTDBVertexEntity { + val issue = newEntity(CLASS) as YTDBVertexEntity issue.setName(name) priority?.let { issue.setProperty(PRIORITY, it) } return issue } -internal fun OStoreTransaction.createBoardImpl(name: String): OVertexEntity { - val e = newEntity(Boards.CLASS) as OVertexEntity +internal fun YTDBStoreTransaction.createBoardImpl(name: String): YTDBVertexEntity { + val e = newEntity(Boards.CLASS) as YTDBVertexEntity e.setName(name) return e } -internal fun addIssueToProjectImpl(issue: OEntity, project: OEntity) { +internal fun addIssueToProjectImpl(issue: YTDBEntity, project: YTDBEntity) { issue.addLink(IN_PROJECT, project) project.addLink(HAS_ISSUE, issue) } -internal fun addIssueToBoardImpl(issue: OEntity, board: OEntity) { +internal fun addIssueToBoardImpl(issue: YTDBEntity, board: YTDBEntity) { issue.addLink(ON_BOARD, board) board.addLink(Boards.Links.HAS_ISSUE, issue) } @@ -113,8 +113,8 @@ internal fun DatabaseSession.addAssociation( val fromClass = getClass(fromClassName) ?: throw IllegalStateException("$fromClassName not found") val toClass = getClass(toClassName) ?: throw IllegalStateException("$toClassName not found") - val inEdgeName = OVertexEntity.edgeClassName(inPropName) - val outEdgeName = OVertexEntity.edgeClassName(outPropName) + val inEdgeName = YTDBVertexEntity.edgeClassName(inPropName) + val outEdgeName = YTDBVertexEntity.edgeClassName(outPropName) getClass(inEdgeName) ?: this.createEdgeClass(inEdgeName) getClass(outEdgeName) ?: this.createEdgeClass(outEdgeName) diff --git a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OrientDBUsers.kt b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OrientDBUsers.kt similarity index 76% rename from entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OrientDBUsers.kt rename to entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OrientDBUsers.kt index b8a234622..921d16c4c 100644 --- a/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/orientdb/testutil/OrientDBUsers.kt +++ b/entity-store/src/test/kotlin/jetbrains/exodus/entitystore/youtrackdb/testutil/OrientDBUsers.kt @@ -14,10 +14,10 @@ * limitations under the License. */ -package jetbrains.exodus.entitystore.orientdb.testutil +package jetbrains.exodus.entitystore.youtrackdb.testutil -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.OVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity object BaseUser { const val CLASS = "BaseUser" @@ -44,8 +44,8 @@ object Admin { } -fun OStoreTransaction.createUser(userClass: String, name: String): OVertexEntity { +fun YTDBStoreTransaction.createUser(userClass: String, name: String): YTDBVertexEntity { return newEntity(userClass).apply { setProperty("name", name) - } as OVertexEntity + } as YTDBVertexEntity } diff --git a/query/src/main/java/jetbrains/exodus/query/GetAll.java b/query/src/main/java/jetbrains/exodus/query/GetAll.java index 0d1e84178..63b81a4b8 100644 --- a/query/src/main/java/jetbrains/exodus/query/GetAll.java +++ b/query/src/main/java/jetbrains/exodus/query/GetAll.java @@ -18,7 +18,7 @@ import jetbrains.exodus.core.dataStructures.NanoSet; import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityOfTypeIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityOfTypeIterable; import jetbrains.exodus.query.metadata.ModelMetaData; public class GetAll extends NodeBase { @@ -26,7 +26,7 @@ public class GetAll extends NodeBase { @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OEntityOfTypeIterable(txn, entityType); + return new YTDBEntityOfTypeIterable(txn, entityType); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/GetLinks.java b/query/src/main/java/jetbrains/exodus/query/GetLinks.java index 1149f401d..78e3bf9dd 100644 --- a/query/src/main/java/jetbrains/exodus/query/GetLinks.java +++ b/query/src/main/java/jetbrains/exodus/query/GetLinks.java @@ -18,8 +18,8 @@ import jetbrains.exodus.entitystore.Entity; import jetbrains.exodus.entitystore.EntityId; -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyEqualIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyEqualIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import static jetbrains.exodus.query.Utils.safe_equals; @@ -42,9 +42,9 @@ protected boolean polymorphic() { public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { if (id != null) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OPropertyEqualIterable(txn, entityType, linkName, id); + return new YTDBPropertyEqualIterable(txn, entityType, linkName, id); } - return OEntityIterableBase.Companion.getEMPTY(); + return YTDBEntityIterableBase.Companion.getEMPTY(); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/InstanceOf.java b/query/src/main/java/jetbrains/exodus/query/InstanceOf.java index 35c67fe03..13295b36c 100644 --- a/query/src/main/java/jetbrains/exodus/query/InstanceOf.java +++ b/query/src/main/java/jetbrains/exodus/query/InstanceOf.java @@ -16,7 +16,7 @@ package jetbrains.exodus.query; import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OInstanceOfIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBInstanceOfIterable; import jetbrains.exodus.query.metadata.ModelMetaData; public class InstanceOf extends NodeBase { @@ -32,7 +32,7 @@ public InstanceOf(String className, Boolean invert) { @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OInstanceOfIterable(txn, entityType, className, invert); + return new YTDBInstanceOfIterable(txn, entityType, className, invert); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/LinkEqual.java b/query/src/main/java/jetbrains/exodus/query/LinkEqual.java index 26fb5662c..9224dd37e 100644 --- a/query/src/main/java/jetbrains/exodus/query/LinkEqual.java +++ b/query/src/main/java/jetbrains/exodus/query/LinkEqual.java @@ -19,9 +19,9 @@ import jetbrains.exodus.entitystore.Entity; import jetbrains.exodus.entitystore.EntityId; import jetbrains.exodus.entitystore.PersistentEntityId; -import jetbrains.exodus.entitystore.orientdb.OEntityId; -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkIsNullEntityIterable; -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkToEntityIterable; +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityId; +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkIsNullEntityIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkToEntityIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import static jetbrains.exodus.query.Utils.safe_equals; @@ -46,9 +46,9 @@ private LinkEqual(String name, EntityId id, Entity entity) { public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); if (entity == null) { - return new OLinkIsNullEntityIterable(txn, entityType, name); + return new YTDBLinkIsNullEntityIterable(txn, entityType, name); } - return new OLinkToEntityIterable(txn, name, (OEntityId) entity.getId()); + return new YTDBLinkToEntityIterable(txn, name, (YTDBEntityId) entity.getId()); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/LinkNotNull.java b/query/src/main/java/jetbrains/exodus/query/LinkNotNull.java index 65681ae78..e26b4f47f 100644 --- a/query/src/main/java/jetbrains/exodus/query/LinkNotNull.java +++ b/query/src/main/java/jetbrains/exodus/query/LinkNotNull.java @@ -17,7 +17,7 @@ import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.link.OLinkExistsEntityIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBLinkExistsEntityIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import static jetbrains.exodus.query.Utils.safe_equals; @@ -32,7 +32,7 @@ public LinkNotNull(String name) { @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OLinkExistsEntityIterable(txn, entityType, name); + return new YTDBLinkExistsEntityIterable(txn, entityType, name); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/PropertyContains.java b/query/src/main/java/jetbrains/exodus/query/PropertyContains.java index 73de05e7b..a1a78420a 100644 --- a/query/src/main/java/jetbrains/exodus/query/PropertyContains.java +++ b/query/src/main/java/jetbrains/exodus/query/PropertyContains.java @@ -16,7 +16,7 @@ package jetbrains.exodus.query; import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyContainsIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyContainsIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import static jetbrains.exodus.query.Utils.safe_equals; @@ -36,7 +36,7 @@ public PropertyContains(String name, String contains, boolean ignoreCase) { @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OPropertyContainsIterable(txn, entityType, name, contains, ignoreCase); + return new YTDBPropertyContainsIterable(txn, entityType, name, contains, ignoreCase); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/PropertyEqual.java b/query/src/main/java/jetbrains/exodus/query/PropertyEqual.java index 4f955e66d..10dc82b62 100644 --- a/query/src/main/java/jetbrains/exodus/query/PropertyEqual.java +++ b/query/src/main/java/jetbrains/exodus/query/PropertyEqual.java @@ -17,8 +17,8 @@ import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyEqualIterable; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyIsNullIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyEqualIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyIsNullIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import org.jetbrains.annotations.Nullable; @@ -47,9 +47,9 @@ public String getName() { public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); if (value == null) { - return new OPropertyIsNullIterable(txn, entityType, name); + return new YTDBPropertyIsNullIterable(txn, entityType, name); } - return new OPropertyEqualIterable(txn, entityType, name, value); + return new YTDBPropertyEqualIterable(txn, entityType, name, value); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/PropertyNotNull.java b/query/src/main/java/jetbrains/exodus/query/PropertyNotNull.java index 4a25aaabe..ca1526672 100644 --- a/query/src/main/java/jetbrains/exodus/query/PropertyNotNull.java +++ b/query/src/main/java/jetbrains/exodus/query/PropertyNotNull.java @@ -17,7 +17,7 @@ import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyExistsIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyExistsIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import static jetbrains.exodus.query.Utils.safe_equals; @@ -32,7 +32,7 @@ public PropertyNotNull(String name) { @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OPropertyExistsIterable(txn, entityType, name); + return new YTDBPropertyExistsIterable(txn, entityType, name); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/PropertyRange.java b/query/src/main/java/jetbrains/exodus/query/PropertyRange.java index 77c0aca28..61efe7da6 100644 --- a/query/src/main/java/jetbrains/exodus/query/PropertyRange.java +++ b/query/src/main/java/jetbrains/exodus/query/PropertyRange.java @@ -17,7 +17,7 @@ import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyRangeIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyRangeIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import org.jetbrains.annotations.NotNull; @@ -42,7 +42,7 @@ public PropertyRange(String name, @NotNull Comparable min, @NotNull Comparable m @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OPropertyRangeIterable(txn, entityType, name, min, max); + return new YTDBPropertyRangeIterable(txn, entityType, name, min, max); } PropertyRange merge(PropertyRange range) { diff --git a/query/src/main/java/jetbrains/exodus/query/PropertyStartsWith.java b/query/src/main/java/jetbrains/exodus/query/PropertyStartsWith.java index 5d28626da..de74c7b7c 100644 --- a/query/src/main/java/jetbrains/exodus/query/PropertyStartsWith.java +++ b/query/src/main/java/jetbrains/exodus/query/PropertyStartsWith.java @@ -17,7 +17,7 @@ import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.iterate.property.OPropertyStartsWithIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.property.YTDBPropertyStartsWithIterable; import jetbrains.exodus.query.metadata.ModelMetaData; import static jetbrains.exodus.query.Utils.safe_equals; @@ -35,7 +35,7 @@ public PropertyStartsWith(String name, String starts) { @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - return new OPropertyStartsWithIterable(txn, entityType, name, starts); + return new YTDBPropertyStartsWithIterable(txn, entityType, name, starts); } @Override diff --git a/query/src/main/java/jetbrains/exodus/query/UnaryNot.java b/query/src/main/java/jetbrains/exodus/query/UnaryNot.java index 854713e21..92d6e5c9f 100644 --- a/query/src/main/java/jetbrains/exodus/query/UnaryNot.java +++ b/query/src/main/java/jetbrains/exodus/query/UnaryNot.java @@ -17,9 +17,9 @@ import jetbrains.exodus.entitystore.Entity; -import jetbrains.exodus.entitystore.orientdb.OEntityIterable; -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityOfTypeIterable; -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OMinusEntityIterable; +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityOfTypeIterable; +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBMinusEntityIterable; import jetbrains.exodus.query.metadata.ModelMetaData; public class UnaryNot extends UnaryNode { @@ -30,9 +30,9 @@ public UnaryNot(final NodeBase child) { @Override public Iterable instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) { var txn = queryEngine.getOStore().requireActiveTransaction(); - var all = new OEntityOfTypeIterable(txn, entityType); - var minus = (OEntityIterable) child.instantiate(entityType, queryEngine, metaData, context); - return new OMinusEntityIterable(txn, all, minus); + var all = new YTDBEntityOfTypeIterable(txn, entityType); + var minus = (YTDBEntityIterable) child.instantiate(entityType, queryEngine, metaData, context); + return new YTDBMinusEntityIterable(txn, all, minus); } @Override diff --git a/query/src/main/kotlin/jetbrains/exodus/query/LinksEqualDecorator.kt b/query/src/main/kotlin/jetbrains/exodus/query/LinksEqualDecorator.kt index d0d6c04e2..6e3bae8be 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/LinksEqualDecorator.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/LinksEqualDecorator.kt @@ -16,7 +16,7 @@ package jetbrains.exodus.query import jetbrains.exodus.entitystore.Entity -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityOfTypeIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityOfTypeIterable import jetbrains.exodus.query.Utils.safe_equals import jetbrains.exodus.query.metadata.ModelMetaData @@ -30,7 +30,7 @@ class LinksEqualDecorator(val linkName: String, var decorated: NodeBase, val lin context: InstantiateContext ): Iterable { val txn = queryEngine.oStore.requireActiveTransaction() - return OEntityOfTypeIterable(txn, entityType).findLinks( + return YTDBEntityOfTypeIterable(txn, entityType).findLinks( decorated.instantiate(linkEntityType, queryEngine, metaData, context), linkName ) } diff --git a/query/src/main/kotlin/jetbrains/exodus/query/QueryEngine.kt b/query/src/main/kotlin/jetbrains/exodus/query/QueryEngine.kt index 8e653a1a6..86ae29e5f 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/QueryEngine.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/QueryEngine.kt @@ -21,12 +21,12 @@ import jetbrains.exodus.entitystore.PersistentEntityStore import jetbrains.exodus.entitystore.StoreTransaction import jetbrains.exodus.entitystore.iterate.EntityIdSet import jetbrains.exodus.entitystore.iterate.SingleEntityIterable -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OEntityStore -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.iterate.binop.OIntersectionEntityIterable -import jetbrains.exodus.entitystore.orientdb.iterate.link.OMultipleEntitiesIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityStore +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.iterate.binop.YTDBIntersectionEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBMultipleEntitiesIterable import jetbrains.exodus.entitystore.util.EntityIdSetFactory import jetbrains.exodus.kotlin.notNull import jetbrains.exodus.query.metadata.ModelMetaData @@ -36,7 +36,7 @@ open class QueryEngine(val modelMetaData: ModelMetaData?, val persistentStore: P private var _sortEngine: SortEngine? = null - val oStore: OEntityStore = persistentStore as OEntityStore + val oStore: YTDBEntityStore = persistentStore as YTDBEntityStore open var sortEngine: SortEngine? get() = _sortEngine @@ -89,7 +89,7 @@ open class QueryEngine(val modelMetaData: ModelMetaData?, val persistentStore: P return left } if (left.isEmpty || right.isEmpty) { - return OEntityIterableBase.EMPTY + return YTDBEntityIterableBase.EMPTY } return if (left is EntityIterable && right is EntityIterable) { @Suppress("USELESS_CAST") @@ -135,7 +135,7 @@ open class QueryEngine(val modelMetaData: ModelMetaData?, val persistentStore: P open fun exclude(left: Iterable, right: Iterable): Iterable { if (left.isEmpty || left === right) { - return OEntityIterableBase.EMPTY + return YTDBEntityIterableBase.EMPTY } if (right.isEmpty) { return left @@ -152,7 +152,7 @@ open class QueryEngine(val modelMetaData: ModelMetaData?, val persistentStore: P return if (it is EntityIterable) { it.selectDistinct(linkName) } else { - it?.let { inMemorySelectDistinct(it, linkName) } ?: OEntityIterableBase.EMPTY + it?.let { inMemorySelectDistinct(it, linkName) } ?: YTDBEntityIterableBase.EMPTY } } @@ -161,7 +161,7 @@ open class QueryEngine(val modelMetaData: ModelMetaData?, val persistentStore: P return if (it is EntityIterable) { it.selectManyDistinct(linkName) } else { - return it?.let { inMemorySelectManyDistinct(it, linkName) } ?: OEntityIterableBase.EMPTY + return it?.let { inMemorySelectManyDistinct(it, linkName) } ?: YTDBEntityIterableBase.EMPTY } } @@ -205,26 +205,26 @@ open class QueryEngine(val modelMetaData: ModelMetaData?, val persistentStore: P val sequence: kotlin.sequences.Sequence val txn = persistentStore.andCheckCurrentTransaction - if (left is OEntityIterable) { + if (left is YTDBEntityIterable) { //May be rewrite it. Constant from nowhere val rightValues = right.take(20) if (rightValues.size < 20) { - return OIntersectionEntityIterable( - txn as OStoreTransaction, + return YTDBIntersectionEntityIterable( + txn as YTDBStoreTransaction, left, - OMultipleEntitiesIterable(txn, rightValues.toList()) + YTDBMultipleEntitiesIterable(txn, rightValues.toList()) ) } else { ids = getAsEntityIdSet(left) sequence = right.asSequence() } - } else if (right is OEntityIterable) { + } else if (right is YTDBEntityIterable) { val leftValues = left.take(20) if (leftValues.size < 20) { - return OIntersectionEntityIterable( - txn as OStoreTransaction, + return YTDBIntersectionEntityIterable( + txn as YTDBStoreTransaction, right, - OMultipleEntitiesIterable(txn, leftValues.toList()) + YTDBMultipleEntitiesIterable(txn, leftValues.toList()) ) } else { ids = getAsEntityIdSet(left) @@ -267,9 +267,9 @@ open class QueryEngine(val modelMetaData: ModelMetaData?, val persistentStore: P private val Iterable?.isEmpty: Boolean get() { - return this == null || this === OEntityIterableBase.EMPTY + return this == null || this === YTDBEntityIterableBase.EMPTY } -private val Iterable?.isPersistent: Boolean get() = this is OEntityIterableBase +private val Iterable?.isPersistent: Boolean get() = this is YTDBEntityIterableBase diff --git a/query/src/main/kotlin/jetbrains/exodus/query/SortEngine.kt b/query/src/main/kotlin/jetbrains/exodus/query/SortEngine.kt index 0844fd43d..ed9996456 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/SortEngine.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/SortEngine.kt @@ -18,10 +18,10 @@ package jetbrains.exodus.query import jetbrains.exodus.entitystore.ComparableGetter import jetbrains.exodus.entitystore.Entity import jetbrains.exodus.entitystore.EntityIterable -import jetbrains.exodus.entitystore.orientdb.OEntityIterable -import jetbrains.exodus.entitystore.orientdb.OVertexEntity -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.iterate.link.OMultipleEntitiesIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBEntityIterable +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBMultipleEntitiesIterable import jetbrains.exodus.query.metadata.ModelMetaData open class SortEngine { @@ -47,11 +47,11 @@ open class SortEngine { val i = queryEngine.toEntityIterable(source) if (queryEngine.isPersistentIterable(i)) { val it = (i as EntityIterable).unwrap() - if (it === OEntityIterableBase.EMPTY) { - OEntityIterableBase.EMPTY + if (it === YTDBEntityIterableBase.EMPTY) { + YTDBEntityIterableBase.EMPTY } return if (it.roughCount == 0L && it.count() == 0L) { - OEntityIterableBase.EMPTY + YTDBEntityIterableBase.EMPTY } else { txn.sort(entityType, propertyName, (source as EntityIterable).unwrap(), asc) } @@ -69,9 +69,9 @@ open class SortEngine { source: Iterable, asc: Boolean ): Iterable { - if (source is OEntityIterable && source !is OMultipleEntitiesIterable) { + if (source is YTDBEntityIterable && source !is YTDBMultipleEntitiesIterable) { val txn = queryEngine.persistentStore.andCheckCurrentTransaction - return txn.sort(entityType, "${OVertexEntity.edgeClassName(linkName)}.$propName", source.unwrap(), asc) + return txn.sort(entityType, "${YTDBVertexEntity.edgeClassName(linkName)}.$propName", source.unwrap(), asc) } else { val mmd = queryEngine.modelMetaData!! val emd = mmd.getEntityMetaData(entityType)!! @@ -122,7 +122,7 @@ open class SortEngine { queryEngine.assertOperational() val emd = mmd?.getEntityMetaData(entityType) var it = if (emd != null && emd.isAbstract) - OEntityIterableBase.EMPTY + YTDBEntityIterableBase.EMPTY else queryEngine.instantiateGetAll(entityType) if (emd != null) { @@ -138,7 +138,7 @@ open class SortEngine { } private interface IterableGetter { - fun getIterable(type: String): OEntityIterableBase + fun getIterable(type: String): YTDBEntityIterableBase } private class EntityComparator(private val selector: ComparableGetter) : Comparator { diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/CountingTransaction.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/CountingTransaction.kt index aefdaea55..6081a246a 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/CountingTransaction.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/CountingTransaction.kt @@ -15,9 +15,9 @@ */ package jetbrains.exodus.query.metadata -import jetbrains.exodus.entitystore.orientdb.OPersistentEntityStore -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.OVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBPersistentEntityStore +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity /** @@ -32,11 +32,11 @@ import jetbrains.exodus.entitystore.orientdb.OVertexEntity * @property commitEvery The number of changes increments before a commit is triggered. */ internal class CountingTransaction( - private val store: OPersistentEntityStore, + private val store: YTDBPersistentEntityStore, private val commitEvery: Int ) { private var counter = 0 - private lateinit var txn : OStoreTransaction + private lateinit var txn : YTDBStoreTransaction var transactionsCommited: Long = 0 private set @@ -51,7 +51,7 @@ internal class CountingTransaction( } fun begin() { - txn = store.beginTransaction() as OStoreTransaction + txn = store.beginTransaction() as YTDBStoreTransaction } fun commit() { @@ -67,12 +67,12 @@ internal class CountingTransaction( } } - fun newVertex(type: String, localEntityId: Long): OVertexEntity { + fun newVertex(type: String, localEntityId: Long): YTDBVertexEntity { return txn.newEntity(type, localEntityId) } } -internal fun OPersistentEntityStore.withCountingTx(commitEvery: Int, block: (CountingTransaction) -> R): R { +internal fun YTDBPersistentEntityStore.withCountingTx(commitEvery: Int, block: (CountingTransaction) -> R): R { val tx = CountingTransaction(this, commitEvery) tx.begin() try { diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/DataAfterMigrationChecker.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/DataAfterMigrationChecker.kt index 99070efb0..e5a6514ad 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/DataAfterMigrationChecker.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/DataAfterMigrationChecker.kt @@ -19,9 +19,9 @@ import jetbrains.exodus.bindings.ComparableSet import jetbrains.exodus.entitystore.EntityId import jetbrains.exodus.entitystore.EntityRemovedInDatabaseException import jetbrains.exodus.entitystore.PersistentEntityStore -import jetbrains.exodus.entitystore.orientdb.OComparableSet -import jetbrains.exodus.entitystore.orientdb.OPersistentEntityStore -import jetbrains.exodus.entitystore.orientdb.OVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBComparableSet +import jetbrains.exodus.entitystore.youtrackdb.YTDBPersistentEntityStore +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity import mu.KotlinLogging import java.io.InputStream import kotlin.time.Duration @@ -30,7 +30,7 @@ import kotlin.time.measureTimedValue private val log = KotlinLogging.logger { } -fun checkDataIsSame(xStore: PersistentEntityStore, oStore: OPersistentEntityStore, xEntityIdToOEntityId: Map): DataAfterMigrationCheckingStats { +fun checkDataIsSame(xStore: PersistentEntityStore, oStore: YTDBPersistentEntityStore, xEntityIdToOEntityId: Map): DataAfterMigrationCheckingStats { return DataAfterMigrationChecker(xStore, oStore, xEntityIdToOEntityId).checkDataIsSame() } @@ -47,7 +47,7 @@ data class DataAfterMigrationCheckingStats( @OptIn(ExperimentalStdlibApi::class) internal class DataAfterMigrationChecker( private val xStore: PersistentEntityStore, - private val oStore: OPersistentEntityStore, + private val oStore: YTDBPersistentEntityStore, private val xEntityIdToOEntityId: Map, private val printProgressAtLeastOnceIn: Int = 5_000 ) { @@ -80,7 +80,7 @@ internal class DataAfterMigrationChecker( oStore.withReadonlyTx { oTx -> val xTypes = xTx.entityTypes.toSet() val oTypes = oTx.entityTypes.toSet() - .filterNot { it.contains(OVertexEntity.EDGE_CLASS_SUFFIX) } - oEntityStoreExtraEntityTypes + .filterNot { it.contains(YTDBVertexEntity.EDGE_CLASS_SUFFIX) } - oEntityStoreExtraEntityTypes log.info { "xStore entity types: ${xTypes.size}" } log.info { "oStore entity types excluding extra types: ${xTypes.size}" } when { @@ -134,7 +134,7 @@ internal class DataAfterMigrationChecker( checkSets( setsInfo = "$type $entityIdx/$xSize ${e1.id} $propName sets", xSet = v1.toSet(), - oSet = (v2 as OComparableSet<*>).toSet() + oSet = (v2 as YTDBComparableSet<*>).toSet() ) } v1 is String -> { diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/IndicesCreator.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/IndicesCreator.kt index c6afe9416..56bebdb06 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/IndicesCreator.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/IndicesCreator.kt @@ -19,9 +19,9 @@ import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.record.Direction import com.jetbrains.youtrack.db.api.record.Vertex import com.jetbrains.youtrack.db.api.schema.SchemaClass -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.edgeClassName -import jetbrains.exodus.entitystore.orientdb.getTargetLocalEntityIds -import jetbrains.exodus.entitystore.orientdb.setTargetLocalEntityIds +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.edgeClassName +import jetbrains.exodus.entitystore.youtrackdb.getTargetLocalEntityIds +import jetbrains.exodus.entitystore.youtrackdb.setTargetLocalEntityIds import mu.KotlinLogging private val log = KotlinLogging.logger {} @@ -35,21 +35,23 @@ internal class IndicesCreator( ) { private val logger = PaddedLogger.logger(log) - fun createIndices(oSession: DatabaseSession) { + fun createIndices(dbSession: DatabaseSession) { try { - with (logger) { + with(logger) { appendLine("applying indices to OrientDB") appendLine("creating indices if absent:") for ((ownerVertexName, indices) in indicesByOwnerVertexName) { - val oClass = oSession.getClass(ownerVertexName) ?: throw IllegalStateException("$ownerVertexName not found") - appendLine("${oClass.name}:") + val dbClass = + dbSession.getClass(ownerVertexName) ?: throw IllegalStateException("$ownerVertexName not found") + appendLine("${dbClass.name}:") withPadding { for ((_, indexName, properties, unique) in indices) { append(indexName) - if (!oClass.areIndexed(oSession, *properties.toTypedArray())) { - val indexType = if (unique) SchemaClass.INDEX_TYPE.UNIQUE else SchemaClass.INDEX_TYPE.NOTUNIQUE - oClass.createIndex(oSession, indexName, indexType, *properties.toTypedArray()) + if (!dbSession.schema.indexExists(dbSession, indexName)) { + val indexType = + if (unique) SchemaClass.INDEX_TYPE.UNIQUE else SchemaClass.INDEX_TYPE.NOTUNIQUE + dbClass.createIndex(dbSession, indexName, indexType, *properties.toTypedArray()) appendLine(", created") } else { appendLine(", already created") @@ -115,7 +117,7 @@ internal data class DeferredIndex( val properties: Set, val unique: Boolean ) { - constructor(ownerVertexName: String, properties: Set, unique: Boolean): this( + constructor(ownerVertexName: String, properties: Set, unique: Boolean) : this( ownerVertexName, indexName = "${ownerVertexName}_${properties.sorted().joinToString("_")}${if (unique) "_unique" else ""}", properties, diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrient.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrient.kt index c2551206d..f5fb6e53a 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrient.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrient.kt @@ -17,10 +17,10 @@ package jetbrains.exodus.query.metadata import com.jetbrains.youtrack.db.api.DatabaseType -import jetbrains.exodus.entitystore.orientdb.ODatabaseConfig -import jetbrains.exodus.entitystore.orientdb.ODatabaseConnectionConfig -import jetbrains.exodus.entitystore.orientdb.ODatabaseProviderImpl -import jetbrains.exodus.entitystore.orientdb.iniYouTrackDb +import jetbrains.exodus.entitystore.youtrackdb.YTDBDatabaseConfig +import jetbrains.exodus.entitystore.youtrackdb.YTDBDatabaseConnectionConfig +import jetbrains.exodus.entitystore.youtrackdb.YTDBDatabaseProviderImpl +import jetbrains.exodus.entitystore.youtrackdb.iniYouTrackDb fun main() { val xodusDatabaseDirectory = requireParam("xodusDatabaseDirectory") @@ -93,20 +93,20 @@ fun main() { entitiesPerTransaction: $entitiesPerTransaction """.trimIndent()) - val connectionConfig = ODatabaseConnectionConfig.builder() + val connectionConfig = YTDBDatabaseConnectionConfig.builder() .withPassword(orientPassword) .withUserName(orientUsername) .withDatabaseRoot(orientDatabaseDirectory) .withDatabaseType(orientDatabaseType) .build() - val config = ODatabaseConfig.builder() + val config = YTDBDatabaseConfig.builder() .withDatabaseName(orientDatabaseName) .build() val db = iniYouTrackDb(connectionConfig) // create a provider - val dbProvider = ODatabaseProviderImpl(config, db) + val dbProvider = YTDBDatabaseProviderImpl(config, db) val launcher = XodusToOrientDataMigratorLauncher( xodus = MigrateFromXodusConfig( diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigrator.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigrator.kt index 245a82fdd..a98e7fc8b 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigrator.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigrator.kt @@ -21,11 +21,11 @@ import jetbrains.exodus.bindings.ComparableSet import jetbrains.exodus.entitystore.EntityId import jetbrains.exodus.entitystore.EntityRemovedInDatabaseException import jetbrains.exodus.entitystore.PersistentEntityStore -import jetbrains.exodus.entitystore.orientdb.* -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.CLASS_ID_CUSTOM_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.CLASS_ID_SEQUENCE_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.localEntityIdSequenceName +import jetbrains.exodus.entitystore.youtrackdb.* +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.CLASS_ID_CUSTOM_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.CLASS_ID_SEQUENCE_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.localEntityIdSequenceName import mu.KotlinLogging import kotlin.time.Duration import kotlin.time.measureTime @@ -35,9 +35,9 @@ private val log = KotlinLogging.logger { } fun migrateDataFromXodusToOrientDb( xodus: PersistentEntityStore, - orient: OPersistentEntityStore, - orientProvider: ODatabaseProvider, - schemaBuddy: OSchemaBuddy, + orient: YTDBPersistentEntityStore, + orientProvider: YTDBDatabaseProvider, + schemaBuddy: YTDBSchemaBuddy, /* * How many entities should be copied in a single transaction * */ @@ -87,9 +87,9 @@ data class XodusToOrientMigrationStats( */ internal class XodusToOrientDataMigrator( private val xodus: PersistentEntityStore, - private val orient: OPersistentEntityStore, - private val orientProvider: ODatabaseProvider, - private val schemaBuddy: OSchemaBuddy, + private val orient: YTDBPersistentEntityStore, + private val orientProvider: YTDBDatabaseProvider, + private val schemaBuddy: YTDBSchemaBuddy, /* * How many entities should be copied in a single transaction * */ @@ -228,7 +228,7 @@ internal class XodusToOrientDataMigrator( for (propName in xEntity.propertyNames) { val propValue = xEntity.getProperty(propName) val comparableValue = if (propValue is ComparableSet<*>) { - OComparableSet(propValue.toHashSet()) + YTDBComparableSet(propValue.toHashSet()) } else { propValue as Comparable<*> } diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigratorLauncher.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigratorLauncher.kt index a4c3c5372..924f6dcfa 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigratorLauncher.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/XodusToOrientDataMigratorLauncher.kt @@ -17,7 +17,7 @@ package jetbrains.exodus.query.metadata import com.jetbrains.youtrack.db.api.YouTrackDB import jetbrains.exodus.entitystore.PersistentEntityStores -import jetbrains.exodus.entitystore.orientdb.* +import jetbrains.exodus.entitystore.youtrackdb.* import jetbrains.exodus.env.Environments import jetbrains.exodus.env.newEnvironmentConfig import jetbrains.exodus.log.BackupMetadata @@ -41,9 +41,9 @@ val VERTEX_CLASSES_TO_SKIP_MIGRATION = 10 * @param closeOnFinish Flag indicating whether to close the database upon completion of migration. */ data class MigrateToOrientConfig( - val databaseProvider: ODatabaseProvider, + val databaseProvider: YTDBDatabaseProvider, val db: YouTrackDB, - val orientConfig: ODatabaseConfig, + val orientConfig: YTDBDatabaseConfig, val closeOnFinish: Boolean = false ) @@ -117,13 +117,13 @@ class XodusToOrientDataMigratorLauncher( // 1.2 Create OModelMetadata // it is important to disable autoInitialize for the schemaBuddy, // dataMigrator does not like anything existing in the database before it migrated the data - val schemaBuddy = OSchemaBuddyImpl(dbProvider, autoInitialize = false) - val oModelMetadata = OModelMetaData(dbProvider, schemaBuddy) + val schemaBuddy = YTDBSchemaBuddyImpl(dbProvider, autoInitialize = false) + val oModelMetadata = YTDBModelMetaData(dbProvider, schemaBuddy) // 1.3 Create OPersistentEntityStore // it is important to pass the oModelMetadata to the entityStore as schemaBuddy. // it (oModelMetadata) must handle all the schema-related logic. - val oEntityStore = OPersistentEntityStore(dbProvider, dbName, schemaBuddy = oModelMetadata) + val oEntityStore = YTDBPersistentEntityStore(dbProvider, dbName, schemaBuddy = oModelMetadata) // 1.4 Create TransientEntityStore // val oTransientEntityStore = TransientEntityStoreImpl(oModelMetadata, oEntityStore) diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/OModelMetaData.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/YTDBModelMetaData.kt similarity index 90% rename from query/src/main/kotlin/jetbrains/exodus/query/metadata/OModelMetaData.kt rename to query/src/main/kotlin/jetbrains/exodus/query/metadata/YTDBModelMetaData.kt index 7d44162e0..7680e4e75 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/OModelMetaData.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/YTDBModelMetaData.kt @@ -17,12 +17,12 @@ package jetbrains.exodus.query.metadata import com.jetbrains.youtrack.db.api.DatabaseSession import com.jetbrains.youtrack.db.api.schema.SchemaClass -import jetbrains.exodus.entitystore.orientdb.* +import jetbrains.exodus.entitystore.youtrackdb.* -class OModelMetaData( - private val dbProvider: ODatabaseProvider, - private val schemaBuddy: OSchemaBuddy = OSchemaBuddyImpl(dbProvider, autoInitialize = false) -) : ModelMetaDataImpl(), OSchemaBuddy by schemaBuddy { +class YTDBModelMetaData( + private val dbProvider: YTDBDatabaseProvider, + private val schemaBuddy: YTDBSchemaBuddy = YTDBSchemaBuddyImpl(dbProvider, autoInitialize = false) +) : ModelMetaDataImpl(), YTDBSchemaBuddy by schemaBuddy { override fun onPrepared(entitiesMetaData: MutableCollection) { dbProvider.withCurrentOrNewSession(requireNoActiveTransaction = true) { session -> @@ -55,7 +55,7 @@ class OModelMetaData( * It is enough to check the existence of the edge class. * We reuse the same edge class for all the links with the same name. */ - val edgeClassName = OVertexEntity.edgeClassName(linkName) + val edgeClassName = YTDBVertexEntity.edgeClassName(linkName) val oClass = session.getClass(edgeClassName) if (oClass != null) { return oClass diff --git a/query/src/main/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializer.kt b/query/src/main/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializer.kt index 559b3f458..4d7fe1ca1 100644 --- a/query/src/main/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializer.kt +++ b/query/src/main/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializer.kt @@ -23,12 +23,12 @@ import com.jetbrains.youtrack.db.api.schema.SchemaProperty import com.jetbrains.youtrack.db.api.schema.PropertyType import com.jetbrains.youtrack.db.api.schema.SchemaClass import com.jetbrains.youtrack.db.internal.core.collate.CaseInsensitiveCollate -import jetbrains.exodus.entitystore.orientdb.OVertexEntity -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.linkTargetEntityIdPropertyName -import jetbrains.exodus.entitystore.orientdb.createClassIdSequenceIfAbsent -import jetbrains.exodus.entitystore.orientdb.createLocalEntityIdSequenceIfAbsent -import jetbrains.exodus.entitystore.orientdb.setClassIdIfAbsent +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.linkTargetEntityIdPropertyName +import jetbrains.exodus.entitystore.youtrackdb.createClassIdSequenceIfAbsent +import jetbrains.exodus.entitystore.youtrackdb.createLocalEntityIdSequenceIfAbsent +import jetbrains.exodus.entitystore.youtrackdb.setClassIdIfAbsent import mu.KotlinLogging private val log = KotlinLogging.logger {} @@ -333,7 +333,7 @@ internal class YouTrackDbSchemaInitializer( } private fun DatabaseSession.createEdgeClassIfAbsent(name: String): SchemaClass { - val className = OVertexEntity.edgeClassName(name) + val className = YTDBVertexEntity.edgeClassName(name) var oClass: SchemaClass? = getClass(className) if (oClass == null) { oClass = oSession.createEdgeClass(className)!! @@ -512,7 +512,7 @@ internal class YouTrackDbSchemaInitializer( private fun removeEdge(className: String, associationName: String, direction: Direction) { append(className) val sourceClass = oSession.getClass(className) - val edgeClassName = OVertexEntity.edgeClassName(associationName) + val edgeClassName = YTDBVertexEntity.edgeClassName(associationName) if (sourceClass != null) { val propOutName = Vertex.getEdgeLinkFieldName(direction, edgeClassName) append(".$propOutName") diff --git a/query/src/test/kotlin/jetbrains/exodus/query/OBinaryOperationsWithSortTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/OBinaryOperationsWithSortTest.kt index 20d5b27b4..3011a268d 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/OBinaryOperationsWithSortTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/OBinaryOperationsWithSortTest.kt @@ -15,8 +15,8 @@ */ package jetbrains.exodus.query -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityOfTypeIterable -import jetbrains.exodus.entitystore.orientdb.testutil.* +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityOfTypeIterable +import jetbrains.exodus.entitystore.youtrackdb.testutil.* import jetbrains.exodus.query.metadata.entity import jetbrains.exodus.query.metadata.oModel import org.junit.Assert @@ -42,8 +42,8 @@ class OBinaryOperationsWithSortTest : OTestMixin { val engine = QueryEngine(model, youTrackDb.store) engine.sortEngine = SortEngine() youTrackDb.withStoreTx { txn -> - val users = OEntityOfTypeIterable(txn, User.CLASS) - val agents = OEntityOfTypeIterable(txn, Agent.CLASS) + val users = YTDBEntityOfTypeIterable(txn, User.CLASS) + val agents = YTDBEntityOfTypeIterable(txn, Agent.CLASS) val union = engine.union(users, agents) val sorted = engine.query(union, BaseUser.CLASS, SortByProperty(null, "name", true)) assertContentEquals( @@ -85,7 +85,7 @@ class OBinaryOperationsWithSortTest : OTestMixin { val engine = QueryEngine(model, youTrackDb.store) engine.sortEngine = SortEngine() youTrackDb.withStoreTx { txn -> - val users = OEntityOfTypeIterable(txn, User.CLASS) + val users = YTDBEntityOfTypeIterable(txn, User.CLASS) val u1 = engine.query(BaseUser.CLASS, PropertyEqual("name", "u1")) val minus = engine.exclude(users, u1) val sorted = engine.query(minus, BaseUser.CLASS, SortByProperty(null, "name", true)) diff --git a/query/src/test/kotlin/jetbrains/exodus/query/OQueryEngineTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/YTDBQueryEngineTest.kt similarity index 96% rename from query/src/test/kotlin/jetbrains/exodus/query/OQueryEngineTest.kt rename to query/src/test/kotlin/jetbrains/exodus/query/YTDBQueryEngineTest.kt index b18c3f386..22cf83d4b 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/OQueryEngineTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/YTDBQueryEngineTest.kt @@ -20,10 +20,10 @@ import io.mockk.every import io.mockk.mockk import jetbrains.exodus.entitystore.Entity import jetbrains.exodus.entitystore.EntityIterable -import jetbrains.exodus.entitystore.orientdb.OStoreTransaction -import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase -import jetbrains.exodus.entitystore.orientdb.iterate.link.OMultipleEntitiesIterable -import jetbrains.exodus.entitystore.orientdb.testutil.* +import jetbrains.exodus.entitystore.youtrackdb.YTDBStoreTransaction +import jetbrains.exodus.entitystore.youtrackdb.iterate.YTDBEntityIterableBase +import jetbrains.exodus.entitystore.youtrackdb.iterate.link.YTDBMultipleEntitiesIterable +import jetbrains.exodus.entitystore.youtrackdb.testutil.* import jetbrains.exodus.query.metadata.EntityMetaData import jetbrains.exodus.query.metadata.ModelMetaData import jetbrains.exodus.query.metadata.PropertyMetaData @@ -38,8 +38,8 @@ import kotlin.test.assertEquals @RunWith(Parameterized::class) -class OQueryEngineTest( - val iterableGetter: ((QueryEngine, OStoreTransaction) -> (EntityIterable?)), +class YTDBQueryEngineTest( + val iterableGetter: ((QueryEngine, YTDBStoreTransaction) -> (EntityIterable?)), val argName: String ): OTestMixin { @@ -48,18 +48,18 @@ class OQueryEngineTest( @Parameterized.Parameters(name = "{1}") fun data(): Collection> { return listOf( - arrayOf({ _: QueryEngine, _: OStoreTransaction -> null }, "Query"), - arrayOf({ engine: QueryEngine, currentTx: OStoreTransaction -> + arrayOf({ _: QueryEngine, _: YTDBStoreTransaction -> null }, "Query"), + arrayOf({ engine: QueryEngine, currentTx: YTDBStoreTransaction -> val filteringSequence = engine.instantiateGetAll(Issues.CLASS).asSequence().filter { it.id.typeId >= 0 } InMemoryEntityIterable(filteringSequence.asIterable(), currentTx, engine) }, "InMemory"), - arrayOf({ engine: QueryEngine, currentTx: OStoreTransaction -> + arrayOf({ engine: QueryEngine, currentTx: YTDBStoreTransaction -> val filteringSequence = engine.instantiateGetAll(Issues.CLASS).asSequence().filter { it.id.typeId >= 0 } - OMultipleEntitiesIterable(currentTx, filteringSequence.toList()) + YTDBMultipleEntitiesIterable(currentTx, filteringSequence.toList()) }, "MultipleEntitiesIterable") ) } @@ -360,7 +360,7 @@ class OQueryEngineTest( // When withStoreTx { - val issues = engine.queryGetAll(Issues.CLASS) as OEntityIterableBase + val issues = engine.queryGetAll(Issues.CLASS) as YTDBEntityIterableBase val boards = issues.selectMany(Issues.Links.ON_BOARD) // Then diff --git a/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateDataTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateDataTest.kt index 822bd67f8..ab651010b 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateDataTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateDataTest.kt @@ -25,13 +25,13 @@ import jetbrains.exodus.bindings.StringBinding import jetbrains.exodus.entitystore.PersistentEntityStore import jetbrains.exodus.entitystore.StoreTransaction import jetbrains.exodus.entitystore.XodusTestDB -import jetbrains.exodus.entitystore.orientdb.OVertexEntity -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.CLASS_ID_SEQUENCE_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.localEntityIdSequenceName -import jetbrains.exodus.entitystore.orientdb.createVertexClassWithClassId -import jetbrains.exodus.entitystore.orientdb.requireClassId -import jetbrains.exodus.entitystore.orientdb.requireLocalEntityId -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.CLASS_ID_SEQUENCE_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.localEntityIdSequenceName +import jetbrains.exodus.entitystore.youtrackdb.createVertexClassWithClassId +import jetbrains.exodus.entitystore.youtrackdb.requireClassId +import jetbrains.exodus.entitystore.youtrackdb.requireLocalEntityId +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB import jetbrains.exodus.util.ByteArraySizedInputStream import jetbrains.exodus.util.LightOutputStream import jetbrains.exodus.util.UTFUtil @@ -55,6 +55,7 @@ class MigrateDataTest { @JvmField val xodus = XodusTestDB() + @OptIn(ExperimentalStdlibApi::class) @Test @Ignore fun `Xodus home UTF-8 is broken, example`() { @@ -180,6 +181,7 @@ class MigrateDataTest { * * So, this test is an illustration of the situation. */ + @OptIn(ExperimentalStdlibApi::class) @Test fun `broken strings from Xodus`() { // it is how the string is stored in Classic Xodus on the disk @@ -521,14 +523,14 @@ class MigrateDataTest { internal fun StoreTransaction.assertOrientContainsAllTheEntities(pile: PileOfEntities) { for (type in pile.types) { - for (record in this.getAll(type).map { it as OVertexEntity }) { + for (record in this.getAll(type).map { it as YTDBVertexEntity }) { val entity = pile.getEntity(type, record.getTestId()) record.assertEquals(entity) } } } -internal fun OVertexEntity.assertEquals(expected: Entity) { +internal fun YTDBVertexEntity.assertEquals(expected: Entity) { val actualDocument = this val actual = this @@ -561,7 +563,7 @@ internal fun OVertexEntity.assertEquals(expected: Entity) { } } -internal fun OVertexEntity.getTestId(): Int = getProperty("id") as Int +internal fun YTDBVertexEntity.getTestId(): Int = getProperty("id") as Int internal fun Vertex.getTestId(): Int = getProperty("id") as Int diff --git a/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrientDbSmokeTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrientDbSmokeTest.kt index a4f4f19f2..09b30345a 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrientDbSmokeTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateXodusToOrientDbSmokeTest.kt @@ -23,7 +23,7 @@ import com.jetbrains.youtrack.db.api.record.Vertex import jetbrains.exodus.TestUtil import jetbrains.exodus.entitystore.PersistentEntityStoreImpl import jetbrains.exodus.entitystore.PersistentEntityStores -import jetbrains.exodus.entitystore.orientdb.* +import jetbrains.exodus.entitystore.youtrackdb.* import org.junit.Test import java.io.File import kotlin.test.assertEquals @@ -44,14 +44,14 @@ class MigrateXodusToOrientDbSmokeTest { // create the database val builder = YouTrackDBConfig.builder() builder.addGlobalConfigurationParameter(GlobalConfiguration.NON_TX_READS_WARNING_MODE, "SILENT") - val connectionConfig = ODatabaseConnectionConfig.builder() + val connectionConfig = YTDBDatabaseConnectionConfig.builder() .withPassword(password) .withUserName(username) .withDatabaseType(DatabaseType.MEMORY) .withDatabaseRoot("") .build() - val config = ODatabaseConfig.builder() + val config = YTDBDatabaseConfig.builder() .withConnectionConfig(connectionConfig) .withDatabaseName("MEMORY") .build() @@ -59,17 +59,17 @@ class MigrateXodusToOrientDbSmokeTest { val db = iniYouTrackDb(connectionConfig) db.execute("create database $dbName MEMORY users ( $username identified by '$password' role admin )") // create a provider - val dbProvider = ODatabaseProviderImpl(config, db) + val dbProvider = YTDBDatabaseProviderImpl(config, db) // 1.2 Create OModelMetadata // it is important to disable autoInitialize for the schemaBuddy, // dataMigrator does not like anything existing in the database before it migrated the data - val oModelMetadata = OModelMetaData(dbProvider, OSchemaBuddyImpl(dbProvider, autoInitialize = false)) + val oModelMetadata = YTDBModelMetaData(dbProvider, YTDBSchemaBuddyImpl(dbProvider, autoInitialize = false)) // 1.3 Create OPersistentEntityStore // it is important to pass the oModelMetadata to the entityStore as schemaBuddy. // it (oModelMetadata) must handle all the schema-related logic. - val oEntityStore = OPersistentEntityStore(dbProvider, dbName, schemaBuddy = oModelMetadata) + val oEntityStore = YTDBPersistentEntityStore(dbProvider, dbName, schemaBuddy = oModelMetadata) // 1.4 Create TransientEntityStore // val oTransientEntityStore = TransientEntityStoreImpl(oModelMetadata, oEntityStore) @@ -106,13 +106,13 @@ class MigrateXodusToOrientDbSmokeTest { db.close() } - private fun OPersistentEntityStore.checkContainsAllTheEntities(entities: PileOfEntities) { + private fun YTDBPersistentEntityStore.checkContainsAllTheEntities(entities: PileOfEntities) { executeInTransaction { tx -> tx.assertOrientContainsAllTheEntities(entities) } } - private fun ODatabaseProvider.checkSchemaCreated() { + private fun YTDBDatabaseProvider.checkSchemaCreated() { withSession { session -> val type1 = session.getClass("type1")!! val type2 = session.getClass("type2")!! @@ -126,7 +126,7 @@ class MigrateXodusToOrientDbSmokeTest { } } - private fun OPersistentEntityStore.checkLinksWork() { + private fun YTDBPersistentEntityStore.checkLinksWork() { executeInTransaction { tx -> for (entity in tx.getAll("type2")) { if (entity.getProperty("id") == 7) { @@ -147,7 +147,7 @@ class MigrateXodusToOrientDbSmokeTest { } } - private fun OModelMetaData.createTestSchema() { + private fun YTDBModelMetaData.createTestSchema() { entity("type1") { property("prop1", "string") property("prop2", "boolean") diff --git a/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateYourDatabaseTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateYourDatabaseTest.kt index 99ee4a716..ef51dc483 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateYourDatabaseTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/metadata/MigrateYourDatabaseTest.kt @@ -16,10 +16,10 @@ package jetbrains.exodus.query.metadata import com.jetbrains.youtrack.db.api.DatabaseType -import jetbrains.exodus.entitystore.orientdb.ODatabaseConfig -import jetbrains.exodus.entitystore.orientdb.ODatabaseConnectionConfig -import jetbrains.exodus.entitystore.orientdb.ODatabaseProviderImpl -import jetbrains.exodus.entitystore.orientdb.iniYouTrackDb +import jetbrains.exodus.entitystore.youtrackdb.YTDBDatabaseConfig +import jetbrains.exodus.entitystore.youtrackdb.YTDBDatabaseConnectionConfig +import jetbrains.exodus.entitystore.youtrackdb.YTDBDatabaseProviderImpl +import jetbrains.exodus.entitystore.youtrackdb.iniYouTrackDb import org.junit.Test import kotlin.test.Ignore @@ -40,19 +40,19 @@ class MigrateYourDatabaseTest { @Ignore fun `migrate data from Xodus to OrientDB`() { - val connectionConfig = ODatabaseConnectionConfig.builder() + val connectionConfig = YTDBDatabaseConnectionConfig.builder() .withPassword("password") .withUserName("admin") .withDatabaseRoot("") .withDatabaseType(DatabaseType.MEMORY) .build() - val config = ODatabaseConfig.builder() + val config = YTDBDatabaseConfig.builder() .withDatabaseName("testDB") .build() val db = iniYouTrackDb(connectionConfig) - val provider = ODatabaseProviderImpl(config, db) + val provider = YTDBDatabaseProviderImpl(config, db) val launcher = XodusToOrientDataMigratorLauncher( orient = MigrateToOrientConfig( db = db, diff --git a/query/src/test/kotlin/jetbrains/exodus/query/metadata/OModelMetaDataTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/metadata/OModelMetaDataTest.kt index a11f21c15..6002f9a83 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/metadata/OModelMetaDataTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/metadata/OModelMetaDataTest.kt @@ -16,10 +16,10 @@ package jetbrains.exodus.query.metadata import jetbrains.exodus.entitystore.PersistentEntityId -import jetbrains.exodus.entitystore.orientdb.* -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.linkTargetEntityIdPropertyName -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB -import jetbrains.exodus.entitystore.orientdb.testutil.OTestMixin +import jetbrains.exodus.entitystore.youtrackdb.* +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.linkTargetEntityIdPropertyName +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.testutil.OTestMixin import org.junit.Assert import org.junit.Assert.assertEquals import org.junit.Rule @@ -180,7 +180,7 @@ class OModelMetaDataTest : OTestMixin { @Test fun `prepare() initializes the classId map`() { val model = - oModel(youTrackDb.provider, OSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false)) { + oModel(youTrackDb.provider, YTDBSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false)) { entity("type1") } @@ -196,7 +196,7 @@ class OModelMetaDataTest : OTestMixin { // model does not find the id because internal data structures are not initialized yet youTrackDb.withSession { - assertEquals(ORIDEntityId.EMPTY_ID, model.getOEntityId(it, oldSchoolEntityId)) + assertEquals(RIDEntityId.EMPTY_ID, model.getOEntityId(it, oldSchoolEntityId)) } // prepare() must initialize internal data structures in the end @@ -209,7 +209,7 @@ class OModelMetaDataTest : OTestMixin { @Test fun `addAssociation() initializes complementary properties for indexed links`() { - oModel(youTrackDb.provider, OSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false)) { + oModel(youTrackDb.provider, YTDBSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false)) { entity("type2") entity("type1") association("type1", "ass1", "type2", AssociationEndCardinality._0_n) @@ -241,7 +241,7 @@ class OModelMetaDataTest : OTestMixin { assertFalse(type2.existsProperty(linkTargetEntityIdPropertyName("ass2"))) } - oModel(youTrackDb.provider, OSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false)) { + oModel(youTrackDb.provider, YTDBSchemaBuddyImpl(youTrackDb.provider, autoInitialize = false)) { entity("type2") { index(IndexedField("ass2", isProperty = false)) } @@ -280,7 +280,7 @@ class OModelMetaDataTest : OTestMixin { } // initialize the entity types model.prepare() - val store = OPersistentEntityStore(youTrackDb.provider, youTrackDb.dbName, model) + val store = YTDBPersistentEntityStore(youTrackDb.provider, youTrackDb.dbName, model) // check that the links do not exist withSession { session -> @@ -333,7 +333,7 @@ class OModelMetaDataTest : OTestMixin { } // initialize the entity types model.prepare() - val store = OPersistentEntityStore(youTrackDb.provider, youTrackDb.dbName, model) + val store = YTDBPersistentEntityStore(youTrackDb.provider, youTrackDb.dbName, model) // entity1 has already existed for a while val id1 = store.computeInTransaction { tx -> diff --git a/query/src/test/kotlin/jetbrains/exodus/query/metadata/SchemaTestUtils.kt b/query/src/test/kotlin/jetbrains/exodus/query/metadata/SchemaTestUtils.kt index 225451df3..a4d147bd3 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/metadata/SchemaTestUtils.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/metadata/SchemaTestUtils.kt @@ -22,7 +22,7 @@ import com.jetbrains.youtrack.db.api.record.Vertex import com.jetbrains.youtrack.db.api.schema.SchemaProperty import com.jetbrains.youtrack.db.api.schema.SchemaClass import com.jetbrains.youtrack.db.internal.core.metadata.schema.SchemaClassInternal -import jetbrains.exodus.entitystore.orientdb.* +import jetbrains.exodus.entitystore.youtrackdb.* import org.junit.Assert.* // assertions @@ -164,11 +164,11 @@ internal fun model(initialize: ModelMetaDataImpl.() -> Unit): ModelMetaDataImpl } internal fun oModel( - databaseProvider: ODatabaseProvider, - schemaBuddy: OSchemaBuddy = OSchemaBuddyImpl(databaseProvider, autoInitialize = false), + databaseProvider: YTDBDatabaseProvider, + schemaBuddy: YTDBSchemaBuddy = YTDBSchemaBuddyImpl(databaseProvider, autoInitialize = false), buildModel: ModelMetaDataImpl.() -> Unit -): OModelMetaData { - val model = OModelMetaData(databaseProvider, schemaBuddy) +): YTDBModelMetaData { + val model = YTDBModelMetaData(databaseProvider, schemaBuddy) model.buildModel() return model } @@ -278,7 +278,7 @@ internal fun Vertex.setPropertyAndSave(propName: String, value: Any) { } internal fun Vertex.addEdge(linkName: String, target: Vertex) { - val edgeClassName = OVertexEntity.edgeClassName(linkName) + val edgeClassName = YTDBVertexEntity.edgeClassName(linkName) addEdge(target, edgeClassName) save() target.save() @@ -286,7 +286,7 @@ internal fun Vertex.addEdge(linkName: String, target: Vertex) { internal fun Vertex.addIndexedEdge(linkName: String, target: Vertex) { val bag = getTargetLocalEntityIds(linkName) - addEdge(target, OVertexEntity.edgeClassName(linkName)) + addEdge(target, YTDBVertexEntity.edgeClassName(linkName)) bag.add(target.identity) setTargetLocalEntityIds(linkName, bag) save() diff --git a/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerLinkIndicesTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerLinkIndicesTest.kt index 7a22022b0..0069ed08e 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerLinkIndicesTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerLinkIndicesTest.kt @@ -18,10 +18,10 @@ package jetbrains.exodus.query.metadata import com.jetbrains.youtrack.db.api.exception.RecordDuplicatedException import com.jetbrains.youtrack.db.api.record.Direction import com.jetbrains.youtrack.db.api.record.Vertex -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.edgeClassName -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.linkTargetEntityIdPropertyName -import jetbrains.exodus.entitystore.orientdb.getTargetLocalEntityIds -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.edgeClassName +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.linkTargetEntityIdPropertyName +import jetbrains.exodus.entitystore.youtrackdb.getTargetLocalEntityIds +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB import org.junit.Assert.assertEquals import org.junit.Rule import org.junit.Test diff --git a/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerTest.kt b/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerTest.kt index 98a52b146..d169b93b7 100644 --- a/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerTest.kt +++ b/query/src/test/kotlin/jetbrains/exodus/query/metadata/YouTrackDbSchemaInitializerTest.kt @@ -19,12 +19,12 @@ import com.jetbrains.youtrack.db.api.exception.RecordDuplicatedException import com.jetbrains.youtrack.db.api.schema.SchemaProperty import com.jetbrains.youtrack.db.api.schema.PropertyType import com.jetbrains.youtrack.db.internal.core.db.DatabaseSessionInternal -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME -import jetbrains.exodus.entitystore.orientdb.OVertexEntity.Companion.localEntityIdSequenceName -import jetbrains.exodus.entitystore.orientdb.requireClassId -import jetbrains.exodus.entitystore.orientdb.requireLocalEntityId -import jetbrains.exodus.entitystore.orientdb.setLocalEntityId -import jetbrains.exodus.entitystore.orientdb.testutil.InMemoryYouTrackDB +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.LOCAL_ENTITY_ID_PROPERTY_NAME +import jetbrains.exodus.entitystore.youtrackdb.YTDBVertexEntity.Companion.localEntityIdSequenceName +import jetbrains.exodus.entitystore.youtrackdb.requireClassId +import jetbrains.exodus.entitystore.youtrackdb.requireLocalEntityId +import jetbrains.exodus.entitystore.youtrackdb.setLocalEntityId +import jetbrains.exodus.entitystore.youtrackdb.testutil.InMemoryYouTrackDB import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Rule