{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare/pulls/comments/44062959","id":44062959,"diff_hunk":"@@ -0,0 +1,460 @@\n+/**\n+ *\n+ */\n+package org.commcare.api.persistence;\n+\n+import org.javarosa.core.services.PrototypeManager;\n+import org.javarosa.core.services.storage.EntityFilter;\n+import org.javarosa.core.services.storage.IStorageUtilityIndexed;\n+import org.javarosa.core.services.storage.Persistable;\n+import org.javarosa.core.services.storage.StorageFullException;\n+import org.javarosa.core.util.InvalidIndexException;\n+import org.javarosa.core.util.externalizable.DeserializationException;\n+import org.sqlite.javax.SQLiteConnectionPoolDataSource;\n+\n+import java.io.ByteArrayInputStream;\n+import java.io.DataInputStream;\n+import java.io.File;\n+import java.io.IOException;\n+import java.sql.Connection;\n+import java.sql.PreparedStatement;\n+import java.sql.ResultSet;\n+import java.sql.SQLException;\n+import java.util.Iterator;\n+import java.util.NoSuchElementException;\n+import java.util.Vector;\n+\n+/**\n+ * IStorageIndexedUtility implemented on SQLite using JDBC. Contains all the functionality\n+ * for interacting with the user's SQLite representation.\n+ *\n+ * @author wspride\n+ */\n+public class SqliteIndexedStorageUtility<T extends Persistable> implements IStorageUtilityIndexed<T>, Iterable<T> {\n+\n+    public static final String DATABASE_FOLDER = \"dbs\";\n+\n+    private final Class<T> prototype;\n+    private final String tableName;\n+    private final String sandboxId;\n+\n+    public SqliteIndexedStorageUtility(Class<T> prototype, String sandboxId, String tableName) {\n+        this.tableName = tableName;\n+        this.sandboxId = sandboxId;\n+        this.prototype = prototype;\n+\n+        Connection c = null;\n+        try {\n+            c = getConnection();\n+            SqlHelper.createTable(c, tableName, prototype.newInstance());\n+            c.close();\n+        } catch (SQLException e) {\n+            System.out.println(\"Couldn't create table: \" + tableName + \" due to exception: \" + e);\n+            e.printStackTrace();\n+        } catch(InstantiationException | IllegalAccessException | ClassNotFoundException e){\n+            throw new RuntimeException(e);\n+        } finally{\n+            try {\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException e) {\n+                e.printStackTrace();\n+            }\n+        }\n+    }\n+\n+    Connection getConnection() throws SQLException, ClassNotFoundException {\n+\n+        File databaseFolder = new File(SqliteIndexedStorageUtility.DATABASE_FOLDER);\n+        if (!databaseFolder.exists()) {\n+            databaseFolder.mkdir();\n+        }\n+\n+        Class.forName(\"org.sqlite.JDBC\");\n+        SQLiteConnectionPoolDataSource dataSource = new SQLiteConnectionPoolDataSource();\n+        dataSource.setUrl(\"jdbc:sqlite:\" + SqliteIndexedStorageUtility.DATABASE_FOLDER + \"/\" +  this.sandboxId + \".db\");\n+        return dataSource.getConnection();\n+    }\n+\n+    @Override\n+    public void write(Persistable p) throws StorageFullException {\n+        if (p.getID() != -1) {\n+            update(p.getID(), p);\n+            return;\n+        }\n+\n+        Connection c = null;\n+        try {\n+            c = getConnection();\n+            int id = SqlHelper.insertToTable(c, tableName, p);\n+            c.close();\n+\n+            c = getConnection();\n+            p.setID(id);\n+            SqlHelper.updateId(c, tableName, p);\n+            c.close();\n+        } catch (SQLException | ClassNotFoundException e) {\n+            throw new RuntimeException(e);\n+        } finally{\n+            try {\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException e) {\n+                e.printStackTrace();\n+            }\n+        }\n+    }\n+\n+    public T readFromBytes(byte[] mBytes) {\n+\n+        T returnPrototype;\n+        ByteArrayInputStream mByteStream = null;\n+        try {\n+            returnPrototype = prototype.newInstance();\n+            mByteStream = new ByteArrayInputStream(mBytes);\n+            returnPrototype.readExternal(new DataInputStream(mByteStream), PrototypeManager.getDefault());\n+            return returnPrototype;\n+        } catch (InstantiationException | IllegalAccessException | DeserializationException | IOException e) {\n+            throw new RuntimeException(e);\n+        } finally{\n+            if(mByteStream != null){\n+                try {\n+                    mByteStream.close();\n+                } catch (IOException e) {\n+                    e.printStackTrace();\n+                }\n+            }\n+        }\n+    }\n+\n+    @Override\n+    public T read(int id) {\n+        byte[] mBytes = readBytes(id);\n+        return readFromBytes(mBytes);\n+\n+    }\n+\n+    @Override\n+    public Vector getIDsForValue(String fieldName, Object value) {\n+        Connection c = null;\n+        PreparedStatement preparedStatement = null;\n+        try {\n+            c = this.getConnection();\n+            preparedStatement = SqlHelper.prepareTableSelectStatement(c, this.tableName,\n+                    new String[]{fieldName}, new String[]{(String)value}, prototype.newInstance());\n+            if (preparedStatement == null) {\n+                return null;\n+            }\n+            ResultSet rs = preparedStatement.executeQuery();\n+                    Vector<Integer> ids = new Vector<>();\n+            while (rs.next()) {\n+                ids.add(rs.getInt(org.commcare.modern.database.DatabaseHelper.ID_COL));\n+            }\n+            return ids;\n+        } catch (InstantiationException | IllegalAccessException | SQLException | ClassNotFoundException e) {\n+            throw new RuntimeException(e);\n+        } finally {\n+            try {\n+                if (preparedStatement != null) {\n+                    preparedStatement.close();\n+                }\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException e) {\n+                e.printStackTrace();\n+            }\n+        }\n+    }\n+\n+    @Override\n+    public T getRecordForValue(String fieldName, Object value)\n+            throws NoSuchElementException, InvalidIndexException {\n+        Connection c = null;\n+        PreparedStatement preparedStatement = null;\n+        try {\n+            c = this.getConnection();\n+            preparedStatement =\n+                    SqlHelper.prepareTableSelectStatement(c, this.tableName,\n+                            new String[]{fieldName}, new String[]{(String)value},\n+                            prototype.newInstance());\n+            ResultSet rs = preparedStatement.executeQuery();\n+            if (!rs.next()) {\n+                throw new NoSuchElementException();\n+            }\n+            byte[] mBytes = rs.getBytes(org.commcare.modern.database.DatabaseHelper.DATA_COL);\n+            return readFromBytes(mBytes);\n+        } catch (SQLException | InstantiationException |\n+                IllegalAccessException | NullPointerException | ClassNotFoundException e) {\n+            throw new RuntimeException(e);\n+        } finally {\n+            try {\n+                if (preparedStatement != null) {\n+                    preparedStatement.close();\n+                }\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException e) {\n+                e.printStackTrace();\n+            }\n+        }\n+    }\n+\n+    @Override\n+    public int add(T e) throws StorageFullException {\n+        Connection c = null;\n+        try {\n+            c = getConnection();\n+            int id = SqlHelper.insertToTable(c, tableName, e);\n+            c.close();\n+            c = getConnection();\n+            e.setID(id);\n+            SqlHelper.updateId(c, tableName, e);\n+            c.close();\n+            return id;\n+        } catch (SQLException | ClassNotFoundException ex) {\n+            throw new RuntimeException(ex);\n+        } finally{\n+            try {\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException ex) {\n+                ex.printStackTrace();\n+            }\n+        }\n+    }\n+\n+    @Override\n+    public void close() {\n+        // Don't need this because we close all resources after using them\n+    }\n+\n+    @Override\n+    public void destroy() {\n+        // TODO Auto-generated method stub\n+\n+    }\n+\n+    @Override\n+    public boolean exists(int id) {\n+        PreparedStatement preparedStatement = null;\n+        Connection c = null;\n+        try {\n+            c = getConnection();\n+            preparedStatement = SqlHelper.prepareIdSelectStatement(c, this.tableName, id);\n+            ResultSet rs = preparedStatement.executeQuery();\n+            if (rs.next()) {\n+                return true;\n+            }\n+        } catch (Exception e) {\n+            throw new RuntimeException(e);\n+        } finally {\n+            try {\n+                if (preparedStatement != null) {\n+                    preparedStatement.close();\n+                }\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException e) {\n+                e.printStackTrace();\n+            }\n+        }\n+        return false;\n+    }\n+\n+    @Override\n+    public Object getAccessLock() {\n+        // TODO Auto-generated method stub\n+        return null;\n+    }\n+\n+    @Override\n+    public int getNumRecords() {\n+        PreparedStatement preparedStatement = null;\n+        Connection c = null;\n+        try {\n+            c = getConnection();\n+            String sqlQuery = \"SELECT COUNT (*) FROM \" + this.tableName + \";\";\n+            preparedStatement = c.prepareStatement(sqlQuery);\n+            ResultSet rs = preparedStatement.executeQuery();\n+            return rs.getInt(1);\n+        } catch (Exception e) {\n+            System.out.println(\"SqliteIndexedStorageUtility readBytes exception: \" + e);\n+        } finally {\n+            try {\n+                if (preparedStatement != null) {\n+                    preparedStatement.close();\n+                }\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException e) {\n+                e.printStackTrace();\n+            }\n+        }\n+        return -1;\n+    }\n+\n+    @Override\n+    public int getRecordSize(int id) {\n+        return 0;\n+    }\n+\n+    @Override\n+    public JdbcSqlStorageIterator<T> iterate() {\n+        Connection connection;\n+        ResultSet resultSet = null;\n+        PreparedStatement preparedStatement = null;\n+        try {\n+            connection = this.getConnection();\n+            String sqlQuery = \"SELECT \" + org.commcare.modern.database.DatabaseHelper.ID_COL + \" , \" +\n+                    org.commcare.modern.database.DatabaseHelper.DATA_COL + \" FROM \" + this.tableName + \";\";\n+            preparedStatement = connection.prepareStatement(sqlQuery);\n+            resultSet = preparedStatement.executeQuery();\n+        } catch (SQLException | ClassNotFoundException e) {\n+            e.printStackTrace();\n+        }\n+        return new JdbcSqlStorageIterator<T>(preparedStatement, resultSet, this.getNumRecords(), this);\n+    }\n+\n+    @Override\n+    public int getTotalSize() {\n+        //serialize and test blah blah.\n+        return 0;\n+    }\n+\n+    @Override\n+    public boolean isEmpty() {\n+        return this.getNumRecords() <= 0;\n+    }\n+\n+    @Override\n+    public byte[] readBytes(int id) {\n+        PreparedStatement preparedStatement = null;\n+        Connection c = null;\n+        try {\n+            c = getConnection();\n+            preparedStatement = SqlHelper.prepareIdSelectStatement(c, this.tableName, id);\n+            if (preparedStatement == null) {\n+                return null;\n+            }\n+            ResultSet rs = preparedStatement.executeQuery();\n+            return rs.getBytes(org.commcare.modern.database.DatabaseHelper.DATA_COL);\n+        } catch (Exception e) {\n+            System.out.println(\"SqliteIndexedStorageUtility readBytes exception: \" + e);\n+        } finally{\n+            try {\n+                if (preparedStatement != null) {\n+                    preparedStatement.close();\n+                }\n+                if (c != null) {\n+                    c.close();\n+                }\n+            } catch (SQLException e) {\n+                e.printStackTrace();\n+            }\n+        }\n+        return null;\n+    }\n+\n+    @Override\n+    public void update(int id, Persistable p) throws StorageFullException {\n+        Connection c = null;\n+        try {\n+            c = getConnection();\n+            SqlHelper.updateToTable(c, tableName, p, id);\n+            c.close();","path":"api/org/commcare/api/persistence/SqliteIndexedStorageUtility.java","position":371,"original_position":371,"commit_id":"a389244d6d294399f8a81e1fc31ebab5725a6b67","original_commit_id":"a389244d6d294399f8a81e1fc31ebab5725a6b67","user":{"login":"ctsims","id":155066,"avatar_url":"https://avatars.githubusercontent.com/u/155066?v=3","gravatar_id":"","url":"https://api.github.com/users/ctsims","html_url":"https://github.com/ctsims","followers_url":"https://api.github.com/users/ctsims/followers","following_url":"https://api.github.com/users/ctsims/following{/other_user}","gists_url":"https://api.github.com/users/ctsims/gists{/gist_id}","starred_url":"https://api.github.com/users/ctsims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctsims/subscriptions","organizations_url":"https://api.github.com/users/ctsims/orgs","repos_url":"https://api.github.com/users/ctsims/repos","events_url":"https://api.github.com/users/ctsims/events{/privacy}","received_events_url":"https://api.github.com/users/ctsims/received_events","type":"User","site_admin":false},"body":"close should come in the finally.","created_at":"2015-11-05T20:12:19Z","updated_at":"2015-11-05T20:12:19Z","html_url":"https://github.com/dimagi/commcare/pull/101#discussion_r44062959","pull_request_url":"https://api.github.com/repos/dimagi/commcare/pulls/101","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare/pulls/comments/44062959"},"html":{"href":"https://github.com/dimagi/commcare/pull/101#discussion_r44062959"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare/pulls/101"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare/pulls/101","id":39971873,"html_url":"https://github.com/dimagi/commcare/pull/101","diff_url":"https://github.com/dimagi/commcare/pull/101.diff","patch_url":"https://github.com/dimagi/commcare/pull/101.patch","issue_url":"https://api.github.com/repos/dimagi/commcare/issues/101","number":101,"state":"closed","locked":false,"title":"SQLite API","user":{"login":"wpride","id":2293064,"avatar_url":"https://avatars.githubusercontent.com/u/2293064?v=3","gravatar_id":"","url":"https://api.github.com/users/wpride","html_url":"https://github.com/wpride","followers_url":"https://api.github.com/users/wpride/followers","following_url":"https://api.github.com/users/wpride/following{/other_user}","gists_url":"https://api.github.com/users/wpride/gists{/gist_id}","starred_url":"https://api.github.com/users/wpride/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wpride/subscriptions","organizations_url":"https://api.github.com/users/wpride/orgs","repos_url":"https://api.github.com/users/wpride/repos","events_url":"https://api.github.com/users/wpride/events{/privacy}","received_events_url":"https://api.github.com/users/wpride/received_events","type":"User","site_admin":false},"body":"Cross-requested with https://github.com/dimagi/commcare-odk/pull/668 and https://github.com/dimagi/javarosa/pull/126","created_at":"2015-07-14T22:51:17Z","updated_at":"2015-11-05T20:12:19Z","closed_at":"2015-11-05T20:04:32Z","merged_at":"2015-11-05T20:04:32Z","merge_commit_sha":"79dbd30a244772003879039b42b39e5fad156a87","assignee":null,"milestone":{"url":"https://api.github.com/repos/dimagi/commcare/milestones/3","html_url":"https://github.com/dimagi/commcare/milestones/commcare_2.25","labels_url":"https://api.github.com/repos/dimagi/commcare/milestones/3/labels","id":1368196,"number":3,"title":"commcare_2.25","description":null,"creator":{"login":"phillipm","id":94817,"avatar_url":"https://avatars.githubusercontent.com/u/94817?v=3","gravatar_id":"","url":"https://api.github.com/users/phillipm","html_url":"https://github.com/phillipm","followers_url":"https://api.github.com/users/phillipm/followers","following_url":"https://api.github.com/users/phillipm/following{/other_user}","gists_url":"https://api.github.com/users/phillipm/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipm/subscriptions","organizations_url":"https://api.github.com/users/phillipm/orgs","repos_url":"https://api.github.com/users/phillipm/repos","events_url":"https://api.github.com/users/phillipm/events{/privacy}","received_events_url":"https://api.github.com/users/phillipm/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":3,"state":"open","created_at":"2015-10-21T13:18:42Z","updated_at":"2015-11-05T20:04:32Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dimagi/commcare/pulls/101/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare/pulls/101/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimagi/commcare/issues/101/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare/statuses/a389244d6d294399f8a81e1fc31ebab5725a6b67","head":{"label":"dimagi:commcare-api","ref":"commcare-api","sha":"a389244d6d294399f8a81e1fc31ebab5725a6b67","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":20939782,"name":"commcare","full_name":"dimagi/commcare","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare","description":"","fork":false,"url":"https://api.github.com/repos/dimagi/commcare","forks_url":"https://api.github.com/repos/dimagi/commcare/forks","keys_url":"https://api.github.com/repos/dimagi/commcare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare/events","assignees_url":"https://api.github.com/repos/dimagi/commcare/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare/merges","archive_url":"https://api.github.com/repos/dimagi/commcare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare/releases{/id}","created_at":"2014-06-17T21:13:25Z","updated_at":"2015-05-01T15:55:40Z","pushed_at":"2015-11-05T20:10:51Z","git_url":"git://github.com/dimagi/commcare.git","ssh_url":"git@github.com:dimagi/commcare.git","clone_url":"https://github.com/dimagi/commcare.git","svn_url":"https://github.com/dimagi/commcare","homepage":null,"size":8794,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"fb5f4c90c7d634ac1b79fbe21fed0b2c96109dc5","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":20939782,"name":"commcare","full_name":"dimagi/commcare","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare","description":"","fork":false,"url":"https://api.github.com/repos/dimagi/commcare","forks_url":"https://api.github.com/repos/dimagi/commcare/forks","keys_url":"https://api.github.com/repos/dimagi/commcare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare/events","assignees_url":"https://api.github.com/repos/dimagi/commcare/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare/merges","archive_url":"https://api.github.com/repos/dimagi/commcare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare/releases{/id}","created_at":"2014-06-17T21:13:25Z","updated_at":"2015-05-01T15:55:40Z","pushed_at":"2015-11-05T20:10:51Z","git_url":"git://github.com/dimagi/commcare.git","ssh_url":"git@github.com:dimagi/commcare.git","clone_url":"https://github.com/dimagi/commcare.git","svn_url":"https://github.com/dimagi/commcare","homepage":null,"size":8794,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare/pulls/101"},"html":{"href":"https://github.com/dimagi/commcare/pull/101"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare/issues/101"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare/issues/101/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare/pulls/101/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare/pulls/101/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare/statuses/a389244d6d294399f8a81e1fc31ebab5725a6b67"}}}}