//For some reason age is a string right now, caused by angular.
//This is a problem and should not be this way but here ya go
public boolean addNewTodo(Request req, Response res)
    {
        res.type("application/json");
        Object o = JSON.parse(req.body());
        try {
            if(o.getClass().equals(BasicDBObject.class))
            {
                try {
                    BasicDBObject dbO = (BasicDBObject) o;
                    String owner = dbO.getString("owner");
                    //For some reason age is a string right now, caused by angular.
                    //This is a problem and should not be this way but here ya go
                    boolean status = dbO.getBoolean("status");
                    String body = dbO.getString("body");
                    String category = dbO.getString("category");
                    System.err.println("Adding new todo [owner=" + owner + ", category=" + category + " body=" + body + " status=" + status + ']');
                    return todoController.addNewTodo(owner, category, body, status);
                }
                catch(NullPointerException e)
                {
                    System.err.println("A value was malformed or omitted, new todo request failed.");
                    return false;
                }
            }
            else
            {
                System.err.println("Expected BasicDBObject, received " + o.getClass());
                return false;
            }
        }
        catch(RuntimeException ree)
        {
            ree.printStackTrace();
            return false;
        }
    }
BasicDBObject dbO = (BasicDBObject) o;
String owner = dbO.getString("owner");
//For some reason age is a string right now, caused by angular.
//This is a problem and should not be this way but here ya go
boolean status = dbO.getBoolean("status");
String body = dbO.getString("body");
public boolean addNewTodo(Request req, Response res)
{
res.type("application/json");
Object o = JSON.parse(req.body());
try {
if(o.getClass().equals(BasicDBObject.class))
{
try {
BasicDBObject dbO = (BasicDBObject) o;
String owner = dbO.getString("owner");
//For some reason age is a string right now, caused by angular.
//This is a problem and should not be this way but here ya go
boolean status = dbO.getBoolean("status");
String body = dbO.getString("body");
String category = dbO.getString("category");
System.err.println("Adding new todo [owner=" + owner + ", category=" + category + " body=" + body + " status=" + status + ']');
return todoController.addNewTodo(owner, category, body, status);
}
catch(NullPointerException e)
{
System.err.println("A value was malformed or omitted, new todo request failed.");
return false;
public boolean addNewTodo(Request req, Response res)
{
res.type("application/json");
Object o = JSON.parse(req.body());
try {
if(o.getClass().equals(BasicDBObject.class))
{
try {
BasicDBObject dbO = (BasicDBObject) o;
String owner = dbO.getString("owner");
//For some reason age is a string right now, caused by angular.
//This is a problem and should not be this way but here ya go
boolean status = dbO.getBoolean("status");
String body = dbO.getString("body");
String category = dbO.getString("category");
System.err.println("Adding new todo [owner=" + owner + ", category=" + category + " body=" + body + " status=" + status + ']');
return todoController.addNewTodo(owner, category, body, status);
}
catch(NullPointerException e)
{
System.err.println("A value was malformed or omitted, new todo request failed.");
return false;
}
}
else
{
System.err.println("Expected BasicDBObject, received " + o.getClass());
return false;
}
}
catch(RuntimeException ree)
{