// get a copy of the session so we can touch projects.
Session current = this.getSession(sessionId);
if(current == null)
{
logger.log(Level.WARNING, "Project Session switch attempted with invalid SSID");
throw new SessionException("Session matching the givenId does not exist");
}
User u = current.getUser();
// find the project
ManagerLayer manager = ManagerLayer.getInstance();
ProjectManager projects = manager.getProjects();
Project p = null;
try
{
p = projects.getEntityByName(current, projectName)[0];
if(p == null)
{
throw new NotFoundException("Could not find project with given name to switch to.");
}
}
catch(NotFoundException e)
{
logger.log(Level.WARNING, "Project Session switch attempted with nonexistent project");
throw new SessionException("Session-project switch failed because requested project does not exist.");
}
this.removeSession(sessionId);
logger.log(Level.INFO, "User Project Session Switch successful!");