Beispiel #1
0
        protected internal override void Serialize(MappingSerializer serializer)
        {
            if (_indexDefinition.NodeIndex)
            {
                serializer.PutList("labels", new ListRepresentation(RepresentationType.String, map(label => ValueRepresentation.String(label.name()), _indexDefinition.Labels)));
                if (!_indexDefinition.MultiTokenIndex)
                {
                    serializer.PutString("label", single(_indexDefinition.Labels).name());
                }
            }
            else
            {
                serializer.PutList("relationshipTypes", new ListRepresentation(RepresentationType.String, map(relType => ValueRepresentation.String(relType.name()), _indexDefinition.RelationshipTypes)));
                if (!_indexDefinition.MultiTokenIndex)
                {
                    serializer.PutString("relationshipType", single(_indexDefinition.RelationshipTypes).name());
                }
            }

            System.Func <string, Representation> converter = ValueRepresentation.@string;
            IEnumerable <Representation>         propertyKeyRepresentations = map(converter, _indexDefinition.PropertyKeys);

            serializer.PutList("property_keys", new ListRepresentation(RepresentationType.String, propertyKeyRepresentations));
            // Only print state and progress if progress is a valid value and not yet online
            if (_indexState == Org.Neo4j.Graphdb.schema.Schema_IndexState.Populating)
            {
                serializer.PutString("state", _indexState.name());
                serializer.PutString("population_progress", string.Format("{0,1:F0}%", _indexPopulationProgress.CompletedPercentage));
            }
        }
Beispiel #2
0
        protected internal override void Serialize(MappingSerializer serializer)
        {
            foreach (object key in _value.Keys)
            {
                object val       = _value[key];
                string keyString = key == null ? "null" : key.ToString();
                if (val is Number)
                {
                    serializer.PutNumber(keyString, ( Number )val);
                }
                else if (val is bool?)
                {
                    serializer.PutBoolean(keyString, ( bool? )val.Value);
                }
                else if (val is string)
                {
                    serializer.PutString(keyString, ( string )val);
                }
                else if (val is Path)
                {
                    PathRepresentation <Path> representation = new PathRepresentation <Path>(( Path )val);
                    serializer.PutMapping(keyString, representation);
                }
                else if (val is System.Collections.IEnumerable)
                {
                    serializer.PutList(keyString, ObjectToRepresentationConverter.GetListRepresentation((System.Collections.IEnumerable)val));
                }
                else if (val is System.Collections.IDictionary)
                {
                    serializer.PutMapping(keyString, ObjectToRepresentationConverter.GetMapRepresentation((System.Collections.IDictionary)val));
                }
                else if (val == null)
                {
                    serializer.PutString(keyString, null);
                }
                else if (val.GetType().IsArray)
                {
                    object[] objects = ToArray(val);

                    serializer.PutList(keyString, ObjectToRepresentationConverter.GetListRepresentation(asList(objects)));
                }
                else if (val is Node || val is Relationship)
                {
                    Representation representation = ObjectToRepresentationConverter.GetSingleRepresentation(val);
                    serializer.PutMapping(keyString, ( MappingRepresentation )representation);
                }
                else
                {
                    throw new System.ArgumentException("Unsupported value type: " + val.GetType());
                }
            }
        }
Beispiel #3
0
        protected internal override void Serialize(MappingSerializer serializer)
        {
            serializer.PutList("columns", _columns);
            serializer.PutList("data", _resultRepresentation);

            if (_statsRepresentation != null)
            {
                serializer.PutMapping("stats", _statsRepresentation);
            }
            if (_plan != null)
            {
                serializer.PutMapping("plan", _plan);
            }
        }
Beispiel #4
0
        protected internal virtual void Serialize(ConstraintDefinition constraintDefinition, MappingSerializer serializer)
        {
            System.Func <string, Representation> converter = ValueRepresentation.@string;
            IEnumerable <Representation>         propertyKeyRepresentations = map(converter, constraintDefinition.PropertyKeys);

            serializer.PutList("property_keys", new ListRepresentation(RepresentationType.String, propertyKeyRepresentations));
        }
Beispiel #5
0
 internal override void ExtraData(MappingSerializer serializer)
 {
     if (!Deleted)
     {
         MappingWriter writer     = serializer.Writer;
         MappingWriter properties = writer.NewMapping(RepresentationType.Properties, "data");
         (new PropertiesRepresentation(_node)).serialize(properties);
         if (writer.Interactive)
         {
             serializer.PutList("relationship_types", ListRepresentation.RelationshipTypes(_node.GraphDatabase.AllRelationshipTypes));
         }
         properties.Done();
     }
 }
Beispiel #6
0
        protected internal override void Serialize(MappingSerializer mappingSerializer)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.ExecutionPlanDescription planDescription = getPlan();
            ExecutionPlanDescription planDescription = Plan;

            mappingSerializer.PutString("name", planDescription.Name);
            IDictionary <string, object> arguments          = planDescription.Arguments;
            MappingRepresentation        argsRepresentation = getMapRepresentation(arguments);

            mappingSerializer.PutMapping("args", argsRepresentation);

            if (planDescription.HasProfilerStatistics())
            {
                Org.Neo4j.Graphdb.ExecutionPlanDescription_ProfilerStatistics stats = planDescription.ProfilerStatistics;
                mappingSerializer.PutNumber("rows", stats.Rows);
                mappingSerializer.PutNumber("dbHits", stats.DbHits);
            }

            mappingSerializer.PutList("children", new ListRepresentation("children", new IterableWrapperAnonymousInnerClass(this, planDescription.Children)));
        }