Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ public with sharing class fflib_MatcherDefinitions
private Boolean matchInOrder {
get
{
return matchInOrder == null ? false : matchInOrder;
return matchInOrder ?? false;
}
set;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public with sharing class ADDR_GoogleGeoAPI_Validator implements ADDR_IValidator

this.checked_addresses = new List<Address__c>();

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
12 changes: 6 additions & 6 deletions force-app/main/default/classes/ALLO_AllocationsDMLService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()) {
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Allocation__c> proposedAllocations = new List<Allocation__c>();

if (sourceAllocations != null && sourceAllocations.size() > 0) {
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
}

Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/classes/ALLO_AllocationsService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions force-app/main/default/classes/ALLO_AllocationsWrapper.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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<Id, List<Allocation__c>> allocsByParentId = (alloc.Opportunity__c != null) ? oppsAllocations : paymentAllocations;

if (allocsByParentId.containsKey(parentId)) {
Expand All @@ -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<Id, List<Allocation__c>> allocsByParentId = (alloc.Opportunity__c != null) ? oppsAllocations : paymentAllocations;

if (allocsByParentId.containsKey(parentId)) {
Expand Down Expand Up @@ -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<Id, List<Allocation__c>> allocsByParentId = (alloc.Opportunity__c != null) ? oppsAllocations : paymentAllocations;

if (allocsByParentId.containsKey(parentId)) {
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/classes/ALLO_Allocations_TDTM.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
10 changes: 5 additions & 5 deletions force-app/main/default/classes/ALLO_PaymentSync_SVC.cls
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -126,7 +126,7 @@ public class ALLO_PaymentSync_SVC {
Map<Id, Allocation__c> 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<Id, Allocation__c>();
Expand All @@ -149,7 +149,7 @@ public class ALLO_PaymentSync_SVC {
Map<Id, Allocation__c> 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<Id, Allocation__c>();
Expand Down Expand Up @@ -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<Allocation__c> defaultAllocs = defaultAllocsByPayment.get(payment.Id);
Allocation__c defaultAlloc = null;
Expand Down
4 changes: 1 addition & 3 deletions force-app/main/default/classes/BDI_DataImportFLSService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ public class BDI_DataImportFLSService {
}

String fieldName =
relationshipFieldName != null ?
relationshipFieldName :
dataImportFieldName;
relationshipFieldName ?? dataImportFieldName;

SObjectField sourceSObjectField =
UTIL_Describe.getFieldDescribe(
Expand Down
6 changes: 3 additions & 3 deletions force-app/main/default/classes/BDI_DataImport_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[]{};
}

/*******************************************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ public without sharing class BDI_MigrationMappingUtility {
}

fieldValues = new Map<String, Object>{
'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,
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/classes/BDI_ObjectWrapper.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions force-app/main/default/classes/CMT_FilterRule.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> selectedValues = compareValue.split(';');
List<String> fieldValues = fieldValue.split(';');
Expand All @@ -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<String> selectedValues = compareValue.split(';');
Boolean found = false;
Expand Down
Loading