Database Reference
In-Depth Information
Adding a Status Update
The page shown in Figure
12-10
shows the form to add a status update for the current user, which is displayed when
clicking on the “Add Content” link just under the “Graph Story—Social Feed” header. The HTML for the form can be
found in
{PROJECTROOT}/WebContent/mustache/html/graphs/social/posts.html
. The form uses the
addContent
function in
graphstory.js
to
POST
a new status update as well as return the response and add it to the top of the
status update stream.
Figure 12-10.
Adding a status update
The
addContent
method in
SocialAction
and the corresponding
addContent
method in
ContentDAO
are
shown in Listing 12-31. When a new status update is created, in addition to its graph id, the
addContent
method also
generates a contentId, which performed using the SecureRandom.uuid method.
The
addContent
method makes the status the
CURRENTPOST
and also determines whether a previous
CURRENTPOST
exists, and, if one does, changes its relationship type to
NEXTPOST
. In addition, the tags connected to the status update
will be merged into the graph and connected to the status update via the
HAS
relationship type.