Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

updating to api v24.0

  • Loading branch information...
commit a3a218cbdcc9c9f069f463d8b73f91c5b27a496c 1 parent c0b58f3
mickle00 authored
92 src/classes/CaseTransferController.cls
... ... @@ -1,10 +1,10 @@
1 1 public class CaseTransferController{
2   -
3   - public Case myCase {get;set;}
4   - public string transferReason {get;set;}
5   - public String transferringToCaseTeam {get;set;}
6   -
7   - public CaseTransferController(ApexPages.StandardController stdController){
  2 +
  3 + public Case myCase {get;set;}
  4 + public string transferReason {get;set;}
  5 + public String transferringToCaseTeam {get;set;}
  6 +
  7 + public CaseTransferController(ApexPages.StandardController stdController){
8 8 // Get fields without needing to query for them
9 9 // Hack to allow tests to run
10 10 if (!Test.isRunningTest()) stdController.addFields(this.FIELDNAMES);
@@ -17,21 +17,21 @@ public class CaseTransferController{
17 17
18 18 public PageReference transferCase(){
19 19 this.createTransferredCase(myCase);
20   - return this.returnToCase();
  20 + return this.returnToCase();
21 21 }
22 22
23 23 public PageReference closeAndTransferCase(){
24 24 this.createTransferredCase(myCase);
25 25 //Why doesn't the standard controller have ClosingView() as a method, similar to View()?
26   - PageReference originalCaseClosePage = new PageReference('/' + myCase.Id + '/s?retURL=' + myCase.Id);
27   - return originalCaseClosePage;
  26 + PageReference originalCaseClosePage = new PageReference('/' + myCase.Id + '/s?retURL=' + myCase.Id);
  27 + return originalCaseClosePage;
28 28 }
29 29
30 30 public List<selectOption> getCaseTeamPicklistOptions() {
31 31 List<selectOption> options = new List<selectOption>();
32 32 String appendText;
33 33 for (Case_Team__c myCaseTeam : getAllCaseTeams()) {
34   - appendText = myCaseTeam.Email__c == null ? '' : ' (' + myCaseTeam.Email__c + ')';
  34 + appendText = myCaseTeam.Email__c == null ? '' : ' (' + myCaseTeam.Email__c + ')';
35 35 options.add(new selectOption(myCaseTeam.Name, myCaseTeam.Name + appendText));
36 36 }
37 37 return options;
@@ -42,34 +42,34 @@ public class CaseTransferController{
42 42 **/
43 43
44 44 public Map<String, Id> getCaseTeamToRecordTypeIdMap(){
45   - if (this.caseTeamToRecordTypeIdMap == null){
46   - this.caseTeamToRecordTypeIdMap = new Map<String, Id>();
47   - Map<String, RecordType> caseRecordTypeMap = Utilities.getRecordTypesMap('Case', true);
48   - for (Case_Team__c myCaseTeam : getAllCaseTeams()){
49   - if (caseRecordTypeMap.containsKey(myCaseTeam.Record_Type_Developer_Name__c)){
  45 + if (this.caseTeamToRecordTypeIdMap == null){
  46 + this.caseTeamToRecordTypeIdMap = new Map<String, Id>();
  47 + Map<String, RecordType> caseRecordTypeMap = Utilities.getRecordTypesMap('Case', true);
  48 + for (Case_Team__c myCaseTeam : getAllCaseTeams()){
  49 + if (caseRecordTypeMap.containsKey(myCaseTeam.Record_Type_Developer_Name__c)){
50 50 this.caseTeamToRecordTypeIdMap.put(myCaseTeam.Name, caseRecordTypeMap.get(myCaseTeam.Record_Type_Developer_Name__c).Id);
51   - }
52   - }
53   - }
54   - return this.caseTeamToRecordTypeIdMap;
  51 + }
  52 + }
  53 + }
  54 + return this.caseTeamToRecordTypeIdMap;
55 55 }
56 56
57 57 public Map<String, Case_Team__c> getCaseTeamMap(){
58   - if (this.caseTeamMap == null){
59   - this.caseTeamMap = new Map<String, Case_Team__c>();
60   - for (Case_Team__c myCaseTeam : this.getAllCaseTeams()){
61   - this.caseTeamMap.put(myCaseTeam.Name, myCaseTeam);
62   - }
63   - }
64   - return this.caseTeamMap;
  58 + if (this.caseTeamMap == null){
  59 + this.caseTeamMap = new Map<String, Case_Team__c>();
  60 + for (Case_Team__c myCaseTeam : this.getAllCaseTeams()){
  61 + this.caseTeamMap.put(myCaseTeam.Name, myCaseTeam);
  62 + }
  63 + }
  64 + return this.caseTeamMap;
65 65 }
66 66
67 67 private List<Case_Team__c> getAllCaseTeams(){
68   - if (this.allCaseTeams == null){
69   - this.allCaseTeams = new List<Case_Team__c>();
70   - this.allCaseTeams = [SELECT Id, Name, Record_Type_Developer_Name__c, Email__c, Team__c FROM Case_Team__c WHERE Active__c = true order by Name ASC];
71   - }
72   - return this.allCaseTeams;
  68 + if (this.allCaseTeams == null){
  69 + this.allCaseTeams = new List<Case_Team__c>();
  70 + this.allCaseTeams = [SELECT Id, Name, Record_Type_Developer_Name__c, Email__c, Team__c FROM Case_Team__c WHERE Active__c = true order by Name ASC];
  71 + }
  72 + return this.allCaseTeams;
73 73 }
74 74
75 75 private void createTransferredCase(Case parentCase){
@@ -100,7 +100,7 @@ public class CaseTransferController{
100 100 insert newCase;
101 101 this.createTransferredCaseComment(newCase.Id);
102 102 } catch (Exception exc){
103   - ExceptionClass.InsertException(exc);
  103 + ExceptionClass.InsertException(exc);
104 104 }
105 105 }
106 106
@@ -116,11 +116,11 @@ public class CaseTransferController{
116 116 }
117 117
118 118 private Integer getParentCaseCommentsSize(){
119   - if (this.parentCaseComments == null){
120   - this.parentCaseComments = new List<CaseComment>();
121   - this.parentCaseComments = [SELECT Id FROM CaseComment WHERE ParentId = :this.myCase.Id];
122   - }
123   - return this.parentCaseComments.size();
  119 + if (this.parentCaseComments == null){
  120 + this.parentCaseComments = new List<CaseComment>();
  121 + this.parentCaseComments = [SELECT Id FROM CaseComment WHERE ParentId = :this.myCase.Id];
  122 + }
  123 + return this.parentCaseComments.size();
124 124 }
125 125
126 126 private Integer getParentAttachmentsSize(){
@@ -137,13 +137,13 @@ public class CaseTransferController{
137 137 private Map<String, Case_Team__c> caseTeamMap;
138 138 private List<Case_Team__c> allCaseTeams;
139 139 private List<String> FIELDNAMES = new List<String>{'Description'
140   - ,'Description_Rich_Text__c'
141   - ,'SuppliedEmail'
142   - ,'SuppliedName'
143   - ,'ContactId'
144   - ,'AccountId'
145   - ,'Status'
146   - ,'Team__c'
147   - ,'RecordTypeId'
148   - ,'Id'};
  140 + ,'Description_Rich_Text__c'
  141 + ,'SuppliedEmail'
  142 + ,'SuppliedName'
  143 + ,'ContactId'
  144 + ,'AccountId'
  145 + ,'Status'
  146 + ,'Team__c'
  147 + ,'RecordTypeId'
  148 + ,'Id'};
149 149 }
2  src/classes/CaseTransferController.cls-meta.xml
... ... @@ -1,5 +1,5 @@
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3   - <apiVersion>23.0</apiVersion>
  3 + <apiVersion>24.0</apiVersion>
4 4 <status>Active</status>
5 5 </ApexClass>
32 src/classes/CaseTransferController_Test.cls
... ... @@ -1,26 +1,26 @@
1 1 @isTest
2 2 private class CaseTransferController_Test {
3   -
4   - static Case testCase;
5   - static Case_Team__c testCaseTeam;
6   -
7   - static CaseTransferController getTestController(){
8   - testCase = new Case(Subject = 'TestCase', Status = 'TestStatus', Description = 'Test Description');
9   - insert testCase;
10   - PageReference CaseTransferPage = Page.CaseTransfer;
  3 +
  4 + static Case testCase;
  5 + static Case_Team__c testCaseTeam;
  6 +
  7 + static CaseTransferController getTestController(){
  8 + testCase = new Case(Subject = 'TestCase', Status = 'TestStatus', Description = 'Test Description');
  9 + insert testCase;
  10 + PageReference CaseTransferPage = Page.CaseTransfer;
11 11 Test.setCurrentPage(CaseTransferPage);
12 12 ApexPages.currentPage().getParameters().put('Id', testCase.Id);
13 13 ApexPages.StandardController caseController = new ApexPages.StandardController(testCase);
14 14 CaseTransferController myController = new CaseTransferController(caseController);
15 15 return myController;
16   - }
17   -
18   - static Case_Team__c getNewCaseTeam(){
19   - RecordType randomRecordType = [SELECT Id, DeveloperName FROM RecordType WHERE sObjectType = 'Case'AND isActive = true LIMIT 1];
20   - testCaseTeam = new Case_Team__c (Name = 'TestCaseTeam', Record_Type_Developer_Name__c = randomRecordType.DeveloperName, Email_Service_Address__c = 'fake@nevergoingtohappen.org');
21   - insert testCaseTeam;
22   - return testCaseTeam;
23   - }
  16 + }
  17 +
  18 + static Case_Team__c getNewCaseTeam(){
  19 + RecordType randomRecordType = [SELECT Id, DeveloperName FROM RecordType WHERE sObjectType = 'Case'AND isActive = true LIMIT 1];
  20 + testCaseTeam = new Case_Team__c (Name = 'TestCaseTeam', Record_Type_Developer_Name__c = randomRecordType.DeveloperName, Email_Service_Address__c = 'fake@nevergoingtohappen.org');
  21 + insert testCaseTeam;
  22 + return testCaseTeam;
  23 + }
24 24
25 25 static testMethod void shouldHaveCaseComment() {
26 26 CaseTransferController myController = getTestController();
2  src/classes/CaseTransferController_Test.cls-meta.xml
... ... @@ -1,5 +1,5 @@
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3   - <apiVersion>23.0</apiVersion>
  3 + <apiVersion>24.0</apiVersion>
4 4 <status>Active</status>
5 5 </ApexClass>

0 comments on commit a3a218c

Please sign in to comment.
Something went wrong with that request. Please try again.