Example #1
0
 internal static Representation GetSingleRepresentation(object result)
 {
     if (result == null)
     {
         return(ValueRepresentation.OfNull());
     }
     else if (result is GraphDatabaseService)
     {
         return(new DatabaseRepresentation());
     }
     else if (result is Node)
     {
         return(new NodeRepresentation(( Node )result));
     }
     else if (result is Relationship)
     {
         return(new RelationshipRepresentation(( Relationship )result));
     }
     else if (result is double? || result is float?)
     {
         return(ValueRepresentation.number((( Number )result).doubleValue()));
     }
     else if (result is long?)
     {
         return(ValueRepresentation.number((( long? )result).Value));
     }
     else if (result is int?)
     {
         return(ValueRepresentation.number((( int? )result).Value));
     }
     else if (result is bool?)
     {
         return(ValueRepresentation.Bool((( bool? )result).Value));
     }
     else
     {
         return(ValueRepresentation.String(result.ToString()));
     }
 }
Example #2
0
 public ValueRepresentation ExtendedEntity()
 {
     return(ValueRepresentation.String(ExtendedEntity));
 }
Example #3
0
 public ValueRepresentation StartNodeUri()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_rel.StartNode)));
 }
Example #4
0
 public ValueRepresentation PropertyUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/properties/{key}")));
 }
Example #5
0
 protected internal override Representation underlyingObjectToObject(Node node)
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(node)));
 }
Example #6
0
 public virtual ValueRepresentation EndNode()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_path.endNode())));
 }
Example #7
0
 protected internal override Representation underlyingObjectToObject(string directionString)
 {
     return(ValueRepresentation.String(directionString));
 }
Example #8
0
 public ValueRepresentation AllRelationshipsUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships/all")));
 }
Example #9
0
 public static string Serialize(ValueRepresentation repr)
 {
     return(Serialize(_baseUri, repr));
 }
Example #10
0
 public virtual ValueRepresentation PasswordChange()
 {
     return(ValueRepresentation.Uri(format("/user/%s/password", _user.name())));
 }
Example #11
0
 public virtual ValueRepresentation PasswordChangeRequired()
 {
     return(ValueRepresentation.Bool(_user.passwordChangeRequired()));
 }
Example #12
0
 public virtual ValueRepresentation User()
 {
     return(ValueRepresentation.String(_user.name()));
 }
Example #13
0
 private IndexedEntityRepresentation(MappingRepresentation entity, long entityId, string key, string value, IndexRepresentation indexRepresentation) : base(entity.Type)
 {
     this._entity = entity;
     _selfUri     = ValueRepresentation.Uri(indexRepresentation.RelativeUriFor(key, value, entityId));
 }
Example #14
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));
            }
        }
Example #15
0
 public ValueRepresentation PagedTraverseUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/paged/traverse/{returnType}{?pageSize,leaseTime}")));
 }
Example #16
0
 public static string Serialize(URI baseUri, ValueRepresentation repr)
 {
     return(repr.Serialize(new StringFormat(), baseUri, null));
 }
Example #17
0
 public ValueRepresentation RelationshipCreationUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships")));
 }
Example #18
0
 public static Representation Value(object property)
 {
     return(ValueRepresentation.Property(property));
 }
Example #19
0
 public ValueRepresentation IncomingRelationshipsUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships/in")));
 }
Example #20
0
 public ValueRepresentation OutgoingRelationshipsUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships/out")));
 }
Example #21
0
 public virtual ValueRepresentation StartNode()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_path.startNode())));
 }
Example #22
0
 public ValueRepresentation AllTypedRelationshipsUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/relationships/all/{-list|&|types}")));
 }
Example #23
0
 public virtual ValueRepresentation Length()
 {
     return(ValueRepresentation.Number(_path.length()));
 }
Example #24
0
 public ValueRepresentation OutgoingTypedRelationshipsUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/relationships/out/{-list|&|types}")));
 }
Example #25
0
 public ValueRepresentation PropertiesUri()
 {
     return(ValueRepresentation.Uri(Path("/properties")));
 }
Example #26
0
 public ValueRepresentation LabelsUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/labels")));
 }
Example #27
0
 public override ValueRepresentation SelfUri()
 {
     return(ValueRepresentation.Uri(Path("")));
 }
Example #28
0
 public ValueRepresentation TraverseUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/traverse/{returnType}")));
 }
Example #29
0
 public ValueRepresentation EndNodeUri()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_rel.EndNode)));
 }
Example #30
0
 public ValueRepresentation Description()
 {
     return(ValueRepresentation.String(_description));
 }