Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void writeRows(final Iterable<String> columns, org.neo4j.graphdb.Result data, final ResultDataContentWriter writer) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        private void WriteRows(IEnumerable <string> columns, Result data, ResultDataContentWriter writer)
        {
            @out.writeArrayFieldStart("data");
            try
            {
                data.Accept(row =>
                {
                    @out.writeStartObject();
                    try
                    {
                        using (TransactionStateChecker txStateChecker = TransactionStateChecker.Create(_container))
                        {
                            writer.Write(@out, columns, row, txStateChecker);
                        }
                    }
                    finally
                    {
                        @out.writeEndObject();
                    }
                    return(true);
                });
            }
            finally
            {
                @out.writeEndArray();                         // </data>
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void writeNodes(org.codehaus.jackson.JsonGenerator out, Iterable<org.neo4j.graphdb.Node> nodes, TransactionStateChecker txStateChecker) throws java.io.IOException
        private void WriteNodes(JsonGenerator @out, IEnumerable <Node> nodes, TransactionStateChecker txStateChecker)
        {
            @out.writeArrayFieldStart("nodes");
            try
            {
                foreach (Node node in nodes)
                {
                    @out.writeStartObject();
                    try
                    {
                        long nodeId = node.Id;
                        @out.writeStringField("id", Convert.ToString(nodeId));
                        if (txStateChecker.IsNodeDeletedInCurrentTx(nodeId))
                        {
                            MarkDeleted(@out);
                        }
                        else
                        {
                            @out.writeArrayFieldStart("labels");
                            try
                            {
                                foreach (Label label in node.Labels)
                                {
                                    @out.writeString(label.Name());
                                }
                            }
                            finally
                            {
                                @out.writeEndArray();
                            }
                            WriteProperties(@out, node);
                        }
                    }
                    finally
                    {
                        @out.writeEndObject();
                    }
                }
            }
            finally
            {
                @out.writeEndArray();
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void write(org.codehaus.jackson.JsonGenerator out, Iterable<String> columns, org.neo4j.graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker) throws java.io.IOException
        public override void Write(JsonGenerator @out, IEnumerable <string> columns, Org.Neo4j.Graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker)
        {
            ISet <Node>         nodes         = new HashSet <Node>();
            ISet <Relationship> relationships = new HashSet <Relationship>();

            Extract(nodes, relationships, Map(columns, row));

            @out.writeObjectFieldStart("graph");
            try
            {
                WriteNodes(@out, nodes, txStateChecker);
                WriteRelationships(@out, relationships, txStateChecker);
            }
            finally
            {
                @out.writeEndObject();
            }
        }
Пример #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void writeRelationships(org.codehaus.jackson.JsonGenerator out, Iterable<org.neo4j.graphdb.Relationship> relationships, TransactionStateChecker txStateChecker) throws java.io.IOException
        private void WriteRelationships(JsonGenerator @out, IEnumerable <Relationship> relationships, TransactionStateChecker txStateChecker)
        {
            @out.writeArrayFieldStart("relationships");
            try
            {
                foreach (Relationship relationship in relationships)
                {
                    @out.writeStartObject();
                    try
                    {
                        long relationshipId = relationship.Id;
                        @out.writeStringField("id", Convert.ToString(relationshipId));
                        if (txStateChecker.IsRelationshipDeletedInCurrentTx(relationshipId))
                        {
                            MarkDeleted(@out);
                        }
                        else
                        {
                            @out.writeStringField("type", relationship.Type.name());
                            @out.writeStringField("startNode", Convert.ToString(relationship.StartNode.Id));
                            @out.writeStringField("endNode", Convert.ToString(relationship.EndNode.Id));
                            WriteProperties(@out, relationship);
                        }
                    }
                    finally
                    {
                        @out.writeEndObject();
                    }
                }
            }
            finally
            {
                @out.writeEndArray();
            }
        }
Пример #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void write(org.codehaus.jackson.JsonGenerator out, org.neo4j.server.rest.repr.RepresentationFormat format, Object value, TransactionStateChecker checker) throws java.io.IOException
        private void Write(JsonGenerator @out, RepresentationFormat format, object value, TransactionStateChecker checker)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: if (value instanceof java.util.Map<?, ?>)
            if (value is IDictionary <object, ?> )
            {
                @out.writeStartObject();
                try
                {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (java.util.Map.Entry<String, ?> entry : ((java.util.Map<String, ?>) value).entrySet())
                    foreach (KeyValuePair <string, ?> entry in ((IDictionary <string, ?>)value).SetOfKeyValuePairs())
                    {
                        @out.writeFieldName(entry.Key);
                        write(@out, format, entry.Value, checker);
                    }
                }
                finally
                {
                    @out.writeEndObject();
                }
            }
Пример #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void write(org.codehaus.jackson.JsonGenerator out, Iterable<String> columns, org.neo4j.graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker) throws java.io.IOException
        public override void Write(JsonGenerator @out, IEnumerable <string> columns, Org.Neo4j.Graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker)
        {
            RepresentationFormat format = new StreamingJsonFormat.StreamingRepresentationFormat(@out, null);

            @out.writeArrayFieldStart("rest");
            try
            {
                foreach (string key in columns)
                {
                    write(@out, format, row.Get(key), txStateChecker);
                }
            }
            finally
            {
                @out.writeEndArray();
            }
        }
Пример #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void write(org.codehaus.jackson.JsonGenerator out, Iterable<String> columns, org.neo4j.graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker) throws java.io.IOException
        public override void Write(JsonGenerator @out, IEnumerable <string> columns, Org.Neo4j.Graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker)
        {
            foreach (ResultDataContentWriter writer in _writers)
            {
                writer.Write(@out, columns, row, txStateChecker);
            }
        }
Пример #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void write(org.codehaus.jackson.JsonGenerator out, Iterable<String> columns, org.neo4j.graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker) throws java.io.IOException
        public override void Write(JsonGenerator @out, IEnumerable <string> columns, Org.Neo4j.Graphdb.Result_ResultRow row, TransactionStateChecker txStateChecker)
        {
            @out.writeArrayFieldStart("row");
            try
            {
                foreach (string key in columns)
                {
                    @out.writeObject(row.Get(key));
                }
            }
            finally
            {
                @out.writeEndArray();
                WriteMeta(@out, columns, row);
            }
        }