package awesomefb;

import com.mongodb.BasicDBObject;
import org.bson.types.ObjectId;
import org.json.JSONObject;

/**
 * Created by earl on 5/25/2015.
 */
public class User {
    private String mUserId;
    private String mFacebookId;
    private String mName;

    /**
     * Saves user data into users collection,
     * returns DBObject with newly inserted id and some basic info (FB ID, name)
     * @param reference
     */
    public User(JSONObject reference) {
        mFacebookId = reference.getString("id");
        mName = reference.getString("name");
        DatabaseManager databaseManager = DatabaseManager.getInstance();

        BasicDBObject userObject = new BasicDBObject("fb_id", mFacebookId).append("name", mName);
        mUserId = new ObjectId().toString();
        userObject.put("_id", mUserId);

        System.out.println("[awesomeFb] Inserting basic user data " + mFacebookId);
        databaseManager.insertUser(this);
    }

    public String getUserId() {
        return mUserId;
    }

    public String getFacebookId() {
        return mFacebookId;
    }

    public String getName() {
        return mName;
    }

    public BasicDBObject toDBObject() {
        return new BasicDBObject("user_id", mUserId)
                .append("fb_id", mFacebookId).append("name", mName);
    }
}

@@ -254,16 +254,45 @@
 g mName;
+%0A    private boolean mIsPage;
 %0A%0A    /*
@@ -582,24 +582,69 @@
 ng(%22name%22);%0A
+        mIsPage = reference.has(%22category%22);%0A
         Data
@@ -1207,32 +1207,93 @@
 n mName;%0A    %7D%0A%0A
+    public boolean isPage() %7B%0A        return mIsPage;%0A    %7D%0A%0A
     public Basic
@@ -1406,32 +1406,49 @@
 d%22, mFacebookId)
+%0A                
 .append(%22name%22, 
@@ -1449,22 +1449,83 @@
 ame%22, mName)
+%0A                .append(%22is_page%22, mIsPage)%0A                
 ;%0A    %7D%0A%7D%0A

Add isPage method to User class