diff --git a/README.md b/README.md index 361c97c..f99a871 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ graph TD feature-toggle --> platform-datamodel; feature-toggle --> custom-metadata-dao; feature-toggle --> custom-pemission-helper; + platform-interfaces ``` ## Komme i gang diff --git a/sfdx-project.json b/sfdx-project.json index 04336ba..80354de 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -48,10 +48,9 @@ ] }, { - "path": "src/application-monitoring", - "package": "application-monitoring", - "versionNumber": "0.1.0.NEXT", - "definitionFile": "config/scratch-org-def.json" + "path": "src/platform-utility/platform-interfaces", + "package": "platform-interfaces", + "versionNumber": "0.1.0.NEXT" } ], "packageAliases": { @@ -59,6 +58,6 @@ "custom-metadata-dao": "0HoKB000000000B0AQ", "custom-permission-helper": "0HoKB000000000f0AA", "feature-toggle": "0HoKB000000000V0AQ", - "application-monitoring": "0HoQC00000004d70AA" + "platform-interfaces": "0HoKB000000000Q0AQ" } } diff --git a/src/application-monitoring/README.md b/src/application-monitoring/README.md deleted file mode 100644 index 04bc857..0000000 --- a/src/application-monitoring/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# application-monitoring - -## Application Log - -This package contains an application logging framework that can be used for logging various events either på utilizing the _LoggerUtility_ apex class, or by generating _Application_Log\_\_c_ records via process builder, flow, workflow etc. The logger has four log levels: (Error, Warning, Info, Critical). It is highly recommended to also pass a _CRM_ApplicationDomain.Domain_ parameter, which defines which area of the application is both creating the log entry and is responsible for follow up. Calling the respective logger methods can be done as shown: - -```Apex -LoggerUtility logger = new LoggerUtility(); -logger.Info('Message', SObjectRef, domain); -logger.Warning('Message', SObjectRef, domain); -logger.Error('Message', SObjectRef, domain); -logger.Critical('Message', SObjectRef, domain); - -logger.Exception(ex, domain) //Used for logging catched exceptions -logger.publish(); -``` - -The logger framework automatically adds the stacktrace, source function and source class to the log record when creating a log entry. To allow for application logging while also rolling back a transaction the framework includes also an _Application_Event\_\_e_ platform event counterpart that can be published even when rolling back transactions, _the standard publish() will generate a platform event_. Each log entry generates an unique UUID at runtime that can be handy for i.e. callouts requiring unique callout references in the callout chain. This examples returns the UUID of the last logged event: -`logger.peek().UUID__c` - -The data model is available in [platform-data-model](src/platform-data-model/README.md) - -| | | -| ------- | --- | -| Apex | ✅ | -| LWC | ✅ | -| Flow | ✅ | -| Trigger | ✅ | - -```` - -## Dependencies - -- [platform-datamodel](src/platform-data-model/feature-flag-custom-metadata) - data model - -```mermaid ---- -title: Package dependencies ---- -graph TD - application-monitoring --> platform-datamodel; -```` diff --git a/src/application-monitoring/main/classes/ApplicationLogPublisher.cls b/src/application-monitoring/main/classes/ApplicationLogPublisher.cls deleted file mode 100644 index 847e1ed..0000000 --- a/src/application-monitoring/main/classes/ApplicationLogPublisher.cls +++ /dev/null @@ -1,181 +0,0 @@ -@SuppressWarnings('PMD') -public class ApplicationLogPublisher { - public static Application_Log_Setting__mdt testSetting; - //Introduce setting to determine if messages should be published also for sandboxes - private static Boolean isSandbox = [ - SELECT Id, isSandbox - FROM Organization - LIMIT 1 - ] - .isSandbox; - - /** - * @description: Performs a check on created application logs to see if any meet - * the requirements for publishing to slack channels. - * @author Stian Ruud Schikora | 02-23-2021 - * @param appLogs - **/ - public static void publishLogs(List appLogs) { - Set appDomains = new Set(); - List logsToPublish = new List(); - - for (Application_Log__c log : appLogs) { - appDomains.add(log.Application_Domain__c); - } - - List logSettings = getLogSettings( - appDomains - ); - - for (Application_Log__c log : appLogs) { - for (Application_Log_Setting__mdt setting : logSettings) { - if ( - log.Application_Domain__c == setting.Application_Domain__c - ) { - String hook = getHook(setting); - if ( - getLogLevelOrdinal(log.Log_Level__c) >= - getLogLevelOrdinal(setting.Minimum_Log_Level__c) && - setting.Category__c == log.Category__c - ) { - if ( - Setting.Immediate_Post__c && String.isNotBlank(hook) - ) { - logsToPublish.add( - new AppLog( - log, - hook, - Setting.Message_Template__c - ) - ); - } - } - } else { - continue; - } - } - } - - if (!logsToPublish.isEmpty()) { - //If there are more logs to publish than the transactional callout limit, generate several future contexts - if (logsToPublish.size() > Limits.getLimitCallouts()) { - List listToPublish = new List(); - while (logsToPublish.size() > 0) { - listToPublish.add(logsToPublish.remove(0)); - if (listToPublish.size() == Limits.getLimitCallouts()) { - publishToSlack(JSON.serialize(listToPublish)); - listToPublish.clear(); - } - } - } else { - publishToSlack(JSON.serialize(logsToPublish)); - } - } - } - - @future(Callout=true) - private static void publishToSlack(String jsonAppLogs) { - List logs = (List) JSON.deserialize( - jsonAppLogs, - List.class - ); - ApiController apiCtrl = new ApiController(); - for (AppLog log : logs) { - apiCtrl.setEndpoint(log.slackHook); - apiCtrl.setMethod('POST'); - apiCtrl.addHeader('Content-Type', 'application/json'); - - SlackMessage message = new SlackMessage(log.messageTemplate); - String errorMessage = - 'Log level: ' + - log.logRecord.Log_Level__c + - '\n Source: ' + - log.logRecord.Source_Class__c + - '\n Link: ' + - URL.getSalesforceBaseUrl().toExternalForm() + - '/' + - log.logRecord.Id + - '\n Message: ' + - log.logRecord.Log_Message__c; - message.addSection(errorMessage); - - apiCtrl.setBody(JSON.serialize(message)); - - apiCtrl.doCallout(); - } - } - - /** - * @description: Queries the relevant log settings for the defined application domains - * @author Stian Ruud Schikora | 02-23-2021 - * @param appDomains - * @return List - **/ - private static List getLogSettings( - Set appDomains - ) { - if (Test.isRunningTest()) { - return testSetting != null - ? new List{ testSetting } - : new List(); - } - return [ - SELECT - Id, - MasterLabel, - Application_Domain__c, - Slack_Hook__c, - Slack_Hook_Sandbox__c, - Message_Template__c, - Immediate_Post__c, - Minimum_Log_Level__c, - Named_Credential__c, - Category__c - FROM Application_Log_Setting__mdt - WHERE Application_Domain__c IN :appDomains - ]; - } - - /** - * @description: Returns the correct slack hook for production or sandbox. - * @author Stian Ruud Schikora | 03-13-2021 - * @param logSetting - * @return String - **/ - private static String getHook(Application_Log_Setting__mdt logSetting) { - if (isSandbox) { - return logSetting.Slack_Hook_Sandbox__c; - } - - return String.isNotBlank(logSetting.Named_Credential__c) - ? 'callout:' + logSetting.Named_Credential__c - : logSetting.Slack_Hook__c; - } - - /** - * @description: Returns the log level ordinal for a input loglevel string - INFO = 0, WARNING = 1, ERROR = 2, CRITICAL = 3 - * @author Stian Ruud Schikora | 02-22-2021 - * @param logLevel - * @return Integer - **/ - private static Integer getLogLevelOrdinal(String logLevel) { - return LoggerUtility.inverseLevelMap.get(logLevel).ordinal(); - } - - private class AppLog { - private AppLog( - Application_Log__c appLog, - String slackHook, - String messageTemplate - ) { - this.logRecord = appLog; - this.slackHook = slackHook; - this.messageTemplate = messageTemplate; - } - - private Application_Log__c logRecord; - private String slackHook; - private String messageTemplate; - } -} diff --git a/src/application-monitoring/main/classes/ApplicationLogPublisher.cls-meta.xml b/src/application-monitoring/main/classes/ApplicationLogPublisher.cls-meta.xml deleted file mode 100644 index 133fce1..0000000 --- a/src/application-monitoring/main/classes/ApplicationLogPublisher.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 58.0 - Active - diff --git a/src/application-monitoring/main/classes/CRM_DatabaseOperations.cls b/src/application-monitoring/main/classes/CRM_DatabaseOperations.cls deleted file mode 100644 index 8c2fdd4..0000000 --- a/src/application-monitoring/main/classes/CRM_DatabaseOperations.cls +++ /dev/null @@ -1,416 +0,0 @@ -@SuppressWarnings('PMD') -public inherited sharing class CRM_DatabaseOperations { - private LoggerUtility logger = new LoggerUtility(); - private Boolean allOrNone = false; - private Boolean isVerbose = false; - private Boolean emptyRecyclebin = false; - private Integer numberOfRetries = 0; - private Integer maxRetries = -10; - private CRM_ApplicationDomain.Domain domain = CRM_ApplicationDomain.Domain.CRM; - - public CRM_DatabaseOperations() { - } - - // Set the AllOrNone database operations parameter. Defaults to false. - public CRM_DatabaseOperations setAllOrNone() { - this.allOrNone = true; - return this; - } - - // Set how many times processing failed records should be retried. Records with unable to lock errors are automatically retried. - public CRM_DatabaseOperations setNumberOfRetries(Integer numberOfRetries) { - this.numberOfRetries = numberOfRetries; - return this; - } - - // Sets the logging to verbose - i.e. every database operations error for every record is logged. Defaults to false. - public CRM_DatabaseOperations setVerbose() { - this.isVerbose = true; - return this; - } - - // Sets the current environmental domain. Defaults to CRM. - public CRM_DatabaseOperations setDomain( - CRM_ApplicationDomain.Domain domain - ) { - this.domain = domain; - return this; - } - - // Sets the maximum number of retries for records with unable to lock errors. Defaults to 10. - public CRM_DatabaseOperations setMaxRetries(Integer maxRetries) { - this.maxRetries = 0 - maxRetries; - return this; - } - - // Sets the EmptyRecyclebin parameter for permanent deletion. - public CRM_DatabaseOperations setEmptyRecyclebin() { - this.emptyRecyclebin = true; - return this; - } - - // Safely insert record(s) with logging and retries - public void insertRecords(List records) { - processRecords(records, CRM_DatabaseOperations.ProcessingType.INSERT_T); - } - - public void insertRecords(SObject record) { - processRecords( - new List{ record }, - CRM_DatabaseOperations.ProcessingType.INSERT_T - ); - } - - // Safely update record(s) with logging and retries - public void updateRecords(List records) { - processRecords(records, CRM_DatabaseOperations.ProcessingType.UPDATE_T); - } - - public void updateRecords(SObject record) { - processRecords( - new List{ record }, - CRM_DatabaseOperations.ProcessingType.UPDATE_T - ); - } - - // Safely upsert record(s) with logging and retries - public void upsertRecords(List records) { - processRecords(records, CRM_DatabaseOperations.ProcessingType.UPSERT_T); - } - - public void upsertRecords(SObject record) { - processRecords( - new List{ record }, - CRM_DatabaseOperations.ProcessingType.UPSERT_T - ); - } - - // Safely delete record(s) with logging and retries - public void deleteRecords(List records) { - processRecords(records, CRM_DatabaseOperations.ProcessingType.DELETE_T); - } - - public void deleteRecords(SObject record) { - processRecords( - new List{ record }, - CRM_DatabaseOperations.ProcessingType.DELETE_T - ); - } - - public void deleteRecords(Id recordId) { - processRecords( - recordIdsToSObject(new List{ recordId }), - CRM_DatabaseOperations.ProcessingType.DELETE_T - ); - } - - public void deleteRecords(List recordIds) { - processRecords( - recordIdsToSObject(recordIds), - CRM_DatabaseOperations.ProcessingType.DELETE_T - ); - } - - public void deleteRecords(Set recordIds) { - processRecords( - recordIdsToSObject(new List(recordIds)), - CRM_DatabaseOperations.ProcessingType.DELETE_T - ); - } - - // Safely undelete record(s) with logging and retries - public void undeleteRecords(List records) { - processRecords( - records, - CRM_DatabaseOperations.ProcessingType.UNDELETE_T - ); - } - - public void undeleteRecords(SObject record) { - processRecords( - new List{ record }, - CRM_DatabaseOperations.ProcessingType.UNDELETE_T - ); - } - - public void undeleteRecords(Id recordId) { - processRecords( - recordIdsToSObject(new List{ recordId }), - CRM_DatabaseOperations.ProcessingType.UNDELETE_T - ); - } - - public void undeleteRecords(List recordIds) { - processRecords( - recordIdsToSObject(recordIds), - CRM_DatabaseOperations.ProcessingType.UNDELETE_T - ); - } - - public void undeleteRecords(Set recordIds) { - processRecords( - recordIdsToSObject(new List(recordIds)), - CRM_DatabaseOperations.ProcessingType.UNDELETE_T - ); - } - - private void processRecords( - List records, - CRM_DatabaseOperations.ProcessingType type - ) { - // try to process all records - List rws = new List(); - Set recordIds = new Set(); - String processType = ''; - Savepoint sp = Database.setSavepoint(); - try { - recordIds = getRecordIds(records); - switch on type { - when INSERT_T { - processType = 'insert'; - for ( - Database.SaveResult sr : Database.insert( - records, - allOrNone - ) - ) { - rws.add(new ResultWrapper(sr)); - } - } - when UPDATE_T { - processType = 'update'; - for ( - Database.SaveResult sr : Database.update( - records, - allOrNone - ) - ) { - rws.add(new ResultWrapper(sr)); - } - } - when UPSERT_T { - processType = 'upsert'; - for ( - Database.UpsertResult ur : Database.upsert( - records, - allOrNone - ) - ) { - rws.add(new ResultWrapper(ur)); - } - } - when DELETE_T { - processType = 'delete'; - for ( - Database.DeleteResult dr : Database.delete( - records, - allOrNone - ) - ) { - rws.add(new ResultWrapper(dr)); - } - if (emptyRecyclebin) - Database.emptyRecycleBin(records); - } - when UNDELETE_T { - processType = 'undelete'; - for ( - Database.UndeleteResult udr : Database.undelete( - records, - allOrNone - ) - ) { - rws.add(new ResultWrapper(udr)); - } - } - when else { - logger.critical( - 'Unknown operation type for data processing.', - null, - domain - ); - } - } - } catch (Exception e) { - logger.critical( - 'Exception on ' + - processType + - '! ' + - e.getMessage() + - ' Stack trace: ' + - e.getStackTraceString(), - null, - domain - ); - logger.publish(); - Database.rollback(sp); - } - - retryFailedRecords(rws, recordIds, type, records); - } - - private void retryFailedRecords( - List results, - Set recordId, - CRM_DatabaseOperations.ProcessingType type, - List records - ) { - // once all retries are exhausted, log any persistent errors. If verbose, log all errors. - // additionally, automatically retry records that failed due to UNABLE_TO_LOCK_ROW errors. (Limited by maxRetries) - Set successfulRecords = new Set(); - Boolean isUnableToLock = false; - Set recordIds = recordId == null ? new Set() : recordId; - - for (ResultWrapper rw : results) { - if (rw.errors.isEmpty() || rw.errors == null) { - successfulRecords.add(rw.recordId); - } else { - for (Database.Error er : rw.errors) { - if ( - er.getStatusCode() == - System.StatusCode.UNABLE_TO_LOCK_ROW - ) - isUnableToLock = true; - if ( - isVerbose || - (numberOfRetries <= 0 && !isUnableToLock) || - numberOfRetries == maxRetries - ) { - logger.error( - 'Processing returned error: ' + - er.getStatusCode() + - ': ' + - er.getMessage() + - '\n Stacktrace: ' + - getMinimalStackTrace(), - null, - domain - ); - } - } - } - } - recordIds.removeAll(successfulRecords); - if (!recordIds.isEmpty()) - logger.error( - 'Record Ids that failed to process: ' + recordIds, - null, - domain - ); - - // publish all excisting errors - if (logger.peek() != null) - logger.publish(); - - // if there are failed record ids, find the associated records and recursively try to process them again. - if (!recordIds.isEmpty() || successfulRecords.size() < records.size()) { - List recordsToRetry = new List(); - for (SObject record : records) { - if ( - (record.Id == null || - !successfulRecords.contains(record.Id)) && - (numberOfRetries > 0 || isUnableToLock) - ) { - recordsToRetry.add(record); - } - if ( - record.Id == null && - (isVerbose || (numberOfRetries <= 0 && !isUnableToLock)) - ) { - logger.error( - 'Record failed to process: ' + record, - null, - domain - ); - } - } - if (logger.peek() != null) - logger.publish(); - numberOfRetries -= 1; - if (numberOfRetries >= maxRetries && !recordsToRetry.isEmpty()) - processRecords(recordsToRetry, type); - } - } - - // Returns a set of record ids from a List of records - private Set getRecordIds(List records) { - Set recordIds = new Set(); - for (SObject so : records) { - if (so.Id != null) - recordIds.add(so.Id); - } - return recordIds; - } - - // Creates a list of SObjects from a List of Ids without querying the database - private List recordIdsToSObject(List recordIds) { - if (!recordIds.isEmpty()) { - String sObjectType = String.valueOf(recordIds[0].getSobjectType()); - List toDelete = new List(); - - for (Id recordId : recordIds) { - sObject sObj = (SObject) Type.forName(sObjectType) - .newInstance(); - sObj.Id = recordId; - toDelete.add(sObj); - } - return toDelete; - } - return null; - } - - // Returns the calling class, method, line. Adapted from LoggerUtility.getStackTrace() - private String getMinimalStackTrace() { - String stackTrace = ''; - System.debug('--- IGNORE EXCEPTION START ---'); - try { - String str; - str.length(); - } catch (Exception e) { - stackTrace = e.getStackTraceString() - .substringAfterLast('Class.CRM_DatabaseOperations') - .substringAfter('column 1') - .substringAfter('Class.') - .substringBefore('\n'); - } - System.debug('--- IGNORE EXCEPTION END ---'); - return stackTrace; - } - - private enum ProcessingType { - INSERT_T, - UPDATE_T, - UPSERT_T, - DELETE_T, - UNDELETE_T - } - - private class ResultWrapper { - public Id recordId; - public List errors = new List(); - - public ResultWrapper(Database.SaveResult sr) { - recordId = sr.getId(); - if (!sr.isSuccess()) - this.errors = sr.getErrors(); - } - - public ResultWrapper(Database.UpsertResult ur) { - recordId = ur.getId(); - if (!ur.isSuccess()) - this.errors = ur.getErrors(); - } - - public ResultWrapper(Database.DeleteResult dr) { - recordId = dr.getId(); - if (!dr.isSuccess()) - this.errors = dr.getErrors(); - } - - public ResultWrapper(Database.UndeleteResult udr) { - recordId = udr.getId(); - if (!udr.isSuccess()) - this.errors = udr.getErrors(); - } - } -} diff --git a/src/application-monitoring/main/classes/LoggerUtility.cls b/src/application-monitoring/main/classes/LoggerUtility.cls deleted file mode 100644 index b61c2b3..0000000 --- a/src/application-monitoring/main/classes/LoggerUtility.cls +++ /dev/null @@ -1,572 +0,0 @@ -@SuppressWarnings('PMD') -public without sharing class LoggerUtility extends CRM_ApplicationDomain { - public enum LogLevel { - INFO, - API_TRANSACTION, - WARNING, - ERROR, - CRITICAL - } - - public static Map levelMap = new Map{ - LogLevel.ERROR => 'Error', - LogLevel.WARNING => 'Warning', - LogLevel.INFO => 'Info', - LogLevel.API_TRANSACTION => 'API Transaction', - LogLevel.CRITICAL => 'Critical' - }; - - public static Map inverseLevelMap = new Map{ - 'Error' => LogLevel.ERROR, - 'Warning' => LogLevel.WARNING, - 'Info' => LogLevel.INFO, - 'API Transaction' => LogLevel.API_TRANSACTION, - 'Critical' => LogLevel.CRITICAL - }; - - private List logs = new List(); - public String category { public get; private set; } // Category stored on the logs for easier filtering - public String domain { public get; private set; } // Domain stored on the logs for easier filtering - - @AuraEnabled(cacheable=true) - public static void singleLog( - String category, - String domain, - String logLevel, - String payload, - String message, - String recordId - ) { - LoggerUtility logger = new LoggerUtility(category); - LogLevel logLvl = inverseLevelMap.get(logLevel); - Id id = null; - if (!String.isBlank(recordId)) { - try { - id = (Id) recordId; - } catch (StringException exp) { - id = null; - } - } - String objectName = id?.getSobjectType()?.getDescribe()?.getName(); - Domain dom = logger.domainNameMap.get(domain); - logger.logMessage( - logLvl, - (string) id, - objectName, - message, - payload, - null, - dom - ); - logger.publish(); - } - - public LoggerUtility() { - this.category = ''; - } - - public LoggerUtility(String category) { - this.category = category; - } - - /** - * @description Allows specifying the domain immediately. - * @param domain - * @param category - */ - public LoggerUtility(CRM_ApplicationDomain.Domain domain, String category) { - this.category = category; - this.domain = domainMap.get(domain); - } - - public LoggerUtility setCategory(String category) { - this.category = category; - return this; - } - - public void logMessage( - LogLevel logLevel, - String referenceId, - String referenceInfo, - String logMessage, - String payLoad, - long timeTaken, - Domain domain - ) { - logMessage( - logLevel, - referenceId, - referenceInfo, - logMessage, - payLoad, - timeTaken - ); - peek().Application_Domain__c = domainMap.get(domain); - } - - public void logMessage( - LogLevel logLevel, - String referenceId, - String referenceInfo, - String logMessage, - String payLoad, - long timeTaken - ) { - Application_Event__e event = new Application_Event__e( - Log_Level__c = levelMap.get(logLevel), - Source_Class__c = getSourceClass(), - Source_Function__c = getSourceFunction(), - ReferenceId__c = referenceId, - Reference_Info__c = referenceInfo, - Log_Messages__c = logMessage, - Payload__c = payLoad, - UUID__c = Request.getCurrent().getRequestId(), - User_Context__c = UserInfo.getUserId(), - Category__c = this.category, - Application_Domain__c = this.domain - ); - logs.add(event); - } - /** - * @description Method to publish the created event - * @author Lars Petter Johnsen - */ - public void publish() { - EventBus.publish(logs); - logs.clear(); - } - - @InvocableMethod( - label='Create Application Log' - description='Call apex to store application log in DB' - category='Application Logging' - ) - public static void handleLogRequests(List request) { - LoggerUtility flowLogger = new LoggerUtility(); - Boolean hasDomain; - for (LogRequest req : request) { - hasDomain = String.isNotBlank(req.domain); - switch on req.logLevel { - when 'INFO' { - if (hasDomain) { - flowLogger.info( - req.logMessage, - req.refRecord, - CRM_ApplicationDomain.Domain.valueOf(req.domain) - ); - } else { - flowLogger.info(req.logMessage, req.refRecord); - } - } - when 'WARNING' { - if (hasDomain) { - flowLogger.warning( - req.logMessage, - req.refRecord, - CRM_ApplicationDomain.Domain.valueOf(req.domain) - ); - } else { - flowLogger.warning(req.logMessage, req.refRecord); - } - } - when 'ERROR' { - if (hasDomain) { - flowLogger.error( - req.logMessage, - req.refRecord, - CRM_ApplicationDomain.Domain.valueOf(req.domain) - ); - } else { - flowLogger.error(req.logMessage, req.refRecord); - } - } - when 'CRITICAL' { - if (hasDomain) { - flowLogger.critical( - req.logMessage, - req.refRecord, - CRM_ApplicationDomain.Domain.valueOf(req.domain) - ); - } else { - flowLogger.critical(req.logMessage, req.refRecord); - } - } - } - flowLogger.peek().Source_Class__c = req.source; - flowlogger.peek().Category__c = req.category; - } - - flowLogger.publish(); - } - - /** - * @description returns a UUID from the System.UUID class - * @return String - * @author Stian Ruud Schikora | 11-03-2020 - **/ - @TestVisible - private static String getUuid() { - return System.UUID.randomUUID().toString(); - } - - /** - * @description Performs a conversion from event to object allowing direct database insert - * @author Stian Ruud Schikora | 11-02-2020 - * @return List - **/ - public List publishSynch() { - List convertedLogs = convertToLogs(); - insert convertedLogs; - return convertedLogs; - } - - /** - * @description Converts application event list directly to logs - * @author Stian Ruud Schikora | 11-02-2020 - * @return List - **/ - private List convertToLogs() { - List convertedLogs = new List(); - for (Application_Event__e event : logs) { - convertedLogs.add(convertToLog(event)); - } - - return convertedLogs; - } - - public static List convertToLogs( - List eventsToConvert - ) { - List convertedLogs = new List(); - for (Application_Event__e event : eventsToConvert) { - if ( - inverseLevelMap.get(event.Log_Level__c) != - LogLevel.API_Transaction - ) { - convertedLogs.add(convertToLog(event)); - } - } - - return convertedLogs; - } - - /** - * @description Convert an application event to an application log - * @author Stian Ruud Schikora | 11-02-2020 - * @param event - * @return Application_Log__c - **/ - public static Application_Log__c convertToLog(Application_Event__e event) { - Application_Log__c log = new Application_Log__c(); - log.Log_Level__c = event.Log_Level__c; - log.Log_Message__c = event.Log_Messages__c; - log.Pay_Load__c = event.Payload__c; - log.Referrence_ID__c = event.ReferenceId__c; - log.Referrence_Info__c = event.Reference_Info__c; - log.Source_Class__c = event.Source_Class__c; - log.Source_Function__c = event.Source_Function__c; - log.UUID__c = event.UUID__c; - log.User_Context__c = event.User_Context__c; - log.Application_Domain__c = event.Application_Domain__c; - log.Category__c = event.Category__c; - return log; - } - - /** - * @description Returns the base endpoint from the requestUri - * @author Stian Ruud Schikora | 07-18-2021 - * @param requestUri - * @return String - **/ - private static String getBaseEndpoint(String requestUri) { - String strippedUri = requestUri.substringBefore('?'); //Get the URI without any query parameters - String http = strippedUri.substringBetween('http://', '/') != null - ? strippedUri.substringBetween('http://', '/') - : strippedUri.substringAfter('http://'); - String https = strippedUri.substringBetween('https://', '/') != null - ? strippedUri.substringBetween('https://', '/') - : strippedUri.substringAfter('https://'); - - return String.isNotBlank(https) - ? https.abbreviate(40) - : String.isNotBlank(http) - ? http.abbreviate(40) - : strippedUri.abbreviate(40); - } - - /** - * @description Returns the latest entry in the logs or null if no logs has been added - * - * @return `Application_Event__e` - **/ - public Application_Event__e peek() { - return (logs.isEmpty() ? null : logs.get(logs.size() - 1)); - } - - public void info(String message, sObject obj) { - logMessage( - logLevel.Info, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null - ); - } - - public void warning(String message, sObject obj) { - logMessage( - logLevel.Warning, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null - ); - } - - public void error(String message, sObject obj) { - logMessage( - logLevel.Error, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null - ); - } - - public void critical(String message, sObject obj) { - logMessage( - logLevel.Critical, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null - ); - } - - /** - * @description Simplest way to just log info with an existing LoggerUtility - * @param message - */ - public void infoAndPublish(String message) { - info(message, null); - publish(); - } - - /** - * @description Simplest way to just log a warning with an existing LoggerUtility - * @param message - */ - public void warningAndPublish(String message) { - warning(message, null); - publish(); - } - - /** - * @description Simplest way to just log an error with an existing LoggerUtility - * @param message - */ - public void errorAndPublish(String message) { - error(message, null); - publish(); - } - - /** - * @description Simplest way to just log a critical error with an existing LoggerUtility - * @param message - */ - public void criticalAndPublish(String message) { - critical(message, null); - publish(); - } - - public void exception(Exception ex) { - logMessage( - logLevel.Critical, - '', - '', - ex.getMessage(), - ex.getStackTraceString(), - null - ); - } - - public void exception(Exception ex, sObject obj) { - logMessage( - logLevel.Critical, - getObjectId(obj), - getObjectName(obj), - ex.getMessage(), - ex.getStackTraceString(), - null - ); - } - - public void info(String message, sObject obj, Domain domain) { - logMessage( - logLevel.Info, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null, - domain - ); - } - - public void warning(String message, sObject obj, Domain domain) { - logMessage( - logLevel.Warning, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null, - domain - ); - } - - public void error(String message, sObject obj, Domain domain) { - logMessage( - logLevel.Error, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null, - domain - ); - } - - public void error(String message, sObject obj, Domain domain, String uuid) { - error(message, obj, domain); - peek().UUID__c = uuid; //Overwrites the autogenerated UUID with the input - } - - public void critical(String message, sObject obj, Domain domain) { - logMessage( - logLevel.Critical, - getObjectId(obj), - getObjectName(obj), - message, - JSON.serializePretty(obj), - null, - domain - ); - } - - public void httpError( - String message, - HttpResponse response, - sObject obj, - Domain domain - ) { - String payload = - 'HTTP Status: ' + - String.valueOf(response.getStatusCode()) + - ' - ' + - response.getStatus() + - '\n'; - payload += 'Body: \n' + response.getBody(); - - payload += obj != null - ? '\n sObject: \n' + JSON.serializePretty(obj) - : ''; - - logMessage( - logLevel.Error, - getObjectId(obj), - getObjectName(obj), - message, - payload, - null, - domain - ); - } - - public void httpError( - String message, - HttpResponse response, - sObject obj, - Domain domain, - String uuid - ) { - httpError(message, response, obj, domain); - peek().UUID__c = uuid; //Overwrites the autogenerated UUID with the input - } - - public void exception(Exception e, Domain domain) { - exception(e, null, domain); - } - - public void exception(Exception ex, sObject obj, Domain domain) { - logMessage( - logLevel.Critical, - getObjectId(obj), - getObjectName(obj), - ex.getMessage(), - ex.getStackTraceString(), - null, - domain - ); - } - - private static String getSourceClass() { - String stackTrace = getStackTrace(); - - String sourceClass = stackTrace.substringAfter('Class.') - .substringBefore('.'); - - return sourceClass; - } - - private String getObjectName(sObject obj) { - return obj == null ? '' : obj.getSObjectType().getDescribe().getName(); - } - - private String getObjectId(sObject obj) { - return obj != null ? obj.Id : null; - } - - private static String getSourceFunction() { - String sourceFunction = getStackTrace() - .substringAfter(getSourceClass() + '.') - .substringBefore(':'); - - return sourceFunction; - } - - private static String getStackTrace() { - String stackTrace = ''; - try { - String str; - str.length(); - } catch (Exception e) { - stackTrace = e.getStackTraceString() - .substringAfterLast('Class.Logger') - .substringAfter('column 1'); - } - return stackTrace; - } - - public class LogRequest { - @InvocableVariable(label='Reference Record') - public SObject refRecord; - @InvocableVariable(label='Log Message') - public String logMessage; - @InvocableVariable(label='Domain') - public String domain; - @InvocableVariable( - label='Category' - description='Optional category for the log entry' - ) - public String category; - @InvocableVariable(label='Log Level (INFO, WARNING, ERROR, CRITICAL)') - public String logLevel; - @InvocableVariable(label='Source flow') - public String source; - } -} diff --git a/src/application-monitoring/main/classes/LoggerUtility.cls-meta.xml b/src/application-monitoring/main/classes/LoggerUtility.cls-meta.xml deleted file mode 100644 index 88ae4ad..0000000 --- a/src/application-monitoring/main/classes/LoggerUtility.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - Active - diff --git a/src/application-monitoring/main/classes/SlackMessage.cls b/src/application-monitoring/main/classes/SlackMessage.cls deleted file mode 100644 index bba05bd..0000000 --- a/src/application-monitoring/main/classes/SlackMessage.cls +++ /dev/null @@ -1,31 +0,0 @@ -@SuppressWarnings('PMD') -global class SlackMessage { - global List blocks; - - global SlackMessage(String text) { - this.blocks = new List(); - this.blocks.add(new Block(text)); - } - - global void addSection(String text) { - this.blocks.add(new Block(text)); - } - - private class Block { - private Block(String text) { - this.text = new Text(text); - } - - private final String type = 'section'; - private Text text; - } - - private class Text { - private Text(String text) { - this.text = text; - } - - private final String type = 'mrkdwn'; - private String text; - } -} diff --git a/src/application-monitoring/main/classes/SlackMessage.cls-meta.xml b/src/application-monitoring/main/classes/SlackMessage.cls-meta.xml deleted file mode 100644 index 88ae4ad..0000000 --- a/src/application-monitoring/main/classes/SlackMessage.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - Active - diff --git a/src/application-monitoring/main/flows/Flow_Create_Application_Log.flow-meta.xml b/src/application-monitoring/main/flows/Flow_Create_Application_Log.flow-meta.xml deleted file mode 100644 index fe7d412..0000000 --- a/src/application-monitoring/main/flows/Flow_Create_Application_Log.flow-meta.xml +++ /dev/null @@ -1,210 +0,0 @@ - - - 63.0 - Autolaunched flow used for creating log entries for i.e. error handling. - Default - Flow Create Application Log {!$Flow.CurrentDateTime} - - - BuilderType - - LightningFlowBuilder - - - - CanvasMode - - AUTO_LAYOUT_CANVAS - - - - OriginBuilderType - - LightningFlowBuilder - - - AutoLaunchedFlow - - Insert_Application_Log - - 176 - 134 - - Insert_fault_Application_Log - - - Application_Domain__c - - Application_Domain - - - - Category__c - - Log_Category - - - - Log_Level__c - - Log_Level - - - - Log_Message__c - - Log_Message - - - - Pay_Load__c - - Error_Payload - - - - Referrence_ID__c - - ReferenceID - - - - Referrence_Info__c - - Reference_Object - - - - Source_Class__c - - Error_Source - - - Application_Log__c - true - - - If flow fails to create an application log, we try to report this. - Insert_fault_Application_Log - - 440 - 242 - - Application_Domain__c - - PLATFORCE - - - - Category__c - - Logging - - - - Log_Level__c - - Error - - - - Log_Message__c - - Got error when calling this flow - - - - Pay_Load__c - - $Flow.FaultMessage - - - - Referrence_ID__c - - ReferenceID - - - - Source_Class__c - - Flow_Create_Application_Log - - - Application_Log__c - true - - SystemModeWithSharing - - 50 - 0 - - Insert_Application_Log - - - Active - - Domain for the log entry (Valid values are NKS, HOT, POAB, AAREG, IPS, AVVIK, PLATFORCE) - Application_Domain - String - false - true - false - - - Payload to be stored in application log. - Error_Payload - String - false - true - false - - - Where did the error originate - Error_Source - String - false - true - false - - - Optional category for the log entry - Log_Category - String - false - true - false - - - Log level for the entry (Info, Warning, Error or Critical) - Log_Level - String - false - true - false - - - Message to be logged. - Log_Message - String - false - true - false - - - Reference object type for the application log. - Reference_Object - String - false - true - false - - - Record reference for the application log. - ReferenceID - String - false - true - false - - diff --git a/src/application-monitoring/main/lwc/loggerUtility/loggerUtility.js b/src/application-monitoring/main/lwc/loggerUtility/loggerUtility.js deleted file mode 100644 index d5955ad..0000000 --- a/src/application-monitoring/main/lwc/loggerUtility/loggerUtility.js +++ /dev/null @@ -1,25 +0,0 @@ -import singleLog from "@salesforce/apex/LoggerUtility.singleLog"; - -export default class LoggerUtility { - static logError(domain, category, error, message, recordId) { - singleLog({ - domain: domain, - category: category, - payload: JSON.stringify(error), - logLevel: "Error", - recordId: recordId, - message: message, - }); - } - - static logInfo(domain, category, error, message, recordId) { - singleLog({ - domain: domain, - category: category, - payload: JSON.stringify(error), - logLevel: "Info", - recordId: recordId, - message: message, - }); - } -} diff --git a/src/application-monitoring/main/lwc/loggerUtility/loggerUtility.js-meta.xml b/src/application-monitoring/main/lwc/loggerUtility/loggerUtility.js-meta.xml deleted file mode 100644 index f37569d..0000000 --- a/src/application-monitoring/main/lwc/loggerUtility/loggerUtility.js-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - false - \ No newline at end of file diff --git a/src/application-monitoring/main/triggers/ApplicationEventTrigger.trigger b/src/application-monitoring/main/triggers/ApplicationEventTrigger.trigger deleted file mode 100644 index 3d824d1..0000000 --- a/src/application-monitoring/main/triggers/ApplicationEventTrigger.trigger +++ /dev/null @@ -1,11 +0,0 @@ -trigger ApplicationEventTrigger on Application_Event__e(after insert) { // NOPMD - List logs = new List(); - - if (Trigger.isAfter) { - if (Trigger.isInsert) { - logs.addAll(LoggerUtility.convertToLogs(Trigger.new)); - insert logs; // NOPMD - } - } - -} diff --git a/src/application-monitoring/main/triggers/ApplicationEventTrigger.trigger-meta.xml b/src/application-monitoring/main/triggers/ApplicationEventTrigger.trigger-meta.xml deleted file mode 100644 index e541b64..0000000 --- a/src/application-monitoring/main/triggers/ApplicationEventTrigger.trigger-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - Active - diff --git a/src/application-monitoring/main/triggers/ApplicationLogTrigger.trigger b/src/application-monitoring/main/triggers/ApplicationLogTrigger.trigger deleted file mode 100644 index 7950adf..0000000 --- a/src/application-monitoring/main/triggers/ApplicationLogTrigger.trigger +++ /dev/null @@ -1,3 +0,0 @@ -trigger ApplicationLogTrigger on Application_Log__c(after insert) { - ApplicationLogPublisher.publishLogs(Trigger.new); -} diff --git a/src/application-monitoring/main/triggers/ApplicationLogTrigger.trigger-meta.xml b/src/application-monitoring/main/triggers/ApplicationLogTrigger.trigger-meta.xml deleted file mode 100644 index 9b58644..0000000 --- a/src/application-monitoring/main/triggers/ApplicationLogTrigger.trigger-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - Active - diff --git a/src/application-monitoring/test/classes/ApplicationLogPublisher_Test.cls b/src/application-monitoring/test/classes/ApplicationLogPublisher_Test.cls deleted file mode 100644 index 0d5c258..0000000 --- a/src/application-monitoring/test/classes/ApplicationLogPublisher_Test.cls +++ /dev/null @@ -1,32 +0,0 @@ -@SuppressWarnings('PMD') -@isTest -public class ApplicationLogPublisher_Test { - private static final String category = 'TEST CATEGORY'; - - @isTest - static void testAppLogPublish() { - SingleRequestMock mock = new SingleRequestMock(200, 'OK', '', null); - Test.setMock(HttpCalloutMock.class, mock); - - Application_Log_Setting__mdt testSetting = new Application_Log_Setting__mdt( - Application_Domain__c = 'NKS', - Slack_Hook__c = 'https://slack.test.com', - Slack_Hook_Sandbox__c = 'https://slack.test.com', - Message_Template__c = 'TEST TEMPLATE', - Immediate_Post__c = true, - Minimum_Log_Level__c = 'Error', - Category__c = category - ); - - LoggerUtility logger = new LoggerUtility(category); - for (Integer i = 0; i < 101; i++) { - logger.error('TESTING', null, CRM_ApplicationDomain.Domain.NKS); - } - - Test.startTest(); - ApplicationLogPublisher.testSetting = testSetting; - List logs = logger.publishSynch(); //Do DML for trigger coverage - ApplicationLogPublisher.publishLogs(logs); //Calling directly in static context to trigger testSettings - Test.stopTest(); - } -} diff --git a/src/application-monitoring/test/classes/ApplicationLogPublisher_Test.cls-meta.xml b/src/application-monitoring/test/classes/ApplicationLogPublisher_Test.cls-meta.xml deleted file mode 100644 index 88ae4ad..0000000 --- a/src/application-monitoring/test/classes/ApplicationLogPublisher_Test.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - Active - diff --git a/src/application-monitoring/test/classes/CRM_DatabaseOperations_Test.cls b/src/application-monitoring/test/classes/CRM_DatabaseOperations_Test.cls deleted file mode 100644 index fa65364..0000000 --- a/src/application-monitoring/test/classes/CRM_DatabaseOperations_Test.cls +++ /dev/null @@ -1,179 +0,0 @@ -@isTest -public class CRM_DatabaseOperations_Test { - @isTest - public static void testDatabaseOperationsLists() { - List accs = TestDataFactory.getAccounts(10, false); - List accs2 = new List(); - List names = new List{ - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '10', - '11', - '12', - '13', - '14', - '15' - }; - CRM_DatabaseOperations cbr = new CRM_DatabaseOperations(); - - for (Integer i = 0; i < 5; i++) { - accs2.add(accs[accs.size() - 1]); - accs.remove(accs.size() - 1); - } - System.assert( - accs.size() == 5 && accs2.size() == 5, - 'Account creation went wrong.' - ); - - Test.startTest(); - - // INSERT - cbr.insertRecords(accs); - accs = [SELECT Name, Id FROM Account WHERE Name IN :names]; - System.assert( - accs.size() == 5, - 'Accounts were not inserted correctly.' - ); - - // UPSERT - for (Account acc : accs) { - acc.Name = String.valueOf(Integer.valueOf(acc.Name) + 10); - } - accs.addAll(accs2); - cbr.upsertRecords(accs); - accs = [SELECT Name, Id FROM Account WHERE Name IN :names]; - System.assert( - accs.size() == 10, - 'Accounts were not upserted correctly.' - ); - - // UPDATE - for (Account acc : accs) { - acc.Name = acc.Name + ' DatabaseTest'; - } - cbr.updateRecords(accs); - accs = [SELECT Name, Id FROM Account WHERE Name LIKE '%DatabaseTest%']; - System.assert( - accs.size() == 10, - 'Accounts were not updated correctly.' - ); - - // DELETE - cbr.deleteRecords(accs); - List afterDelete = new List( - [SELECT Name, Id FROM Account WHERE Name LIKE '%DatabaseTest%'] - ); - System.assert( - afterDelete.isEmpty(), - 'Accounts were not deleted correctly.' - ); - - // UNDELETE - cbr.undeleteRecords(accs); - accs = [SELECT Name, Id FROM Account WHERE Name LIKE '%DatabaseTest%']; - System.assert( - accs.size() == 10, - 'Accounts were not undeleted correctly.' - ); - - Test.stopTest(); - } - - @isTest - public static void testDatabaseOperationsSingleRecord() { - Account acc = new Account(Name = '1'); - List names = new List{ '11', '2' }; - CRM_DatabaseOperations cbr = new CRM_DatabaseOperations(); - - Test.startTest(); - - // INSERT - cbr.insertRecords(acc); - List accs = new List( - [SELECT Name, Id FROM Account WHERE Name = '1'] - ); - System.assert( - accs.size() == 1, - 'Accounts were not inserted correctly.' - ); - - // UPSERT - for (Account ac : accs) { - ac.Name = String.valueOf(Integer.valueOf(ac.Name) + 10); - } - acc = accs[0]; - Account acc2 = new Account(Name = '2'); - cbr.upsertRecords(acc); - cbr.upsertRecords(acc2); - accs = [SELECT Name, Id FROM Account WHERE Name IN :names]; - System.assert( - accs.size() == 2, - 'Accounts were not upserted correctly.' - ); - - // UPDATE - acc.Name = acc.Name + ' DatabaseTest'; - cbr.updateRecords(acc); - accs = [SELECT Name, Id FROM Account WHERE Name LIKE '%DatabaseTest%']; - System.assert(accs.size() == 1, 'Accounts were not updated correctly.'); - - // DELETE - cbr.deleteRecords(acc); - List afterDelete = new List( - [SELECT Name, Id FROM Account WHERE Name LIKE '%DatabaseTest%'] - ); - System.assert( - afterDelete.isEmpty(), - 'Accounts were not deleted correctly.' - ); - - // UNDELETE - cbr.undeleteRecords(acc); - accs = [SELECT Name, Id FROM Account WHERE Name LIKE '%DatabaseTest%']; - System.assert( - accs.size() == 1, - 'Accounts were not undeleted correctly.' - ); - - Test.stopTest(); - } - - @isTest - public static void testParameters() { - Account acc1 = new Account(); - Account acc2 = new Account(Name = 'TestAllOrNone'); - Account acc3 = new Account(Name = 'TestAllOrNone'); - List accs = new List{ acc1, acc2 }; - List accs2 = new List{ acc1, acc3 }; - CRM_DatabaseOperations cbr = new CRM_DatabaseOperations() - .setVerbose() - .setNumberOfRetries(1) - .setDomain(CRM_ApplicationDomain.Domain.NKS); - - Test.startTest(); - cbr.insertRecords(accs); - cbr = cbr.setAllOrNone(); - cbr.insertRecords(accs2); - Test.stopTest(); - System.assert( - [SELECT COUNT() FROM Application_Log__c] == 7, - 'Incorrect amount of application logs was created.' - ); - System.assert( - [SELECT Application_Domain__c FROM Application_Log__c LIMIT 1][0] - .Application_Domain__c == 'NKS', - 'Domain wasn\'t set correctly.' - ); - System.assert( - [SELECT Id FROM Account WHERE Name = 'TestAllOrNone'].size() == 1, - 'Partial insert was unsuccessful.' - ); - } -} diff --git a/src/application-monitoring/test/classes/CRM_DatabaseOperations_Test.cls-meta.xml b/src/application-monitoring/test/classes/CRM_DatabaseOperations_Test.cls-meta.xml deleted file mode 100644 index 1e7de94..0000000 --- a/src/application-monitoring/test/classes/CRM_DatabaseOperations_Test.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - Active - diff --git a/src/application-monitoring/test/classes/LoggerUtility_Test.cls b/src/application-monitoring/test/classes/LoggerUtility_Test.cls deleted file mode 100644 index 2024425..0000000 --- a/src/application-monitoring/test/classes/LoggerUtility_Test.cls +++ /dev/null @@ -1,222 +0,0 @@ -/** - * @description Unit tests for the LoggerUtility class. - */ -@SuppressWarnings('PMD') -@IsTest(isParallel=true) -public class LoggerUtility_Test { - @IsTest - public static void testLogging() { - LoggerUtility logger = new LoggerUtility(); - - logger.info('Testing info logging', null); - logger.error('Testing error logging', null); - logger.warning('Testing warning logging', null); - logger.critical('Testing critical logging', null); - - try { - Integer i = 1 / 0; - } catch (Exception ex) { - logger.exception(ex); - logger.exception(ex, new Account()); - } - - logger.peek(); - - Test.startTest(); - logger.publish(); - Test.stopTest(); - - System.assert([SELECT COUNT() FROM Application_Log__c] == 6); - } - - @IsTest - public static void testLoggingDomain() { - LoggerUtility logger = new LoggerUtility(); - - logger.setCategory('Test'); - - logger.info( - 'Testing info logging', - null, - CRM_ApplicationDomain.Domain.NKS - ); - logger.error( - 'Testing error logging', - null, - CRM_ApplicationDomain.Domain.NKS - ); - logger.warning( - 'Testing warning logging', - null, - CRM_ApplicationDomain.Domain.NKS - ); - logger.critical( - 'Testing critical logging', - null, - CRM_ApplicationDomain.Domain.NKS - ); - - try { - Integer i = 1 / 0; - } catch (Exception ex) { - logger.exception(ex, CRM_ApplicationDomain.Domain.NKS); - } - - logger.peek(); - - Test.startTest(); - logger.publish(); - Test.stopTest(); - - System.assert([SELECT COUNT() FROM Application_Log__c] == 5); - } - - @IsTest - public static void testLoggingHttpError() { - LoggerUtility logger = new LoggerUtility(); - - HttpResponse response = new HttpResponse(); - response.setStatusCode(400); - response.setBody('Http body'); - response.setStatus('Error status'); - - logger.httpError( - 'Test logging http error', - response, - null, - CRM_ApplicationDomain.Domain.NKS - ); - - Test.startTest(); - logger.publish(); - Test.stopTest(); - - System.assert([SELECT COUNT() FROM Application_Log__c] == 1); - } - - @isTest - public static void testPublishSynch() { - LoggerUtility logger = new LoggerUtility(); - - logger.info('Testing info logging', null); - logger.error('Testing error logging', null); - logger.warning('Testing warning logging', null); - logger.critical('Testing critical logging', null); - - Test.startTest(); - logger.publishSynch(); - Test.stopTest(); - - System.assert( - [SELECT COUNT() FROM Application_Log__c] == 4, - 'Invalid log amount: ' + [SELECT COUNT() FROM Application_Log__c] - ); - } - - @IsTest - private static void getUuid() { - String uuid; - Test.startTest(); - uuid = LoggerUtility.getUuid(); - Test.stopTest(); - - System.Assert.isTrue(String.isNotBlank(uuid), 'UUID is blank'); - } - - @isTest - public static void testHandleLogRequests() { - LoggerUtility.LogRequest logReq1 = new LoggerUtility.LogRequest(); - LoggerUtility.LogRequest logReq2 = new LoggerUtility.LogRequest(); - LoggerUtility.LogRequest logReq3 = new LoggerUtility.LogRequest(); - LoggerUtility.LogRequest logReq4 = new LoggerUtility.LogRequest(); - - logReq1.logLevel = 'INFO'; - logReq1.source = 'TEST'; - logReq1.logMessage = 'MESSAGE'; - - logReq2.logLevel = 'WARNING'; - logReq2.source = 'TEST'; - logReq2.logMessage = 'MESSAGE'; - - logReq3.logLevel = 'ERROR'; - logReq3.source = 'TEST'; - logReq3.logMessage = 'MESSAGE'; - - logReq4.logLevel = 'CRITICAL'; - logReq4.source = 'TEST'; - logReq4.logMessage = 'MESSAGE'; - - Test.startTest(); - LoggerUtility.handleLogRequests( - new List{ - logReq1, - logReq2, - logReq3, - logReq4 - } - ); - Test.stopTest(); - - System.assert([SELECT COUNT() FROM Application_Log__c] == 4); - } - - /** - * Ensure that the domain can be set in the constructor. Also ensure that - * this can be overridden in calls to logMessage. - */ - @IsTest - public static void constructDomain() { - LoggerUtility logger = new LoggerUtility( - CRM_ApplicationDomain.Domain.NKS, - 'Test' - ); - logger.info('Testing info logging', null); - logger.logMessage( - LoggerUtility.logLevel.Info, - null, - null, - 'Testing separate domain logging', - JSON.serializePretty(null), - null, - CRM_ApplicationDomain.Domain.HOT - ); - Test.startTest(); - logger.publish(); - Test.stopTest(); - Assert.areEqual( - 1, - [ - SELECT COUNT() - FROM Application_Log__c - WHERE Application_Domain__c = 'NKS' - ] - ); - Assert.areEqual( - 1, - [ - SELECT COUNT() - FROM Application_Log__c - WHERE Application_Domain__c = 'HOT' - ] - ); - } - - /** - * Ensure that not setting the domain in the constructor is still fine. - */ - @IsTest - public static void doNotConstructDomain() { - LoggerUtility logger = new LoggerUtility('Test'); - logger.info('Testing info logging', null); - Test.startTest(); - logger.publish(); - Test.stopTest(); - Assert.areEqual(1, [SELECT COUNT() FROM Application_Log__c]); - Application_Log__c entry = [ - SELECT Application_Domain__c - FROM Application_Log__c - LIMIT 1 - ]; - Assert.isNull(entry.Application_Domain__c); - } -} diff --git a/src/application-monitoring/test/classes/LoggerUtility_Test.cls-meta.xml b/src/application-monitoring/test/classes/LoggerUtility_Test.cls-meta.xml deleted file mode 100644 index 88ae4ad..0000000 --- a/src/application-monitoring/test/classes/LoggerUtility_Test.cls-meta.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 64.0 - Active - diff --git a/src/application-monitoring/test/testSuites/application_monitoring.testSuite-meta.xml b/src/application-monitoring/test/testSuites/application_monitoring.testSuite-meta.xml deleted file mode 100644 index e9c12d9..0000000 --- a/src/application-monitoring/test/testSuites/application_monitoring.testSuite-meta.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - ApplicationLogPublisher_Test - CRM_DatabaseOperations_Test - LoggerUtility_Test - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/Application_Event__e.object-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/Application_Event__e.object-meta.xml deleted file mode 100644 index 7eb74e9..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/Application_Event__e.object-meta.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Deployed - HighVolume - - Application Events - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/API_Request_Time__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/API_Request_Time__c.field-meta.xml deleted file mode 100644 index efc4f26..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/API_Request_Time__c.field-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - API_Request_Time__c - Time the API transaction entry is instantiated. - false - false - false - false - - false - DateTime - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Application_Domain__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Application_Domain__c.field-meta.xml deleted file mode 100644 index 094ff22..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Application_Domain__c.field-meta.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Application_Domain__c - Specifies which area of the application the application log is connected to. - false - false - false - false - - 64 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Category__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Category__c.field-meta.xml deleted file mode 100644 index 2a96136..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Category__c.field-meta.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Category__c - Category within application domain to allow for further filtering og logs. - false - false - false - false - - 32 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Log_Level__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Log_Level__c.field-meta.xml deleted file mode 100644 index ebff72c..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Log_Level__c.field-meta.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Log_Level__c - false - false - false - false - - 50 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Log_Messages__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Log_Messages__c.field-meta.xml deleted file mode 100644 index a8f305b..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Log_Messages__c.field-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - Log_Messages__c - false - false - false - false - - 131072 - LongTextArea - 3 - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Payload__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Payload__c.field-meta.xml deleted file mode 100644 index cbbb945..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Payload__c.field-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - Payload__c - false - false - false - false - - 131072 - LongTextArea - 3 - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/ReferenceId__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/ReferenceId__c.field-meta.xml deleted file mode 100644 index 4b28a75..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/ReferenceId__c.field-meta.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - ReferenceId__c - false - false - false - false - - 18 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Reference_Info__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Reference_Info__c.field-meta.xml deleted file mode 100644 index 918d102..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Reference_Info__c.field-meta.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Reference_Info__c - false - false - false - false - - 255 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Request_URI__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Request_URI__c.field-meta.xml deleted file mode 100644 index 5733270..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Request_URI__c.field-meta.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Request_URI__c - URI of an outbound or inbound API request - false - false - false - false - - 255 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Source_Class__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Source_Class__c.field-meta.xml deleted file mode 100644 index 63a08b6..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Source_Class__c.field-meta.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Source_Class__c - The class the Event happened in - false - false - false - false - - 255 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Source_Function__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/Source_Function__c.field-meta.xml deleted file mode 100644 index fcec0ed..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/Source_Function__c.field-meta.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Source_Function__c - false - false - false - false - - 255 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/UUID__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/UUID__c.field-meta.xml deleted file mode 100644 index c81d900..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/UUID__c.field-meta.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - UUID__c - Field containing a UUID generated by the logger framework. - false - false - false - false - - 40 - false - Text - false - diff --git a/src/platform-data-model/application-event/objects/Application_Event__e/fields/User_Context__c.field-meta.xml b/src/platform-data-model/application-event/objects/Application_Event__e/fields/User_Context__c.field-meta.xml deleted file mode 100644 index e7817ab..0000000 --- a/src/platform-data-model/application-event/objects/Application_Event__e/fields/User_Context__c.field-meta.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - User_Context__c - Reference to the user who was in context when the error occurred. - false - false - false - false - - 18 - false - Text - false - diff --git a/src/platform-data-model/application-log/layouts/Application_Log__c-Application Log Layout.layout-meta.xml b/src/platform-data-model/application-log/layouts/Application_Log__c-Application Log Layout.layout-meta.xml deleted file mode 100644 index 2cce4e8..0000000 --- a/src/platform-data-model/application-log/layouts/Application_Log__c-Application Log Layout.layout-meta.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - Submit - - false - false - true - - - - Required - Name - - - Edit - Application_Domain__c - - - Edit - Category__c - - - true - - - Edit - Log_Level__c - - - Edit - Log_Message__c - - - Edit - Pay_Load__c - - - - - Edit - OwnerId - - - Edit - UUID__c - - - Edit - Time_Taken__c - - - - - - true - true - true - - - - Edit - Source_Class__c - - - Edit - Source_Function__c - - - Edit - User_Context__c - - - - - Edit - Referrence_ID__c - - - Edit - Referrence_Info__c - - - - - - false - false - true - - - - Readonly - CreatedById - - - - - Readonly - LastModifiedById - - - - - - true - false - true - - - - - - - - RelatedNoteList - - false - false - false - false - false - - 00h1x000001q2BI - 4 - 0 - Default - - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/Application_Log__c.object-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/Application_Log__c.object-meta.xml deleted file mode 100644 index 86d0063..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/Application_Log__c.object-meta.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - Accept - Default - - - CancelEdit - Default - - - Clone - Default - - - Delete - Default - - - Edit - Default - - - List - Default - - - New - Default - - - SaveEdit - Default - - - Tab - Default - - - View - Default - - false - SYSTEM - Deployed - false - true - false - false - true - true - true - true - - - - Text - - Application Logs - - ReadWrite - Public - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Application_Domain__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Application_Domain__c.field-meta.xml deleted file mode 100644 index ebecaeb..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Application_Domain__c.field-meta.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Application_Domain__c - Specifies which area of the application the application log is connected to. - false - - false - false - Picklist - - true - Application_Domain - - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/CRM_Ready_for_Deletion__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/CRM_Ready_for_Deletion__c.field-meta.xml deleted file mode 100644 index d24a748..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/CRM_Ready_for_Deletion__c.field-meta.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - CRM_Ready_for_Deletion__c - Formula field used in the deletion policy for the application log. All logs older than one month are to be deleted. - false - OR(DateValue(CreatedDate) < ADDMONTHS(TODAY(),-1), - AND(DateValue(CreatedDate) < TODAY() - 2, Log_Level__c == 'Info') - ) - -/*Deletes all info logs older than two days and all other types older than last month */ - BlankAsZero - - false - Checkbox - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Category__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Category__c.field-meta.xml deleted file mode 100644 index f6842bc..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Category__c.field-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - Category__c - Category within application domain to allow for further filtering og logs. - false - - 32 - false - false - Text - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Log_Level__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Log_Level__c.field-meta.xml deleted file mode 100644 index 55fa3e6..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Log_Level__c.field-meta.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Log_Level__c - false - - 255 - false - false - Text - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Log_Message__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Log_Message__c.field-meta.xml deleted file mode 100644 index c624ee6..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Log_Message__c.field-meta.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - Log_Message__c - false - - 32768 - false - LongTextArea - 3 - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Pay_Load__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Pay_Load__c.field-meta.xml deleted file mode 100644 index a599425..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Pay_Load__c.field-meta.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - Pay_Load__c - false - - 32768 - false - LongTextArea - 3 - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Referrence_ID__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Referrence_ID__c.field-meta.xml deleted file mode 100644 index 500603d..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Referrence_ID__c.field-meta.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Referrence_ID__c - false - - 18 - false - false - Text - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Referrence_Info__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Referrence_Info__c.field-meta.xml deleted file mode 100644 index 0af03ea..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Referrence_Info__c.field-meta.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - Referrence_Info__c - false - - 32768 - false - LongTextArea - 3 - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Source_Class__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Source_Class__c.field-meta.xml deleted file mode 100644 index f45537d..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Source_Class__c.field-meta.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Source_Class__c - false - - 255 - false - false - Text - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Source_Function__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Source_Function__c.field-meta.xml deleted file mode 100644 index ae026fa..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Source_Function__c.field-meta.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Source_Function__c - false - - 255 - false - false - Text - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Time_Taken__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/Time_Taken__c.field-meta.xml deleted file mode 100644 index 852bbc1..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/Time_Taken__c.field-meta.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Time_Taken__c - Time Taken (In ms) - false - - 18 - false - 0 - false - Number - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/UUID__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/UUID__c.field-meta.xml deleted file mode 100644 index 25f7c42..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/UUID__c.field-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - UUID__c - Field to contain a UUID generated by the logger framework - true - - 40 - false - false - Text - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/fields/User_Context__c.field-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/fields/User_Context__c.field-meta.xml deleted file mode 100644 index dbf75e1..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/fields/User_Context__c.field-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - User_Context__c - Reference to the user who was in context when the error occurred. - false - - 18 - false - false - Text - false - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/listViews/All.listView-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/listViews/All.listView-meta.xml deleted file mode 100644 index f67706e..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/listViews/All.listView-meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - All - NAME - Source_Class__c - Source_Function__c - Log_Level__c - Log_Message__c - Pay_Load__c - Everything - - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/listViews/Logs_This_Week.listView-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/listViews/Logs_This_Week.listView-meta.xml deleted file mode 100644 index 9df19b2..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/listViews/Logs_This_Week.listView-meta.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - Logs_This_Week - NAME - Source_Class__c - Source_Function__c - Log_Level__c - Log_Message__c - Pay_Load__c - Everything - - CREATED_DATE - equals - THIS_WEEK - - - diff --git a/src/platform-data-model/application-log/objects/Application_Log__c/listViews/Logs_Today.listView-meta.xml b/src/platform-data-model/application-log/objects/Application_Log__c/listViews/Logs_Today.listView-meta.xml deleted file mode 100644 index 1edb402..0000000 --- a/src/platform-data-model/application-log/objects/Application_Log__c/listViews/Logs_Today.listView-meta.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - Logs_Today - NAME - Source_Class__c - Source_Function__c - Log_Level__c - Log_Message__c - Pay_Load__c - CREATED_DATE - Everything - - CREATED_DATE - equals - TODAY - - - diff --git a/src/platform-utility/platform-interfaces/README.md b/src/platform-utility/platform-interfaces/README.md new file mode 100644 index 0000000..87983d7 --- /dev/null +++ b/src/platform-utility/platform-interfaces/README.md @@ -0,0 +1 @@ +Interfaces og Binding Custom Metadata for bruk av [force-di](https://github.com/navikt/sf-external-force-di) diff --git a/src/platform-utility/platform-interfaces/main/classes/IAvvikAccess.cls b/src/platform-utility/platform-interfaces/main/classes/IAvvikAccess.cls new file mode 100644 index 0000000..22d1122 --- /dev/null +++ b/src/platform-utility/platform-interfaces/main/classes/IAvvikAccess.cls @@ -0,0 +1,19 @@ +/** + * @description + * Interface for AvvikAccess job injection, enabling dependency injection and mocking of asynchronous AvvikAccess logic. + * Implementations should provide logic for setting the NAV identifier and executing the queueable job. + * Used to decouple DefaultLoginFlowController and related classes from concrete AvvikAccess implementations, improving testability and package boundaries. + */ +public interface IAvvikAccess { + /** + * @description Sets the NAV identifier for the AvvikAccess job. + * @param navId NAV identifier to use in the job. + */ + void setNavIdent(String navId); + + /** + * @description Executes the queueable job logic for AvvikAccess. + * @param context QueueableContext provided by the platform. + */ + void execute(QueueableContext context); +} diff --git a/src/application-monitoring/main/classes/CRM_DatabaseOperations.cls-meta.xml b/src/platform-utility/platform-interfaces/main/classes/IAvvikAccess.cls-meta.xml similarity index 80% rename from src/application-monitoring/main/classes/CRM_DatabaseOperations.cls-meta.xml rename to src/platform-utility/platform-interfaces/main/classes/IAvvikAccess.cls-meta.xml index 1e7de94..998805a 100644 --- a/src/application-monitoring/main/classes/CRM_DatabaseOperations.cls-meta.xml +++ b/src/platform-utility/platform-interfaces/main/classes/IAvvikAccess.cls-meta.xml @@ -1,5 +1,5 @@ - 64.0 + 62.0 Active diff --git a/src/platform-utility/platform-interfaces/main/customMetadata/di_Binding.IAvvikAccess.md-meta.xml b/src/platform-utility/platform-interfaces/main/customMetadata/di_Binding.IAvvikAccess.md-meta.xml new file mode 100644 index 0000000..09e2baa --- /dev/null +++ b/src/platform-utility/platform-interfaces/main/customMetadata/di_Binding.IAvvikAccess.md-meta.xml @@ -0,0 +1,29 @@ + + + + false + + BindingName__c + + + + BindingObjectAlternate__c + + + + BindingObject__c + + + + BindingSequence__c + + + + To__c + AvvikAccessMock + + + Type__c + Apex + +