예제 #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()));
     }
 }
예제 #2
0
 public ValueRepresentation ExtendedEntity()
 {
     return(ValueRepresentation.String(ExtendedEntity));
 }
예제 #3
0
 public ValueRepresentation StartNodeUri()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_rel.StartNode)));
 }
예제 #4
0
 public ValueRepresentation PropertyUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/properties/{key}")));
 }
예제 #5
0
 protected internal override Representation underlyingObjectToObject(Node node)
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(node)));
 }
예제 #6
0
 public virtual ValueRepresentation EndNode()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_path.endNode())));
 }
예제 #7
0
 protected internal override Representation underlyingObjectToObject(string directionString)
 {
     return(ValueRepresentation.String(directionString));
 }
예제 #8
0
 public ValueRepresentation AllRelationshipsUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships/all")));
 }
예제 #9
0
 public static string Serialize(ValueRepresentation repr)
 {
     return(Serialize(_baseUri, repr));
 }
예제 #10
0
 public virtual ValueRepresentation PasswordChange()
 {
     return(ValueRepresentation.Uri(format("/user/%s/password", _user.name())));
 }
예제 #11
0
 public virtual ValueRepresentation PasswordChangeRequired()
 {
     return(ValueRepresentation.Bool(_user.passwordChangeRequired()));
 }
예제 #12
0
 public virtual ValueRepresentation User()
 {
     return(ValueRepresentation.String(_user.name()));
 }
예제 #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));
 }
예제 #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));
            }
        }
예제 #15
0
 public ValueRepresentation PagedTraverseUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/paged/traverse/{returnType}{?pageSize,leaseTime}")));
 }
예제 #16
0
 public static string Serialize(URI baseUri, ValueRepresentation repr)
 {
     return(repr.Serialize(new StringFormat(), baseUri, null));
 }
예제 #17
0
 public ValueRepresentation RelationshipCreationUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships")));
 }
예제 #18
0
 public static Representation Value(object property)
 {
     return(ValueRepresentation.Property(property));
 }
예제 #19
0
 public ValueRepresentation IncomingRelationshipsUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships/in")));
 }
예제 #20
0
 public ValueRepresentation OutgoingRelationshipsUri()
 {
     return(ValueRepresentation.Uri(Path("/relationships/out")));
 }
예제 #21
0
 public virtual ValueRepresentation StartNode()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_path.startNode())));
 }
예제 #22
0
 public ValueRepresentation AllTypedRelationshipsUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/relationships/all/{-list|&|types}")));
 }
예제 #23
0
 public virtual ValueRepresentation Length()
 {
     return(ValueRepresentation.Number(_path.length()));
 }
예제 #24
0
 public ValueRepresentation OutgoingTypedRelationshipsUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/relationships/out/{-list|&|types}")));
 }
예제 #25
0
 public ValueRepresentation PropertiesUri()
 {
     return(ValueRepresentation.Uri(Path("/properties")));
 }
예제 #26
0
 public ValueRepresentation LabelsUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/labels")));
 }
예제 #27
0
 public override ValueRepresentation SelfUri()
 {
     return(ValueRepresentation.Uri(Path("")));
 }
예제 #28
0
 public ValueRepresentation TraverseUriTemplate()
 {
     return(ValueRepresentation.Template(Path("/traverse/{returnType}")));
 }
예제 #29
0
 public ValueRepresentation EndNodeUri()
 {
     return(ValueRepresentation.Uri(NodeRepresentation.Path(_rel.EndNode)));
 }
예제 #30
0
 public ValueRepresentation Description()
 {
     return(ValueRepresentation.String(_description));
 }