From 3e39d9e19b1c201aa49046f25f22f04e15847bb1 Mon Sep 17 00:00:00 2001 From: Clayton Date: Fri, 1 Nov 2024 14:19:44 +0000 Subject: [PATCH] Suggested by Clayton FixBot for [main (d5734a9)] and rule [ApexTernaryNullCoalescingOperator] --- .../main/classes/fflib_MatcherDefinitions.cls | 2 +- .../classes/ADDR_GoogleGeoAPI_Validator.cls | 3 +-- .../default/classes/ADDR_SmartyStreets_Gateway.cls | 2 +- .../default/classes/ALLO_AllocationsDMLService.cls | 12 ++++++------ .../classes/ALLO_AllocationsRecalculateService.cls | 14 +++++++------- .../classes/ALLO_AllocationsReviewService.cls | 2 +- .../default/classes/ALLO_AllocationsService.cls | 2 +- .../default/classes/ALLO_AllocationsWrapper.cls | 6 +++--- .../main/default/classes/ALLO_Allocations_TDTM.cls | 2 +- .../classes/ALLO_ManageAllocations_CTRL.cls | 2 +- .../main/default/classes/ALLO_PaymentSync_SVC.cls | 10 +++++----- .../default/classes/BDI_DataImportFLSService.cls | 4 +--- .../main/default/classes/BDI_DataImport_TEST.cls | 6 +++--- .../classes/BDI_ManageAdvancedMappingCtrl.cls | 2 +- .../classes/BDI_MigrationMappingUtility.cls | 2 +- .../main/default/classes/BDI_ObjectWrapper.cls | 2 +- .../classes/BGE_DataImportBatchEntry_CTRL.cls | 8 ++------ force-app/main/default/classes/CMT_FilterRule.cls | 10 +++++----- .../classes/CMT_FilterRuleEvaluation_SVC.cls | 4 ++-- .../classes/CON_DeleteContactOverride_CTRL.cls | 6 ++---- .../main/default/classes/CRLP_ApiService_TEST.cls | 2 +- force-app/main/default/classes/CRLP_Query_SEL.cls | 2 +- force-app/main/default/classes/CRLP_Rollup.cls | 3 +-- .../default/classes/DonationHistoryController.cls | 4 ++-- force-app/main/default/classes/ERR_Handler.cls | 8 ++++---- .../classes/HH_HouseholdNamingSettingValidator.cls | 4 +--- force-app/main/default/classes/HH_NameSpec.cls | 2 +- .../main/default/classes/MTCH_FindGifts_CTRL.cls | 2 +- force-app/main/default/classes/NPSP_Address.cls | 8 ++++---- force-app/main/default/classes/NPSP_Contact.cls | 2 +- .../main/default/classes/OPP_OpportunityNaming.cls | 2 +- .../main/default/classes/PMT_RefundService.cls | 2 +- .../default/classes/PSC_ManageSoftCredits_CTRL.cls | 2 +- .../main/default/classes/PS_CommitmentRequest.cls | 4 +--- .../main/default/classes/PS_GatewayService.cls | 2 +- .../classes/PS_IntegrationServiceConfig.cls | 4 +--- force-app/main/default/classes/RD2_ApiService.cls | 6 ++---- .../main/default/classes/RD2_CommitmentService.cls | 4 +--- .../main/default/classes/RD2_NamingService.cls | 2 +- .../classes/RD2_OpportunityEvaluation_BATCH.cls | 2 +- .../default/classes/RD2_OpportunityMatcher.cls | 2 +- .../default/classes/RD2_OpportunityService.cls | 4 +--- .../main/default/classes/RD2_RecurringDonation.cls | 14 ++++---------- .../main/default/classes/RD2_ScheduleService.cls | 12 +++++------- .../classes/RD2_VisualizeScheduleController.cls | 2 +- .../classes/RLLP_OppPartialSoftCreditRollup.cls | 4 ++-- .../classes/STG_PanelRDHealthCheck_TEST.cls | 2 +- .../main/default/classes/UTIL_BatchJobService.cls | 2 +- .../classes/UTIL_OrgTelemetry_SObject_BATCH.cls | 2 +- .../default/classes/UTIL_UnitTestData_TEST.cls | 2 +- force-app/tdtm/classes/TDTM_TriggerHandler.cls | 6 +++--- 51 files changed, 95 insertions(+), 125 deletions(-) mode change 100755 => 100644 force-app/main/default/classes/ALLO_PaymentSync_SVC.cls mode change 100755 => 100644 force-app/main/default/classes/PS_IntegrationServiceConfig.cls mode change 100755 => 100644 force-app/main/default/classes/RD2_OpportunityMatcher.cls mode change 100755 => 100644 force-app/main/default/classes/RD2_RecurringDonation.cls diff --git a/force-app/infrastructure/apex-mocks/main/classes/fflib_MatcherDefinitions.cls b/force-app/infrastructure/apex-mocks/main/classes/fflib_MatcherDefinitions.cls index fa7a911ced4..08086140823 100644 --- a/force-app/infrastructure/apex-mocks/main/classes/fflib_MatcherDefinitions.cls +++ b/force-app/infrastructure/apex-mocks/main/classes/fflib_MatcherDefinitions.cls @@ -992,7 +992,7 @@ public with sharing class fflib_MatcherDefinitions private Boolean matchInOrder { get { - return matchInOrder == null ? false : matchInOrder; + return matchInOrder ?? false; } set; } diff --git a/force-app/main/default/classes/ADDR_GoogleGeoAPI_Validator.cls b/force-app/main/default/classes/ADDR_GoogleGeoAPI_Validator.cls index 2ddd5417f5c..717da042428 100644 --- a/force-app/main/default/classes/ADDR_GoogleGeoAPI_Validator.cls +++ b/force-app/main/default/classes/ADDR_GoogleGeoAPI_Validator.cls @@ -79,8 +79,7 @@ public with sharing class ADDR_GoogleGeoAPI_Validator implements ADDR_IValidator this.checked_addresses = new List(); - String endPoint = settings.Address_Verification_Endpoint__c != null ? - settings.Address_Verification_Endpoint__c : getDefaultURL(); + String endPoint = settings.Address_Verification_Endpoint__c ?? getDefaultURL(); if (!addresses.isEmpty()){ for (Address__c a : addresses) { diff --git a/force-app/main/default/classes/ADDR_SmartyStreets_Gateway.cls b/force-app/main/default/classes/ADDR_SmartyStreets_Gateway.cls index 49c87589d01..b793754db71 100644 --- a/force-app/main/default/classes/ADDR_SmartyStreets_Gateway.cls +++ b/force-app/main/default/classes/ADDR_SmartyStreets_Gateway.cls @@ -280,7 +280,7 @@ public with sharing class ADDR_SmartyStreets_Gateway { */ public String getFullAddress() { return (((addressee != null) ? (addressee + '\n') : '') + ((delivery_line_1 != null) ? (delivery_line_1 + '\n') : '') + - ((delivery_line_2 != null) ? (delivery_line_2 + '\n') : '') + ((last_line != null) ? (last_line) : '')).trim(); + ((delivery_line_2 != null) ? (delivery_line_2 + '\n') : '') + (last_line ?? '')).trim(); } } diff --git a/force-app/main/default/classes/ALLO_AllocationsDMLService.cls b/force-app/main/default/classes/ALLO_AllocationsDMLService.cls index f1830708ec0..debb2458506 100644 --- a/force-app/main/default/classes/ALLO_AllocationsDMLService.cls +++ b/force-app/main/default/classes/ALLO_AllocationsDMLService.cls @@ -122,7 +122,7 @@ public inherited sharing class ALLO_AllocationsDMLService { * @return Class Instance */ public ALLO_AllocationsDMLService withAlternateRecordErrorsLogger(ERR_RecordError altRecErrs) { - this.recErrs = (altRecErrs != null) ? altRecErrs : this.recErrs; + this.recErrs = altRecErrs ?? this.recErrs; return this; } @@ -251,7 +251,7 @@ public inherited sharing class ALLO_AllocationsDMLService { for (Integer i=0; i < deletes.size(); i++) { Allocation__c deletedAlloc = allocationsWrapper.allocationsForDelete[i]; Database.DeleteResult delResult = deletes[i]; - Id parentRecordId = (deletedAlloc.Opportunity__c != null) ? deletedAlloc.Opportunity__c : deletedAlloc.Payment__c; + Id parentRecordId = deletedAlloc.Opportunity__c ?? deletedAlloc.Payment__c; allRecordIdsWithDML.add(parentRecordId); if (delResult.isSuccess()) { @@ -288,7 +288,7 @@ public inherited sharing class ALLO_AllocationsDMLService { for (Integer i=0; i < inserts.size(); i++) { Allocation__c insertedAlloc = allocationsWrapper.allocationsForInsert[i]; Database.SaveResult insResult = inserts[i]; - Id parentRecordId = (insertedAlloc.Opportunity__c != null) ? insertedAlloc.Opportunity__c : insertedAlloc.Payment__c; + Id parentRecordId = insertedAlloc.Opportunity__c ?? insertedAlloc.Payment__c; allRecordIdsWithDML.add(parentRecordId); if (insResult.isSuccess()) { // add the successfully inserted Allocation to the Opportunity Allocations List, indexed by the Opportunity Id @@ -324,7 +324,7 @@ public inherited sharing class ALLO_AllocationsDMLService { for (Integer i=0; i < updates.size(); i++) { Allocation__c updatedAlloc = allocationsWrapper.allocationsForUpdate[i]; Database.SaveResult updResult = updates[i]; - Id parentRecordId = (updatedAlloc.Opportunity__c != null) ? updatedAlloc.Opportunity__c : updatedAlloc.Payment__c; + Id parentRecordId = updatedAlloc.Opportunity__c ?? updatedAlloc.Payment__c; allRecordIdsWithDML.add(parentRecordId); if (updResult.isSuccess()) { @@ -348,7 +348,7 @@ public inherited sharing class ALLO_AllocationsDMLService { * @param dmlResult associated with the Allocation that errored */ private void handleError(Id parentRecordId, Allocation__c alloc, Object dmlResult) { - Id opportunityId = (alloc.Opportunity__c != null) ? alloc.Opportunity__c : allocationsWrapper.paymentIdsToOppIds.get(alloc.Payment__c); + Id opportunityId = alloc.Opportunity__c ?? allocationsWrapper.paymentIdsToOppIds.get(alloc.Payment__c); SObject parentSObjectType = (alloc.Opportunity__c != null) ? opportunitySObjectType : paymentSObjectType; getErrorLogger().addError(parentRecordId, dmlResult, parentSObjectType); @@ -394,7 +394,7 @@ public inherited sharing class ALLO_AllocationsDMLService { Integer idx = 0; while (idx < allocs.size()) { Allocation__c alloc = allocs[idx]; - Id allocParentRecordId = (alloc.Opportunity__c != null) ? alloc.Opportunity__c : alloc.Payment__c; + Id allocParentRecordId = alloc.Opportunity__c ?? alloc.Payment__c; if (allocParentRecordId != null && this.recordIdsWithErrors.contains(allocParentRecordId)) { // If it is in the errors set, remove it diff --git a/force-app/main/default/classes/ALLO_AllocationsRecalculateService.cls b/force-app/main/default/classes/ALLO_AllocationsRecalculateService.cls index 6dcdc213ea9..fea32c9a27a 100644 --- a/force-app/main/default/classes/ALLO_AllocationsRecalculateService.cls +++ b/force-app/main/default/classes/ALLO_AllocationsRecalculateService.cls @@ -175,7 +175,7 @@ public inherited sharing class ALLO_AllocationsRecalculateService { // Convert Amount to 0. Will only get here with null amount if Parent is a Payment - amount = (amount != null) ? amount : 0; + amount = amount ?? 0; List proposedAllocations = new List(); if (sourceAllocations != null && sourceAllocations.size() > 0) { @@ -229,14 +229,14 @@ public inherited sharing class ALLO_AllocationsRecalculateService { // convertToPercentages must be true, the Percentage null, sourceAmount cannot be null and either Default Allocations are not enabled or the allocation is not for the Default Allocation if (convertToPercentages && allocation.Percent__c == null && sourceAmount != null) { // Determine Percentage - Decimal allocationPercent = ((allocation.Amount__c != null) ? allocation.Amount__c : 0) / sourceAmount * 100; + Decimal allocationPercent = (allocation.Amount__c ?? 0) / sourceAmount * 100; allocation.Amount__c = (amount * allocationPercent * .01).setScale(2); // Store Percentage as is, so precision is not lost in future calculations allocation.Percent__c = allocationPercent; } - remainder -= (allocation.Amount__c != null) ? allocation.Amount__c : 0; + remainder -= allocation.Amount__c ?? 0; } Boolean isRemainderAndAmountOppositeSign = (amount >= 0 && remainder < 0) || (amount < 0 && remainder > 0); Boolean isRemainderAndAmountSameSign = (amount >= 0 && remainder > 0) || (amount < 0 && remainder < 0); @@ -250,7 +250,7 @@ public inherited sharing class ALLO_AllocationsRecalculateService { for (Allocation__c allocation : listAlloForInsert) { if (allocation.Percent__c != null) { allocationsWrapper.allocationsForInsert.add(allocation); - remainder -= (allocation.Amount__c != null) ? allocation.Amount__c : 0; + remainder -= allocation.Amount__c ?? 0; } } @@ -342,8 +342,8 @@ public inherited sharing class ALLO_AllocationsRecalculateService { proposedAllocations.add(allocation); } } - sumOfAllocations += (curAllocAmount != null) ? curAllocAmount : 0; - totalOfPercentages += (allocation.Percent__c != null) ? allocation.Percent__c : 0; + sumOfAllocations += curAllocAmount ?? 0; + totalOfPercentages += allocation.Percent__c ?? 0; } } @@ -438,7 +438,7 @@ public inherited sharing class ALLO_AllocationsRecalculateService { allocationsWrapper.addError(ALLO_AllocationsUtil.getOpportunityIdFor(parentObj), assembleAllocationError(parentObj, allocation, Label.alloNegativePercent)); errorsFound = true; } - totalOfPercentages += (allocation.Percent__c != null) ? allocation.Percent__c : 0; + totalOfPercentages += allocation.Percent__c ?? 0; if (allocation.Amount__c != 0) { allocation.Amount__c = 0; proposedAllocations.add (allocation); diff --git a/force-app/main/default/classes/ALLO_AllocationsReviewService.cls b/force-app/main/default/classes/ALLO_AllocationsReviewService.cls index d274eba3bbb..658d096fe36 100644 --- a/force-app/main/default/classes/ALLO_AllocationsReviewService.cls +++ b/force-app/main/default/classes/ALLO_AllocationsReviewService.cls @@ -197,7 +197,7 @@ public inherited sharing class ALLO_AllocationsReviewService { if (allocPositiveAmount != positiveAmount) { // Error condition, must be at least logged return true; } - sumAllocAmount += (allocAmount != null) ? allocAmount : 0; + sumAllocAmount += allocAmount ?? 0; } if (ALLO_AllocationsSettings.getSettings().isDefaultAllocationsEnabled()) { if (sumAllocAmount != amount) { diff --git a/force-app/main/default/classes/ALLO_AllocationsService.cls b/force-app/main/default/classes/ALLO_AllocationsService.cls index 5adc1d66b5c..8863e992f32 100644 --- a/force-app/main/default/classes/ALLO_AllocationsService.cls +++ b/force-app/main/default/classes/ALLO_AllocationsService.cls @@ -140,7 +140,7 @@ public inherited sharing class ALLO_AllocationsService { * @return Class Instance */ public ALLO_AllocationsService withAlternateRecordErrorsLogger(ERR_RecordError altRecErrs) { - this.recErrs = (altRecErrs != null) ? altRecErrs : this.recErrs; + this.recErrs = altRecErrs ?? this.recErrs; return this; } diff --git a/force-app/main/default/classes/ALLO_AllocationsWrapper.cls b/force-app/main/default/classes/ALLO_AllocationsWrapper.cls index 66589ee8aee..3664e14563d 100644 --- a/force-app/main/default/classes/ALLO_AllocationsWrapper.cls +++ b/force-app/main/default/classes/ALLO_AllocationsWrapper.cls @@ -390,7 +390,7 @@ public inherited sharing class ALLO_AllocationsWrapper { */ public void addAllocation(Allocation__c alloc) { // Determine Parent Id, and which Map to use - Id parentId = (alloc.Opportunity__c != null) ? alloc.Opportunity__c : alloc.Payment__c; + Id parentId = alloc.Opportunity__c ?? alloc.Payment__c; Map> allocsByParentId = (alloc.Opportunity__c != null) ? oppsAllocations : paymentAllocations; if (allocsByParentId.containsKey(parentId)) { @@ -408,7 +408,7 @@ public inherited sharing class ALLO_AllocationsWrapper { */ public void removeAllocation(Allocation__c alloc) { // Determine Parent Id, and which Map to use - Id parentId = (alloc.Opportunity__c != null) ? alloc.Opportunity__c : alloc.Payment__c; + Id parentId = alloc.Opportunity__c ?? alloc.Payment__c; Map> allocsByParentId = (alloc.Opportunity__c != null) ? oppsAllocations : paymentAllocations; if (allocsByParentId.containsKey(parentId)) { @@ -440,7 +440,7 @@ public inherited sharing class ALLO_AllocationsWrapper { return; // Determine Parent Id, and which Map to use - Id parentId = (alloc.Opportunity__c != null) ? alloc.Opportunity__c : alloc.Payment__c; + Id parentId = alloc.Opportunity__c ?? alloc.Payment__c; Map> allocsByParentId = (alloc.Opportunity__c != null) ? oppsAllocations : paymentAllocations; if (allocsByParentId.containsKey(parentId)) { diff --git a/force-app/main/default/classes/ALLO_Allocations_TDTM.cls b/force-app/main/default/classes/ALLO_Allocations_TDTM.cls index a0915803a26..7b58e932237 100644 --- a/force-app/main/default/classes/ALLO_Allocations_TDTM.cls +++ b/force-app/main/default/classes/ALLO_Allocations_TDTM.cls @@ -1250,7 +1250,7 @@ public class ALLO_Allocations_TDTM extends TDTM_Runnable { * @return Decimal value to return ********************************************************************************************************/ @testVisible private static Decimal valueOrDefaultIfNull(Decimal val, Decimal defaultVal) { - return (val != null) ? val : defaultVal; + return val ?? defaultVal; } /** diff --git a/force-app/main/default/classes/ALLO_ManageAllocations_CTRL.cls b/force-app/main/default/classes/ALLO_ManageAllocations_CTRL.cls index faa32afe944..4b177861e08 100644 --- a/force-app/main/default/classes/ALLO_ManageAllocations_CTRL.cls +++ b/force-app/main/default/classes/ALLO_ManageAllocations_CTRL.cls @@ -48,7 +48,7 @@ public with sharing class ALLO_ManageAllocations_CTRL { * for the current allocations. */ public Boolean hasAccess { - get { return hasAccess == null ? false : hasAccess; } + get { return hasAccess ?? false; } set; } diff --git a/force-app/main/default/classes/ALLO_PaymentSync_SVC.cls b/force-app/main/default/classes/ALLO_PaymentSync_SVC.cls old mode 100755 new mode 100644 index 5ae60e6bc12..87745826457 --- a/force-app/main/default/classes/ALLO_PaymentSync_SVC.cls +++ b/force-app/main/default/classes/ALLO_PaymentSync_SVC.cls @@ -92,7 +92,7 @@ public class ALLO_PaymentSync_SVC { ********************************************************************************************************/ private void addAllocationAmountToPayment(Id paymentId, Decimal allocAmount) { Decimal amt = allocatedAmountByPayment.containsKey(paymentId) ? allocatedAmountByPayment.get(paymentId) : 0; - amt += ((allocAmount != null) ? allocAmount : 0); + amt += (allocAmount ?? 0); allocatedAmountByPayment.put (paymentId, amt); } @@ -103,7 +103,7 @@ public class ALLO_PaymentSync_SVC { ********************************************************************************************************/ private void removeAllocationAmountFromPayment(Id paymentId, Decimal allocAmount) { Decimal amt = allocatedAmountByPayment.containsKey(paymentId) ? allocatedAmountByPayment.get(paymentId) : 0; - amt -= ((allocAmount != null) ? allocAmount : 0); + amt -= (allocAmount ?? 0); allocatedAmountByPayment.put (paymentId, amt); } @@ -126,7 +126,7 @@ public class ALLO_PaymentSync_SVC { Map allocationsByGAUId = null; // Determine if parent of Allocation is Opportunity or Payment - Id parentId = (allocation.Opportunity__c != null) ? allocation.Opportunity__c : allocation.Payment__c; + Id parentId = allocation.Opportunity__c ?? allocation.Payment__c; if (parentId != null) { allocationsByGAUID = (triggerAllocationsByGAUByParentId.containsKey(parentId)) ? triggerAllocationsByGAUByParentId.get(parentId) : new Map(); @@ -149,7 +149,7 @@ public class ALLO_PaymentSync_SVC { Map allocationsByGAUId = null; // Determine if parent of Allocation is Opportunity or Payment - Id parentId = (allocation.Opportunity__c != null) ? allocation.Opportunity__c : allocation.Payment__c; + Id parentId = allocation.Opportunity__c ?? allocation.Payment__c; if (parentId != null) { allocationsByGAUID = (oldTriggerAllocationsByGAUByParentIdForValidation.containsKey(parentId)) ? oldTriggerAllocationsByGAUByParentIdForValidation.get(parentId) : new Map(); @@ -660,7 +660,7 @@ public class ALLO_PaymentSync_SVC { for (npe01__OppPayment__c payment : context.payments.values()) { Decimal allocAmt = (allocatedAmountByPayment.containsKey(payment.Id)) ? allocatedAmountByPayment.get(payment.Id) : 0; - Decimal paymentAmt = (payment.npe01__Payment_Amount__c != null) ? payment.npe01__Payment_Amount__c : 0; + Decimal paymentAmt = payment.npe01__Payment_Amount__c ?? 0; Decimal remainder = paymentAmt - allocAmt; List defaultAllocs = defaultAllocsByPayment.get(payment.Id); Allocation__c defaultAlloc = null; diff --git a/force-app/main/default/classes/BDI_DataImportFLSService.cls b/force-app/main/default/classes/BDI_DataImportFLSService.cls index 48e0fdc369c..9c918647aa8 100644 --- a/force-app/main/default/classes/BDI_DataImportFLSService.cls +++ b/force-app/main/default/classes/BDI_DataImportFLSService.cls @@ -100,9 +100,7 @@ public class BDI_DataImportFLSService { } String fieldName = - relationshipFieldName != null ? - relationshipFieldName : - dataImportFieldName; + relationshipFieldName ?? dataImportFieldName; SObjectField sourceSObjectField = UTIL_Describe.getFieldDescribe( diff --git a/force-app/main/default/classes/BDI_DataImport_TEST.cls b/force-app/main/default/classes/BDI_DataImport_TEST.cls index 8bd41cfd75f..9f4583e874b 100644 --- a/force-app/main/default/classes/BDI_DataImport_TEST.cls +++ b/force-app/main/default/classes/BDI_DataImport_TEST.cls @@ -104,9 +104,9 @@ public with sharing class BDI_DataImport_TEST { Contact2_Firstname__c = firstname2, Contact2_Lastname__c = lastname2, Contact2_Personal_Email__c = (lastname2 == null ? null : firstname2 + '@' + lastname2 + '.com'), - Home_City__c = (address.MailingCity__c == null ? null : address.MailingCity__c), - Home_State_Province__c = (address.MailingState__c == null ? null : address.MailingState__c), - Home_Country__c = (address.MailingCountry__c == null ? null : address.MailingCountry__c) + Home_City__c = (address.MailingCity__c ?? null), + Home_State_Province__c = (address.MailingState__c ?? null), + Home_Country__c = (address.MailingCountry__c ?? null) ); } diff --git a/force-app/main/default/classes/BDI_ManageAdvancedMappingCtrl.cls b/force-app/main/default/classes/BDI_ManageAdvancedMappingCtrl.cls index 9d1f6bb42c6..280653a314e 100644 --- a/force-app/main/default/classes/BDI_ManageAdvancedMappingCtrl.cls +++ b/force-app/main/default/classes/BDI_ManageAdvancedMappingCtrl.cls @@ -267,7 +267,7 @@ public class BDI_ManageAdvancedMappingCtrl { //Add possible invalid field mappings fieldMappings.addAll(objectMapping.Field_Mappings); } - return fieldMappings == null ? new BDI_FieldMapping[]{} : fieldMappings; + return fieldMappings ?? new BDI_FieldMapping[]{}; } /******************************************************************************************************* diff --git a/force-app/main/default/classes/BDI_MigrationMappingUtility.cls b/force-app/main/default/classes/BDI_MigrationMappingUtility.cls index 7437ea1a113..fbd34f6d850 100644 --- a/force-app/main/default/classes/BDI_MigrationMappingUtility.cls +++ b/force-app/main/default/classes/BDI_MigrationMappingUtility.cls @@ -861,7 +861,7 @@ public without sharing class BDI_MigrationMappingUtility { } fieldValues = new Map{ - 'Data_Import_Field_Mapping_Set__c' => dataImportFieldMappingSetRecordName == null ? 'Default_Field_Mapping_Set' : dataImportFieldMappingSetRecordName, + 'Data_Import_Field_Mapping_Set__c' => dataImportFieldMappingSetRecordName ?? 'Default_Field_Mapping_Set', 'Required__c' => isRequired, 'Source_Field_API_Name__c' => sourceFieldAPIName, 'Target_Field_API_Name__c' => targetFieldAPIName, diff --git a/force-app/main/default/classes/BDI_ObjectWrapper.cls b/force-app/main/default/classes/BDI_ObjectWrapper.cls index b92ed10ffb0..a151301345c 100644 --- a/force-app/main/default/classes/BDI_ObjectWrapper.cls +++ b/force-app/main/default/classes/BDI_ObjectWrapper.cls @@ -149,7 +149,7 @@ public with sharing class BDI_ObjectWrapper { if (isAnObjectMappingImportField) { Object valueFromDynamicSource = dynamicSource.sourceObj.get(sourceFieldAPIName); Object valueFromDataImport = dataImport.get(sourceFieldAPIName); - value = valueFromDynamicSource != null ? valueFromDynamicSource : valueFromDataImport; + value = valueFromDynamicSource ?? valueFromDataImport; } else { value = dynamicSource.sourceObj.get(sourceFieldAPIName); } diff --git a/force-app/main/default/classes/BGE_DataImportBatchEntry_CTRL.cls b/force-app/main/default/classes/BGE_DataImportBatchEntry_CTRL.cls index 5d0f216f4bf..aa34cbab815 100644 --- a/force-app/main/default/classes/BGE_DataImportBatchEntry_CTRL.cls +++ b/force-app/main/default/classes/BGE_DataImportBatchEntry_CTRL.cls @@ -105,9 +105,7 @@ public with sharing class BGE_DataImportBatchEntry_CTRL { Decimal totalAmount = 0; for (DataImportRow dataImportRow: dataImportRows) { - totalAmount+= dataImportRow.record.Donation_Amount__c == null - ? 0 - : dataImportRow.record.Donation_Amount__c; + totalAmount+= dataImportRow.record.Donation_Amount__c ?? 0; } return totalAmount; } @@ -120,9 +118,7 @@ public with sharing class BGE_DataImportBatchEntry_CTRL { FROM DataImport__c WHERE NPSP_Data_Import_Batch__c =: batchId ]) { - totalAmount+= dataImport.Donation_Amount__c == null - ? 0 - : dataImport.Donation_Amount__c; + totalAmount+= dataImport.Donation_Amount__c ?? 0; } return totalAmount; } diff --git a/force-app/main/default/classes/CMT_FilterRule.cls b/force-app/main/default/classes/CMT_FilterRule.cls index ba038f3b72c..aba89a5d69f 100644 --- a/force-app/main/default/classes/CMT_FilterRule.cls +++ b/force-app/main/default/classes/CMT_FilterRule.cls @@ -435,21 +435,21 @@ public class CMT_FilterRule { return fieldValue != compareValue; } else if (rule.operation == FilterOperation.STARTS_WITH) { - compareValue = (compareValue == null ? '' : compareValue); + compareValue = (compareValue ?? ''); return fieldValue.startsWithIgnoreCase(compareValue); } else if (rule.operation == FilterOperation.CONTAINS) { - compareValue = (compareValue == null ? '' : compareValue); + compareValue = (compareValue ?? ''); return fieldValue.containsIgnoreCase(compareValue); } else if (rule.operation == FilterOperation.DOES_NOT_CONTAIN) { - compareValue = (compareValue == null ? '' : compareValue); + compareValue = (compareValue ?? ''); return !fieldValue.containsIgnoreCase(compareValue); } else if (rule.operation == FilterOperation.IS_INCLUDED || rule.operation == FilterOperation.IS_NOT_INCLUDED) { // Included only works with Multi-Select picklist fields // It checks to see if the entered value(s) are in the list of picklist values in the field - compareValue = (compareValue == null ? '' : compareValue); + compareValue = (compareValue ?? ''); List selectedValues = compareValue.split(';'); List fieldValues = fieldValue.split(';'); @@ -472,7 +472,7 @@ public class CMT_FilterRule { } else if (rule.operation == FilterOperation.IN_LIST || rule.operation == FilterOperation.NOT_IN_LIST) { // IN and NOT-IN only works with standard text and simple picklist fields // It checks to see if the field value is in the liste of entered value(s) - compareValue = (compareValue == null ? '' : compareValue); + compareValue = (compareValue ?? ''); List selectedValues = compareValue.split(';'); Boolean found = false; diff --git a/force-app/main/default/classes/CMT_FilterRuleEvaluation_SVC.cls b/force-app/main/default/classes/CMT_FilterRuleEvaluation_SVC.cls index b8b0f312b49..8c9c2297404 100644 --- a/force-app/main/default/classes/CMT_FilterRuleEvaluation_SVC.cls +++ b/force-app/main/default/classes/CMT_FilterRuleEvaluation_SVC.cls @@ -80,7 +80,7 @@ public class CMT_FilterRuleEvaluation_SVC { // Build a unique key of a concatenation of the Id's of all the detail rows. String cacheKey = filterGroupId + '.'; for (SObject record : detailRows) { - String recordId = (record.Id == null ? (nullIdRowCounter++).format() : record.Id); + String recordId = (record.Id ?? (nullIdRowCounter++).format()); cacheKey += recordId; } // If this set of detail rows has already been evaluated for this filter group, return the cached result @@ -101,7 +101,7 @@ public class CMT_FilterRuleEvaluation_SVC { List rulesToEvaluate = mapOfFilterRulesByGroupId.get(filterGroupId); for (SObject record : detailRows) { - String recordId = (record.Id == null ? (nullIdRowCounter++).format() : record.Id); + String recordId = (record.Id ?? (nullIdRowCounter++).format()); SObjectType objType = record.getSObjectType(); for (CMT_FilterRule rule : rulesToEvaluate) { if (objType == rule.getObjectType()) { diff --git a/force-app/main/default/classes/CON_DeleteContactOverride_CTRL.cls b/force-app/main/default/classes/CON_DeleteContactOverride_CTRL.cls index 10e2a856959..69606e16ba4 100644 --- a/force-app/main/default/classes/CON_DeleteContactOverride_CTRL.cls +++ b/force-app/main/default/classes/CON_DeleteContactOverride_CTRL.cls @@ -65,9 +65,7 @@ public with sharing class CON_DeleteContactOverride_CTRL { @TestVisible private Boolean lexOrSF1User { get { - return lexOrSF1User = lexOrSF1User == null - ? UserInfo.getUiThemeDisplayed().contains('Theme4') - : lexOrSF1User; + return lexOrSF1User = lexOrSF1User ?? UserInfo.getUiThemeDisplayed().contains('Theme4'); } set; } @@ -393,7 +391,7 @@ public with sharing class CON_DeleteContactOverride_CTRL { ********************************************************************************************************/ public void validate() { CDL_CascadeDeleteLookups.Error error = new CDL_CascadeDeleteLookups.Error( - (contactToDelete.Firstname != null ? contactToDelete.Firstname : '') + ' ' + contactToDelete.LastName); + (contactToDelete.Firstname ?? '') + ' ' + contactToDelete.LastName); for (Opportunity currentOpportunity : relatedOpportunities) { if (currentOpportunity.IsClosed && currentOpportunity.IsWon) { diff --git a/force-app/main/default/classes/CRLP_ApiService_TEST.cls b/force-app/main/default/classes/CRLP_ApiService_TEST.cls index 065fb24121d..ac7130825a8 100644 --- a/force-app/main/default/classes/CRLP_ApiService_TEST.cls +++ b/force-app/main/default/classes/CRLP_ApiService_TEST.cls @@ -564,7 +564,7 @@ public class CRLP_ApiService_TEST { public Object call(String action, Map params) { providedParams = params; actionCalled = action; - return returnValue == null ? new Map() : returnValue; + return returnValue ?? new Map(); } } diff --git a/force-app/main/default/classes/CRLP_Query_SEL.cls b/force-app/main/default/classes/CRLP_Query_SEL.cls index fb37e63cf6d..d7e73c3663f 100644 --- a/force-app/main/default/classes/CRLP_Query_SEL.cls +++ b/force-app/main/default/classes/CRLP_Query_SEL.cls @@ -322,7 +322,7 @@ public inherited sharing class CRLP_Query_SEL { String fieldName = rule.Field__r.QualifiedApiName; if (countOfRuleUsage.containsKey(fieldName)) { countOfRuleUsage.put(fieldName, countOfRuleUsage.get(fieldName)+1); - String constantVal = (rule.Constant__c == null ? '' : rule.Constant__c); + String constantVal = (rule.Constant__c ?? ''); // Next compare the Constant value for each of the rules. If the value is the same across // each of the Rules for this field, the value will is stored in the targetFieldAndConstant map. diff --git a/force-app/main/default/classes/CRLP_Rollup.cls b/force-app/main/default/classes/CRLP_Rollup.cls index 07d1ec2502d..6678381eadf 100644 --- a/force-app/main/default/classes/CRLP_Rollup.cls +++ b/force-app/main/default/classes/CRLP_Rollup.cls @@ -492,8 +492,7 @@ public class CRLP_Rollup { public Rollupmdt(Rollup__mdt rlp) { operation = rlp.Operation__c; - timeBoundOperationType = (rlp.Time_Bound_Operation_Type__c != null ? rlp.Time_Bound_Operation_Type__c : - CRLP_Operation.TimeBoundOperationType.All_Time.name()); + timeBoundOperationType = (rlp.Time_Bound_Operation_Type__c ?? CRLP_Operation.TimeBoundOperationType.All_Time.name()); summaryObject = rlp.Summary_Object__r.QualifiedApiName; summaryField = rlp.Summary_Field__r.QualifiedApiName; detailObject = rlp.Detail_Object__r.QualifiedApiName; diff --git a/force-app/main/default/classes/DonationHistoryController.cls b/force-app/main/default/classes/DonationHistoryController.cls index c8c3c609016..2974c816453 100644 --- a/force-app/main/default/classes/DonationHistoryController.cls +++ b/force-app/main/default/classes/DonationHistoryController.cls @@ -94,7 +94,7 @@ public with sharing class DonationHistoryController { */ @AuraEnabled(cacheable=true) public static DonationHistoryAppView getDonationHistory(Id contactId, Integer offset, String filter) { - contactId = (contactId == null ? getContactIdByUserId() : contactId ); + contactId = (contactId ?? getContactIdByUserId() ); DonationHistoryService service = new DonationHistoryService(); try { Boolean paymentsEnabled = historyService.checkIfPaymentsAreEnabled(); @@ -119,7 +119,7 @@ public with sharing class DonationHistoryController { @AuraEnabled(cacheable=true) public static List getYearsWithDonations(Id contactId) { try { - contactId = (contactId == null ? getContactIdByUserId() : contactId ); + contactId = (contactId ?? getContactIdByUserId() ); return historyService.getYearsWithDonationsForContact(contactId); } catch (Exception e) { throw new AuraHandledException(e.getMessage()); diff --git a/force-app/main/default/classes/ERR_Handler.cls b/force-app/main/default/classes/ERR_Handler.cls index f93038721f4..d0ae7725aad 100644 --- a/force-app/main/default/classes/ERR_Handler.cls +++ b/force-app/main/default/classes/ERR_Handler.cls @@ -498,17 +498,17 @@ public class ERR_Handler { if (result instanceof Database.SaveResult) { Database.SaveResult saveResult = (Database.SaveResult) result; - recordId = (saveResult.getId() != null) ? saveResult.getId() : objId; + recordId = saveResult.getId() ?? objId; error.Error_Type__c = getStatusCode(saveResult.getErrors()[0].getStatusCode()); error.Full_Message__c = saveResult.getErrors()[0].getMessage(); } else if (result instanceof Database.DeleteResult) { Database.DeleteResult deleteResult = (Database.DeleteResult) result; - recordId = (deleteResult.getId() != null) ? deleteResult.getId() : objId; + recordId = deleteResult.getId() ?? objId; error.Error_Type__c = getStatusCode(deleteResult.getErrors()[0].getStatusCode()); error.Full_Message__c = deleteResult.getErrors()[0].getMessage(); } else if (result instanceof Database.UndeleteResult) { Database.UndeleteResult undeleteResult = (Database.UndeleteResult) result; - recordId = (undeleteResult.getId() != null) ? undeleteResult.getId() : objId; + recordId = undeleteResult.getId() ?? objId; error.Error_Type__c = getStatusCode(undeleteResult.getErrors()[0].getStatusCode()); error.Full_Message__c = undeleteResult.getErrors()[0].getMessage(); } @@ -563,7 +563,7 @@ public class ERR_Handler { * @return The URL of the record. Warning: it may not necessarily be valid. */ public static String getRecordURL(Id saveResultId, Id objId) { - Id recordId = (saveResultId != null) ? saveResultId : objId; + Id recordId = saveResultId ?? objId; return getRecordURL(recordId); } diff --git a/force-app/main/default/classes/HH_HouseholdNamingSettingValidator.cls b/force-app/main/default/classes/HH_HouseholdNamingSettingValidator.cls index 4c4e24ed508..78e7762be80 100644 --- a/force-app/main/default/classes/HH_HouseholdNamingSettingValidator.cls +++ b/force-app/main/default/classes/HH_HouseholdNamingSettingValidator.cls @@ -40,9 +40,7 @@ public with sharing class HH_HouseholdNamingSettingValidator { */ private static Contact[] exampleContacts { get { - return exampleContacts = exampleContacts == null - ? buildExampleContacts() - : exampleContacts; + return exampleContacts = exampleContacts ?? buildExampleContacts(); } set; } diff --git a/force-app/main/default/classes/HH_NameSpec.cls b/force-app/main/default/classes/HH_NameSpec.cls index 8d1f75c53cc..1cf31892824 100644 --- a/force-app/main/default/classes/HH_NameSpec.cls +++ b/force-app/main/default/classes/HH_NameSpec.cls @@ -369,7 +369,7 @@ public with sharing class HH_NameSpec implements HH_INaming { // eat potential leading space str = str.replace(' ' + strField, ''); } - str = str.replace(strField, val == null ? '' : val); + str = str.replace(strField, val ?? ''); } return str; } diff --git a/force-app/main/default/classes/MTCH_FindGifts_CTRL.cls b/force-app/main/default/classes/MTCH_FindGifts_CTRL.cls index 6787ef7f23c..afc47ce2767 100644 --- a/force-app/main/default/classes/MTCH_FindGifts_CTRL.cls +++ b/force-app/main/default/classes/MTCH_FindGifts_CTRL.cls @@ -86,7 +86,7 @@ public with sharing class MTCH_FindGifts_CTRL { oppQuery += ' FROM Opportunity WHERE Id = :oppId'; opp = Database.query(oppQuery); - matchingGiftPercent = opp.Account.Matching_Gift_Percent__c == null ? 100 : opp.Account.Matching_Gift_Percent__c; + matchingGiftPercent = opp.Account.Matching_Gift_Percent__c ?? 100; // if the opp Amount is null, treat as $0 and still load the page. if (opp.Amount == null) { diff --git a/force-app/main/default/classes/NPSP_Address.cls b/force-app/main/default/classes/NPSP_Address.cls index 1ca140066da..27f7c1de710 100644 --- a/force-app/main/default/classes/NPSP_Address.cls +++ b/force-app/main/default/classes/NPSP_Address.cls @@ -174,10 +174,10 @@ public inherited sharing class NPSP_Address implements IAddress { strCleanup(address.MailingPostalCode__c) + strCleanup(address.MailingCountry__c) + strCleanup(address.Address_Type__c) + - (address.Seasonal_Start_Day__c != null ? address.Seasonal_Start_Day__c : '') + - (address.Seasonal_Start_Month__c != null ? address.Seasonal_Start_Month__c : '') + - (address.Seasonal_End_Day__c != null ? address.Seasonal_End_Day__c : '') + - (address.Seasonal_End_Month__c != null ? address.Seasonal_End_Month__c : ''); + (address.Seasonal_Start_Day__c ?? '') + + (address.Seasonal_Start_Month__c ?? '') + + (address.Seasonal_End_Day__c ?? '') + + (address.Seasonal_End_Month__c ?? ''); return strKey; } diff --git a/force-app/main/default/classes/NPSP_Contact.cls b/force-app/main/default/classes/NPSP_Contact.cls index 822f050232c..177417deb2a 100644 --- a/force-app/main/default/classes/NPSP_Contact.cls +++ b/force-app/main/default/classes/NPSP_Contact.cls @@ -186,7 +186,7 @@ public inherited sharing class NPSP_Contact { } public IAddress mailingAddress() { - return mailingAddress != null ? mailingAddress : new NPSP_Address(contact); + return mailingAddress ?? new NPSP_Address(contact); } public Boolean mailingAddressIsDifferentFrom(IAddress other) { diff --git a/force-app/main/default/classes/OPP_OpportunityNaming.cls b/force-app/main/default/classes/OPP_OpportunityNaming.cls index cd86e15fcd8..83224318562 100644 --- a/force-app/main/default/classes/OPP_OpportunityNaming.cls +++ b/force-app/main/default/classes/OPP_OpportunityNaming.cls @@ -442,7 +442,7 @@ public inherited sharing class OPP_OpportunityNaming implements OPP_INaming { // eat potential leading space result = result.replace(' ' + strField, ''); } - result = result.replace(strField, val == null ? '' : val); + result = result.replace(strField, val ?? ''); } return result; } diff --git a/force-app/main/default/classes/PMT_RefundService.cls b/force-app/main/default/classes/PMT_RefundService.cls index 2a87f85f65b..fedd184112d 100644 --- a/force-app/main/default/classes/PMT_RefundService.cls +++ b/force-app/main/default/classes/PMT_RefundService.cls @@ -372,7 +372,7 @@ public inherited sharing class PMT_RefundService { for (Integer i = 0; i < this.refundRecords.size(); i++) { Opportunity parentOpp = this.opportunityMap.get(this.refundRecords[i].npe01__Opportunity__c); - parentOpp.Amount = (parentOpp.Amount == null) ? 0 : parentOpp.Amount; + parentOpp.Amount = parentOpp.Amount ?? 0; parentOpp.Amount += getAdjustedRefundAmount(i); } diff --git a/force-app/main/default/classes/PSC_ManageSoftCredits_CTRL.cls b/force-app/main/default/classes/PSC_ManageSoftCredits_CTRL.cls index 5652a72a807..f7dc134797f 100644 --- a/force-app/main/default/classes/PSC_ManageSoftCredits_CTRL.cls +++ b/force-app/main/default/classes/PSC_ManageSoftCredits_CTRL.cls @@ -493,7 +493,7 @@ public with sharing class PSC_ManageSoftCredits_CTRL { Double total = 0; for (SoftCredit sc : softCredits) { if (sc.contactRole.ContactId != null) { - total += sc.partial.Amount__c != null ? sc.partial.Amount__c : 0; + total += sc.partial.Amount__c ?? 0; } } return isAmount ? total : (total/100) * opp.Amount; diff --git a/force-app/main/default/classes/PS_CommitmentRequest.cls b/force-app/main/default/classes/PS_CommitmentRequest.cls index 78089641490..35a2fe49520 100644 --- a/force-app/main/default/classes/PS_CommitmentRequest.cls +++ b/force-app/main/default/classes/PS_CommitmentRequest.cls @@ -435,9 +435,7 @@ public inherited sharing class PS_CommitmentRequest { private Integer getCurrencyMultiplier(String currencyCode) { Integer currencyMultiplier = currencyMultiplierByIsoCode.get(currencyCode); - return currencyMultiplier == null - ? DEFAULT_CURRENCY_MULTIPLIER - : currencyMultiplier; + return currencyMultiplier ?? DEFAULT_CURRENCY_MULTIPLIER; } /*** diff --git a/force-app/main/default/classes/PS_GatewayService.cls b/force-app/main/default/classes/PS_GatewayService.cls index 45b420c0ef1..03e3ba5462e 100644 --- a/force-app/main/default/classes/PS_GatewayService.cls +++ b/force-app/main/default/classes/PS_GatewayService.cls @@ -128,7 +128,7 @@ public with sharing class PS_GatewayService { public GatewayTemplateSetting() {} public GatewayTemplateSetting(ResponseBody rb) { this.id = rb.id; - this.gatewayName = rb.alias == null ? rb.vendorName : rb.alias; + this.gatewayName = rb.alias ?? rb.vendorName; this.isDefault = false; this.isCreditCardEnabled = false; this.isACHEnabled = false; diff --git a/force-app/main/default/classes/PS_IntegrationServiceConfig.cls b/force-app/main/default/classes/PS_IntegrationServiceConfig.cls old mode 100755 new mode 100644 index 9edf87de64a..fb1eefdf7e1 --- a/force-app/main/default/classes/PS_IntegrationServiceConfig.cls +++ b/force-app/main/default/classes/PS_IntegrationServiceConfig.cls @@ -258,9 +258,7 @@ public with sharing class PS_IntegrationServiceConfig { * @return clientId || productId */ public String getClientId() { - return config.get(CLIENTID) == null - ? config.get(PRODUCTID) - : config.get(CLIENTID); + return config.get(CLIENTID) ?? config.get(PRODUCTID); } public String getGatewayIds() { diff --git a/force-app/main/default/classes/RD2_ApiService.cls b/force-app/main/default/classes/RD2_ApiService.cls index a495b4f8d8e..2706b16f72e 100644 --- a/force-app/main/default/classes/RD2_ApiService.cls +++ b/force-app/main/default/classes/RD2_ApiService.cls @@ -139,7 +139,7 @@ public inherited sharing class RD2_ApiService { isPause = rdSchedule.IsPause__c; campaignId = rdSchedule.Campaign__c; dayOfMonth = rdSchedule.InstallmentPeriod__c == RD2_Constants.INSTALLMENT_PERIOD_MONTHLY ? rdSchedule.DayOfMonth__c : null; - endDate = (rdSchedule.EndDate__c != null) ? rdSchedule.EndDate__c : rd.EndDate__c; + endDate = rdSchedule.EndDate__c ?? rd.EndDate__c; installmentAmount = rdSchedule.InstallmentAmount__c; installmentFrequency = rdSchedule.InstallmentFrequency__c != null ? Integer.valueOf(rdSchedule.InstallmentFrequency__c) : null; installmentPeriod = rdSchedule.InstallmentPeriod__c; @@ -422,9 +422,7 @@ public inherited sharing class RD2_ApiService { public PauseObject populateDefaultValues() { this.isSuccess = true; - this.unPause = (this.unPause == null) - ? false - : this.unPause; + this.unPause = this.unPause ?? false; return this; } diff --git a/force-app/main/default/classes/RD2_CommitmentService.cls b/force-app/main/default/classes/RD2_CommitmentService.cls index 4f4a323a24c..9394601e3ae 100644 --- a/force-app/main/default/classes/RD2_CommitmentService.cls +++ b/force-app/main/default/classes/RD2_CommitmentService.cls @@ -193,9 +193,7 @@ public without sharing class RD2_CommitmentService { } private Id getRecordId(npe03__Recurring_Donation__c rd) { - Id recordId = rd.Id != null - ? rd.Id - : rd.npe03__Contact__c != null + Id recordId = rd.Id ?? (rd.npe03__Contact__c != null) ? rd.npe03__Contact__c : rd.npe03__Organization__c; return recordId; diff --git a/force-app/main/default/classes/RD2_NamingService.cls b/force-app/main/default/classes/RD2_NamingService.cls index b3cdf2912e6..5a3d305ceaa 100644 --- a/force-app/main/default/classes/RD2_NamingService.cls +++ b/force-app/main/default/classes/RD2_NamingService.cls @@ -300,7 +300,7 @@ public inherited sharing class RD2_NamingService { String token = '{!' + fld + '}'; while (rdName.containsIgnoreCase(token)) { String val = fieldReplacements.get(fld); - rdName = rdName.replace(token, (val != null ? val : '')); + rdName = rdName.replace(token, (val ?? '')); } } } diff --git a/force-app/main/default/classes/RD2_OpportunityEvaluation_BATCH.cls b/force-app/main/default/classes/RD2_OpportunityEvaluation_BATCH.cls index 9bd7a3eb5a4..429a5c8e93f 100644 --- a/force-app/main/default/classes/RD2_OpportunityEvaluation_BATCH.cls +++ b/force-app/main/default/classes/RD2_OpportunityEvaluation_BATCH.cls @@ -60,7 +60,7 @@ public without sharing class RD2_OpportunityEvaluation_BATCH if (closedFilterEnabled == null) { closedFilterEnabled = UTIL_CustomSettingsFacade.getRecurringDonationsSettings().ExcludeClosedRecurringDonations__c; } - return closedFilterEnabled != null ? closedFilterEnabled : false; + return closedFilterEnabled ?? false; } set; } diff --git a/force-app/main/default/classes/RD2_OpportunityMatcher.cls b/force-app/main/default/classes/RD2_OpportunityMatcher.cls old mode 100755 new mode 100644 index caef649e505..0bfa5fc9306 --- a/force-app/main/default/classes/RD2_OpportunityMatcher.cls +++ b/force-app/main/default/classes/RD2_OpportunityMatcher.cls @@ -395,7 +395,7 @@ public inherited sharing class RD2_OpportunityMatcher { ? installment.installmentAmount : (isClosedLost() ? 0 : opp.Amount); - return amount == null ? 0 : amount; + return amount ?? 0; } /*** diff --git a/force-app/main/default/classes/RD2_OpportunityService.cls b/force-app/main/default/classes/RD2_OpportunityService.cls index f49d28417b2..ac688c010bd 100644 --- a/force-app/main/default/classes/RD2_OpportunityService.cls +++ b/force-app/main/default/classes/RD2_OpportunityService.cls @@ -422,9 +422,7 @@ public with sharing class RD2_OpportunityService { Boolean isChanged = false; if (opp.AccountId != rd.npe03__Organization__c) { - opp.AccountId = rd.npe03__Organization__c == null - ? rd.npe03__Contact__c != null ? rd.npe03__Contact__r.AccountId : null - : rd.npe03__Organization__c; + opp.AccountId = rd.npe03__Organization__c ?? (rd.npe03__Contact__c != null ? rd.npe03__Contact__r.AccountId : null); isChanged = true; } diff --git a/force-app/main/default/classes/RD2_RecurringDonation.cls b/force-app/main/default/classes/RD2_RecurringDonation.cls old mode 100755 new mode 100644 index 49009526ac1..4c056f9f46e --- a/force-app/main/default/classes/RD2_RecurringDonation.cls +++ b/force-app/main/default/classes/RD2_RecurringDonation.cls @@ -97,9 +97,7 @@ public inherited sharing class RD2_RecurringDonation { public RD2_RecurringDonation(npe03__Recurring_Donation__c rd, List opportunities) { this.rd = rd; - this.opportunities = opportunities == null - ? new List() - : opportunities; + this.opportunities = opportunities ?? new List(); } /** @@ -469,9 +467,7 @@ public inherited sharing class RD2_RecurringDonation { * @return Decimal */ public Decimal getPaidAmount() { - return rd.npe03__Paid_Amount__c == null - ? 0 - : rd.npe03__Paid_Amount__c; + return rd.npe03__Paid_Amount__c ?? 0; } public RecurringDonationSchedule__c getPauseSchedule() { @@ -521,7 +517,7 @@ public inherited sharing class RD2_RecurringDonation { } public Date getExpectedDonationDate(RD2_ScheduleService scheduleService) { - Date baseDate = (rd.npe03__Last_Payment_Date__c == null) ? rd.StartDate__c : rd.npe03__Last_Payment_Date__c; + Date baseDate = rd.npe03__Last_Payment_Date__c ?? rd.StartDate__c; return scheduleService.getVisualizedInstallments( baseDate.addDays(1), 1, @@ -581,9 +577,7 @@ public inherited sharing class RD2_RecurringDonation { * @return Boolean */ public Boolean isNew() { - return isNew == null - ? opportunities.isEmpty() - : isNew; + return isNew ?? opportunities.isEmpty(); } /** diff --git a/force-app/main/default/classes/RD2_ScheduleService.cls b/force-app/main/default/classes/RD2_ScheduleService.cls index d71d09c325e..d940f995520 100644 --- a/force-app/main/default/classes/RD2_ScheduleService.cls +++ b/force-app/main/default/classes/RD2_ScheduleService.cls @@ -98,7 +98,7 @@ public without sharing class RD2_ScheduleService { schedule.InstallmentFrequency__c = rd.InstallmentFrequency__c; schedule.InstallmentPeriod__c = rd.npe03__Installment_Period__c; schedule.PaymentMethod__c = rd.PaymentMethod__c; - schedule.StartDate__c = (rd.StartDate__c != null ? rd.StartDate__c : rd.npe03__Date_Established__c); + schedule.StartDate__c = (rd.StartDate__c ?? rd.npe03__Date_Established__c); if (isFirstAndFifteenth(rd)) { schedule.DayOfMonth__c = RD2_Constants.DAY_OF_MONTH_FIRST; @@ -315,11 +315,9 @@ public without sharing class RD2_ScheduleService { return installments; } - numInstallments = numInstallments == null - ? DEFAULT_INSTALLMENT_NUMBER - : numInstallments; + numInstallments = numInstallments ?? DEFAULT_INSTALLMENT_NUMBER; - Date referenceDate = startDate == null ? currentDate : startDate; + Date referenceDate = startDate ?? currentDate; while (installments.size() < numInstallments) { Installment inst = getNextInstallment(referenceDate, schedules); @@ -346,7 +344,7 @@ public without sharing class RD2_ScheduleService { */ public List getVisualizedInstallments(Date startDate, Date endDate, List schedules) { List installments = new List(); - startDate = startDate == null ? currentDate : startDate; + startDate = startDate ?? currentDate; if (schedules == null || startDate > endDate) { return installments; @@ -1016,7 +1014,7 @@ public without sharing class RD2_ScheduleService { campaignId = rdSchedule.Campaign__c; campaignName = rdSchedule.Campaign__r.Name; dayOfMonth = rdSchedule.InstallmentPeriod__c == RD2_Constants.INSTALLMENT_PERIOD_MONTHLY ? rdSchedule.DayOfMonth__c : null; - endDate = (rdSchedule.EndDate__c != null) ? rdSchedule.EndDate__c : rd.EndDate__c; + endDate = rdSchedule.EndDate__c ?? rd.EndDate__c; installmentAmount = rdSchedule.InstallmentAmount__c; installmentFrequency = rdSchedule.InstallmentFrequency__c != null ? Integer.valueOf(rdSchedule.InstallmentFrequency__c) : null; installmentPeriod = rdSchedule.InstallmentPeriod__c; diff --git a/force-app/main/default/classes/RD2_VisualizeScheduleController.cls b/force-app/main/default/classes/RD2_VisualizeScheduleController.cls index 8626848fa90..e27f3f35144 100644 --- a/force-app/main/default/classes/RD2_VisualizeScheduleController.cls +++ b/force-app/main/default/classes/RD2_VisualizeScheduleController.cls @@ -560,7 +560,7 @@ public with sharing class RD2_VisualizeScheduleController { */ @AuraEnabled public List getRecords() { - return this.records == null ? new List() : this.records; + return this.records ?? new List(); } } diff --git a/force-app/main/default/classes/RLLP_OppPartialSoftCreditRollup.cls b/force-app/main/default/classes/RLLP_OppPartialSoftCreditRollup.cls index d683208d602..1d57e70a2df 100644 --- a/force-app/main/default/classes/RLLP_OppPartialSoftCreditRollup.cls +++ b/force-app/main/default/classes/RLLP_OppPartialSoftCreditRollup.cls @@ -188,7 +188,7 @@ public class RLLP_OppPartialSoftCreditRollup { * @return Contact The updated Contact record */ private static Contact countPartialSoftCredits(Contact c, Partial_Soft_Credit__c psc, Date currentYearStart) { - decimal amount = psc.Amount__c != null ? psc.Amount__c : 0; + decimal amount = psc.Amount__c ?? 0; string pscCurrencyIsoCode = RLLP_OppRollup_UTIL.isMultiCurrency() ? (string)psc.get('CurrencyIsoCode') : ''; return countSoftCreditsSharedLogic(c, amount, pscCurrencyIsoCode, psc.Opportunity__r.CloseDate, currentYearStart); } @@ -201,7 +201,7 @@ public class RLLP_OppPartialSoftCreditRollup { * @return Contact The updated Contact record */ private static Contact countOpportunityContactRoles(Contact c, OpportunityContactRole ocr, Date currentYearStart) { - decimal amount = ocr.Opportunity.Amount != null ? ocr.Opportunity.Amount : 0; + decimal amount = ocr.Opportunity.Amount ?? 0; string oppCurrencyIsoCode = RLLP_OppRollup_UTIL.isMultiCurrency() ? (string)ocr.Opportunity.get('CurrencyIsoCode') : ''; return countSoftCreditsSharedLogic(c, amount, oppCurrencyIsoCode, ocr.Opportunity.CloseDate, currentYearStart); } diff --git a/force-app/main/default/classes/STG_PanelRDHealthCheck_TEST.cls b/force-app/main/default/classes/STG_PanelRDHealthCheck_TEST.cls index bb4104b94fd..b5e2f72ad23 100644 --- a/force-app/main/default/classes/STG_PanelRDHealthCheck_TEST.cls +++ b/force-app/main/default/classes/STG_PanelRDHealthCheck_TEST.cls @@ -343,7 +343,7 @@ private class STG_PanelRDHealthCheck_TEST { private static String getValidationResults(STG_PanelHealthCheck_CTRL ctrl) { String results = ''; for (STG_PanelHealthCheck_CTRL.DetectResult dr : ctrl.listDR) { - results += dr.strStatus + ': ' + (dr.strDetails != null ? dr.strDetails : dr.strSolution) + '\n'; + results += dr.strStatus + ': ' + (dr.strDetails ?? dr.strSolution) + '\n'; } return results; } diff --git a/force-app/main/default/classes/UTIL_BatchJobService.cls b/force-app/main/default/classes/UTIL_BatchJobService.cls index bc1b2f815d9..a3b0e97db95 100644 --- a/force-app/main/default/classes/UTIL_BatchJobService.cls +++ b/force-app/main/default/classes/UTIL_BatchJobService.cls @@ -377,7 +377,7 @@ public without sharing class UTIL_BatchJobService { */ @TestVisible private String calcTimeElapsed(DateTime startDate, DateTime endDate) { - endDate = endDate == null ? Datetime.now() : endDate; + endDate = endDate ?? Datetime.now(); Long milliseconds = endDate.getTime() - startDate.getTime(); Long days = milliseconds / 1000 /60 /60 /24; diff --git a/force-app/main/default/classes/UTIL_OrgTelemetry_SObject_BATCH.cls b/force-app/main/default/classes/UTIL_OrgTelemetry_SObject_BATCH.cls index 7f981ff7e51..f15dc8c3993 100644 --- a/force-app/main/default/classes/UTIL_OrgTelemetry_SObject_BATCH.cls +++ b/force-app/main/default/classes/UTIL_OrgTelemetry_SObject_BATCH.cls @@ -162,7 +162,7 @@ public class UTIL_OrgTelemetry_SObject_BATCH implements Database.Batchable{ idToOffset == null ? '' : idToOffset, String.valueOf(queryLimit) } + new List{ idToOffset ?? '', String.valueOf(queryLimit) } ); } diff --git a/force-app/main/default/classes/UTIL_UnitTestData_TEST.cls b/force-app/main/default/classes/UTIL_UnitTestData_TEST.cls index 5816977927a..8b89ba25965 100644 --- a/force-app/main/default/classes/UTIL_UnitTestData_TEST.cls +++ b/force-app/main/default/classes/UTIL_UnitTestData_TEST.cls @@ -816,7 +816,7 @@ public class UTIL_UnitTestData_TEST { Username = email, Alias = alias, TimeZoneSidKey = UserInfo.getTimeZone().toString(), - LocaleSidKey = (localSidKey != null ? localSidKey : UserInfo.getLocale()), + LocaleSidKey = (localSidKey ?? UserInfo.getLocale()), LanguageLocaleKey = UserInfo.getLanguage(), EmailEncodingKey = 'ISO-8859-1' ); diff --git a/force-app/tdtm/classes/TDTM_TriggerHandler.cls b/force-app/tdtm/classes/TDTM_TriggerHandler.cls index 75d07673eec..50c9a9fb0b9 100644 --- a/force-app/tdtm/classes/TDTM_TriggerHandler.cls +++ b/force-app/tdtm/classes/TDTM_TriggerHandler.cls @@ -190,11 +190,11 @@ public class TDTM_TriggerHandler { //Also,a future cannot be called from a future or batch method. if (async && !isBefore && !System.isFuture() && !System.isBatch()) { UTIL_Debug.debug(LoggingLevel.WARN, '****Calling asynchronously: ' + classToRunName + ' for ' + - describeObj.getName() + ': ' + thisAction + ' with ' + (newList != null ? newList : oldList).size() + ' records'); + describeObj.getName() + ': ' + thisAction + ' with ' + (newList ?? oldList).size() + ' records'); runAsync(classToRun, classToRunName, newList, oldList, thisAction, describeObj); } else { UTIL_Debug.debug(LoggingLevel.WARN, '****Calling synchronously: ' + classToRunName + ' for ' + - describeObj.getName() + ': ' + thisAction + ' with ' + (newList != null ? newList : oldList).size() + ' records'); + describeObj.getName() + ': ' + thisAction + ' with ' + (newList ?? oldList).size() + ' records'); return classToRun.run(newList, oldList, thisAction, describeObj); } } else if (classInstance instanceof TDTM_RunnableMutable) { @@ -202,7 +202,7 @@ public class TDTM_TriggerHandler { // interface if the class intends to directly modify the global DmlWrappper TDTM_RunnableMutable classToRun = (TDTM_RunnableMutable) classInstance; UTIL_Debug.debugWithInfo('****Calling synchronously: ' + classToRunName + ' for ' + - describeObj.getName() + ': ' + thisAction + ' with ' + (newList != null ? newList : oldList).size() + ' records'); + describeObj.getName() + ': ' + thisAction + ' with ' + (newList ?? oldList).size() + ' records'); // we do not check whether class is identified as Asynchronous__c because the // underlying assumption to mutating DmlWrapper is that the class modifies