Skip to content

Commit

Permalink
Formatting updates
Browse files Browse the repository at this point in the history
Updated LWC, Aura and Apex to API v60.0
  • Loading branch information
GeekStewie committed Apr 2, 2024
1 parent a025685 commit b9d31ae
Show file tree
Hide file tree
Showing 61 changed files with 154 additions and 145 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ robot/animal_shelter_starter/results/
.DS_Store

test_results.*
/IlluminatedCloud/
2 changes: 1 addition & 1 deletion force-app/main/default/classes/AlertBannerController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public with sharing class AlertBannerController {
return null;
}

if(Schema.sObjectType.animalshelters__Animal_Alert__c.isAccessible() && Schema.sObjectType.animalshelters__Animal_Alert__c.fields.animalshelters__Alert_Message__c.isAccessible() && Schema.sObjectType.animalshelters__Animal_Alert__c.fields.animalshelters__Start_Date_Time__c.isAccessible() && Schema.sObjectType.animalshelters__Animal_Alert__c.fields.animalshelters__End_Date_Time__c.isAccessible()){
if(Schema.SObjectType.animalshelters__Animal_Alert__c.isAccessible() && Schema.SObjectType.animalshelters__Animal_Alert__c.fields.animalshelters__Alert_Message__c.isAccessible() && Schema.SObjectType.animalshelters__Animal_Alert__c.fields.animalshelters__Start_Date_Time__c.isAccessible() && Schema.SObjectType.animalshelters__Animal_Alert__c.fields.animalshelters__End_Date_Time__c.isAccessible()){

List<animalshelters__Animal_Alert__c> AlertList = [SELECT Id, animalshelters__Alert_Message__c,animalshelters__Start_Date_Time__c FROM animalshelters__Animal_Alert__c WHERE animalshelters__Animal__c = :parentId AND animalshelters__Start_Date_Time__c <= TODAY AND (animalshelters__End_Date_Time__c >= TODAY OR animalshelters__End_Date_Time__c = NULL) WITH SECURITY_ENFORCED LIMIT 20];
return AlertList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
5 changes: 3 additions & 2 deletions force-app/main/default/classes/AlertBannerControllerTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
* Ver Date Author Modification
* 1.0 4/30/2020 Stewart Anderson (Salesforce.org) Initial Version
**/
@isTest
@IsTest
public class AlertBannerControllerTest {
static testMethod void testMethod1 () {
@IsTest
static void testMethod1 () {
List<animalshelters__Animal_Alert__c> AlertListTest = AlertBannerController.getRelatedAlertRecords('a003z00000rlhSbAAI');
List<animalshelters__Animal_Alert__c> AlertListTest2 = AlertBannerController.getRelatedAlertRecords(null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
8 changes: 4 additions & 4 deletions force-app/main/default/classes/AnimalActionRLClass2.cls
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public with sharing class AnimalActionRLClass2 {
// System.debug('recId = ' + recId);
// System.debug('rTypeName = ' + rTypeName);

if(Schema.sObjectType.animalshelters__Animal_Action__c.isAccessible() && Schema.sObjectType.animalshelters__Animal_Action__c.fields.name.isAccessible() && Schema.sObjectType.animalshelters__Animal_Action__c.fields.animalshelters__Action_Completed__c.isAccessible() && Schema.sObjectType.animalshelters__Animal_Action__c.fields.animalshelters__Date_Time_of_Action__c.isAccessible() && Schema.sObjectType.animalshelters__Animal_Action__c.fields.animalshelters__Description__c.isAccessible() && Schema.sObjectType.animalshelters__Animal_Action__c.fields.RecordTypeId.isAccessible() && Schema.sObjectType.animalshelters__Animal__c.isAccessible()){
if(Schema.SObjectType.animalshelters__Animal_Action__c.isAccessible() && Schema.SObjectType.animalshelters__Animal_Action__c.fields.Name.isAccessible() && Schema.SObjectType.animalshelters__Animal_Action__c.fields.animalshelters__Action_Completed__c.isAccessible() && Schema.SObjectType.animalshelters__Animal_Action__c.fields.animalshelters__Date_Time_of_Action__c.isAccessible() && Schema.SObjectType.animalshelters__Animal_Action__c.fields.animalshelters__Description__c.isAccessible() && Schema.SObjectType.animalshelters__Animal_Action__c.fields.RecordTypeId.isAccessible() && Schema.SObjectType.animalshelters__Animal__c.isAccessible()){
List<animalshelters__Animal_Action__c> animalActions= new List<animalshelters__Animal_Action__c>();
boolean blnFirstTimeRound = false;
for(RecordType rec : [SELECT Id FROM RecordType WHERE sObjectType = 'animalshelters__Animal_Action__c' and Name =:rTypeName])
Boolean blnFirstTimeRound = false;
for(RecordType rec : [SELECT Id FROM RecordType WHERE SobjectType = 'animalshelters__Animal_Action__c' AND Name =:rTypeName])
{
if (!blnFirstTimeRound){
List<animalshelters__Animal_Action__c> y = [SELECT Id, Name, animalshelters__Action_Completed__c, animalshelters__Date_Time_of_Action__c, animalshelters__Description__c
FROM animalshelters__Animal_Action__c
WHERE animalshelters__Animal__c= :recId and RecordTypeId= :rec.Id WITH SECURITY_ENFORCED ];
WHERE animalshelters__Animal__c= :recId AND RecordTypeId= :rec.Id WITH SECURITY_ENFORCED ];
for(animalshelters__Animal_Action__c z : y)
{
animalActions.add(z);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Ver Date Author Modification
* 1.0 4/30/2020 Stewart Anderson (Salesforce.org) Initial Version
**/
@isTest
@IsTest
public class AnimalActionRLClass2Test {

@IsTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public with sharing class AnimalShelterFieldsetController {
}
}

@AuraEnabled(cacheable=true)
@AuraEnabled(Cacheable=true)
public static List<FieldSetMemberWrapper> getFieldSet(String sObjectName, String fieldSetName) {
List<FieldSetMemberWrapper> fieldSetMemberWrappers = new List<FieldSetMemberWrapper>();

Expand Down Expand Up @@ -48,7 +48,7 @@ public with sharing class AnimalShelterFieldsetController {
return fieldSetMemberWrappers;
}

@AuraEnabled(cacheable=true)
@AuraEnabled(Cacheable=true)
public static Map<String, List<String>> getBadgeFieldsData(String recordId, String sObjectName, List<String> badgeFieldNames) {

// Check Object and Field Security
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* @last modified on : 12-22-2023
* @last modified by : Stewart Anderson
**/
@isTest
@IsTest
private class AnimalShelterFieldsetControllerTest {

@isTest static void testGetFieldSet() {
@IsTest static void testGetFieldSet() {
// Setup test data
// Since Schema and FieldSets cannot be created in test methods,
// we'll assume there's an existing object and field set available.
Expand All @@ -24,7 +24,7 @@ private class AnimalShelterFieldsetControllerTest {
System.assertNotEquals(0, result.size(), 'The result should have elements');
}

@isTest static void testGetBadgeFieldsData() {
@IsTest static void testGetBadgeFieldsData() {
// Setup test data
// Create a record for the sObject you're testing against
animalshelters__Animal__c testRecord = new animalshelters__Animal__c(animalshelters__Animal_Name__c='Test', animalshelters__Date_of_Arrival__c=Datetime.now());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
**/
public with sharing class AnimalShelterGetCustomSettings {

@AuraEnabled(cacheable=true)
@AuraEnabled(Cacheable=true)
public static animalshelters__Animal_Shelter_Settings__c getCustomSettings(){
if (Schema.sObjectType.animalshelters__Animal_Shelter_Settings__c.isAccessible()) {
if (Schema.SObjectType.animalshelters__Animal_Shelter_Settings__c.isAccessible()) {
return animalshelters__Animal_Shelter_Settings__c.getOrgDefaults();
} else {
throw new AuraHandledException('Access Issue: There was an attempt to access Animal Shelter Starter Settings by a user without access.');
Expand All @@ -19,7 +19,7 @@ public with sharing class AnimalShelterGetCustomSettings {

@AuraEnabled
public static void saveCustomSetting(animalshelters__Animal_Shelter_Settings__c customSetting) {
if (Schema.sObjectType.animalshelters__Animal_Shelter_Settings__c.isUpdateable()) {
if (Schema.SObjectType.animalshelters__Animal_Shelter_Settings__c.isUpdateable()) {
update customSetting;
} else {
throw new AuraHandledException('Access Issue: There was an attempt to update Animal Shelter Starter Settings by a user without access.');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ private class AnimalShelterGetCustomSettingsTest {
@IsTest static void testGetCustomSetting() {
// Create a new custom setting record
animalshelters__Animal_Shelter_Settings__c setting = new animalshelters__Animal_Shelter_Settings__c();
setting.animalshelters__Breeds_Migration_Complete__c = True;
setting.animalshelters__Default_Animal_Name__c = False;
setting.animalshelters__Breeds_Migration_Complete__c = true;
setting.animalshelters__Default_Animal_Name__c = false;
setting.animalshelters__Default_Animal_Name_Prefix__c = 'pre';
setting.animalshelters__microchip_api_Token__c = 'TestValue';
insert setting;
Expand All @@ -25,8 +25,8 @@ private class AnimalShelterGetCustomSettingsTest {
@IsTest static void testSaveCustomSetting() {
// Create a new custom setting record
animalshelters__Animal_Shelter_Settings__c setting = new animalshelters__Animal_Shelter_Settings__c();
setting.animalshelters__Breeds_Migration_Complete__c = True;
setting.animalshelters__Default_Animal_Name__c = False;
setting.animalshelters__Breeds_Migration_Complete__c = true;
setting.animalshelters__Default_Animal_Name__c = false;
setting.animalshelters__Default_Animal_Name_Prefix__c = 'pre';
setting.animalshelters__microchip_api_Token__c = 'TestValueNew';
insert setting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
@isTest
@IsTest
public class FSCAnimalCloneDatatableControllerTest {

@TestSetup
static void setupTestData(){

animalshelters__Animal__c testAnimal = new animalshelters__Animal__c(animalshelters__Animal_Name__c = 'Tandy', animalshelters__Type__c = 'Rabbit', animalshelters__Date_of_Arrival__c = Date.today(), animalshelters__IsCloned__c = True);
Insert testAnimal;
animalshelters__Animal__c testAnimal = new animalshelters__Animal__c(animalshelters__Animal_Name__c = 'Tandy', animalshelters__Type__c = 'Rabbit', animalshelters__Date_of_Arrival__c = Date.today(), animalshelters__IsCloned__c = true);
insert testAnimal;
}

@isTest static void testReadRecord(){
@IsTest static void testReadRecord(){

List<animalshelters__Animal__c> tstRecord = new List<animalshelters__Animal__c>();
tstRecord = FSCAnimalCloneDatatableController.getClonedAnimals();
System.assertEquals(true,tstRecord.size()>0,'Read Animal Record Failed');

}

@isTest static void testUpdateRecord(){
@IsTest static void testUpdateRecord(){

List<animalshelters__Animal__c> tstUpdate = new List<animalshelters__Animal__c>();
List<animalshelters__Animal__c> updateAnimal = [SELECT animalshelters__Animal_Name__c, animalshelters__Type__c, animalshelters__Date_of_Arrival__c FROM animalshelters__Animal__c WHERE animalshelters__IsCloned__c = True];
List<animalshelters__Animal__c> updateAnimal = [SELECT animalshelters__Animal_Name__c, animalshelters__Type__c, animalshelters__Date_of_Arrival__c FROM animalshelters__Animal__c WHERE animalshelters__IsCloned__c = TRUE];
updateAnimal.get(0).animalshelters__Animal_Name__c = 'Tommy';
tstUpdate = FSCAnimalCloneDatatableController.updateClonedRecords(updateAnimal);
System.assertEquals(tstUpdate.get(0).animalshelters__Animal_Name__c, 'Tommy','Animal name !="Tommy"');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public with sharing class FSC_FileUploadPreviewController {

@AuraEnabled
public static void deleteFile(String contentDocumentId){
if (ContentDocument.sObjectType.getDescribe().isDeletable()){
if (ContentDocument.SObjectType.getDescribe().isDeletable()){
delete [SELECT Id
FROM ContentDocument
WHERE Id = :contentDocumentId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class FSC_FileUploadPreviewControllerTest {

}

@isTest static void testReadDocument(){
@IsTest static void testReadDocument(){

List<Account> accList = [SELECT Id FROM Account WHERE Name = 'ASS Test Account' LIMIT 1];
for(Account acc : accList){
Expand All @@ -44,7 +44,7 @@ public class FSC_FileUploadPreviewControllerTest {
}
}

@isTest static void testDeleteDocument(){
@IsTest static void testDeleteDocument(){

List<ContentDocument> cdList = [SELECT Id FROM ContentDocument WHERE Title = 'ASS Test File' LIMIT 1];
for(ContentDocument cd : cdList){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
33 changes: 18 additions & 15 deletions force-app/main/default/classes/GetRandomNumber.cls
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ global with sharing class GetRandomNumber {
Results curResult = new Results();
curResult.randomNumber = generateRandomFromRange(requests[0].startNumber, requests[0].endNumber);

List<Results> resultsList = new List<results>();
List<Results> resultsList = new List<Results>();
resultsList.add(curResult);
return resultsList;
}
Expand All @@ -37,41 +37,44 @@ global with sharing class GetRandomNumber {
global static Double generateRandomFromRange(Integer startNum, Integer endNum) {


if(startNum == 0 && endNum == 1)
if (startNum == 0 && endNum == 1) {
return Math.random();
}

Integer returnValue;
//Logic- first we will generate random boolean value which will decide if we want to
//add the random number from startNum or will subtract random number from endNum
Integer randomNumber = Integer.valueof((math.random() * 10));
boolean addSubFlag= math.mod(randomNumber,2) == 0 ? true : false;
Integer randomNumber = Integer.valueOf((Math.random() * 10));
Boolean addSubFlag= Math.mod(randomNumber,2) == 0 ? true : false;

integer diffInRange = endNum-startNum;
Integer diffInRange = endNum-startNum;
//Now find random number staring from 0 to diffInRange
Integer randomNum = Math.mod(Math.round(Math.random()*diffInRange+1),diffInRange);

//If addSubFlag is true, we will add random number generated between 0 and diffInRange from start number
//else we will subtract random number from end number
if(addSubFlag){
if(diffInRange > 1)
returnValue =startNum + randomNum;
else
returnValue =startNum;
if (diffInRange > 1) {
returnValue = startNum + randomNum;
} else {
returnValue = startNum;
}
}else{
if(diffInRange > 1)
returnValue = endNum - randomNum;
else
returnValue =endNum;
if (diffInRange > 1) {
returnValue = endNum - randomNum;
} else {
returnValue = endNum;
}
}
return returnValue;

}

global class Requests {
@InvocableVariable(required=true)
@InvocableVariable(Required=true)
global Integer startNumber;

@InvocableVariable(required=true)
@InvocableVariable(Required=true)
global Integer endNumber;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
8 changes: 4 additions & 4 deletions force-app/main/default/classes/GetRandomNumberTest.cls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@isTest
@IsTest
global with sharing class GetRandomNumberTest {

@isTest
@IsTest
public static void numberReturnedIsInRange() {
Integer startNum = 0;
Integer endNum =1;
Expand All @@ -23,7 +23,7 @@ global with sharing class GetRandomNumberTest {
System.assertEquals(true, resultNum <= endNum);
}

@isTest
@IsTest
public static void numberZeroToOneGeneratedIsInRange() {
Integer startNum = 0;
Integer endNum =1;
Expand All @@ -36,7 +36,7 @@ global with sharing class GetRandomNumberTest {
System.assertEquals(true, resultNum <= endNum);
}

@isTest
@IsTest
public static void numberAboveOneGeneratedIsInRange() {
Integer startNum = 5;
Integer endNum =7;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<apiVersion>60.0</apiVersion>
<status>Active</status>
</ApexClass>
Loading

0 comments on commit b9d31ae

Please sign in to comment.