Skip to content

Class Name: AnonymizationSchedulerOne

Last Updated: 2025-10-22 Source Code: AnonymizationSchedulerOne.cls

API Name: AnonymizationSchedulerOne Type: Schedulable Test Coverage: Not specified

Business Purpose

This scheduler coordinates the execution of multiple anonymization batch jobs as part of AANP's GDPR compliance workflow. It orchestrates the first phase of data anonymization by launching contact point address, practice site, order, and Chargent order anonymization processes simultaneously, ensuring systematic and comprehensive personal data protection across multiple object types.

Class Overview

Scope and Sharing

  • Sharing Model: with sharing
  • Access Modifier: public
  • Interfaces Implemented: Schedulable

Key Responsibilities

  • Orchestrates first phase of GDPR anonymization batch processing
  • Launches UpdateContactPointAddressBatch for address anonymization
  • Executes UpdatePracticeSiteBatch for practice location data anonymization
  • Runs UpdateOrderBatch for order address anonymization
  • Initiates UpdateChargentOrdersBatch for payment order anonymization
  • Coordinates simultaneous execution of multiple batch processes

Public Methods

execute

public void execute(SchedulableContext sc)

Purpose: Main entry point for scheduled execution that launches all four anonymization batch processes simultaneously.

Parameters: - sc (SchedulableContext): Standard Salesforce schedulable context provided by the platform

Returns: - void: No return value

Throws: - No explicit exception handling

Usage Example:

// Schedule to run daily at 2 AM
String cronExpression = '0 0 2 * * ?';
System.schedule('Daily Anonymization Phase 1', cronExpression, new AnonymizationSchedulerOne());

Business Logic: - Creates instances of four batch classes - Executes each batch with a scope of 200 records - All batches start simultaneously without dependency management - No error handling or status tracking between batches


Private/Helper Methods

No private helper methods in this class.


Dependencies

Apex Classes

  • UpdateContactPointAddressBatch: Handles anonymization of ContactPointAddress records
  • UpdatePracticeSiteBatch: Handles anonymization of practice site records
  • UpdateOrderBatch: Handles anonymization of Order records
  • UpdateChargentOrdersBatch: Handles anonymization of Chargent payment order records

Salesforce Objects

  • ContactPointAddress: Addresses requiring anonymization
  • Practice_Site__c (assumed): Practice locations requiring anonymization
  • Order: Order records requiring anonymization
  • ChargentOrders__ChargentOrder__c: Chargent payment orders requiring anonymization

Custom Settings/Metadata

  • No custom settings or metadata dependencies identified

External Services

  • Salesforce Scheduled Apex framework
  • Database.executeBatch framework

Design Patterns

  • Orchestrator Pattern: Coordinates multiple batch processes to achieve a larger business goal
  • Fire-and-Forget Pattern: Launches batch jobs without tracking or managing their completion
  • Batch Processing Pattern: Uses Salesforce batch framework for large-scale data operations

Governor Limits Considerations

SOQL Queries: None in this class (delegated to batch classes) DML Operations: None in this class (delegated to batch classes) CPU Time: Minimal - only instantiates batch classes Heap Size: Minimal - no data processing in scheduler

Bulkification: Yes - Delegates to bulkified batch processes Async Processing: Yes - Uses Database.executeBatch with 200 record scope per batch

Governor Limit Risks: - Simultaneous execution of 4 batch jobs could compete for shared governor limits - No coordination to prevent overlapping batch executions if scheduler runs frequently - 200 record batch size may need tuning based on actual batch complexity

Error Handling

Strategy: No error handling implemented Logging: No logging implemented User Notifications: No notifications implemented

Critical Gaps: - Failed batch instantiations or launches will fail silently - No mechanism to alert compliance team of failures - No audit trail of execution attempts

Security Considerations

Sharing Rules: Respects sharing (with sharing keyword) Field-Level Security: Not applicable in this class (delegated to batch classes) CRUD Permissions: Not applicable in this class (delegated to batch classes) Input Validation: No user input to validate

Security Notes: - Schedulable context runs in system mode by default - Batch classes should implement appropriate security checks

Test Class

Test Class: Not specified Coverage: Not specified Test Scenarios Covered: - Should verify all four batch classes are instantiated - Should verify Database.executeBatch is called for each batch - Should verify batch size of 200 is used - Should test scheduling and unscheduling

Changes & History

No change history documented.

Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • No error handling or monitoring - Failed batches won't be detected or reported
  • No dependency management - Batches run independently without coordination
  • Simultaneous batch execution - Four batches starting simultaneously could exceed governor limits
  • Missing SOQL exception handling - Batch class instantiation failures will cause scheduler failure
  • No completion tracking - No way to verify all batches completed successfully

HIGH - Address Soon After Go-Live

  • No logging or audit trail - Limited visibility into anonymization progress
  • Missing batch completion validation - No verification that all batches completed successfully
  • No notification system - Compliance team not alerted to completion or failures
  • No scheduling conflict prevention - Could run multiple times if previous execution hasn't completed

MEDIUM - Future Enhancement

  • Batch size should be configurable - Hard-coded 200 may not be optimal for all scenarios
  • No scheduling frequency management - Could run more frequently than needed
  • Missing integration with AnonymizationSchedulerTwo - No coordination between scheduler phases
  • No monitoring dashboard - Compliance team needs visibility into execution status

LOW - Monitor

  • Class name indicates ordering dependency - Naming suggests this is part of a sequence
  • No documentation of execution timing - Optimal scheduling frequency not documented
  • Limited context for batch selection - Business logic for why these four batches not documented

Maintenance Notes

Complexity: Low Recommended Review Schedule: Quarterly

Key Maintainer Notes: - This is a critical component of GDPR compliance scheduling that requires careful monitoring - Consider implementing comprehensive logging and batch completion tracking - Consider sequential execution logic to prevent resource conflicts - Coordinate with legal/compliance team on scheduling frequency and requirements - Implement alerting for failed anonymization processes - Document relationship with AnonymizationSchedulerTwo - The UpdateChargentOrdersBatch was added to the code but not mentioned in original documentation - All four batches execute with 200 record scope - may need individual tuning - No built-in retry mechanism if batches fail

Critical Dependencies: - All four batch classes must be deployed and functional - Sufficient batch Apex and flex queue capacity must be available - System must have capacity to handle four simultaneous batch jobs