@Mapping( "metadata" ) public MapRepresentation metadata() { if ( isDeleted() ) { return new MapRepresentation( map( "id", node.getId(), "deleted", Boolean.TRUE ) ); } else { Collection<String> labels = Iterables.asCollection( new IterableWrapper<String,Label>( node.getLabels() ) { @Override protected String underlyingObjectToObject( Label label ) { return label.name(); } } ); return new MapRepresentation( map( "id", node.getId(), "labels", labels ) ); } }
@Override void extraData( MappingSerializer serializer ) { if ( !isDeleted() ) { MappingWriter writer = serializer.writer; MappingWriter properties = writer.newMapping( RepresentationType.PROPERTIES, "data" ); new PropertiesRepresentation( node ).serialize( properties ); if ( writer.isInteractive() ) { serializer.putList( "relationship_types", ListRepresentation.relationshipTypes( node.getGraphDatabase().getAllRelationshipTypes() ) ); } properties.done(); } }
@Mapping( "metadata" ) public MapRepresentation metadata() { if ( isDeleted() ) { return new MapRepresentation( map( "id", node.getId(), "deleted", Boolean.TRUE ) ); } else { Collection<String> labels = Iterables.asCollection( new IterableWrapper<String,Label>( node.getLabels() ) { @Override protected String underlyingObjectToObject( Label label ) { return label.name(); } } ); return new MapRepresentation( map( "id", node.getId(), "labels", labels ) ); } }
@Override void extraData( MappingSerializer serializer ) { if ( !isDeleted() ) { MappingWriter writer = serializer.writer; MappingWriter properties = writer.newMapping( RepresentationType.PROPERTIES, "data" ); new PropertiesRepresentation( node ).serialize( properties ); if ( writer.isInteractive() ) { serializer.putList( "relationship_types", ListRepresentation.relationshipTypes( node.getGraphDatabase().getAllRelationshipTypes() ) ); } properties.done(); } }