Skip to content

Commit

Permalink
Merge pull request #4112 from SalesforceFoundation/feature/crlp-chunk…
Browse files Browse the repository at this point in the history
…-mode

Customizable Rollups: Chunk mode processing for Account/Contact Hard & Soft Credits
  • Loading branch information
ptewson-sfdo authored Mar 18, 2019
2 parents 6f22315 + 05bf0ae commit 4f0859a
Show file tree
Hide file tree
Showing 22 changed files with 1,271 additions and 521 deletions.
13 changes: 9 additions & 4 deletions src/classes/CRLP_AccountSkew_AccSoftCredit_BATCH.cls
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@
*/
public class CRLP_AccountSkew_AccSoftCredit_BATCH extends CRLP_Batch_Base_Skew implements Database.Batchable<SObject>, Database.Stateful, Schedulable {

/*******************************************************************************************************
* @description The CRLP_RollupProcessingOptions.RollupType of this class.
*/
private static final CRLP_RollupProcessingOptions.RollupType jobType =
CRLP_RollupProcessingOptions.RollupType.AccountSoftCredit;

public CRLP_AccountSkew_AccSoftCredit_BATCH() {}

/*******************************************************************************************************
* @description Constructs the class - Rollup all RDs that meet the "Skew" criteria
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
*/
public CRLP_AccountSkew_AccSoftCredit_BATCH(CRLP_RollupProcessingOptions.RollupTypeFilter jobFilter) {
super(CRLP_RollupProcessingOptions.RollupType.AccountSoftCredit, jobFilter);
super(jobType, jobFilter);
}

/*******************************************************************************************************
Expand All @@ -54,7 +59,7 @@ public class CRLP_AccountSkew_AccSoftCredit_BATCH extends CRLP_Batch_Base_Skew i
* by the SkewDispatcher Id chunking logic.
*/
public CRLP_AccountSkew_AccSoftCredit_BATCH(List<Id> recordIds, Id lastIdProcessedForChunking) {
super(CRLP_RollupProcessingOptions.RollupType.AccountSoftCredit, recordIds, lastIdProcessedForChunking);
super(jobType, recordIds, lastIdProcessedForChunking);
}

/**
Expand All @@ -64,7 +69,7 @@ public class CRLP_AccountSkew_AccSoftCredit_BATCH extends CRLP_Batch_Base_Skew i
String className = CRLP_AccountSkew_AccSoftCredit_BATCH.class.getName();
if (CRLP_Rollup_SVC.isCustomizableRollupEngineEnabled) {
if (!UTIL_MasterSchedulableHelper.hasRunningJob(className)) {
Database.executeBatch(new CRLP_SkewDispatcher_BATCH(CRLP_RollupProcessingOptions.RollupType.AccountSoftCredit), CRLP_SkewDispatcher_BATCH.BATCH_SIZE);
Database.executeBatch(new CRLP_SkewDispatcher_BATCH(jobType), CRLP_SkewDispatcher_BATCH.BATCH_SIZE);
} else {
logDuplicateBatchError(className);
}
Expand Down
13 changes: 9 additions & 4 deletions src/classes/CRLP_AccountSkew_BATCH.cls
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@
*/
public class CRLP_AccountSkew_BATCH extends CRLP_Batch_Base_Skew implements Database.Batchable<SObject>, Database.Stateful, Schedulable {

/*******************************************************************************************************
* @description The CRLP_RollupProcessingOptions.RollupType of this class.
*/
private static final CRLP_RollupProcessingOptions.RollupType jobType =
CRLP_RollupProcessingOptions.RollupType.AccountHardCredit;

public CRLP_AccountSkew_BATCH() {}

/*******************************************************************************************************
* @description Constructs the class - Rollup all Accounts that meet the "Skew" criteria
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
*/
public CRLP_AccountSkew_BATCH(CRLP_RollupProcessingOptions.RollupTypeFilter jobFilter) {
super(CRLP_RollupProcessingOptions.RollupType.AccountHardCredit, jobFilter);
super(jobType, jobFilter);
}

/*******************************************************************************************************
Expand All @@ -54,7 +59,7 @@ public class CRLP_AccountSkew_BATCH extends CRLP_Batch_Base_Skew implements Data
* by the SkewDispatcher Id chunking logic.
*/
public CRLP_AccountSkew_BATCH(List<Id> recordIds, Id lastIdProcessedForChunking) {
super(CRLP_RollupProcessingOptions.RollupType.AccountHardCredit, recordIds, lastIdProcessedForChunking);
super(jobType, recordIds, lastIdProcessedForChunking);
}

/**
Expand All @@ -64,7 +69,7 @@ public class CRLP_AccountSkew_BATCH extends CRLP_Batch_Base_Skew implements Data
String className = CRLP_AccountSkew_BATCH.class.getName();
if (CRLP_Rollup_SVC.isCustomizableRollupEngineEnabled) {
if (!UTIL_MasterSchedulableHelper.hasRunningJob(className)) {
Database.executeBatch(new CRLP_SkewDispatcher_BATCH(CRLP_RollupProcessingOptions.RollupType.AccountHardCredit), CRLP_SkewDispatcher_BATCH.BATCH_SIZE);
Database.executeBatch(new CRLP_SkewDispatcher_BATCH(jobType), CRLP_SkewDispatcher_BATCH.BATCH_SIZE);
} else {
logDuplicateBatchError(className);
}
Expand Down
4 changes: 1 addition & 3 deletions src/classes/CRLP_Account_AccSoftCredit_BATCH.cls
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class CRLP_Account_AccSoftCredit_BATCH extends CRLP_Batch_Base_NonSkew im

/*******************************************************************************************************
* @description Constructs the class - Rollup all Accounts that meet the "Non Skew" criteria
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
*/
public CRLP_Account_AccSoftCredit_BATCH(CRLP_RollupProcessingOptions.RollupTypeFilter jobFilter) {
Expand All @@ -49,8 +48,7 @@ public class CRLP_Account_AccSoftCredit_BATCH extends CRLP_Batch_Base_NonSkew im

/*******************************************************************************************************
* @description Constructs the class - Rollup is for a specific set of Account Id's
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
* @param recordIds Specific set of parent record id's to roll up to
*/
public CRLP_Account_AccSoftCredit_BATCH(List<Id> recordIds) {
super(CRLP_RollupProcessingOptions.RollupType.AccountSoftCredit, recordIds);
Expand Down
31 changes: 24 additions & 7 deletions src/classes/CRLP_Account_BATCH.cls
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,41 @@
*/
public class CRLP_Account_BATCH extends CRLP_Batch_Base_NonSkew implements Database.Batchable<SObject>, Database.Stateful, Schedulable {

public CRLP_Account_BATCH() { }
/*******************************************************************************************************
* @description The CRLP_RollupProcessingOptions.RollupType of this class.
*/
private static final CRLP_RollupProcessingOptions.RollupType jobType =
CRLP_RollupProcessingOptions.RollupType.AccountHardCredit;

/*******************************************************************************************************
* @description Constructs the class, passing the RollupType of this class.
*/
public CRLP_Account_BATCH() {
super(jobType);
}

/*******************************************************************************************************
* @description Constructs the class - Rollup all Accounts that meet the "Non Skew" criteria
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
*/
public CRLP_Account_BATCH(CRLP_RollupProcessingOptions.RollupTypeFilter jobFilter) {
super(CRLP_RollupProcessingOptions.RollupType.AccountHardCredit, jobFilter);
super(jobType, jobFilter);
}

/*******************************************************************************************************
* @description Constructs the class - Rollup is for a specific set of Account Id's
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
* @param recordIds Specific set of parent record id's to roll up to
*/
public CRLP_Account_BATCH(List<Id> recordIds) {
super(CRLP_RollupProcessingOptions.RollupType.AccountHardCredit, recordIds);
super(jobType, recordIds);
}

/*******************************************************************************************************
* @description Constructs the class - Rollup is for a specific set of Account Id's
* @param lastIdProcessedForChunking The last Id retrieved in the previous batch. Used in chunk mode.
*/
public CRLP_Account_BATCH(Id lastIdProcessedForChunking) {
super(jobType, lastIdProcessedForChunking);
}

/**
Expand All @@ -63,7 +80,7 @@ public class CRLP_Account_BATCH extends CRLP_Batch_Base_NonSkew implements Datab
String className = CRLP_Account_BATCH.class.getName();
if (CRLP_Rollup_SVC.isCustomizableRollupEngineEnabled) {
if (!UTIL_MasterSchedulableHelper.hasRunningJob(className)) {
CRLP_RollupBatch_SVC.executeBatchRollupJob(CRLP_RollupProcessingOptions.RollupType.AccountHardCredit,
CRLP_RollupBatch_SVC.executeBatchRollupJob(jobType,
CRLP_RollupProcessingOptions.BatchJobMode.NonSkewMode);
} else {
logDuplicateBatchError(className);
Expand Down
4 changes: 1 addition & 3 deletions src/classes/CRLP_Account_SoftCredit_BATCH.cls
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class CRLP_Account_SoftCredit_BATCH extends CRLP_Batch_Base_NonSkew imple

/*******************************************************************************************************
* @description Constructs the class - Rollup all Accounts that meet the "Non Skew" criteria
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
*/
public CRLP_Account_SoftCredit_BATCH(CRLP_RollupProcessingOptions.RollupTypeFilter jobFilter) {
Expand All @@ -49,8 +48,7 @@ public class CRLP_Account_SoftCredit_BATCH extends CRLP_Batch_Base_NonSkew imple

/*******************************************************************************************************
* @description Constructs the class - Rollup is for a specific set of Account Id's
* @param jobType Defines the type of rollup job
* @param jobFilter Allows for filtering the rollups on N-Day, Memberships, etc.
* @param recordIds Specific set of parent record id's to roll up to
*/
public CRLP_Account_SoftCredit_BATCH(List<Id> recordIds) {
super(CRLP_RollupProcessingOptions.RollupType.AccountContactSoftCredit, recordIds);
Expand Down
Loading

0 comments on commit 4f0859a

Please sign in to comment.