Database Reference
In-Depth Information
catch (Exception e) {
log.error(e);
return ERROR;
}
}
Figure 12-7.
The Social Graph home page
Login Service
To check to see if the user values being passed through are connected to a valid user in the database, the application
uses the
login
method in the
UserDAO
class
.
As shown in the Listing 12-21, the result of the
login
method is assigned
to the
tempUser
variable.
If the result is not null, the result is set on the
graphStory User
object and returned to the controller layer of the
application.
Listing 12-21.
The
login
Method in the
UserDAO
Class
private User tempUser;
public GraphStory login(GraphStory graphStory) throws Exception {
tempUser = getByUserName(graphStory.getUser());
if (tempUser != null) {
graphStory.setUser(tempUser);
} else {
addErrorMsg(graphStory, "The username you entered does not exist.");
}
return graphStory;
}