Database Reference
In-Depth Information
Finally, the graphDatabaseService bean provides the location and authentication information for the graph
database, and the neo4j:config and neo4j:repositories settings set the entity package location and the package
location of repository interfaces, respectively.
Controller and Service Layers
All of the controllers in the sample application extend a parent controller called GraphStoryController . The
GraphStoryController provides access to the GraphStory bean, the GraphStoryInterface service, and a method
called currentuser , which allows for quick access to the currently logged-in user.
The GraphStory bean encapsulates the domain objects for the sample application and is primarily used for
convenience. This object will allow domain objects to be sent to the service layer and returned—in some cases—with
additional objects and properties.
The GraphStoryInterface service provides access to each of the individual service interfaces that support
persistence and other service-level operations on each of the domain objects. For example, if an exception is raised
in the service layer, such as a when attempting to create a User that matches an existing User's username, then the
GraphStory object can be returned with message information, such as an error message, which can then be used to
determine the next part of the application flow as well as return messages to the view.
Spring MVC and the front-end code, such as Mustache, help run the sample application, but extended
coverage of those concepts will be limited to the Social Graph section. In the Social Graph section, I will focus on the
non-obvious but important aspects of those concepts. As you go through the rest of the application, controllers as well
as the front-end code will use similar syntax—so they will be referenced but not listed in the chapter, because repetitive
coverage of that syntax would distract from the discrete, specific Spring Data neo4j examples.
Head's-Up
Social Graph Model
This section explores the social graph model and a few of the operations that typically accompany it. In particular, this
section looks at the following:
The User Entity
Sign-up and Login
Updating a user
Creating a relationship type through a user by following other users
Managing user content, such as displaying, adding, updating, and removing status updates
The sample graph database used for these examples is loaded with data so that you can immediately begin
working with representative data in each of the graph models. In the case of the social graph—and for other graph
models, as well—you will login with the user ajordan . Going forward, please login with ajordan to see each of the
working examples.
Note
 
 
Search WWH ::




Custom Search