1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.neo4j.server.rest.repr;
21
22 import org.neo4j.graphdb.GraphDatabaseService;
23 import org.neo4j.graphdb.NotFoundException;
24
25 public class DatabaseRepresentation extends MappingRepresentation implements
26 ExtensibleRepresentation
27 {
28 private final GraphDatabaseService graphDb;
29
30 public DatabaseRepresentation( GraphDatabaseService graphDb )
31 {
32 super( RepresentationType.GRAPHDB );
33 this.graphDb = graphDb;
34 }
35
36 @Override
37 public String getIdentity()
38 {
39
40 return null;
41 }
42
43 @Override
44 protected void serialize( MappingSerializer serializer )
45 {
46 serializer.putUri( "node", "node" );
47 try {
48 serializer.putUri( "reference_node",
49 NodeRepresentation.path( graphDb.getReferenceNode() ) );
50 } catch(NotFoundException e) {
51
52 }
53 serializer.putUri( "node_index", "index/node" );
54 serializer.putUri( "relationship_index", "index/relationship" );
55 serializer.putUri( "extensions_info", "ext" );
56 serializer.putUri( "relationship_types", "relationship/types" );
57 }
58 }