//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void createLabelAndProperty() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CreateLabelAndProperty() { TokenWrite tokenWrites = TokenWriteInNewTransaction(); _labelId = tokenWrites.LabelGetOrCreateForName(LABEL); _labelId2 = tokenWrites.LabelGetOrCreateForName(LABEL2); _relType = tokenWrites.RelationshipTypeGetOrCreateForName(REL_TYPE); _relType2 = tokenWrites.RelationshipTypeGetOrCreateForName(REL_TYPE2); _propertyKeyId = tokenWrites.PropertyKeyGetOrCreateForName(PROPERTY_KEY); _propertyKeyId2 = tokenWrites.PropertyKeyGetOrCreateForName(PROPERTY_KEY2); _descriptor = SchemaDescriptorFactory.forLabel(_labelId, _propertyKeyId); _descriptor2 = SchemaDescriptorFactory.forLabel(_labelId, _propertyKeyId2); Commit(); _executorService = Executors.newCachedThreadPool(); }
public override ConstraintDefinition CreatePropertyExistenceConstraint(RelationshipType type, string propertyKey) { KernelTransaction transaction = SafeAcquireTransaction(TransactionSupplier); using (Statement ignore = transaction.AcquireStatement()) { try { TokenWrite tokenWrite = transaction.TokenWrite(); int typeId = tokenWrite.RelationshipTypeGetOrCreateForName(type.Name()); int[] propertyKeyId = getOrCreatePropertyKeyIds(tokenWrite, propertyKey); transaction.SchemaWrite().relationshipPropertyExistenceConstraintCreate(SchemaDescriptorFactory.forRelType(typeId, propertyKeyId)); return(new RelationshipPropertyExistenceConstraintDefinition(this, type, propertyKey)); } catch (Exception e) when(e is AlreadyConstrainedException || e is CreateConstraintFailureException || e is RepeatedSchemaComponentException) { throw new ConstraintViolationException(e.getUserMessage(new SilentTokenNameLookup(transaction.TokenRead())), e); } catch (IllegalTokenNameException e) { throw new System.ArgumentException(e); } catch (Exception e) when(e is InvalidTransactionTypeKernelException || e is SchemaKernelException) { throw new ConstraintViolationException(e.Message, e); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void getOrCreateIds() throws org.neo4j.internal.kernel.api.exceptions.KernelException private void getOrCreateIds() { using (Transaction tx = _graphDb.beginTx()) { ThreadToStatementContextBridge bridge = _graphDb.DependencyResolver.resolveDependency(typeof(ThreadToStatementContextBridge)); TokenWrite tokenWrite = bridge.GetKernelTransactionBoundToThisThread(true).tokenWrite(); _labelId = tokenWrite.LabelGetOrCreateForName("Person"); _relTypeId = tokenWrite.RelationshipTypeGetOrCreateForName("Knows"); _propertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName("name"); _relPropertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName("duration"); tx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @BeforeClass public static void initStorage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public static void InitStorage() { using (Transaction transaction = Db.beginTx()) { TokenWrite tokenWrite = Transaction.tokenWrite(); tokenWrite.PropertyKeyGetOrCreateForName(PROP1); tokenWrite.PropertyKeyGetOrCreateForName(PROP2); tokenWrite.LabelGetOrCreateForName(LABEL1); tokenWrite.LabelGetOrCreateForName(LABEL2); tokenWrite.RelationshipTypeGetOrCreateForName(TYPE1); transaction.Success(); } SchemaStore schemaStore = ResolveDependency(typeof(RecordStorageEngine)).testAccessNeoStores().SchemaStore; _storage = new SchemaStorage(schemaStore); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: int initializeLabelOrRelType(org.neo4j.internal.kernel.api.TokenWrite tokenWrite, String name) throws org.neo4j.internal.kernel.api.exceptions.KernelException internal override int InitializeLabelOrRelType(TokenWrite tokenWrite, string name) { return(tokenWrite.RelationshipTypeGetOrCreateForName(name)); }