GitHub PullRequestReviewCommentEvent at 2014-09-30 15:29:28
Repository: Cumulus
Actor: kbromer
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/comments/18224585","id":18224585,"diff_hunk":"@@ -0,0 +1,264 @@\n+public with sharing class BDI_DataImport_CTRL {\n+\t\n+\tpublic BDI_DataImport_CTRL() {\n+\t\tbatchRunning = false;\n+\t\tbdi = null;\n+\t\tApexJobId = null;\n+\t\tdtStart = null;\n+\t}\n+\n+    public PageReference actionImportOrDelete() {        \n+        String strAction = ApexPages.currentPage().getParameters().get('action');\n+        if (strAction == 'deleteImported') {\n+            return deleteImportedDIRecords();    \n+        } else if (strAction == 'deleteAll') {\n+            return deleteAllDIRecords();\t\n+        }\n+        // else we load up the DataImport page.       \n+        return null;\n+    }\n+    \n+    public PageReference deleteImportedDIRecords() {\n+        for (list<DataImport__c> listDI : [select Id from DataImport__c where Status__c = 'Imported'])\n+            delete listDI;\n+        return (close());    \t\n+    }\n+    \n+    public PageReference deleteAllDIRecords() {\n+    \tfor (list<DataImport__c> listDI : [select Id from DataImport__c])\n+            delete listDI; \n+        return (close());\n+    }\n+    \n+    public BDI_DataImport_BATCH bdi { get; set; }\n+    public Boolean batchRunning { get; set; }\n+    private ID ApexJobId;\n+    private DateTime dtStart;\n+    \n+    public Data_Import_Settings__c diSettings {\n+        get {\n+        \tif (diSettings == null) {\n+                diSettings = UTIL_CustomSettingsFacade.getDataImportSettings();\n+        \t}\n+        \treturn diSettings;\n+        }\n+        private set;\n+    }\n+\n+    // action method that user wants to close this page\n+    public PageReference close() {\n+        string strURL = ApexPages.currentPage().getParameters().get('retURL');\n+        if (strURL == null || strURL == '') strURL = '/home/home.jsp';\n+        PageReference p = new PageReference(strURL);\n+        p.setRedirect(true);\n+        return p;\n+    }\n+\n+    private class BDICtrlException extends Exception {}\n+    \n+    public PageReference importData() {\n+        try {\n+        \t// validate settings\n+        \tif (diSettings.Contact_Custom_Unique_ID__c != null) {\n+                // make sure c1 and c2 have the appropriately named field\n+        \t    if (!UTIL_Describe.isValidField(UTIL_Namespace.StrTokenNSPrefix('DataImport__c'), 'Contact1_' + diSettings.Contact_Custom_Unique_ID__c) ||\n+        \t       !UTIL_Describe.isValidField(UTIL_Namespace.StrTokenNSPrefix('DataImport__c'), 'Contact2_' + diSettings.Contact_Custom_Unique_ID__c)) {\n+                    throw(new BDICtrlException(string.format(Label.bdiContactCustomIdError, \n+                        new string[]{diSettings.Contact_Custom_Unique_ID__c, \n+                        \t'Contact1_' + diSettings.Contact_Custom_Unique_ID__c,\n+                        \t'Contact2_' + diSettings.Contact_Custom_Unique_ID__c})));\n+        \t    }\n+        \t}\n+        \t\n+            if (diSettings.Account_Custom_Unique_ID__c != null) {\n+                // make sure a1 and a2 have the appropriately named field\n+                if (!UTIL_Describe.isValidField(UTIL_Namespace.StrTokenNSPrefix('DataImport__c'), 'Account1_' + diSettings.Contact_Custom_Unique_ID__c) ||\n+                   !UTIL_Describe.isValidField(UTIL_Namespace.StrTokenNSPrefix('DataImport__c'), 'Account2_' + diSettings.Contact_Custom_Unique_ID__c)) {\n+                    throw(new BDICtrlException(string.format(Label.bdiAccountCustomIdError, \n+                        new string[]{diSettings.Account_Custom_Unique_ID__c, \n+                            'Account1_' + diSettings.Account_Custom_Unique_ID__c,\n+                            'Account2_' + diSettings.Account_Custom_Unique_ID__c})));\n+                }\n+            }\n+            \n+        \t// save any settings changes.\n+        \tupsert diSettings;\n+        \t\n+            batchRunning = true;\n+            bdi = new BDI_DataImport_BATCH();\n+            ApexJobId = Database.executeBatch(bdi, integer.valueOf(diSettings.Batch_Size__c));\n+            dtStart = system.now();\n+\n+        } catch (Exception ex) {\n+            // no reason to log the error if we haven't started the batch,\n+            // since it is just a validation error that we are displaying on the page.\n+            if (batchRunning)\n+                ERR_Handler.processError(ex, ERR_Handler.Context.BDI);\n+            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage()));\n+        }\n+        return null;\n+    }\n+\n+    public AsyncApexJob aaj {","path":"src/classes/BDI_DataImport_CTRL.cls","position":102,"original_position":102,"commit_id":"82fda3f8eacdab16dcea35f1c487f529bc79463f","original_commit_id":"82fda3f8eacdab16dcea35f1c487f529bc79463f","user":{"login":"kbromer","id":926530,"avatar_url":"https://avatars.githubusercontent.com/u/926530?v=2","gravatar_id":"","url":"https://api.github.com/users/kbromer","html_url":"https://github.com/kbromer","followers_url":"https://api.github.com/users/kbromer/followers","following_url":"https://api.github.com/users/kbromer/following{/other_user}","gists_url":"https://api.github.com/users/kbromer/gists{/gist_id}","starred_url":"https://api.github.com/users/kbromer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbromer/subscriptions","organizations_url":"https://api.github.com/users/kbromer/orgs","repos_url":"https://api.github.com/users/kbromer/repos","events_url":"https://api.github.com/users/kbromer/events{/privacy}","received_events_url":"https://api.github.com/users/kbromer/received_events","type":"User","site_admin":false},"body":"Got it, makes sense","created_at":"2014-09-30T15:29:28Z","updated_at":"2014-09-30T15:29:28Z","html_url":"https://github.com/SalesforceFoundation/Cumulus/pull/1067#discussion_r18224585","pull_request_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067","_links":{"self":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/comments/18224585"},"html":{"href":"https://github.com/SalesforceFoundation/Cumulus/pull/1067#discussion_r18224585"},"pull_request":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067"}}},"pull_request":{"url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067","id":21819734,"html_url":"https://github.com/SalesforceFoundation/Cumulus/pull/1067","diff_url":"https://github.com/SalesforceFoundation/Cumulus/pull/1067.diff","patch_url":"https://github.com/SalesforceFoundation/Cumulus/pull/1067.patch","issue_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/1067","number":1067,"state":"open","locked":false,"title":"Feature/983 data importer","user":{"login":"davidhabib","id":908119,"avatar_url":"https://avatars.githubusercontent.com/u/908119?v=2","gravatar_id":"","url":"https://api.github.com/users/davidhabib","html_url":"https://github.com/davidhabib","followers_url":"https://api.github.com/users/davidhabib/followers","following_url":"https://api.github.com/users/davidhabib/following{/other_user}","gists_url":"https://api.github.com/users/davidhabib/gists{/gist_id}","starred_url":"https://api.github.com/users/davidhabib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidhabib/subscriptions","organizations_url":"https://api.github.com/users/davidhabib/orgs","repos_url":"https://api.github.com/users/davidhabib/repos","events_url":"https://api.github.com/users/davidhabib/events{/privacy}","received_events_url":"https://api.github.com/users/davidhabib/received_events","type":"User","site_admin":false},"body":"# Warning\r\n\r\n# Info\r\n\r\nThe release includes the new NPSP Data Importer, which helps you easily import your data into the Nonprofit Starter Pack\r\n\r\n# Issues\r\n\r\nFixes #983 \r\nFixes #1020 \r\nFixes #1015 \r\nFixes #1014 \r\n\r\n","created_at":"2014-09-25T23:23:51Z","updated_at":"2014-09-30T15:29:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4053db01990d20b52465d06efc689b503b64f6d9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067/commits","review_comments_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067/comments","review_comment_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/comments/{number}","comments_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/1067/comments","statuses_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/statuses/82fda3f8eacdab16dcea35f1c487f529bc79463f","head":{"label":"SalesforceFoundation:feature/983-data-importer","ref":"feature/983-data-importer","sha":"82fda3f8eacdab16dcea35f1c487f529bc79463f","user":{"login":"SalesforceFoundation","id":972305,"avatar_url":"https://avatars.githubusercontent.com/u/972305?v=2","gravatar_id":"","url":"https://api.github.com/users/SalesforceFoundation","html_url":"https://github.com/SalesforceFoundation","followers_url":"https://api.github.com/users/SalesforceFoundation/followers","following_url":"https://api.github.com/users/SalesforceFoundation/following{/other_user}","gists_url":"https://api.github.com/users/SalesforceFoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/SalesforceFoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SalesforceFoundation/subscriptions","organizations_url":"https://api.github.com/users/SalesforceFoundation/orgs","repos_url":"https://api.github.com/users/SalesforceFoundation/repos","events_url":"https://api.github.com/users/SalesforceFoundation/events{/privacy}","received_events_url":"https://api.github.com/users/SalesforceFoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":13108586,"name":"Cumulus","full_name":"SalesforceFoundation/Cumulus","owner":{"login":"SalesforceFoundation","id":972305,"avatar_url":"https://avatars.githubusercontent.com/u/972305?v=2","gravatar_id":"","url":"https://api.github.com/users/SalesforceFoundation","html_url":"https://github.com/SalesforceFoundation","followers_url":"https://api.github.com/users/SalesforceFoundation/followers","following_url":"https://api.github.com/users/SalesforceFoundation/following{/other_user}","gists_url":"https://api.github.com/users/SalesforceFoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/SalesforceFoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SalesforceFoundation/subscriptions","organizations_url":"https://api.github.com/users/SalesforceFoundation/orgs","repos_url":"https://api.github.com/users/SalesforceFoundation/repos","events_url":"https://api.github.com/users/SalesforceFoundation/events{/privacy}","received_events_url":"https://api.github.com/users/SalesforceFoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SalesforceFoundation/Cumulus","description":"The next version of the Salesforce.com Nonprofit Starter Pack","fork":false,"url":"https://api.github.com/repos/SalesforceFoundation/Cumulus","forks_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/forks","keys_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/teams","hooks_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/hooks","issue_events_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/events{/number}","events_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/events","assignees_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/assignees{/user}","branches_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/branches{/branch}","tags_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/tags","blobs_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/refs{/sha}","trees_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/statuses/{sha}","languages_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/languages","stargazers_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/stargazers","contributors_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/contributors","subscribers_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/subscribers","subscription_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/subscription","commits_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/commits{/sha}","git_commits_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/commits{/sha}","comments_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/comments{/number}","issue_comment_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/comments/{number}","contents_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/contents/{+path}","compare_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/merges","archive_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/downloads","issues_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues{/number}","pulls_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls{/number}","milestones_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/milestones{/number}","notifications_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/labels{/name}","releases_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/releases{/id}","created_at":"2013-09-25T23:56:49Z","updated_at":"2014-09-17T18:50:16Z","pushed_at":"2014-09-30T04:22:47Z","git_url":"git://github.com/SalesforceFoundation/Cumulus.git","ssh_url":"git@github.com:SalesforceFoundation/Cumulus.git","clone_url":"https://github.com/SalesforceFoundation/Cumulus.git","svn_url":"https://github.com/SalesforceFoundation/Cumulus","homepage":"http://salesforcefoundation.org/NonprofitStarterPack","size":29155,"stargazers_count":28,"watchers_count":28,"language":"Apex","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":200,"forks":18,"open_issues":200,"watchers":28,"default_branch":"dev"}},"base":{"label":"SalesforceFoundation:dev","ref":"dev","sha":"94e5d22a5b5e6a004100e88987e189290aa58b8d","user":{"login":"SalesforceFoundation","id":972305,"avatar_url":"https://avatars.githubusercontent.com/u/972305?v=2","gravatar_id":"","url":"https://api.github.com/users/SalesforceFoundation","html_url":"https://github.com/SalesforceFoundation","followers_url":"https://api.github.com/users/SalesforceFoundation/followers","following_url":"https://api.github.com/users/SalesforceFoundation/following{/other_user}","gists_url":"https://api.github.com/users/SalesforceFoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/SalesforceFoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SalesforceFoundation/subscriptions","organizations_url":"https://api.github.com/users/SalesforceFoundation/orgs","repos_url":"https://api.github.com/users/SalesforceFoundation/repos","events_url":"https://api.github.com/users/SalesforceFoundation/events{/privacy}","received_events_url":"https://api.github.com/users/SalesforceFoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":13108586,"name":"Cumulus","full_name":"SalesforceFoundation/Cumulus","owner":{"login":"SalesforceFoundation","id":972305,"avatar_url":"https://avatars.githubusercontent.com/u/972305?v=2","gravatar_id":"","url":"https://api.github.com/users/SalesforceFoundation","html_url":"https://github.com/SalesforceFoundation","followers_url":"https://api.github.com/users/SalesforceFoundation/followers","following_url":"https://api.github.com/users/SalesforceFoundation/following{/other_user}","gists_url":"https://api.github.com/users/SalesforceFoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/SalesforceFoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SalesforceFoundation/subscriptions","organizations_url":"https://api.github.com/users/SalesforceFoundation/orgs","repos_url":"https://api.github.com/users/SalesforceFoundation/repos","events_url":"https://api.github.com/users/SalesforceFoundation/events{/privacy}","received_events_url":"https://api.github.com/users/SalesforceFoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SalesforceFoundation/Cumulus","description":"The next version of the Salesforce.com Nonprofit Starter Pack","fork":false,"url":"https://api.github.com/repos/SalesforceFoundation/Cumulus","forks_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/forks","keys_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/teams","hooks_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/hooks","issue_events_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/events{/number}","events_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/events","assignees_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/assignees{/user}","branches_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/branches{/branch}","tags_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/tags","blobs_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/refs{/sha}","trees_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/statuses/{sha}","languages_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/languages","stargazers_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/stargazers","contributors_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/contributors","subscribers_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/subscribers","subscription_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/subscription","commits_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/commits{/sha}","git_commits_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/git/commits{/sha}","comments_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/comments{/number}","issue_comment_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/comments/{number}","contents_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/contents/{+path}","compare_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/merges","archive_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/downloads","issues_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues{/number}","pulls_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls{/number}","milestones_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/milestones{/number}","notifications_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/labels{/name}","releases_url":"https://api.github.com/repos/SalesforceFoundation/Cumulus/releases{/id}","created_at":"2013-09-25T23:56:49Z","updated_at":"2014-09-17T18:50:16Z","pushed_at":"2014-09-30T04:22:47Z","git_url":"git://github.com/SalesforceFoundation/Cumulus.git","ssh_url":"git@github.com:SalesforceFoundation/Cumulus.git","clone_url":"https://github.com/SalesforceFoundation/Cumulus.git","svn_url":"https://github.com/SalesforceFoundation/Cumulus","homepage":"http://salesforcefoundation.org/NonprofitStarterPack","size":29155,"stargazers_count":28,"watchers_count":28,"language":"Apex","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":200,"forks":18,"open_issues":200,"watchers":28,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067"},"html":{"href":"https://github.com/SalesforceFoundation/Cumulus/pull/1067"},"issue":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/1067"},"comments":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/issues/1067/comments"},"review_comments":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067/comments"},"review_comment":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/pulls/1067/commits"},"statuses":{"href":"https://api.github.com/repos/SalesforceFoundation/Cumulus/statuses/82fda3f8eacdab16dcea35f1c487f529bc79463f"}}}}