Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long makeNode(String label) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException
        public virtual long MakeNode(string label)
        {
            long result;

            try
            {
                using (Transaction tx = _graph.beginTransaction(KernelTransaction.Type.@explicit, AnonymousContext.write()))
                {
                    KernelTransaction ktx = _txBridge.getKernelTransactionBoundToThisThread(true);
                    long nodeId           = ktx.DataWrite().nodeCreate();
                    int  labelId          = ktx.TokenWrite().labelGetOrCreateForName(label);
                    ktx.DataWrite().nodeAddLabel(nodeId, labelId);
                    result = nodeId;
                    tx.Success();
                }
            }
            catch (Exception e)
            {
                _log.error("Failed to create node: " + e.Message);
                throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Procedure.ProcedureCallFailed, "Failed to create node: " + e.Message, e);
            }
            return(result);
        }
Beispiel #2
0
 private string Execute(LoginContext subject, string query, System.Action <ResourceIterator <IDictionary <string, object> > > resultConsumer)
 {
     try
     {
         using (Transaction tx = Db.beginTransaction(KernelTransaction.Type.@implicit, subject))
         {
             resultConsumer(Db.execute(query));
             tx.Success();
             return("");
         }
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Beispiel #3
0
 public override InternalTransaction BeginTransaction(KernelTransaction.Type type, LoginContext loginContext, long timeout, TimeUnit unit)
 {
     return(GraphDatabaseAPI.beginTransaction(type, loginContext, timeout, unit));
 }
Beispiel #4
0
 public override InternalTransaction BeginTransaction(KernelTransaction.Type type, LoginContext loginContext)
 {
     return(GraphDatabaseAPI.beginTransaction(type, loginContext));
 }