{"action":"created","comment":{"url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/comments/62162750","id":62162750,"diff_hunk":"@@ -0,0 +1,236 @@\n+/**\n+* File Name   :    CW_AssociateAudienceRewardHelper.cls\n+* Description :    B-114504 - Create Audience Group Schedule Reward records\n+*\n+* Modification Log\n+* ============================================================================\n+* Ver Date       Author         Modification\n+* --- ---------- -------------- --------------------------\n+* 0.1 28/05/2014 Alex Panka\t  Intial version \n+*/\n+//Cristina P: 25/06/14: Changing the class from \"with sharing\" to \"without sharing\" \n+//so the user can create related records while cost/brief is in approval\n+public without sharing class CW_AssociateAudienceRewardHelper \n+{\n+\t/* set controller variables */\n+\tpublic String \t\t\t\t\t\t\tcontextItem {get;set;}\n+\t\t\n+\tpublic list<CW_Audience_Group__c>       agList{get;set;}\n+\tpublic list<CW_Schedule__c>             schList{get;set;}\n+\tpublic list<CW_Campaign_Reward__c>      rewList{get;set;}\n+\tpublic set<String>                      agsSet=new Set<String>();//agsMap=new map<String,List<Id>>();\n+\tpublic map<String,Id>                   agsMapId=new map<String,Id>();\n+\tpublic map<String,Id>                   agsrMap=new map<String,Id>();\n+\t \n+\tprivate set<String>                     newagsset=new set<string>();\n+\tprivate set<Id>                         delagsset=new set<Id>();  \t\n+\tprivate set<String>                     newagsrset=new set<string>();\n+\tprivate set<Id>                         delagsrset=new set<Id>();  \t\n+\tprivate Id                              CampId;\n+\t\n+\tpublic CW_AssociateAudienceRewardHelper(Id CampaignId)\n+\t{\n+\t\tCampId=CampaignId;\n+\t\tinit();\t\t\n+\t}\n+\t\n+\tpublic map<String,Boolean> getCheckkAgs()\n+\t{\n+\t\tmap<String,Boolean> result=new map<String,Boolean>();\n+\t\tfor(CW_Campaign_Reward__c rrec:rewList)\n+\t\t{\n+\t\t\tfor(CW_Audience_Group__c arec:agList)\n+\t\t\t{\n+\t\t\t\tresult.put(''+arec.id+rrec.ID,false);\n+\t\t\t}\n+\t\t}\n+\t\tfor(String key:newagsset){\n+\t\t\tresult.put(key,true);\n+\t\t}\n+\t\tfor(String key:agsSet){\n+\t\t\tresult.put(key,true);\n+\t\t}\n+\t\treturn result;\n+\t}\n+\t\n+\tpublic map<String,Boolean> getCheckkAgsr()\n+\t{\n+\t\tmap<String,Boolean> result=new map<String,Boolean>();\n+\t\tfor(CW_Schedule__c srec : schList)\n+\t\t{\n+\t\t\tfor(CW_Audience_Group__c arec:agList)\n+\t\t\t{\n+\t\t\t\tfor(CW_Campaign_Reward__c rrec:rewList){\n+\t\t\t\t\tresult.put(''+srec.id+arec.id+rrec.id,false);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\t\t\n+\t\tfor(String key:newagsrset){\n+\t\t\tresult.put(key,true);\n+\t\t}\n+\t\tfor(String key:agsrMap.KeySet()){\n+\t\t\tId recId=agsrMap.get(key);\n+\t\t\tif(!delagsrset.contains(recId))\n+\t\t\t\tresult.put(key,true);\n+\t\t}\n+\t\treturn result;\n+\t}\n+\t\n+\tpublic void init()\n+\t{\n+\t\tagsMapId=new map<String,Id>();\n+\t\tagsrMap=new map<String,Id>();\n+\t\t\t \n+\t\t//Records To create/delete\t \n+\t\tnewagsset=new set<string>();\n+\t\tdelagsset=new set<Id>();  \t\n+\t\tnewagsrset=new set<string>();\n+\t\tdelagsrset=new set<Id>();  \t\n+\t\t\n+\t\t//set the data display mode\n+\t\tagList=  [SELECT Id,Name FROM CW_Audience_Group__c  WHERE Campaign__c=:campId AND Is_Control_Group__c=false];\n+\t\tschList= [SELECT Id,Name ,Start_Date__c,End_Date__c  FROM CW_Schedule__c WHERE Marketing_Campaign__c=:campId ];\n+\t\trewList= [SELECT Id,Name,Reward_Catalogue__r.Offer_Type__r.Name,Reward_Type__r.Name FROM CW_Campaign_Reward__c WHERE Campaign_Offer__r.Campaign__c=:campId ];\n+\t\t\n+\t\tfor(CW_Audience_Group_Schedule__c rec: [SELECT Id,name,Audience_Group__c,Schedule__c FROM CW_Audience_Group_Schedule__c])\n+\t\t{\n+\t\t\tagsMapId.put(''+rec.Schedule__c+rec.Audience_Group__c,rec.Id);\n+\t\t}\n+\t\t\n+\t\tfor(CW_Audience_Group_Schedule_Reward__c rec:[Select Id,name,Audience_Group_Schedule__r.Schedule__c,Audience_Group_Schedule__r.Audience_Group__c,Campaign_Reward__c FROM CW_Audience_Group_Schedule_Reward__c])","path":"src/classes/CW_AssociateAudienceRewardHelper.cls","position":100,"original_position":100,"commit_id":"714c08cfff4b74a7e823ac4b37b4156817224b7e","original_commit_id":"714c08cfff4b74a7e823ac4b37b4156817224b7e","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"body":"If the table in this query contains more than 50'000 records a runtime exception will be thrown. I suggest to introduce a `WHERE` clause or cap the max number of records returned adding a `LIMIT` clause to the query.","created_at":"2016-05-05T08:54:14Z","updated_at":"2016-05-05T08:54:14Z","html_url":"https://github.com/eroispaziali/silly-repo/pull/5#discussion_r62162750","pull_request_url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/comments/62162750"},"html":{"href":"https://github.com/eroispaziali/silly-repo/pull/5#discussion_r62162750"},"pull_request":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5","id":68382988,"html_url":"https://github.com/eroispaziali/silly-repo/pull/5","diff_url":"https://github.com/eroispaziali/silly-repo/pull/5.diff","patch_url":"https://github.com/eroispaziali/silly-repo/pull/5.patch","issue_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues/5","number":5,"state":"open","locked":false,"title":"New","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-29T14:46:07Z","updated_at":"2016-05-05T08:54:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17cdd3642a11ea119ee8cac71b5ac47cc1a4de72","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5/commits","review_comments_url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5/comments","review_comment_url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues/5/comments","statuses_url":"https://api.github.com/repos/eroispaziali/silly-repo/statuses/714c08cfff4b74a7e823ac4b37b4156817224b7e","head":{"label":"eroispaziali:new","ref":"new","sha":"714c08cfff4b74a7e823ac4b37b4156817224b7e","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"repo":{"id":56512547,"name":"silly-repo","full_name":"eroispaziali/silly-repo","owner":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eroispaziali/silly-repo","description":"This repo is just for testing GitHub APIs","fork":false,"url":"https://api.github.com/repos/eroispaziali/silly-repo","forks_url":"https://api.github.com/repos/eroispaziali/silly-repo/forks","keys_url":"https://api.github.com/repos/eroispaziali/silly-repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eroispaziali/silly-repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eroispaziali/silly-repo/teams","hooks_url":"https://api.github.com/repos/eroispaziali/silly-repo/hooks","issue_events_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues/events{/number}","events_url":"https://api.github.com/repos/eroispaziali/silly-repo/events","assignees_url":"https://api.github.com/repos/eroispaziali/silly-repo/assignees{/user}","branches_url":"https://api.github.com/repos/eroispaziali/silly-repo/branches{/branch}","tags_url":"https://api.github.com/repos/eroispaziali/silly-repo/tags","blobs_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eroispaziali/silly-repo/statuses/{sha}","languages_url":"https://api.github.com/repos/eroispaziali/silly-repo/languages","stargazers_url":"https://api.github.com/repos/eroispaziali/silly-repo/stargazers","contributors_url":"https://api.github.com/repos/eroispaziali/silly-repo/contributors","subscribers_url":"https://api.github.com/repos/eroispaziali/silly-repo/subscribers","subscription_url":"https://api.github.com/repos/eroispaziali/silly-repo/subscription","commits_url":"https://api.github.com/repos/eroispaziali/silly-repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/eroispaziali/silly-repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/eroispaziali/silly-repo/contents/{+path}","compare_url":"https://api.github.com/repos/eroispaziali/silly-repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eroispaziali/silly-repo/merges","archive_url":"https://api.github.com/repos/eroispaziali/silly-repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eroispaziali/silly-repo/downloads","issues_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues{/number}","pulls_url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls{/number}","milestones_url":"https://api.github.com/repos/eroispaziali/silly-repo/milestones{/number}","notifications_url":"https://api.github.com/repos/eroispaziali/silly-repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eroispaziali/silly-repo/labels{/name}","releases_url":"https://api.github.com/repos/eroispaziali/silly-repo/releases{/id}","deployments_url":"https://api.github.com/repos/eroispaziali/silly-repo/deployments","created_at":"2016-04-18T14:02:28Z","updated_at":"2016-04-20T18:49:34Z","pushed_at":"2016-04-29T14:46:07Z","git_url":"git://github.com/eroispaziali/silly-repo.git","ssh_url":"git@github.com:eroispaziali/silly-repo.git","clone_url":"https://github.com/eroispaziali/silly-repo.git","svn_url":"https://github.com/eroispaziali/silly-repo","homepage":null,"size":2487,"stargazers_count":0,"watchers_count":0,"language":"Apex","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"eroispaziali:master","ref":"master","sha":"cf6e618ba8008d2569e401a88e2f3a65be37be18","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"repo":{"id":56512547,"name":"silly-repo","full_name":"eroispaziali/silly-repo","owner":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eroispaziali/silly-repo","description":"This repo is just for testing GitHub APIs","fork":false,"url":"https://api.github.com/repos/eroispaziali/silly-repo","forks_url":"https://api.github.com/repos/eroispaziali/silly-repo/forks","keys_url":"https://api.github.com/repos/eroispaziali/silly-repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eroispaziali/silly-repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eroispaziali/silly-repo/teams","hooks_url":"https://api.github.com/repos/eroispaziali/silly-repo/hooks","issue_events_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues/events{/number}","events_url":"https://api.github.com/repos/eroispaziali/silly-repo/events","assignees_url":"https://api.github.com/repos/eroispaziali/silly-repo/assignees{/user}","branches_url":"https://api.github.com/repos/eroispaziali/silly-repo/branches{/branch}","tags_url":"https://api.github.com/repos/eroispaziali/silly-repo/tags","blobs_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eroispaziali/silly-repo/statuses/{sha}","languages_url":"https://api.github.com/repos/eroispaziali/silly-repo/languages","stargazers_url":"https://api.github.com/repos/eroispaziali/silly-repo/stargazers","contributors_url":"https://api.github.com/repos/eroispaziali/silly-repo/contributors","subscribers_url":"https://api.github.com/repos/eroispaziali/silly-repo/subscribers","subscription_url":"https://api.github.com/repos/eroispaziali/silly-repo/subscription","commits_url":"https://api.github.com/repos/eroispaziali/silly-repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/eroispaziali/silly-repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/eroispaziali/silly-repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/eroispaziali/silly-repo/contents/{+path}","compare_url":"https://api.github.com/repos/eroispaziali/silly-repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eroispaziali/silly-repo/merges","archive_url":"https://api.github.com/repos/eroispaziali/silly-repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eroispaziali/silly-repo/downloads","issues_url":"https://api.github.com/repos/eroispaziali/silly-repo/issues{/number}","pulls_url":"https://api.github.com/repos/eroispaziali/silly-repo/pulls{/number}","milestones_url":"https://api.github.com/repos/eroispaziali/silly-repo/milestones{/number}","notifications_url":"https://api.github.com/repos/eroispaziali/silly-repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eroispaziali/silly-repo/labels{/name}","releases_url":"https://api.github.com/repos/eroispaziali/silly-repo/releases{/id}","deployments_url":"https://api.github.com/repos/eroispaziali/silly-repo/deployments","created_at":"2016-04-18T14:02:28Z","updated_at":"2016-04-20T18:49:34Z","pushed_at":"2016-04-29T14:46:07Z","git_url":"git://github.com/eroispaziali/silly-repo.git","ssh_url":"git@github.com:eroispaziali/silly-repo.git","clone_url":"https://github.com/eroispaziali/silly-repo.git","svn_url":"https://github.com/eroispaziali/silly-repo","homepage":null,"size":2487,"stargazers_count":0,"watchers_count":0,"language":"Apex","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5"},"html":{"href":"https://github.com/eroispaziali/silly-repo/pull/5"},"issue":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/issues/5"},"comments":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/eroispaziali/silly-repo/statuses/714c08cfff4b74a7e823ac4b37b4156817224b7e"}}}}