From 898ca0b0f42e877d3ce8629a5cbb367b94277844 Mon Sep 17 00:00:00 2001 From: Wim Velzeboer Date: Wed, 15 Sep 2021 10:08:01 +0100 Subject: [PATCH 01/10] Waiting for Winter'22 update to use enum.valueOf --- README.md | 10 +- sfdx-project.json | 2 +- .../classes/fflib_ALogAppenderFilter.cls | 197 +++++++++++ .../fflib_ALogAppenderFilter.cls-meta.xml | 5 + .../logger/classes/fflib_ILogAppender.cls | 34 ++ .../classes/fflib_ILogAppender.cls-meta.xml | 5 + .../classes/fflib_ILogMessageFormatter.cls | 36 ++ .../fflib_ILogMessageFormatter.cls-meta.xml | 5 + .../main/logger/classes/fflib_ILogger.cls | 48 +++ .../logger/classes/fflib_ILogger.cls-meta.xml | 5 + .../main/logger/classes/fflib_LogEntry.cls | 75 ++++ .../classes/fflib_LogEntry.cls-meta.xml | 5 + .../logger/classes/fflib_LogEventAppender.cls | 107 ++++++ .../fflib_LogEventAppender.cls-meta.xml | 5 + .../logger/classes/fflib_LogEventDomain.cls | 71 ++++ .../classes/fflib_LogEventDomain.cls-meta.xml | 5 + .../classes/fflib_LogEventStoreListener.cls | 57 +++ .../fflib_LogEventStoreListener.cls-meta.xml | 5 + .../main/logger/classes/fflib_Logger.cls | 233 +++++++++++++ .../logger/classes/fflib_Logger.cls-meta.xml | 5 + .../classes/fflib_PlatformEventDomain.cls | 41 +++ .../fflib_PlatformEventDomain.cls-meta.xml | 5 + .../classes/ffllib_IPlatformEventDomain.cls | 34 ++ .../ffllib_IPlatformEventDomain.cls-meta.xml | 5 + ...gEntry__c-Log Entry Layout.layout-meta.xml | 84 +++++ .../fflib_LogEntry__c.object-meta.xml | 64 ++++ .../fields/ClassName__c.field-meta.xml | 13 + .../fields/ExecutionContext__c.field-meta.xml | 13 + .../fields/LineNumber__c.field-meta.xml | 14 + .../fields/LogLevel__c.field-meta.xml | 36 ++ .../fields/Message__c.field-meta.xml | 11 + .../fields/MethodName__c.field-meta.xml | 13 + .../fields/User__c.field-meta.xml | 13 + .../listViews/All.listView-meta.xml | 10 + .../All_Debug_Last_7_days.listView-meta.xml | 20 ++ .../All_Error_Last_7_days.listView-meta.xml | 20 ++ .../listViews/All_Last_day.listView-meta.xml | 16 + .../All_Warning_Last_7_days.listView-meta.xml | 21 ++ .../fflib_LogEvent__e.object-meta.xml | 8 + .../fields/ClassName__c.field-meta.xml | 13 + .../fields/ExecutionContext__c.field-meta.xml | 13 + .../fields/LineNumber__c.field-meta.xml | 14 + .../fields/LogLevel__c.field-meta.xml | 14 + .../fields/Message__c.field-meta.xml | 14 + .../fields/MethodName__c.field-meta.xml | 13 + .../fflib_LogLevelFilter__c.object-meta.xml | 8 + .../fields/LogLevel__c.field-meta.xml | 13 + ...flib_LogEntryReports.reportFolder-meta.xml | 4 + ...ort_Count_per_loglevel_NQR.report-meta.xml | 28 ++ ...Prio_LogEntries_Report_H7Z.report-meta.xml | 46 +++ .../tabs/fflib_LogEntry__c.tab-meta.xml | 6 + .../triggers/fflib_LogEventTrigger.trigger | 10 + .../fflib_LogEventTrigger.trigger-meta.xml | 5 + .../logger/fflib_ALogAppenderFilterTest.cls | 228 ++++++++++++ .../fflib_ALogAppenderFilterTest.cls-meta.xml | 5 + .../logger/fflib_LogEventAppenderTest.cls | 103 ++++++ .../fflib_LogEventAppenderTest.cls-meta.xml | 5 + .../fflib_LogEventStoreListenerTest.cls | 103 ++++++ ...lib_LogEventStoreListenerTest.cls-meta.xml | 5 + .../tests/classes/logger/fflib_LoggerTest.cls | 326 ++++++++++++++++++ .../logger/fflib_LoggerTest.cls-meta.xml | 5 + 61 files changed, 2335 insertions(+), 2 deletions(-) create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls create mode 100644 sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/layouts/fflib_LogEntry__c-Log Entry Layout.layout-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fflib_LogEntry__c.object-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ClassName__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ExecutionContext__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LineNumber__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/Message__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/MethodName__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/User__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All.listView-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Debug_Last_7_days.listView-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Error_Last_7_days.listView-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Last_day.listView-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Warning_Last_7_days.listView-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fflib_LogEvent__e.object-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ClassName__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ExecutionContext__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LineNumber__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LogLevel__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/Message__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/MethodName__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fflib_LogLevelFilter__c.object-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fields/LogLevel__c.field-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports.reportFolder-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/LogEntries_Report_Count_per_loglevel_NQR.report-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/Yesterdays_Prio_LogEntries_Report_H7Z.report-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/tabs/fflib_LogEntry__c.tab-meta.xml create mode 100644 sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger create mode 100644 sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls create mode 100644 sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls-meta.xml diff --git a/README.md b/README.md index 6c384a1..2cee57f 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,14 @@ Please have read the [contributing guide](./CONTRIBUTING.md) that will through t You can also have a look at the open items in the [project(s)](./projects), feel free to pick an item from the kanban board! -## Change Log +---- +# Change Log Some of the changes that have major impact are listed here; +### September 2021 +**Logger functionality** +A replacement of System.Debug that is using Platform events to store log messages in a Custom Object for you to monitor + ### August 2021 **Added criteria based on formula; (1 OR 2) AND 3)** @@ -50,6 +55,9 @@ new fflib_Criteria() Evaluates: (AccountNumber = '0001' OR AccountNumber = '0001') AND ShippingCountry = 'USA' ``` + +--- + ## Donations We are pleased to announce that the fflib-apex-extensions Project is accepting donations in the privacy-oriented cryptocurrency Monero (XMR) at the following address: diff --git a/sfdx-project.json b/sfdx-project.json index b2b5c6f..503b680 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -8,5 +8,5 @@ "name": "fflib-apex-extensions", "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "51.0" + "sourceApiVersion": "53.0" } diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls new file mode 100644 index 0000000..76d415b --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls @@ -0,0 +1,197 @@ +/** + * File Name: fflib_ALogAppenderFilter + * Description: Log Appender that includes a filter for logginglevel + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public abstract with sharing class fflib_ALogAppenderFilter implements fflib_ILogAppender +{ + // The default logging level that must be met before log messages are processed + public static final System.LoggingLevel DEFAULT_LEVEL = System.LoggingLevel.ERROR; + + // The current used logging level which can be modified during runtime + protected System.LoggingLevel minLogLevel = DEFAULT_LEVEL; + + /** + * setLoggingLevel + * + * @description Change the current minimum logging level + * @param logLevel + */ + public void setLoggingLevel(System.LoggingLevel logLevel) + { + this.minLogLevel = logLevel; + } + + /** + * isValidLogLevel + * + * @description Compares the Organisation, User and Apex logging level settings + * @param logLevel + * + * @return Returns true if one of the settings is equal or higher than the given loglevel + */ + protected Boolean isValidLogLevel(System.LoggingLevel logLevel) + { + return ( + isValidOrganisationLogLevel(logLevel) || + isValidUserLogLevel(logLevel) || + isValidApexClassLogLevel(logLevel) + ); + } + + /** + * isValidLogLevel + * + * @description Compares the given log level valueToCompare against the compareTo + * @param compareTo The log level to compare against + * @param valueToCompare The log level to compare + * + * @return Returns true if the valueToCompare is equal of higher then the compareTo + */ + private Boolean isValidLogLevel(System.LoggingLevel compareTo, System.LoggingLevel valueToCompare) + { + return compareTo != System.LoggingLevel.NONE + && + valueToCompare != System.LoggingLevel.NONE + && + valueToCompare.ordinal() >= compareTo.ordinal(); + } + + /** + * isValidApexClassLogLevel + * + * @description Compare the given loglevel against the current Apex setting stored in this.minLogLevel + * @param logLevel The log level to compare + * + * @return Returns true if the given log level is equal of higher then the Apex setting + */ + private Boolean isValidApexClassLogLevel(System.LoggingLevel logLevel) + { + return isValidLogLevel(this.minLogLevel, logLevel); + } + + /** + * isValidOrganisationLogLevel + * + * @description Compare the given loglevel against the Organisation setting stored in a Custom Setting + * @param logLevel The log level to compare + * + * @return Returns true if the given log level is equal of higher then the Organisation setting + */ + private Boolean isValidOrganisationLogLevel(System.LoggingLevel logLevel) + { + return isValidLogLevel( + getDefaultOrganisationLogLevel(), + logLevel + ); + } + + /** + * isValidUserLogLevel + * + * @description Compare the given loglevel against the User setting stored in a Custom Setting + * @param logLevel The log level to compare + * + * @return Returns true if the given log level is equal of higher then the User setting + */ + private Boolean isValidUserLogLevel(System.LoggingLevel logLevel) + { + return isValidLogLevel( + getUserLogLevel(), + logLevel + ); + } + + /** + * getDefaultOrganisationLogLevel + * + * @return Returns the default Organisation log level setting stored in fflib_LogLevelFilter__c + */ + private System.LoggingLevel getDefaultOrganisationLogLevel() + { + fflib_LogLevelFilter__c orgSettings = fflib_LogLevelFilter__c.getOrgDefaults(); + if (String.isBlank(orgSettings.LogLevel__c)) + { + return System.LoggingLevel.NONE; + } + return stringToLoggingLevel(orgSettings.LogLevel__c); + } + + /** + * getUserLogLevel + * + * @return Returns the default User log level setting stored in user or profile setting in fflib_LogLevelFilter__c + */ + private System.LoggingLevel getUserLogLevel() + { + fflib_LogLevelFilter__c logLevelFilter = fflib_LogLevelFilter__c.getInstance(UserInfo.getUserId()); + if (!hasSettingsValue(logLevelFilter, fflib_LogLevelFilter__c.LogLevel__c)) + { + return System.LoggingLevel.NONE; + } + return stringToLoggingLevel(logLevelFilter.LogLevel__c); + } + + /** + * hasSettingsValue + * + * @description Validates if the Custom Setting has a value stored in the given field + * @param setting The Custom Setting to validate + * @param sObjectField The field to check + * + * @return Returns true is the given field is set in the Custom Setting + */ + private Boolean hasSettingsValue(fflib_LogLevelFilter__c setting, SObjectField sObjectField) + { + return ( + null != setting + && + setting.getPopulatedFieldsAsMap().containsKey(sObjectField.getDescribe().getName()) + ); + } + + /** + * stringToLoggingLevel + * + * @param logLevelToConvert + * + * @return Returns the Log level for a given string, and System.LoggingLevel.None is an invalid string is given + */ + private System.LoggingLevel stringToLoggingLevel(String logLevelToConvert) + { + String logLevelString = logLevelToConvert.toUpperCase(); + for (System.LoggingLevel logLevel : System.LoggingLevel.values()) + { + if (logLevelString == logLevel.name()) + { + return logLevel; + } + } + return System.LoggingLevel.NONE; + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls new file mode 100644 index 0000000..da36064 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls @@ -0,0 +1,34 @@ +/** + * File Name: fflib_ILogAppender + * Description: Interface for appending log entries to and endpoint + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public interface fflib_ILogAppender +{ + void append(fflib_LogEntry logEntry); +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls new file mode 100644 index 0000000..d8866a6 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls @@ -0,0 +1,36 @@ +/** + * File Name: fflib_ILogMessageFormatter + * Description: Interface for formatting log messages + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public interface fflib_ILogMessageFormatter +{ + String format(String message); + String format(String message, List args); + String format(Exception e); +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml new file mode 100644 index 0000000..c413058 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls new file mode 100644 index 0000000..3e5949b --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls @@ -0,0 +1,48 @@ +/** + * File Name: fflib_ILogger + * Description: Interface for the Logger utility + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public interface fflib_ILogger +{ + void add(String message); + void debug(Exception e); + void debug(String message); + void debug(String message, List args); + void error(Exception e); + void error(String message); + void error(String message, List args); + void info(String message); + void info(String message, List args); + void warning(String message); + void warning(String message, List args); + + fflib_ILogger addAppender(fflib_ILogAppender appender); + fflib_ILogger setAppender(fflib_ILogAppender appender); + fflib_ILogger setMessageFormatter(fflib_ILogMessageFormatter formatter); +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls new file mode 100644 index 0000000..f9fa716 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls @@ -0,0 +1,75 @@ +/** + * File Name: fflib_LogEntry + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public with sharing class fflib_LogEntry +{ + public String className { get; set; } + public String executionContext { get; set; } + public Decimal lineNumber { get; set; } + public Id logEntryId { get; set; } + public System.LoggingLevel logLevel { get; set; } + public String message { get; set; } + public String methodName { get; set; } + public Id userId { get; set; } + public Datetime createdDatetime { get; set; } + + public fflib_LogEntry() + { + this(System.LoggingLevel.INFO, null); + } + + public fflib_LogEntry(System.LoggingLevel loggingLevel, String message) + { + this.executionContext = Request.getCurrent().getRequestId() + '/' + Request.getCurrent().getQuiddity(); + this.logLevel = loggingLevel; + this.message = message; + this.userId = System.UserInfo.getUserId(); + } + + public fflib_LogEntry(fflib_LogEvent__e logEvent) + { + this.className = logEvent.ClassName__c; + this.executionContext = logEvent.ExecutionContext__c; + this.lineNumber = logEvent.LineNumber__c; + this.logEntryId = logEvent.Id; + this.logLevel = System.LoggingLevel.valueOf(logEvent.LogLevel__c); + } + + public fflib_LogEvent__e toPlatformEvent() + { + return new fflib_LogEvent__e( + ClassName__c = this.className, + ExecutionContext__c = this.executionContext, + LineNumber__c = this.lineNumber, + LogLevel__c = this.logLevel.name(), + Message__c = this.message, + MethodName__c = this.methodName + ); + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml new file mode 100644 index 0000000..d75b058 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml @@ -0,0 +1,5 @@ + + + 51.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls new file mode 100644 index 0000000..a28ccf8 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls @@ -0,0 +1,107 @@ +/** + * File Name: fflib_LogEventAppender + * Description: Log Appender for publishing Platform Events + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public virtual without sharing class fflib_LogEventAppender extends fflib_ALogAppenderFilter +{ + + /** + * Publish a platform event fflib_LogEvent__e with the given message and logging level if it meets the minimum logging level + * + * @param logEntry The new log entry to append + */ + public virtual void append(fflib_LogEntry logEntry) + { + if (!isValidLogLevel(logEntry.logLevel)) return; + + publishEvents( + new List + { + logEntry.toPlatformEvent() + }); + } + + /** + * publishEvents + * + * @description Publish the given fflib_LogEvent__e events and report if there are any errors + * @param events The Platform events to publish + */ + protected virtual void publishEvents(List events) + { + List results = EventBus.publish(events); + checkAndReportErrors(results); + } + + + /** + * checkAndReportErrors + * + * @description Iterate over the given Database.SaveResults and report any errors + * @param saveResults + */ + protected void checkAndReportErrors(List saveResults) + { + // Inspect publishing result for each event + for (Database.SaveResult saveResult : saveResults) + { + if (!saveResult.isSuccess()) + { + reportError(saveResult); + } + } + } + + /** + * reportError + * + * @description Construct the error message for the failing Database.SaveResult and throws an exception + * @param saveResult + * + * @throws fflib_LogEventAppender.fflib_LogEventAppenderException + */ + protected virtual void reportError(Database.SaveResult saveResult) + { + String errorMessage = 'Error while publishing Log event:'; + for (Database.Error databaseError : saveResult.getErrors()) + { + errorMessage += String.format( + ' {0} - {1}, ', + new List + { + String.valueOf(databaseError.getStatusCode()), + databaseError.getMessage() + } + ); + } + throw new fflib_LogEventAppenderException(errorMessage); + } + + public class fflib_LogEventAppenderException extends Exception {} +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls new file mode 100644 index 0000000..29535e4 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls @@ -0,0 +1,71 @@ +/** + * File Name: fflib_LogEventDomain + * Description: Log Platform Events domain abstract class for the Log Entry events + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public abstract with sharing class fflib_LogEventDomain extends fflib_PlatformEventDomain +{ + + protected List logEntries = new List(); + + /** + * Class constructor + */ + public fflib_LogEventDomain(List records) + { + super(records); + recordsToLogEntries(); + } + + protected void recordsToLogEntries() + { + for (SObject record : Records) + { + this.logEntries.add( + new LogEntry((fflib_LogEvent__e) record) + ); + } + } + + public class LogEntry + { + public Id createdById; + public Datetime createdDatetime; + public System.LoggingLevel loggingLevel; + public String message; + + public LogEntry(fflib_LogEvent__e event) + { + this.loggingLevel = System.LoggingLevel.values().get((Integer) event.LogLevel__c); + this.message = event.message__c; + this.createdById = event.CreatedById; + this.createdDatetime = event.CreatedDate; + } + } + +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls new file mode 100644 index 0000000..1c6bd75 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls @@ -0,0 +1,57 @@ +/** + * File Name: fflib_LogEventStoreListener + * Description: Log Platform Events listener to store messages into a custom object + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public with sharing class fflib_LogEventStoreListener extends fflib_LogEventDomain +{ + + /** + * Class constructor + */ + public fflib_LogEventStoreListener(List records) + { + super(records); + } + + public void run() + { + List logEntryRecords = new List(); + for (fflib_LogEventDomain.LogEntry logEntry : logEntries) + { + logEntryRecords.add( + new fflib_LogEntry__c( + LogLevel__c = logEntry.loggingLevel.name(), + Message__c = logEntry.message, + User__c = logEntry.createdById + ) + ); + } + insert logEntryRecords; + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls new file mode 100644 index 0000000..0792098 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls @@ -0,0 +1,233 @@ +/** + * File Name: fflib_Logger + * Description: Logging utility with standard system.debug log appender and log message formatter + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public with sharing class fflib_Logger implements fflib_ILogger +{ + public static final String LF = '\n'; + public static final String CR = '\r'; + + private static final String ORG_NAMESPACE = [SELECT NamespacePrefix FROM Organization].NamespacePrefix; + private static final String CLASSNAME = fflib_Logger.class.getName(); + private static final Pattern STACK_LINE = + Pattern.compile('^(?:Class\\.)?([^.]+)\\.?([^\\.\\:]+)?[\\.\\:]?([^\\.\\:]*): line (\\d+), column (\\d+)$'); + + + protected List logAppenders = new List + { + new SystemAppender() + }; + + protected fflib_ILogMessageFormatter messageFormatter = new LogMessageFormatter(); + + + public void add(String message) + { + add(System.LoggingLevel.INFO, message); + + } + + public void add(LoggingLevel loggingLevel, Exception e) + { + add(new fflib_LogEntry(loggingLevel, messageFormatter.format(e))); + } + + public void add(LoggingLevel loggingLevel, String message) + { + add(new fflib_LogEntry(loggingLevel, messageFormatter.format(message))); + } + + public void add(LoggingLevel loggingLevel, String message, List args) + { + add(new fflib_LogEntry(loggingLevel, messageFormatter.format(message, args))); + } + + private void add(fflib_LogEntry logEntry) + { + populateStackTrace(logEntry); + addLogEntryToAppenders(logEntry); + } + + public fflib_ILogger addAppender(fflib_ILogAppender appender) + { + this.logAppenders.add(appender); + return this; + } + + + public void debug(Exception e) + { + add(System.LoggingLevel.DEBUG, e); + } + + public void debug(String message) + { + add(System.LoggingLevel.DEBUG, message); + } + + public void debug(String message, List args) + { + add(System.LoggingLevel.DEBUG, message, args); + } + + public void error(Exception e) + { + add(System.LoggingLevel.ERROR, e); + } + + public void error(String message) + { + add(System.LoggingLevel.ERROR, message); + } + + public void error(String message, List args) + { + add(System.LoggingLevel.ERROR, message, args); + } + + public void info(Exception e) + { + add(System.LoggingLevel.INFO, e); + } + + public void info(String message) + { + add(System.LoggingLevel.INFO, message); + } + + public void info(String message, List args) + { + add(System.LoggingLevel.INFO, message, args); + } + + public fflib_ILogger setAppender(fflib_ILogAppender appender) + { + this.logAppenders.clear(); + this.logAppenders.add(appender); + return this; + } + + public fflib_ILogger setMessageFormatter(fflib_ILogMessageFormatter formatter) + { + this.messageFormatter = formatter; + return this; + } + + public void warning(String message) + { + add(System.LoggingLevel.WARN, message); + } + + public void warning(String message, List args) + { + add(System.LoggingLevel.WARN, message, args); + } + + + private void populateStackTrace(fflib_LogEntry logEntry) + { + List stacktrace = new DmlException().getStackTraceString().split('\n'); + + for (String line : stacktrace) + { + Matcher matcher = STACK_LINE.matcher(line); + + if (matcher.find() && !line.startsWith('Class.' + CLASSNAME + '.')) + { + Boolean hasNamespace = String.isNotBlank(matcher.group(3)); + + if (hasNamespace) + { + logEntry.className = + (matcher.group(1).equals(ORG_NAMESPACE)) ? + matcher.group(2) + : + matcher.group(1) + '.' + matcher.group(2); + + logEntry.methodName = formatMethodName(matcher.group(3)); + } + else + { + logEntry.className = matcher.group(1); + logEntry.methodName = formatMethodName(matcher.group(2)); + } + + logEntry.lineNumber = Integer.valueOf(matcher.group(4)); + return; + } + } + } + + private String formatMethodName(String method) + { + String result = (method == null) ? 'anonymous' : method; + return (result.contains('init')) ? 'ctor' : result; + } + + private void addLogEntryToAppenders(fflib_LogEntry logEntry) + { + for (fflib_ILogAppender logAppender : logAppenders) + { + logAppender.append(logEntry); + } + } + + public virtual class SystemAppender implements fflib_ILogAppender + { + public void append(fflib_LogEntry logEntry) + { + System.debug(logEntry.className + ' #' + logEntry.lineNumber + ' @'+ logEntry.methodName + ' ' + logEntry.message); + } + } + + public virtual class LogMessageFormatter implements fflib_ILogMessageFormatter + { + public virtual String format(String message) + { + return message; + } + + public virtual String format(String message, List args) + { + return String.format(message, args); + } + + public virtual String format(Exception e) + { + String result = 'Exception: ' + e; + if (null != e.getCause()) + { + result += LF + ' Cause: ' + e.getCause(); + } + result += LF + ' Stack trace: ' + e.getStackTraceString(); + + return result; + } + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls new file mode 100644 index 0000000..3b58590 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls @@ -0,0 +1,41 @@ +/** + * File Name: fflib_PlatformEventDomain + * Description: Platform Events Domain abstract class + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public abstract with sharing class fflib_PlatformEventDomain implements ffllib_IPlatformEventDomain +{ + + protected List Records { get; private set; } + + + public fflib_PlatformEventDomain(List records) + { + this.Records = records; + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml new file mode 100644 index 0000000..91b23b8 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml @@ -0,0 +1,5 @@ + + + 46.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls b/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls new file mode 100644 index 0000000..eabe777 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls @@ -0,0 +1,34 @@ +/** + * File Name: ffllib_IPlatformEventDomain + * Description: Platform events domain interface + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public interface ffllib_IPlatformEventDomain +{ + void run(); +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml new file mode 100644 index 0000000..91b23b8 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml @@ -0,0 +1,5 @@ + + + 46.0 + Active + diff --git a/sfdx-source/apex-extensions/main/logger/layouts/fflib_LogEntry__c-Log Entry Layout.layout-meta.xml b/sfdx-source/apex-extensions/main/logger/layouts/fflib_LogEntry__c-Log Entry Layout.layout-meta.xml new file mode 100644 index 0000000..4405ab4 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/layouts/fflib_LogEntry__c-Log Entry Layout.layout-meta.xml @@ -0,0 +1,84 @@ + + + Submit + + false + false + true + + + + Required + Name + + + + + Edit + User__c + + + Required + LogLevel__c + + + + + + true + true + true + + + + Edit + Message__c + + + + + + false + false + true + + + + Readonly + CreatedById + + + + + Readonly + LastModifiedById + + + Edit + OwnerId + + + + + + true + false + true + + + + + + + false + false + false + false + false + + 00h3D000000xiYW + 4 + 0 + Default + + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fflib_LogEntry__c.object-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fflib_LogEntry__c.object-meta.xml new file mode 100644 index 0000000..763b91e --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fflib_LogEntry__c.object-meta.xml @@ -0,0 +1,64 @@ + + + + Accept + Default + + + CancelEdit + Default + + + Clone + Default + + + Delete + Default + + + Edit + Default + + + List + Default + + + New + Default + + + SaveEdit + Default + + + Tab + Default + + + View + Default + + false + SYSTEM + Deployed + Object to store log entries after they a caught from a Platform event + false + true + false + false + true + true + true + true + + + + Text + + LogEntries + + ReadWrite + Public + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ClassName__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ClassName__c.field-meta.xml new file mode 100644 index 0000000..9746530 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ClassName__c.field-meta.xml @@ -0,0 +1,13 @@ + + + ClassName__c + false + false + false + false + + 80 + false + Text + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ExecutionContext__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ExecutionContext__c.field-meta.xml new file mode 100644 index 0000000..e1af4ce --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/ExecutionContext__c.field-meta.xml @@ -0,0 +1,13 @@ + + + ExecutionContext__c + false + false + false + false + + 80 + false + Text + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LineNumber__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LineNumber__c.field-meta.xml new file mode 100644 index 0000000..af1c400 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LineNumber__c.field-meta.xml @@ -0,0 +1,14 @@ + + + LineNumber__c + false + false + false + false + + 18 + false + 0 + Number + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml new file mode 100644 index 0000000..54d66be --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml @@ -0,0 +1,36 @@ + + + LogLevel__c + The logging level + false + + true + false + Picklist + + true + + false + + ERROR + false + + + + WARN + false + + + + INFO + false + + + + DEBUG + false + + + + + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/Message__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/Message__c.field-meta.xml new file mode 100644 index 0000000..37f034b --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/Message__c.field-meta.xml @@ -0,0 +1,11 @@ + + + Message__c + The Message of the log entry + false + + 32768 + false + LongTextArea + 5 + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/MethodName__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/MethodName__c.field-meta.xml new file mode 100644 index 0000000..1a94447 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/MethodName__c.field-meta.xml @@ -0,0 +1,13 @@ + + + MethodName__c + false + false + false + false + + 80 + false + Text + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/User__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/User__c.field-meta.xml new file mode 100644 index 0000000..e46ee60 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/User__c.field-meta.xml @@ -0,0 +1,13 @@ + + + User__c + The User + SetNull + false + + User + LogEntries + false + false + Lookup + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All.listView-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All.listView-meta.xml new file mode 100644 index 0000000..614e7c3 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All.listView-meta.xml @@ -0,0 +1,10 @@ + + + All + Everything + + NAME + CREATED_DATE + LogLevel__c + User__c + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Debug_Last_7_days.listView-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Debug_Last_7_days.listView-meta.xml new file mode 100644 index 0000000..17a4253 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Debug_Last_7_days.listView-meta.xml @@ -0,0 +1,20 @@ + + + All_Debug_Last_7_days + NAME + CREATED_DATE + User__c + Message__c + Everything + + LogLevel__c + equals + ERROR + + + CREATED_DATE + equals + LAST_N_DAYS:7 + + + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Error_Last_7_days.listView-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Error_Last_7_days.listView-meta.xml new file mode 100644 index 0000000..6e283c4 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Error_Last_7_days.listView-meta.xml @@ -0,0 +1,20 @@ + + + All_Error_Last_7_days + NAME + CREATED_DATE + User__c + Message__c + Mine + + LogLevel__c + equals + ERROR + + + CREATED_DATE + equals + LAST_N_DAYS:7 + + + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Last_day.listView-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Last_day.listView-meta.xml new file mode 100644 index 0000000..1f7d389 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Last_day.listView-meta.xml @@ -0,0 +1,16 @@ + + + All_Last_day + NAME + CREATED_DATE + LogLevel__c + User__c + Message__c + Everything + + CREATED_DATE + equals + LAST_N_DAYS:1 + + + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Warning_Last_7_days.listView-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Warning_Last_7_days.listView-meta.xml new file mode 100644 index 0000000..14598ba --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/listViews/All_Warning_Last_7_days.listView-meta.xml @@ -0,0 +1,21 @@ + + + All_Warning_Last_7_days + NAME + CREATED_DATE + LogLevel__c + User__c + Message__c + Mine + + LogLevel__c + equals + WARN + + + CREATED_DATE + equals + LAST_N_DAYS:7 + + + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fflib_LogEvent__e.object-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fflib_LogEvent__e.object-meta.xml new file mode 100644 index 0000000..15cb317 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fflib_LogEvent__e.object-meta.xml @@ -0,0 +1,8 @@ + + + Deployed + FFLIB Logger Events + StandardVolume + + Log Events + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ClassName__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ClassName__c.field-meta.xml new file mode 100644 index 0000000..9746530 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ClassName__c.field-meta.xml @@ -0,0 +1,13 @@ + + + ClassName__c + false + false + false + false + + 80 + false + Text + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ExecutionContext__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ExecutionContext__c.field-meta.xml new file mode 100644 index 0000000..e1af4ce --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/ExecutionContext__c.field-meta.xml @@ -0,0 +1,13 @@ + + + ExecutionContext__c + false + false + false + false + + 80 + false + Text + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LineNumber__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LineNumber__c.field-meta.xml new file mode 100644 index 0000000..af1c400 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LineNumber__c.field-meta.xml @@ -0,0 +1,14 @@ + + + LineNumber__c + false + false + false + false + + 18 + false + 0 + Number + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LogLevel__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LogLevel__c.field-meta.xml new file mode 100644 index 0000000..541508b --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/LogLevel__c.field-meta.xml @@ -0,0 +1,14 @@ + + + LogLevel__c + false + false + false + false + + 5 + false + Text + false + + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/Message__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/Message__c.field-meta.xml new file mode 100644 index 0000000..e96ba1e --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/Message__c.field-meta.xml @@ -0,0 +1,14 @@ + + + Message__c + The message thrown by the Logger + false + false + false + false + + 32768 + LongTextArea + 5 + + fflib_LogEventDomain \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/MethodName__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/MethodName__c.field-meta.xml new file mode 100644 index 0000000..1a94447 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEvent__e/fields/MethodName__c.field-meta.xml @@ -0,0 +1,13 @@ + + + MethodName__c + false + false + false + false + + 80 + false + Text + false + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fflib_LogLevelFilter__c.object-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fflib_LogLevelFilter__c.object-meta.xml new file mode 100644 index 0000000..6fc90a7 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fflib_LogLevelFilter__c.object-meta.xml @@ -0,0 +1,8 @@ + + + Hierarchy + Filter to add customised logging for particular users + false + + Public + diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fields/LogLevel__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fields/LogLevel__c.field-meta.xml new file mode 100644 index 0000000..8dbcb6f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogLevelFilter__c/fields/LogLevel__c.field-meta.xml @@ -0,0 +1,13 @@ + + + LogLevel__c + The minimum log level to report for the tracked User or Profile + false + Allowed values none, error, warn, info, debug + + 5 + false + false + Text + false + diff --git a/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports.reportFolder-meta.xml b/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports.reportFolder-meta.xml new file mode 100644 index 0000000..7571ce6 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports.reportFolder-meta.xml @@ -0,0 +1,4 @@ + + + Log Entries + diff --git a/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/LogEntries_Report_Count_per_loglevel_NQR.report-meta.xml b/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/LogEntries_Report_Count_per_loglevel_NQR.report-meta.xml new file mode 100644 index 0000000..60f0e22 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/LogEntries_Report_Count_per_loglevel_NQR.report-meta.xml @@ -0,0 +1,28 @@ + + + + CUST_NAME + + Summary + + CUST_CREATED_DATE + Asc + + + Day + fflib_LogEntry__c.LogLevel__c + Asc + + LogEntries Report - Day count per level + + co + 1 + + CustomEntity$fflib_LogEntry__c + organization + false + + CUST_CREATED_DATE + INTERVAL_CUSTOM + + diff --git a/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/Yesterdays_Prio_LogEntries_Report_H7Z.report-meta.xml b/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/Yesterdays_Prio_LogEntries_Report_H7Z.report-meta.xml new file mode 100644 index 0000000..3982d0f --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/reports/fflib_LogEntryReports/Yesterdays_Prio_LogEntries_Report_H7Z.report-meta.xml @@ -0,0 +1,46 @@ + + + + CUST_NAME + + + CUST_CREATED_DATE + + + fflib_LogEntry__c.LogLevel__c + + + fflib_LogEntry__c.User__c + + + fflib_LogEntry__c.Message__c + + Shows all ERROR and WARNING log entires from yesterday + + + CUST_CREATED_DATE + true + equals + YESTERDAY + + + fflib_LogEntry__c.LogLevel__c + true + equals + ERROR,WARN + + + Tabular + LogEntries Report - Yesterday + + co + 1 + + CustomEntity$fflib_LogEntry__c + organization + true + + CUST_CREATED_DATE + INTERVAL_CUSTOM + + diff --git a/sfdx-source/apex-extensions/main/logger/tabs/fflib_LogEntry__c.tab-meta.xml b/sfdx-source/apex-extensions/main/logger/tabs/fflib_LogEntry__c.tab-meta.xml new file mode 100644 index 0000000..b1c82f4 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/tabs/fflib_LogEntry__c.tab-meta.xml @@ -0,0 +1,6 @@ + + + true + Tab to show Log Entries + Custom34: Insect + diff --git a/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger b/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger new file mode 100644 index 0000000..ff45d1b --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger @@ -0,0 +1,10 @@ +/** + * File Name: sflib_LogEventTrigger + * Description: Tigger to store Log events into a custom object + * Copyright (c) 2019 Johnson & Johnson + * @author: architect ir. Wilhelmus G.J. Velzeboer | wvelzebo@its.jnj.com + */ +trigger fflib_LogEventTrigger on fflib_LogEvent__e (after insert) +{ + new fflib_LogEventStoreListener(Trigger.new).run(); +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml b/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml new file mode 100644 index 0000000..6205514 --- /dev/null +++ b/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls b/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls new file mode 100644 index 0000000..0cb0c5b --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls @@ -0,0 +1,228 @@ +/** + * File Name: fflib_LogAppenderFilterTest + * Description: Unit test class for fflib_LogAppenderFilter.cls + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +@IsTest +private class fflib_ALogAppenderFilterTest +{ + private static final String TEST_USER_PROFILE = 'Standard User'; + + @IsTest + static void itShouldValidateErrorLevelWithDefaultSetToError() + { + // GIVEN - We create an AppenderFilter instance and set the filter to ERRROR + FilteredAppender appender = new FilteredAppender(); + + // WHEN - we check if ERROR is valid + Boolean isValid = appender.checkValidLogLevel(System.LoggingLevel.ERROR); + + // THEN - It should be valid + System.assert(isValid); + } + + @IsTest + static void itShouldNotValidateErrorLevelWithDefaultSetToNone() + { + // GIVEN - We create an AppenderFilter instance and set the filter to NONE + FilteredAppender appender = new FilteredAppender(); + appender.setLoggingLevel(System.LoggingLevel.NONE); + + // WHEN - we check if ERROR is valid + Boolean isValid = appender.checkValidLogLevel(System.LoggingLevel.ERROR); + + // THEN - It should not be valid + System.assert(!isValid); + } + + @IsTest + static void itShouldNotValidateWarningLevelWithDefaultSetToError() + { + // GIVEN - We create an AppenderFilter instance and set the filter to NONE + FilteredAppender appender = new FilteredAppender(); + + // WHEN - we check if ERROR is valid + Boolean isValid = appender.checkValidLogLevel(System.LoggingLevel.WARN); + + // THEN - It should not be valid + System.assert(!isValid); + } + + /** + * THIS UNIT TEST IS DISABLED BY DEFAULT SINCE THERE IS NO KNOWN STANDARD USER FACTORY METHOD FOR THE TARGET ORG + */ + @IsTest + static void itShouldValidateWarningLevelWithDefaultSetToErrorForSpecifiedUser() + { + // Given - A default AppenderFilter instance and a specific user config set to Warning + FilteredAppender appender = new FilteredAppender(); + User testUser = generateUser(); + insert testUser; + + insert new fflib_LogLevelFilter__c( + + SetupOwnerId = testUser.Id, + LogLevel__c = System.LoggingLevel.WARN.name() + ); + + // When - we check if WARNING is valid + Boolean isValid = false; + System.runAs(testUser) + { + isValid = appender.checkValidLogLevel(System.LoggingLevel.WARN); + } + + // Then - It should be valid + System.assert(isValid); + } + + /** + * THIS UNIT TEST IS DISABLED BY DEFAULT SINCE THERE IS NO KNOWN STANDARD USER FACTORY METHOD FOR THE TARGET ORG + */ + @IsTest + static void itShouldValidateWarningLevelWithDefaultSetToErrorForSpecifiedProfile() + { + // Given - A default AppenderFilter instance and a specific user config set to Warning + FilteredAppender appender = new FilteredAppender(); + User testUser = generateUser(); + insert testUser; + + insert new fflib_LogLevelFilter__c( + + SetupOwnerId = testUser.ProfileId, + LogLevel__c = System.LoggingLevel.WARN.name() + ); + + // When - we check if WARNING is valid + Boolean isValid = false; + System.runAs(testUser) + { + isValid = appender.checkValidLogLevel(System.LoggingLevel.WARN); + } + + // Then - It should be valid + System.assert(isValid); + } + + @IsTest + static void itShouldValidateWarningLevelWithDefaultOrganisationLogLevelValueSetToWarning() + { + // GIVEN - A default AppenderFilter instance with log level set to ERROR + // and a custom setting at Organisation Level to WARNING + FilteredAppender appender = new FilteredAppender(); + + fflib_LogLevelFilter__c settings = fflib_LogLevelFilter__c.getOrgDefaults(); + settings.LogLevel__c = 'WARN'; + upsert settings fflib_LogLevelFilter__c.Id; + + // WHEN - We check if WARNING is valid + Boolean isValid = appender.checkValidLogLevel(System.LoggingLevel.WARN); + + // Then - It should be valid + System.assert(isValid); + } + + @IsTest + static void itShouldValidateWarningLevelWithDefaultOrganisationLogLevelValueSetToLowerCaseWarning() + { + // GIVEN - A default AppenderFilter instance with log level set to ERROR + // and a custom setting at Organisation Level to WARNING + FilteredAppender appender = new FilteredAppender(); + + fflib_LogLevelFilter__c settings = fflib_LogLevelFilter__c.getOrgDefaults(); + settings.LogLevel__c = 'warn'; + upsert settings fflib_LogLevelFilter__c.Id; + + // WHEN - We check if WARNING is valid + Boolean isValid = appender.checkValidLogLevel(System.LoggingLevel.WARN); + + // Then - It should be valid + System.assert(isValid); + } + + + @IsTest + static void itShouldNotFailWithIncorrectValueSetForDefaultOrganisationLogLevel() + { + // GIVEN - A default AppenderFilter instance with log level set to ERROR + // and a custom setting at Organisation Level to FAIL + FilteredAppender appender = new FilteredAppender(); + + fflib_LogLevelFilter__c settings = fflib_LogLevelFilter__c.getOrgDefaults(); + settings.LogLevel__c = 'Fail'; + upsert settings fflib_LogLevelFilter__c.Id; + + // WHEN - We check if WARNING is valid + Boolean isValid = appender.checkValidLogLevel(System.LoggingLevel.WARN); + + // Then - It should be valid + System.assert(!isValid); + } + + @IsTest + static void itShouldNotLogWhenSetToNone() + { + // GIVEN - A default AppenderFilter instance with log level set to NONE + FilteredAppender appender = new FilteredAppender(); + appender.setLoggingLevel(System.LoggingLevel.NONE); + + // WHEN - We check if WARNING is valid + Boolean isValid = appender.checkValidLogLevel(System.LoggingLevel.WARN); + + // Then - It should not be valid + System.assert(!isValid); + } + + + private static User generateUser() + { + Profile profile = [SELECT Id FROM Profile WHERE Name = :TEST_USER_PROFILE]; + return new User( + Alias = 'jnjfflib', + Email = 'TestUser@example.com', + EmailEncodingKey = 'UTF-8', + FirstName = 'Test', + LanguageLocaleKey = 'en_US', + LastName = 'User', + LocaleSidKey = 'en_US', + ProfileId = profile.Id, + TimeZoneSidKey = 'America/Los_Angeles', + Username = 'TestUser@example.com.jnjfflib' + ); + } + + private class FilteredAppender extends fflib_ALogAppenderFilter + { + public Boolean checkValidLogLevel(System.LoggingLevel logLevel) + { + return isValidLogLevel(logLevel); + } + + public void append(fflib_LogEntry logEntry) {} + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls new file mode 100644 index 0000000..cd4c5b9 --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls @@ -0,0 +1,103 @@ +/** + * File Name: fflib_LogEventAppenderTest + * Description: Unit test class for fflib_LogEventAppender.cls + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +@IsTest +private class fflib_LogEventAppenderTest +{ + private static final String TEST_ERROR_MESSAGE = 'My Error Message'; + + @IsTest + static void itShouldThrowEventOnAppendedLogEntry() + { + // GIVEN - An instance of the LogEventAppender + fflib_LogEventAppender eventAppender = new fflib_LogEventAppender(); + + + // WHEN - We append an entry + Boolean caughtException = false; + try + { + eventAppender.append(System.LoggingLevel.ERROR, TEST_ERROR_MESSAGE); + } + catch (Exception e) + { + caughtException = true; + } + + // THEN - An Log Event should be thrown + System.assert(!caughtException); + } + + static testMethod void itShouldNotAppendInfoMessageWhileDefaultLevelIsSetToError() + { + // GIVEN - And appender with a default level set to Error + fflib_LogEventAppender eventAppender = new fflib_LogEventAppender(); + + // WHEN - We append an Info Entry + eventAppender.append(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE); + + // THEN - It should be ignored + System.assertEquals(0, Limits.getDmlStatements(), 'Oops, the log entry should have been ignored'); + } + + static testMethod void itShouldAppendInfoMessageWhenTheApexLevelIsSetToInfo() + { + // GIVEN - And appender with a Apex level set to Info + fflib_LogEventAppender eventAppender = new fflib_LogEventAppender(); + eventAppender.setLoggingLevel(System.LoggingLevel.INFO); + + // WHEN - We append an Info Entry + System.Test.startTest(); + eventAppender.append(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE); + System.Test.stopTest(); + + // THEN - It should be ignored + System.assertEquals(1, [SELECT COUNT() FROM fflib_LogEntry__c]); + } + + static testMethod void itShouldAppendInfoMessageWhenTheOrgSettingsLevelIsSetToInfo() + { + // GIVEN - And appender with a Org level set to Info + fflib_LogEventAppender eventAppender = new fflib_LogEventAppender(); + + fflib_LogLevelFilter__c orgSettings = fflib_LogLevelFilter__c.getOrgDefaults(); + System.debug(orgSettings); + orgSettings.LogLevel__c = 'INFO'; + insert orgSettings; + + // WHEN - We append an Info Entry + System.Test.startTest(); + eventAppender.append(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE); + System.Test.stopTest(); + + // THEN - It should be ignored + System.assertEquals(1, [SELECT COUNT() FROM fflib_LogEntry__c]); + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls new file mode 100644 index 0000000..c0fff7e --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls @@ -0,0 +1,103 @@ +/** + * File Name: fflib_LogEventStoreListenerTest + * Description: Unit tests for fflib_LogEventStoreListener.cls + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +@IsTest +private class fflib_LogEventStoreListenerTest +{ + + private static final String ERROR_MESSAGE = 'My Error Message'; + + private static final String TEST_USER_PROFILE = 'Standard User'; + + @IsTest + static void itShouldStoreRecordOnLogEvent() + { + // GIVEN - A Log Event + fflib_LogEvent__e logEvent = generateLoggingLevelEvent(System.LoggingLevel.ERROR, ERROR_MESSAGE); + + // WHEN - The log event is published + System.Test.startTest(); + EventBus.publish(logEvent); + System.Test.stopTest(); + + // THEN - a record should be created in the Log Event Store + System.assertEquals(1, [SELECT COUNT() FROM fflib_LogEntry__c]); + } + + /** + * THIS UNIT TEST IS DISABLED BY DEFAULT SINCE THERE IS NO KNOWN STANDARD USER FACTORY METHOD FOR THE TARGET ORG + */ + @IsTest + static void itShouldStoreRecordOnLogEventWithUserDetails() + { + // GIVEN - A Log Event thrown by a specific user + fflib_LogEvent__e logEvent = generateLoggingLevelEvent(System.LoggingLevel.ERROR, ERROR_MESSAGE); + User testUser = generateUser(); + insert testUser; + + // WHEN - The log event is published + System.Test.startTest(); + System.runAs(testUser) + { + EventBus.publish(logEvent); + } + System.Test.stopTest(); + + // THEN - a record should be created in the Log Event Store + List logEntries = [SELECT Id, LogLevel__c, Message__c, User__c FROM fflib_LogEntry__c]; + System.assert(logEntries.size() == 1); + System.assertEquals(testUser.Id, logEntries.get(0).User__c, 'Log Entry stored with wrong CreatedById'); + } + + private static fflib_LogEvent__e generateLoggingLevelEvent(LoggingLevel loggingLevel, String message) + { + return new fflib_LogEvent__e( + LogLevel__c = loggingLevel.ordinal(), + message__c = message + ); + } + + private static User generateUser() + { + Profile profile = [SELECT Id FROM Profile WHERE Name = :TEST_USER_PROFILE]; + return new User( + Alias = 'jnjfflib', + Email = 'TestUser@example.com', + EmailEncodingKey = 'UTF-8', + FirstName = 'Test', + LanguageLocaleKey = 'en_US', + LastName = 'User', + LocaleSidKey = 'en_US', + ProfileId = profile.Id, + TimeZoneSidKey = 'America/Los_Angeles', + Username = 'TestUser@example.com.jnjfflib' + ); + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls new file mode 100644 index 0000000..83dd2ef --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls @@ -0,0 +1,326 @@ +/** + * File Name: fflib_LoggerTest + * Description: Unit test for fflib_Logger.cls + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +@IsTest +private class fflib_LoggerTest +{ +/* + private static final List ARGUMENTS = new List {'A', 'B', 'C'}; + private static final String ERROR_MESSAGE = 'Some Error'; + private static final String ERROR_MESSAGE_WITH_ARGS = 'Some Error {0}, {1}, {2}'; + private static final String ERROR_MESSAGE_FORMATTED_WITH_EXCEPTION = String.format( + 'Exception: {0} {1}\n Stack trace: {2}', + new List + { + 'LogTestMockException:[]:', + ERROR_MESSAGE, + '()' + } + ); + private static final String ERROR_MESSAGE_FORMATTED_WITH_ARGS = + String.format( + ERROR_MESSAGE_WITH_ARGS, + ARGUMENTS + ); + private static final LogAppenderMock APPENDER_MOCK = new LogAppenderMock(); + private static final SecondLogAppenderMock APPENDER_MOCK_B = new SecondLogAppenderMock(); + + + @IsTest + static void itShouldAppendAMessage() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.add(ERROR_MESSAGE); + + // THEN - It should be appended to the logAppender + System.assert(APPENDER_MOCK.getAppendedMessages(System.LoggingLevel.INFO).contains(ERROR_MESSAGE)); + } + + @IsTest + static void itShouldAppendDebugMessage() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.debug(ERROR_MESSAGE); + + // THEN - It should be appended to the logAppender + System.assert( + APPENDER_MOCK + .getAppendedMessages(System.LoggingLevel.DEBUG) + .contains(ERROR_MESSAGE) + ); + } + + /** + * todo : For some reason this method fails when run by Jenkins deployment user during a build, need to investigate why and re-enable it + + @IsTest + static void itShouldAppendDebugException() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + Exception e = new LogTestMockException(ERROR_MESSAGE); + + // WHEN - When the error is logged + log.debug(e); + + // THEN - It should be appended to the logAppender + System.assert( + APPENDER_MOCK + .getAppendedMessages(System.LoggingLevel.DEBUG) + .contains(ERROR_MESSAGE_FORMATTED_WITH_EXCEPTION) + ); + } + */ + + @IsTest + static void itShouldAppendDebugMessageWithArguments() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.debug(ERROR_MESSAGE_WITH_ARGS, ARGUMENTS); + + // THEN - It should be appended to the logAppender + System.assert( + APPENDER_MOCK + .getAppendedMessages(System.LoggingLevel.DEBUG) + .contains(ERROR_MESSAGE_FORMATTED_WITH_ARGS) + ); + } + + @IsTest + static void itShouldAppendErrorMessage() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.error(ERROR_MESSAGE); + + // THEN - It should be appended to the logAppender + System.assert(APPENDER_MOCK.getAppendedMessages(System.LoggingLevel.ERROR).contains(ERROR_MESSAGE)); + } + + @IsTest + static void itShouldAppendErrorMessageWithArguments() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.error(ERROR_MESSAGE_WITH_ARGS, ARGUMENTS); + + // THEN - It should be appended to the logAppender + System.assert( + APPENDER_MOCK + .getAppendedMessages(System.LoggingLevel.ERROR) + .contains(ERROR_MESSAGE_FORMATTED_WITH_ARGS) + ); + } + + @IsTest + static void itShouldAppendInfoMessage() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.info(ERROR_MESSAGE); + + // THEN - It should be appended to the logAppender + System.assert(APPENDER_MOCK.getAppendedMessages(System.LoggingLevel.INFO).contains(ERROR_MESSAGE)); + } + + @IsTest + static void itShouldAppendInfoMessageWithArguments() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.info(ERROR_MESSAGE_WITH_ARGS, ARGUMENTS); + + // THEN - It should be appended to the logAppender + System.assert( + APPENDER_MOCK + .getAppendedMessages(System.LoggingLevel.INFO) + .contains(ERROR_MESSAGE_FORMATTED_WITH_ARGS) + ); + } + + @IsTest + static void itShouldAppendWarningMessage() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.warning(ERROR_MESSAGE); + + // THEN - It should be appended to the logAppender + System.assert(APPENDER_MOCK.getAppendedMessages(System.LoggingLevel.WARN).contains(ERROR_MESSAGE)); + } + + @IsTest + static void itShouldAppendWarningMessageWithArguments() + { + // GIVEN - An error message and a configured logger + fflib_ILogger log = generatedLoggerWithMockAppender(); + + // WHEN - When the error is logged + log.warning(ERROR_MESSAGE_WITH_ARGS, ARGUMENTS); + + // THEN - It should be appended to the logAppender + System.assert( + APPENDER_MOCK + .getAppendedMessages(System.LoggingLevel.WARN) + .contains(ERROR_MESSAGE_FORMATTED_WITH_ARGS) + ); + } + + @IsTest + static void itShouldHandleTwoAppenders() + { + // GIVEN an error message and a logger with two appenders configured + fflib_ILogger log = new fflib_Logger(); + log.addAppender(APPENDER_MOCK); + log.addAppender(APPENDER_MOCK_B); + log.setMessageFormatter(new fflib_Logger.LogMessageFormatter()); + + // WHEN - When the error is logged + log.error(ERROR_MESSAGE); + + // THEN - It Should be added to both appenders + System.assert( + APPENDER_MOCK + .getAppendedMessages(System.LoggingLevel.ERROR) + .contains(ERROR_MESSAGE) + ); + System.assert( + APPENDER_MOCK_B + .getAppendedMessages(System.LoggingLevel.ERROR) + .contains(ERROR_MESSAGE) + ); + } + + + private static fflib_ILogger generatedLoggerWithMockAppender() + { + fflib_ILogger result = new fflib_Logger(); + result.setAppender(APPENDER_MOCK); + result.setMessageFormatter(new fflib_Logger.LogMessageFormatter()); + return result; + } + + + private class LogAppenderMock implements fflib_ILogAppender + { + private Map> appendedMessages = + new Map>(); + + public void append(String message) + { + if (!this.appendedMessages.containsKey(System.LoggingLevel.INFO)) + { + this.appendedMessages.put(System.LoggingLevel.INFO, new List()); + } + appendedMessages.get(System.LoggingLevel.INFO).add(message); + } + + public void append(LoggingLevel loggingLevel, String message) + { + if (!this.appendedMessages.containsKey(loggingLevel)) + { + this.appendedMessages.put(loggingLevel, new List()); + } + appendedMessages.get(loggingLevel).add(message); + } + + public List getAppendedMessages(System.LoggingLevel loggingLevel) + { + if (this.appendedMessages.containsKey(loggingLevel)) + { + return this.appendedMessages.get(loggingLevel); + } + else + { + return new List(); + } + } + } + + private class SecondLogAppenderMock implements fflib_ILogAppender + { + private Map> appendedMessages = + new Map>(); + + public void append(String message) + { + if (!this.appendedMessages.containsKey(System.LoggingLevel.INFO)) + { + this.appendedMessages.put(System.LoggingLevel.INFO, new List()); + } + appendedMessages.get(System.LoggingLevel.INFO).add(message); + } + + public void append(LoggingLevel loggingLevel, String message) + { + if (!this.appendedMessages.containsKey(loggingLevel)) + { + this.appendedMessages.put(loggingLevel, new List()); + } + appendedMessages.get(loggingLevel).add(message); + } + + public List getAppendedMessages(System.LoggingLevel loggingLevel) + { + if (this.appendedMessages.containsKey(loggingLevel)) + { + return this.appendedMessages.get(loggingLevel); + } + else + { + return new List(); + } + } + } + + private class LogTestMockException extends Exception + { + } + */ +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls-meta.xml new file mode 100644 index 0000000..f3bac1f --- /dev/null +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 41.0 + Active + From fa51e1d6578fd5db9d2b821ff75df820552d878f Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Thu, 30 Sep 2021 11:14:55 +0100 Subject: [PATCH 02/10] Package version upgrade to API 53.0 --- .../classic/classes/fflib_ClassicDomainFactory.cls-meta.xml | 2 +- .../classic/classes/fflib_ClassicSelectorFactory.cls-meta.xml | 2 +- .../classic/classes/fflib_ClassicServiceFactory.cls-meta.xml | 2 +- .../classes/fflib_ClassicTriggerHandlerFactory.cls-meta.xml | 2 +- .../classic/classes/fflib_ClassicUnitOfWorkFactory.cls-meta.xml | 2 +- .../application/dynamic/classes/fflib_AppBinding.cls-meta.xml | 2 +- .../dynamic/classes/fflib_AppBindingMetaDataModule.cls-meta.xml | 2 +- .../dynamic/classes/fflib_AppBindingModule.cls-meta.xml | 2 +- .../dynamic/classes/fflib_AppBindingResolver.cls-meta.xml | 2 +- .../dynamic/classes/fflib_AppBindingType.cls-meta.xml | 2 +- .../application/dynamic/classes/fflib_AppBindings.cls-meta.xml | 2 +- .../dynamic/classes/fflib_AppBindingsSelector.cls-meta.xml | 2 +- .../dynamic/classes/fflib_DynamicAppFactory.cls-meta.xml | 2 +- .../dynamic/classes/fflib_DynamicDomainFactory.cls-meta.xml | 2 +- .../dynamic/classes/fflib_DynamicSelectorFactory.cls-meta.xml | 2 +- .../dynamic/classes/fflib_DynamicServiceFactory.cls-meta.xml | 2 +- .../application/dynamic/classes/fflib_SharingMode.cls-meta.xml | 2 +- .../dynamic/classes/interfaces/fflib_IAppBinding.cls-meta.xml | 2 +- .../classes/interfaces/fflib_IAppBindingModule.cls-meta.xml | 2 +- .../classes/interfaces/fflib_IAppBindingResolver.cls-meta.xml | 2 +- .../classes/interfaces/fflib_IAppBindingRouter.cls-meta.xml | 2 +- .../dynamic/classes/interfaces/fflib_IAppBindings.cls-meta.xml | 2 +- .../main/classes/interfaces/fflib_IDomainFactory.cls-meta.xml | 2 +- .../main/classes/interfaces/fflib_ISelectorFactory.cls-meta.xml | 2 +- .../main/classes/interfaces/fflib_IServiceFactory.cls-meta.xml | 2 +- .../classes/interfaces/fflib_IUnitOfWorkFactory.cls-meta.xml | 2 +- .../main/default/classes/criteria/fflib_Comparator.cls-meta.xml | 2 +- .../main/default/classes/criteria/fflib_Criteria.cls-meta.xml | 2 +- .../main/default/classes/criteria/fflib_Operator.cls-meta.xml | 2 +- .../default/classes/criteria/fflib_OperatorUtils.cls-meta.xml | 2 +- .../main/default/classes/domains/DateTimes.cls-meta.xml | 2 +- .../main/default/classes/domains/Dates.cls-meta.xml | 2 +- .../main/default/classes/domains/Decimals.cls-meta.xml | 2 +- .../main/default/classes/domains/Doubles.cls-meta.xml | 2 +- .../main/default/classes/domains/Ids.cls-meta.xml | 2 +- .../main/default/classes/domains/Integers.cls-meta.xml | 2 +- .../main/default/classes/domains/Longs.cls-meta.xml | 2 +- .../main/default/classes/domains/Objects.cls-meta.xml | 2 +- .../main/default/classes/domains/SObjects.cls-meta.xml | 2 +- .../main/default/classes/domains/Strings.cls-meta.xml | 2 +- .../main/default/classes/utils/fflib_ArrayUtils.cls-meta.xml | 2 +- .../default/classes/utils/fflib_MockSObjectUtil.cls-meta.xml | 2 +- .../main/default/classes/utils/fflib_StringUtils.cls-meta.xml | 2 +- .../main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml | 2 +- .../main/logger/classes/fflib_ILogAppender.cls-meta.xml | 2 +- .../main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml | 2 +- .../main/logger/classes/fflib_ILogger.cls-meta.xml | 2 +- .../main/logger/classes/fflib_LogEntry.cls-meta.xml | 2 +- .../main/logger/classes/fflib_LogEventAppender.cls-meta.xml | 2 +- .../main/logger/classes/fflib_LogEventDomain.cls-meta.xml | 2 +- .../logger/classes/fflib_LogEventStoreListener.cls-meta.xml | 2 +- .../main/logger/classes/fflib_Logger.cls-meta.xml | 2 +- .../main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml | 2 +- .../logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml | 2 +- .../main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml | 2 +- 55 files changed, 55 insertions(+), 55 deletions(-) diff --git a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicDomainFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicDomainFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicDomainFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicDomainFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicSelectorFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicSelectorFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicSelectorFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicSelectorFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicServiceFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicServiceFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicServiceFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicServiceFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicTriggerHandlerFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicTriggerHandlerFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicTriggerHandlerFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicTriggerHandlerFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicUnitOfWorkFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicUnitOfWorkFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicUnitOfWorkFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/classic/classes/fflib_ClassicUnitOfWorkFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBinding.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBinding.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBinding.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBinding.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingMetaDataModule.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingMetaDataModule.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingMetaDataModule.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingMetaDataModule.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingModule.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingModule.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingModule.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingModule.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingResolver.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingResolver.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingResolver.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingResolver.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingType.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingType.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingType.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingType.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindings.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindings.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindings.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindings.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingsSelector.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingsSelector.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingsSelector.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_AppBindingsSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicAppFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicAppFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicAppFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicAppFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicDomainFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicDomainFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicDomainFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicDomainFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicServiceFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicServiceFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicServiceFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicServiceFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_SharingMode.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_SharingMode.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_SharingMode.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_SharingMode.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBinding.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBinding.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBinding.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBinding.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingModule.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingModule.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingModule.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingModule.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingResolver.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingResolver.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingResolver.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingResolver.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingRouter.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingRouter.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingRouter.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindingRouter.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindings.cls-meta.xml b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindings.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindings.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/interfaces/fflib_IAppBindings.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IDomainFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IDomainFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IDomainFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IDomainFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_ISelectorFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_ISelectorFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_ISelectorFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_ISelectorFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IServiceFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IServiceFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IServiceFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IServiceFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IUnitOfWorkFactory.cls-meta.xml b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IUnitOfWorkFactory.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IUnitOfWorkFactory.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/application/main/classes/interfaces/fflib_IUnitOfWorkFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Comparator.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Comparator.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Comparator.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Comparator.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Operator.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Operator.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Operator.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Operator.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_OperatorUtils.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_OperatorUtils.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_OperatorUtils.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_OperatorUtils.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml index db9bf8c..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml @@ -1,5 +1,5 @@ - 48.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/utils/fflib_ArrayUtils.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/utils/fflib_ArrayUtils.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/utils/fflib_ArrayUtils.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/utils/fflib_ArrayUtils.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/utils/fflib_MockSObjectUtil.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/utils/fflib_MockSObjectUtil.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/utils/fflib_MockSObjectUtil.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/utils/fflib_MockSObjectUtil.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/default/classes/utils/fflib_StringUtils.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/utils/fflib_StringUtils.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/utils/fflib_StringUtils.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/default/classes/utils/fflib_StringUtils.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ALogAppenderFilter.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml index c413058..70d3c75 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml index d75b058..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventAppender.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml index 91b23b8..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 46.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml index 91b23b8..f928c8e 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 46.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml b/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml index 6205514..268e21b 100644 --- a/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/triggers/fflib_LogEventTrigger.trigger-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active From 029b76e2a02f6e1bbaa07efb38f9950b6bdec23a Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Thu, 30 Sep 2021 11:51:37 +0100 Subject: [PATCH 03/10] Rename labels of Log Level picklist field --- .../fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml index 54d66be..e60cbc9 100644 --- a/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml +++ b/sfdx-source/apex-extensions/main/logger/objects/fflib_LogEntry__c/fields/LogLevel__c.field-meta.xml @@ -14,22 +14,22 @@ ERROR false - + WARN false - + INFO false - + DEBUG false - + From 09578ffcc25d9a26dcfcc40f8ee84f1a808580be Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Mon, 11 Oct 2021 13:20:43 +0100 Subject: [PATCH 04/10] Add logger functionality plus API upgrade --- .../main/logger/classes/fflib_LogEntry.cls | 6 +- .../logger/classes/fflib_LogEventDomain.cls | 19 +---- .../classes/fflib_LogEventStoreListener.cls | 11 ++- .../main/logger/classes/fflib_Logger.cls | 1 - .../logger/fflib_LogEventAppenderTest.cls | 17 ++-- .../fflib_LogEventStoreListenerTest.cls | 2 +- .../tests/classes/logger/fflib_LoggerTest.cls | 79 ++++--------------- 7 files changed, 37 insertions(+), 98 deletions(-) diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls index f9fa716..baefb4c 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEntry.cls @@ -32,7 +32,6 @@ public with sharing class fflib_LogEntry public String className { get; set; } public String executionContext { get; set; } public Decimal lineNumber { get; set; } - public Id logEntryId { get; set; } public System.LoggingLevel logLevel { get; set; } public String message { get; set; } public String methodName { get; set; } @@ -57,8 +56,11 @@ public with sharing class fflib_LogEntry this.className = logEvent.ClassName__c; this.executionContext = logEvent.ExecutionContext__c; this.lineNumber = logEvent.LineNumber__c; - this.logEntryId = logEvent.Id; this.logLevel = System.LoggingLevel.valueOf(logEvent.LogLevel__c); + this.message = logEvent.Message__c; + this.methodName = logEvent.MethodName__c; + this.userId = logEvent.CreatedById; + this.createdDatetime = logEvent.CreatedDate; } public fflib_LogEvent__e toPlatformEvent() diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls index 29535e4..7115cac 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventDomain.cls @@ -47,25 +47,8 @@ public abstract with sharing class fflib_LogEventDomain extends fflib_PlatformEv for (SObject record : Records) { this.logEntries.add( - new LogEntry((fflib_LogEvent__e) record) + new fflib_LogEntry((fflib_LogEvent__e) record) ); } } - - public class LogEntry - { - public Id createdById; - public Datetime createdDatetime; - public System.LoggingLevel loggingLevel; - public String message; - - public LogEntry(fflib_LogEvent__e event) - { - this.loggingLevel = System.LoggingLevel.values().get((Integer) event.LogLevel__c); - this.message = event.message__c; - this.createdById = event.CreatedById; - this.createdDatetime = event.CreatedDate; - } - } - } \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls index 1c6bd75..1a0b4f1 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_LogEventStoreListener.cls @@ -30,7 +30,6 @@ */ public with sharing class fflib_LogEventStoreListener extends fflib_LogEventDomain { - /** * Class constructor */ @@ -42,13 +41,17 @@ public with sharing class fflib_LogEventStoreListener extends fflib_LogEventDoma public void run() { List logEntryRecords = new List(); - for (fflib_LogEventDomain.LogEntry logEntry : logEntries) + for (fflib_LogEntry logEntry : logEntries) { logEntryRecords.add( new fflib_LogEntry__c( - LogLevel__c = logEntry.loggingLevel.name(), + ClassName__c = logEntry.className, + ExecutionContext__c = logEntry.executionContext, + LineNumber__c = logEntry.lineNumber, + LogLevel__c = logEntry.logLevel.name(), Message__c = logEntry.message, - User__c = logEntry.createdById + MethodName__c = logEntry.methodName, + User__c = logEntry.userId ) ); } diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls index 0792098..df56eb2 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_Logger.cls @@ -50,7 +50,6 @@ public with sharing class fflib_Logger implements fflib_ILogger public void add(String message) { add(System.LoggingLevel.INFO, message); - } public void add(LoggingLevel loggingLevel, Exception e) diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls index cd4c5b9..70eaed0 100644 --- a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventAppenderTest.cls @@ -44,7 +44,7 @@ private class fflib_LogEventAppenderTest Boolean caughtException = false; try { - eventAppender.append(System.LoggingLevel.ERROR, TEST_ERROR_MESSAGE); + eventAppender.append(new fflib_LogEntry(System.LoggingLevel.ERROR, TEST_ERROR_MESSAGE)); } catch (Exception e) { @@ -55,19 +55,21 @@ private class fflib_LogEventAppenderTest System.assert(!caughtException); } - static testMethod void itShouldNotAppendInfoMessageWhileDefaultLevelIsSetToError() + @IsTest + static void itShouldNotAppendInfoMessageWhileDefaultLevelIsSetToError() { // GIVEN - And appender with a default level set to Error fflib_LogEventAppender eventAppender = new fflib_LogEventAppender(); // WHEN - We append an Info Entry - eventAppender.append(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE); + eventAppender.append(new fflib_LogEntry(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE)); // THEN - It should be ignored System.assertEquals(0, Limits.getDmlStatements(), 'Oops, the log entry should have been ignored'); } - static testMethod void itShouldAppendInfoMessageWhenTheApexLevelIsSetToInfo() + @IsTest + static void itShouldAppendInfoMessageWhenTheApexLevelIsSetToInfo() { // GIVEN - And appender with a Apex level set to Info fflib_LogEventAppender eventAppender = new fflib_LogEventAppender(); @@ -75,14 +77,15 @@ private class fflib_LogEventAppenderTest // WHEN - We append an Info Entry System.Test.startTest(); - eventAppender.append(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE); + eventAppender.append(new fflib_LogEntry(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE)); System.Test.stopTest(); // THEN - It should be ignored System.assertEquals(1, [SELECT COUNT() FROM fflib_LogEntry__c]); } - static testMethod void itShouldAppendInfoMessageWhenTheOrgSettingsLevelIsSetToInfo() + @IsTest + static void itShouldAppendInfoMessageWhenTheOrgSettingsLevelIsSetToInfo() { // GIVEN - And appender with a Org level set to Info fflib_LogEventAppender eventAppender = new fflib_LogEventAppender(); @@ -94,7 +97,7 @@ private class fflib_LogEventAppenderTest // WHEN - We append an Info Entry System.Test.startTest(); - eventAppender.append(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE); + eventAppender.append(new fflib_LogEntry(System.LoggingLevel.INFO, TEST_ERROR_MESSAGE)); System.Test.stopTest(); // THEN - It should be ignored diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls index c0fff7e..8c91dc1 100644 --- a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LogEventStoreListenerTest.cls @@ -79,7 +79,7 @@ private class fflib_LogEventStoreListenerTest private static fflib_LogEvent__e generateLoggingLevelEvent(LoggingLevel loggingLevel, String message) { return new fflib_LogEvent__e( - LogLevel__c = loggingLevel.ordinal(), + LogLevel__c = loggingLevel.name(), message__c = message ); } diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls index 83dd2ef..2d4257e 100644 --- a/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_LoggerTest.cls @@ -31,7 +31,7 @@ @IsTest private class fflib_LoggerTest { -/* + private static final List ARGUMENTS = new List {'A', 'B', 'C'}; private static final String ERROR_MESSAGE = 'Some Error'; private static final String ERROR_MESSAGE_WITH_ARGS = 'Some Error {0}, {1}, {2}'; @@ -247,80 +247,29 @@ private class fflib_LoggerTest } - private class LogAppenderMock implements fflib_ILogAppender + private virtual class LogAppenderMock implements fflib_ILogAppender { - private Map> appendedMessages = - new Map>(); + protected List appendedEntries = new List(); - public void append(String message) + public void append(fflib_LogEntry logEntry) { - if (!this.appendedMessages.containsKey(System.LoggingLevel.INFO)) - { - this.appendedMessages.put(System.LoggingLevel.INFO, new List()); - } - appendedMessages.get(System.LoggingLevel.INFO).add(message); + this.appendedEntries.add(logEntry); } - - public void append(LoggingLevel loggingLevel, String message) - { - if (!this.appendedMessages.containsKey(loggingLevel)) - { - this.appendedMessages.put(loggingLevel, new List()); - } - appendedMessages.get(loggingLevel).add(message); - } - public List getAppendedMessages(System.LoggingLevel loggingLevel) { - if (this.appendedMessages.containsKey(loggingLevel)) + List result = new List(); + for (fflib_LogEntry logEntry : appendedEntries) { - return this.appendedMessages.get(loggingLevel); - } - else - { - return new List(); + if (logEntry.logLevel == loggingLevel) + { + result.add(logEntry.message); + } } + return result; } } - private class SecondLogAppenderMock implements fflib_ILogAppender - { - private Map> appendedMessages = - new Map>(); + private class SecondLogAppenderMock extends LogAppenderMock { } - public void append(String message) - { - if (!this.appendedMessages.containsKey(System.LoggingLevel.INFO)) - { - this.appendedMessages.put(System.LoggingLevel.INFO, new List()); - } - appendedMessages.get(System.LoggingLevel.INFO).add(message); - } - - public void append(LoggingLevel loggingLevel, String message) - { - if (!this.appendedMessages.containsKey(loggingLevel)) - { - this.appendedMessages.put(loggingLevel, new List()); - } - appendedMessages.get(loggingLevel).add(message); - } - - public List getAppendedMessages(System.LoggingLevel loggingLevel) - { - if (this.appendedMessages.containsKey(loggingLevel)) - { - return this.appendedMessages.get(loggingLevel); - } - else - { - return new List(); - } - } - } - - private class LogTestMockException extends Exception - { - } - */ + private class LogTestMockException extends Exception {} } \ No newline at end of file From 698b6f24676f26e461a866ee7c56b58ff256e755 Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Mon, 11 Oct 2021 13:51:41 +0100 Subject: [PATCH 05/10] Add logger functionality plus API upgrade --- .../main/logger/classes/fflib_PlatformEventDomain.cls | 2 +- .../main/logger/classes/{ => interfaces}/fflib_ILogAppender.cls | 0 .../classes/{ => interfaces}/fflib_ILogAppender.cls-meta.xml | 0 .../classes/{ => interfaces}/fflib_ILogMessageFormatter.cls | 0 .../{ => interfaces}/fflib_ILogMessageFormatter.cls-meta.xml | 0 .../main/logger/classes/{ => interfaces}/fflib_ILogger.cls | 0 .../logger/classes/{ => interfaces}/fflib_ILogger.cls-meta.xml | 0 .../fflib_IPlatformEventDomain.cls} | 2 +- .../fflib_IPlatformEventDomain.cls-meta.xml} | 0 9 files changed, 2 insertions(+), 2 deletions(-) rename sfdx-source/apex-extensions/main/logger/classes/{ => interfaces}/fflib_ILogAppender.cls (100%) rename sfdx-source/apex-extensions/main/logger/classes/{ => interfaces}/fflib_ILogAppender.cls-meta.xml (100%) rename sfdx-source/apex-extensions/main/logger/classes/{ => interfaces}/fflib_ILogMessageFormatter.cls (100%) rename sfdx-source/apex-extensions/main/logger/classes/{ => interfaces}/fflib_ILogMessageFormatter.cls-meta.xml (100%) rename sfdx-source/apex-extensions/main/logger/classes/{ => interfaces}/fflib_ILogger.cls (100%) rename sfdx-source/apex-extensions/main/logger/classes/{ => interfaces}/fflib_ILogger.cls-meta.xml (100%) rename sfdx-source/apex-extensions/main/logger/classes/{ffllib_IPlatformEventDomain.cls => interfaces/fflib_IPlatformEventDomain.cls} (97%) rename sfdx-source/apex-extensions/main/logger/classes/{ffllib_IPlatformEventDomain.cls-meta.xml => interfaces/fflib_IPlatformEventDomain.cls-meta.xml} (100%) diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls index 3b58590..6150c1d 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls +++ b/sfdx-source/apex-extensions/main/logger/classes/fflib_PlatformEventDomain.cls @@ -28,7 +28,7 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public abstract with sharing class fflib_PlatformEventDomain implements ffllib_IPlatformEventDomain +public abstract with sharing class fflib_PlatformEventDomain implements fflib_IPlatformEventDomain { protected List Records { get; private set; } diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogAppender.cls similarity index 100% rename from sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogAppender.cls diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogAppender.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/logger/classes/fflib_ILogAppender.cls-meta.xml rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogAppender.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogMessageFormatter.cls similarity index 100% rename from sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogMessageFormatter.cls diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogMessageFormatter.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/logger/classes/fflib_ILogMessageFormatter.cls-meta.xml rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogMessageFormatter.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogger.cls similarity index 100% rename from sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogger.cls diff --git a/sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogger.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/logger/classes/fflib_ILogger.cls-meta.xml rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_ILogger.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_IPlatformEventDomain.cls similarity index 97% rename from sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_IPlatformEventDomain.cls index eabe777..dac792f 100644 --- a/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls +++ b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_IPlatformEventDomain.cls @@ -28,7 +28,7 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public interface ffllib_IPlatformEventDomain +public interface fflib_IPlatformEventDomain { void run(); } \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml b/sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_IPlatformEventDomain.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/logger/classes/ffllib_IPlatformEventDomain.cls-meta.xml rename to sfdx-source/apex-extensions/main/logger/classes/interfaces/fflib_IPlatformEventDomain.cls-meta.xml From baebbe6d8b352b33a48bf75cd35c1ab735207c59 Mon Sep 17 00:00:00 2001 From: Wim Velzeboer Date: Mon, 20 Sep 2021 14:53:12 +0100 Subject: [PATCH 06/10] Add getChangedRecord method overloads --- .../fflib_ISObjectTriggerHandler.cls | 45 +++++++++++++++++++ .../fflib_ISObjectTriggerHandler.cls-meta.xml | 5 +++ .../fflib_SObjectTriggerHandler.cls | 44 ++++++++++++++++++ .../fflib_SObjectTriggerHandler.cls-meta.xml | 5 +++ 4 files changed, 99 insertions(+) create mode 100644 sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls create mode 100644 sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls-meta.xml create mode 100644 sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls create mode 100644 sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls new file mode 100644 index 0000000..3b91274 --- /dev/null +++ b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls @@ -0,0 +1,45 @@ +/** + * File Name: fflib_ISObjectTriggerHandler + * @description + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public interface fflib_ISObjectTriggerHandler + extends fflib_ISObjectDomain +{ + /** + * Detects whether any values in context records have changed for given field as string + * Returns list of SObject records that have changes in the specified field + **/ + List getChangedRecords(String fileName); + + /** + * Detects whether any values in context records have changed for given field as token + * Returns list of SObject records that have changes in the specified field + **/ + List getChangedRecords(Schema.SObjectField fieldToken); +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls-meta.xml new file mode 100644 index 0000000..d75b058 --- /dev/null +++ b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_ISObjectTriggerHandler.cls-meta.xml @@ -0,0 +1,5 @@ + + + 51.0 + Active + diff --git a/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls new file mode 100644 index 0000000..f603dd1 --- /dev/null +++ b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls @@ -0,0 +1,44 @@ +/** + * File Name: fflib_SObjectTriggerHandler + * @description + * + * @author architect ir. Wilhelmus G.J. Velzeboer + * + * Copyright (c), W.G.J. Velzeboer, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above author notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +public with sharing class fflib_SObjectTriggerHandler + extends fflib_SObjectDomain + implements fflib_ISObjectTriggerHandler +{ + public List getChangedRecords(String fileName) + { + return getChangedRecords(new Set{ fileName }); + } + + public List getChangedRecords(Schema.SObjectField fieldToken) + { + return getChangedRecords(new Set{ fieldToken }); + } +} \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls-meta.xml new file mode 100644 index 0000000..d75b058 --- /dev/null +++ b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls-meta.xml @@ -0,0 +1,5 @@ + + + 51.0 + Active + From d8e7872c2b4cba3b3b0cbc6d06611490d58184c0 Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Fri, 24 Sep 2021 21:12:10 +0100 Subject: [PATCH 07/10] Fix build failure --- .../triggerHanders/fflib_SObjectTriggerHandler.cls | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls index f603dd1..a379b6f 100644 --- a/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls +++ b/sfdx-source/apex-extensions/main/default/classes/triggerHanders/fflib_SObjectTriggerHandler.cls @@ -32,6 +32,16 @@ public with sharing class fflib_SObjectTriggerHandler extends fflib_SObjectDomain implements fflib_ISObjectTriggerHandler { + public fflib_SObjectTriggerHandler(List records) + { + super(records); + } + + public fflib_SObjectTriggerHandler(List records, Schema.SObjectType sObjectType) + { + super(records, sObjectType); + } + public List getChangedRecords(String fileName) { return getChangedRecords(new Set{ fileName }); From 4b58dbb2d1449560ef422742699d719e8044b419 Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Tue, 5 Oct 2021 10:22:23 +0100 Subject: [PATCH 08/10] Add "fflib_" prefix to primitive domain classes --- .../fileTemplates/AEPE - Domain Structure.cls | 2 +- docs/criteria-based-filter.md | 62 +++++++-------- docs/domains/sobject.md | 4 +- docs/primitive-domains.md | 3 +- .../classes/fflib_DynamicSelectorFactory.cls | 2 +- .../classes/criteria/fflib_Criteria.cls | 32 ++++---- .../{DateTimes.cls => fflib_DateTimes.cls} | 12 +-- ...-meta.xml => fflib_DateTimes.cls-meta.xml} | 0 .../domains/{Dates.cls => fflib_Dates.cls} | 12 +-- ....cls-meta.xml => fflib_Dates.cls-meta.xml} | 0 .../{Decimals.cls => fflib_Decimals.cls} | 12 +-- ...s-meta.xml => fflib_Decimals.cls-meta.xml} | 0 .../{Doubles.cls => fflib_Doubles.cls} | 12 +-- ...ls-meta.xml => fflib_Doubles.cls-meta.xml} | 0 .../domains/{Ids.cls => fflib_Ids.cls} | 14 ++-- ...ds.cls-meta.xml => fflib_Ids.cls-meta.xml} | 0 .../{Integers.cls => fflib_Integers.cls} | 12 +-- ...s-meta.xml => fflib_Integers.cls-meta.xml} | 0 .../domains/{Longs.cls => fflib_Longs.cls} | 12 +-- ....cls-meta.xml => fflib_Longs.cls-meta.xml} | 0 .../{Objects.cls => fflib_Objects2.cls} | 6 +- ...s-meta.xml => fflib_Objects2.cls-meta.xml} | 0 .../{SObjects.cls => fflib_SObjects2.cls} | 78 +++++++++---------- ...-meta.xml => fflib_SObjects2.cls-meta.xml} | 0 .../{Strings.cls => fflib_Strings.cls} | 12 +-- ...ls-meta.xml => fflib_Strings.cls-meta.xml} | 0 .../fflib_ClassicDomainFactoryTest.cls | 2 +- .../classes/domains/PrimitiveDomainsTest.cls | 50 ++++++------ .../tests/classes/domains/SObjectsTest.cls | 4 +- 29 files changed, 172 insertions(+), 171 deletions(-) rename sfdx-source/apex-extensions/main/default/classes/domains/{DateTimes.cls => fflib_DateTimes.cls} (88%) rename sfdx-source/apex-extensions/main/default/classes/domains/{DateTimes.cls-meta.xml => fflib_DateTimes.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Dates.cls => fflib_Dates.cls} (90%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Dates.cls-meta.xml => fflib_Dates.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Decimals.cls => fflib_Decimals.cls} (89%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Decimals.cls-meta.xml => fflib_Decimals.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Doubles.cls => fflib_Doubles.cls} (89%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Doubles.cls-meta.xml => fflib_Doubles.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Ids.cls => fflib_Ids.cls} (90%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Ids.cls-meta.xml => fflib_Ids.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Integers.cls => fflib_Integers.cls} (88%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Integers.cls-meta.xml => fflib_Integers.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Longs.cls => fflib_Longs.cls} (89%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Longs.cls-meta.xml => fflib_Longs.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Objects.cls => fflib_Objects2.cls} (93%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Objects.cls-meta.xml => fflib_Objects2.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{SObjects.cls => fflib_SObjects2.cls} (88%) rename sfdx-source/apex-extensions/main/default/classes/domains/{SObjects.cls-meta.xml => fflib_SObjects2.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Strings.cls => fflib_Strings.cls} (90%) rename sfdx-source/apex-extensions/main/default/classes/domains/{Strings.cls-meta.xml => fflib_Strings.cls-meta.xml} (100%) diff --git a/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls b/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls index e72ac51..e2ce1c0 100644 --- a/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls +++ b/dev-tools/assets/intelliJ/fileTemplates/AEPE - Domain Structure.cls @@ -1,5 +1,5 @@ public inherited sharing class ${NAME} - extends SObjects + extends fflib_SObjects2 implements I${NAME} { public static I${NAME} newInstance(List<${SObject_API_Name}> records) diff --git a/docs/criteria-based-filter.md b/docs/criteria-based-filter.md index 8f55aed..3422b6f 100644 --- a/docs/criteria-based-filter.md +++ b/docs/criteria-based-filter.md @@ -41,39 +41,39 @@ How it can be applied in a Domain class: ```apex public with sharing class Accounts - extends SObjects - implements IAccounts + extends fflib_SObjects2 + implements IAccounts { - private static final Integer LARGE_ACCOUNT_EMPLOYEE_NUMBERS = 500; + private static final Integer LARGE_ACCOUNT_EMPLOYEE_NUMBERS = 500; - public Accounts getByCountry(String countryName) - { - return new Accounts( - getRecords( - new AccountCriteria().shippingCountryEquals(countryName) - ) - ); - } - - public Accounts getByNumberOfEmployeesGreaterThan(Integer numberOfEmployees) - { - return new Accounts( - getRecords( - new AccountCriteria().numberOfEmployeesGreaterThan(numberOfEmployees) - ) - ); - } - - public Accounts getByLargeAccountsInCountry(String countryName) - { - return new Accounts( - getRecords( - new AccountCriteria() - .shippingCountryEquals(countryName) - .numberOfEmployeesGreaterThan(numberOfEmployees) - ) - ); - } + public Accounts getByCountry(String countryName) + { + return new Accounts( + getRecords( + new AccountCriteria().shippingCountryEquals(countryName) + ) + ); + } + + public Accounts getByNumberOfEmployeesGreaterThan(Integer numberOfEmployees) + { + return new Accounts( + getRecords( + new AccountCriteria().numberOfEmployeesGreaterThan(numberOfEmployees) + ) + ); + } + + public Accounts getByLargeAccountsInCountry(String countryName) + { + return new Accounts( + getRecords( + new AccountCriteria() + .shippingCountryEquals(countryName) + .numberOfEmployeesGreaterThan(numberOfEmployees) + ) + ); + } } ``` In this example we see three filters; one for country, another for checking minimal number of employees and a third that combines the first two. diff --git a/docs/domains/sobject.md b/docs/domains/sobject.md index 8411016..dcc2488 100644 --- a/docs/domains/sobject.md +++ b/docs/domains/sobject.md @@ -6,9 +6,9 @@ The primitive domain SObject adds a lot of additional getter methods to the doma This class should be used to extend Domain classes. ```apex -public class Accounts extends SObjects implements IAccounts +public class Accounts extends fflib_SObjects2 implements IAccounts { - ... + ... } ``` diff --git a/docs/primitive-domains.md b/docs/primitive-domains.md index e82b4b2..34799d9 100644 --- a/docs/primitive-domains.md +++ b/docs/primitive-domains.md @@ -8,8 +8,9 @@ Instead of: List myStrings = getSomeStrings(); ``` You can write: + ```apex -Strings myStrings = getSomeString(); +fflib_Strings myStrings = getSomeString(); ``` It is a small thing, but it makes things looks much nicer. diff --git a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls index aed70c5..60e51e6 100644 --- a/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls +++ b/sfdx-source/apex-extensions/main/application/dynamic/classes/fflib_DynamicSelectorFactory.cls @@ -120,7 +120,7 @@ public virtual class fflib_DynamicSelectorFactory return this; } - private class RelatedRecordsDomain extends SObjects + private class RelatedRecordsDomain extends fflib_SObjects2 { public RelatedRecordsDomain(List records) { diff --git a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls index f8ac32d..cd61690 100644 --- a/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls +++ b/sfdx-source/apex-extensions/main/default/classes/criteria/fflib_Criteria.cls @@ -536,35 +536,35 @@ public virtual with sharing class fflib_Criteria // Method overrides public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Dates(values)); + return inSet(field, new fflib_Dates(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new DateTimes(values)); + return inSet(field, new fflib_DateTimes(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Decimals(values)); + return inSet(field, new fflib_Decimals(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Doubles(values)); + return inSet(field, new fflib_Doubles(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Ids(values)); + return inSet(field, new fflib_Ids(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Integers(values)); + return inSet(field, new fflib_Integers(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Longs(values)); + return inSet(field, new fflib_Longs(values)); } public fflib_Criteria inSet(Schema.SObjectField field, Set values) { - return inSet(field, new Strings(values)); + return inSet(field, new fflib_Strings(values)); } /** * checks if the given sets contains the fields values @@ -604,35 +604,35 @@ public virtual with sharing class fflib_Criteria */ public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Dates(values)); + return notInSet(field, new fflib_Dates(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new DateTimes(values)); + return notInSet(field, new fflib_DateTimes(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Decimals(values)); + return notInSet(field, new fflib_Decimals(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Doubles(values)); + return notInSet(field, new fflib_Doubles(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Ids(values)); + return notInSet(field, new fflib_Ids(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Integers(values)); + return notInSet(field, new fflib_Integers(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Longs(values)); + return notInSet(field, new fflib_Longs(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { - return notInSet(field, new Strings(values)); + return notInSet(field, new fflib_Strings(values)); } public fflib_Criteria notInSet(Schema.SObjectField field, Set values) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls similarity index 88% rename from sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls index 950618b..ddb6174 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls @@ -1,5 +1,5 @@ /** - * File Name: DateTimes + * File Name: fflib_DateTimes * @description Primitive domain for the object type DateTime * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,20 +28,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class DateTimes - extends Objects +public virtual with sharing class fflib_DateTimes + extends fflib_Objects2 { - public DateTimes(Set dateTimes) + public fflib_DateTimes(Set dateTimes) { super(new List(dateTimes)); } - public DateTimes(List dateTimes) + public fflib_DateTimes(List dateTimes) { super((List) dateTimes); } - public DateTimes(List elements) + public fflib_DateTimes(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_DateTimes.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls similarity index 90% rename from sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls index 5edb622..1d199cf 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls @@ -1,5 +1,5 @@ /** - * File Name: Dates + * File Name: fflib_Dates * @description Primitive domain for the object type Date * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,20 +28,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual class Dates - extends Objects +public virtual class fflib_Dates + extends fflib_Objects2 { - public Dates(Set dates) + public fflib_Dates(Set dates) { super(new List(dates)); } - public Dates(List dates) + public fflib_Dates(List dates) { super((List) dates); } - public Dates(List elements) + public fflib_Dates(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Dates.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls similarity index 89% rename from sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls index 673a2f4..8272065 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls @@ -1,5 +1,5 @@ /** - * File Name: Decimals + * File Name: fflib_Decimals * @description Primitive domain for the object type Decimal * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,20 +28,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class Decimals - extends Objects +public virtual with sharing class fflib_Decimals + extends fflib_Objects2 { - public Decimals(Set decimals) + public fflib_Decimals(Set decimals) { super(new List(decimals)); } - public Decimals(List decimals) + public fflib_Decimals(List decimals) { super((List) decimals); } - public Decimals(List elements) + public fflib_Decimals(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Decimals.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls similarity index 89% rename from sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls index e1b18ca..b801d84 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls @@ -1,5 +1,5 @@ /** - * File Name: Doubles + * File Name: fflib_Doubles * @description Primitive domain for the object type Double * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,20 +28,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class Doubles - extends Objects +public virtual with sharing class fflib_Doubles + extends fflib_Objects2 { - public Doubles(Set doubles) + public fflib_Doubles(Set doubles) { super(new List(doubles)); } - public Doubles(List doubles) + public fflib_Doubles(List doubles) { super((List) doubles); } - public Doubles(List elements) + public fflib_Doubles(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Doubles.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls similarity index 90% rename from sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls index 48228a3..d3a1c85 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls @@ -1,5 +1,5 @@ /** - * File Name: Ids + * File Name: fflib_Ids * @description Primitive domain for the object type Id * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,25 +28,25 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class Ids - extends Objects +public virtual with sharing class fflib_Ids + extends fflib_Objects2 { - public Ids(Set idSet) + public fflib_Ids(Set idSet) { super(new List(idSet)); } - public Ids(List ids) + public fflib_Ids(List ids) { super((List) ids); } - public Ids(List elements) + public fflib_Ids(List elements) { super(elements); } - public Ids(fflib_Objects objects) + public fflib_Ids(fflib_Objects objects) { super(getIdList(objects)); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Ids.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls similarity index 88% rename from sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls index f362643..8ffe89f 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls @@ -1,5 +1,5 @@ /** - * File Name: Integers + * File Name: fflib_Integers * @description Primitive domain for the object type Integer * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,20 +28,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class Integers - extends Objects +public virtual with sharing class fflib_Integers + extends fflib_Objects2 { - public Integers(Set integerSet) + public fflib_Integers(Set integerSet) { super(new List(integerSet)); } - public Integers(List integerList) + public fflib_Integers(List integerList) { super((List) integerList); } - public Integers(List elements) + public fflib_Integers(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Integers.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls similarity index 89% rename from sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls index ef724c1..e216589 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls @@ -1,5 +1,5 @@ /** - * File Name: Longs + * File Name: fflib_Longs * @description Primitive domain for the object type Long * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,20 +28,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class Longs - extends Objects +public virtual with sharing class fflib_Longs + extends fflib_Objects2 { - public Longs(Set longs) + public fflib_Longs(Set longs) { super(new List(longs)); } - public Longs(List longs) + public fflib_Longs(List longs) { super((List) longs); } - public Longs(List elements) + public fflib_Longs(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Longs.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls similarity index 93% rename from sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls index 061982c..9a7dbcf 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls @@ -1,5 +1,5 @@ /** - * File Name: Objects + * File Name: fflib_Objects2 * @description Primitive domain for the type object * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,10 +28,10 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class Objects +public virtual with sharing class fflib_Objects2 extends fflib_Objects { - public Objects(List elements) + public fflib_Objects2(List elements) { super(elements); } diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Objects2.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls similarity index 88% rename from sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls index e638763..85255f5 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls @@ -1,5 +1,5 @@ /** - * File Name: SObjects + * File Name: fflib_SObjects2 * @description Primitive domain for the object type SObject * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,7 +28,7 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual class SObjects +public virtual class fflib_SObjects2 extends fflib_SObjects implements fflib_ISObjects { @@ -39,7 +39,7 @@ public virtual class SObjects * * @param objects The Objects of type SObjectType, to contain inside the domain */ - public SObjects(List objects) + public fflib_SObjects2(List objects) { // todo - assert of objects of type SObject this((List) objects); @@ -50,7 +50,7 @@ public virtual class SObjects * * @param records The records to contain inside the domain */ - public SObjects(List records) + public fflib_SObjects2(List records) { this(records, records.getSObjectType()); } @@ -61,7 +61,7 @@ public virtual class SObjects * @param records The records to contain inside the domain * @param sObjectType The SObjectType of the records */ - public SObjects(List records, Schema.SObjectType sObjectType) + public fflib_SObjects2(List records, Schema.SObjectType sObjectType) { super(records, sObjectType); SObjectDescribe = sObjectType.getDescribe(); @@ -92,7 +92,7 @@ public virtual class SObjects * * @return Returns only the SObjects from the domain matching the given Ids. */ - public virtual List getRecords(Ids ids) + public virtual List getRecords(fflib_Ids ids) { return getRecords(ids.getIds()); } @@ -193,7 +193,7 @@ public virtual class SObjects * @return The Date values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Dates getDateFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_Dates getDateFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) @@ -202,7 +202,7 @@ public virtual class SObjects if (fieldValue == null) continue; result.add((Date) fieldValue); } - return new Dates(result); + return new fflib_Dates(result); } /** @@ -212,9 +212,9 @@ public virtual class SObjects * @return The Date values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Dates getDateFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_Dates getDateFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getDateFieldValues(sObjectField); } @@ -224,7 +224,7 @@ public virtual class SObjects * @return The DateTime values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) @@ -233,7 +233,7 @@ public virtual class SObjects if (fieldValue == null) continue; result.add((Datetime) fieldValue); } - return new DateTimes(result); + return new fflib_DateTimes(result); } /** @@ -243,9 +243,9 @@ public virtual class SObjects * @return The DateTime values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_DateTimes getDateTimeFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getDateTimeFieldValues(sObjectField); } @@ -255,7 +255,7 @@ public virtual class SObjects * @return The Decimal values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Decimals getDecimalFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_Decimals getDecimalFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) @@ -264,7 +264,7 @@ public virtual class SObjects if (fieldValue == null) continue; result.add((Decimal) fieldValue); } - return new Decimals(result); + return new fflib_Decimals(result); } /** @@ -274,9 +274,9 @@ public virtual class SObjects * @return The Decimal values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Decimals getDecimalFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_Decimals getDecimalFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getDecimalFieldValues(sObjectField); } @@ -286,7 +286,7 @@ public virtual class SObjects * @return The Double values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Doubles getDoubleFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_Doubles getDoubleFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) @@ -295,7 +295,7 @@ public virtual class SObjects if (fieldValue == null) continue; result.add((Double) fieldValue); } - return new Doubles(result); + return new fflib_Doubles(result); } /** @@ -305,9 +305,9 @@ public virtual class SObjects * @return The Double values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Doubles getDoubleFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_Doubles getDoubleFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getDoubleFieldValues(sObjectField); } @@ -440,7 +440,7 @@ public virtual class SObjects * @return The Id values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Ids getIdFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_Ids getIdFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) @@ -450,7 +450,7 @@ public virtual class SObjects result.add(Id.valueOf(String.valueOf(fieldValue))); } - return new Ids(result); + return new fflib_Ids(result); // todo - alternative return to avoid code duplications: return new Ids(getFieldValues(sObjectField)); } @@ -461,9 +461,9 @@ public virtual class SObjects * @return The Id values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Ids getIdFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_Ids getIdFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getIdFieldValues(sObjectField); } @@ -473,7 +473,7 @@ public virtual class SObjects * @return The Integer values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Integers getIntegerFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_Integers getIntegerFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) @@ -483,7 +483,7 @@ public virtual class SObjects result.add(Integer.valueOf(fieldValue)); } - return new Integers(result); + return new fflib_Integers(result); } /** @@ -493,9 +493,9 @@ public virtual class SObjects * @return The Integer values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Integers getIntegerFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_Integers getIntegerFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getIntegerFieldValues(sObjectField); } @@ -505,7 +505,7 @@ public virtual class SObjects * @return The Long values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Longs getLongFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_Longs getLongFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) @@ -514,7 +514,7 @@ public virtual class SObjects if (fieldValue == null) continue; result.add((Long) fieldValue); } - return new Longs(result); + return new fflib_Longs(result); } /** @@ -524,9 +524,9 @@ public virtual class SObjects * @return The Long values of the given sObjectField, null values are omitted */ @TestVisible - protected virtual Longs getLongFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_Longs getLongFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getLongFieldValues(sObjectField); } @@ -699,14 +699,14 @@ public virtual class SObjects * @return The String values of the given sObjectField */ @TestVisible - protected virtual Strings getStringFieldValues(Schema.SObjectField sObjectField) + protected virtual fflib_Strings getStringFieldValues(Schema.SObjectField sObjectField) { Set result = new Set(); for (SObject record : getRecords()) { result.add(String.valueOf(record.get(sObjectField))); } - return new Strings(result); + return new fflib_Strings(result); } /** @@ -716,9 +716,9 @@ public virtual class SObjects * @return The String values of the given sObjectField */ @TestVisible - protected virtual Strings getStringFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) + protected virtual fflib_Strings getStringFieldValues(Schema.SObjectField sObjectField, fflib_Criteria criteria) { - return new SObjects(getRecords(criteria), getSObjectType()) + return new fflib_SObjects2(getRecords(criteria), getSObjectType()) .getStringFieldValues(sObjectField); } @@ -732,7 +732,7 @@ public virtual class SObjects @TestVisible protected virtual void setFieldValue(Schema.SObjectField sObjectField, Object value, fflib_Criteria criteria) { - new SObjects(getRecords(criteria), getSObjectType()) + new fflib_SObjects2(getRecords(criteria), getSObjectType()) .setFieldValue(sObjectField, value); } } \ No newline at end of file diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/SObjects.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_SObjects2.cls-meta.xml diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls similarity index 90% rename from sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls index 392aa6e..1c98a61 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls @@ -1,5 +1,5 @@ /** - * File Name: Strings + * File Name: fflib_Strings * @description Primitive domain for the object type String * * @author architect ir. Wilhelmus G.J. Velzeboer @@ -28,20 +28,20 @@ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -public virtual with sharing class Strings - extends Objects +public virtual with sharing class fflib_Strings + extends fflib_Objects2 { - public Strings(Set stringSet) + public fflib_Strings(Set stringSet) { super(new List(stringSet)); } - public Strings(List stringList) + public fflib_Strings(List stringList) { super(stringList); } - public Strings(List elements) + public fflib_Strings(List elements) { super(elements); diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml b/sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls-meta.xml rename to sfdx-source/apex-extensions/main/default/classes/domains/fflib_Strings.cls-meta.xml diff --git a/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls b/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls index 79b3c75..6342c70 100644 --- a/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/application/fflib_ClassicDomainFactoryTest.cls @@ -80,7 +80,7 @@ private class fflib_ClassicDomainFactoryTest } } - public class MyDomain extends SObjects + public class MyDomain extends fflib_SObjects2 { public MyDomain(List records) { diff --git a/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls b/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls index 17fea0d..40e58e7 100644 --- a/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls @@ -48,9 +48,9 @@ private class PrimitiveDomainsTest Date.newInstance(2022, 02, 02) }; - Dates datesA = new Dates(dateSet); - Dates DatesB = new Dates(dateList); - Dates DatesC = new Dates((List) dateList); + fflib_Dates datesA = new fflib_Dates(dateSet); + fflib_Dates DatesB = new fflib_Dates(dateList); + fflib_Dates DatesC = new fflib_Dates((List) dateList); System.assert(datesA.getDateSet().containsAll(DatesB.getDates())); System.assert(datesA.getDateSet().containsAll(DatesC.getDates())); @@ -73,9 +73,9 @@ private class PrimitiveDomainsTest Datetime.newInstance(2022, 02, 02, 01, 00, 00) }; - DateTimes datetimeA = new DateTimes(dateSet); - DateTimes datetimeB = new DateTimes(dateList); - DateTimes datetimeC = new DateTimes((List) dateList); + fflib_DateTimes datetimeA = new fflib_DateTimes(dateSet); + fflib_DateTimes datetimeB = new fflib_DateTimes(dateList); + fflib_DateTimes datetimeC = new fflib_DateTimes((List) dateList); System.assert(datetimeA.getDateTimeSet().containsAll(datetimeB.getDateTimes())); System.assert(datetimeA.getDateTimeSet().containsAll(datetimeC.getDateTimes())); @@ -87,9 +87,9 @@ private class PrimitiveDomainsTest final Set dataSet = new Set {5.5, 1.1, -1.1, -2.7}; final List dataList = new List {5.5, 1.1, -1.1, -2.7}; - Decimals domainA = new Decimals(dataSet); - Decimals domainB = new Decimals(dataList); - Decimals domainC = new Decimals((List) dataList); + fflib_Decimals domainA = new fflib_Decimals(dataSet); + fflib_Decimals domainB = new fflib_Decimals(dataList); + fflib_Decimals domainC = new fflib_Decimals((List) dataList); System.assert(domainA.getDecimalSet().containsAll(domainB.getDecimals())); System.assert(domainA.getDecimalSet().containsAll(domainC.getDecimals())); @@ -101,9 +101,9 @@ private class PrimitiveDomainsTest final Set dataSet = new Set {1261992, 3.14159265}; final List dataList = new List {1261992, 3.14159265}; - Doubles domainA = new Doubles(dataSet); - Doubles domainB = new Doubles(dataList); - Doubles domainC = new Doubles((List) dataList); + fflib_Doubles domainA = new fflib_Doubles(dataSet); + fflib_Doubles domainB = new fflib_Doubles(dataList); + fflib_Doubles domainC = new fflib_Doubles((List) dataList); System.assert(domainA.getDoubleSet().containsAll(domainB.getDoubles())); System.assert(domainA.getDoubleSet().containsAll(domainC.getDoubles())); @@ -119,9 +119,9 @@ private class PrimitiveDomainsTest fflib_IDGenerator.generate(Schema.Account.SObjectType) }; - Ids domainA = new Ids(dataSet); - Ids domainB = new Ids(new List(dataSet)); - Ids domainC = new Ids((List) new List(dataSet)); + fflib_Ids domainA = new fflib_Ids(dataSet); + fflib_Ids domainB = new fflib_Ids(new List(dataSet)); + fflib_Ids domainC = new fflib_Ids((List) new List(dataSet)); System.assert(domainA.getIds().containsAll(domainB.getIdList())); System.assert(domainA.getIds().containsAll(domainC.getIdList())); @@ -138,7 +138,7 @@ private class PrimitiveDomainsTest fflib_IDGenerator.generate(Schema.Account.SObjectType) })); - Ids domainA = new Ids(data); + fflib_Ids domainA = new fflib_Ids(data); System.assert(domainA.getIds().containsAll((List) data.getObjects())); } @@ -148,9 +148,9 @@ private class PrimitiveDomainsTest { final Set dataSet = new Set {1261, 31415}; - Integers domainA = new Integers(dataSet); - Integers domainB = new Integers(new List(dataSet)); - Integers domainC = new Integers((List) new List(dataSet)); + fflib_Integers domainA = new fflib_Integers(dataSet); + fflib_Integers domainB = new fflib_Integers(new List(dataSet)); + fflib_Integers domainC = new fflib_Integers((List) new List(dataSet)); System.assert(domainA.getIntegerSet().containsAll(domainB.getIntegers())); System.assert(domainA.getIntegerSet().containsAll(domainC.getIntegers())); @@ -161,9 +161,9 @@ private class PrimitiveDomainsTest { final Set dataSet = new Set {1261, 31415}; - Longs domainA = new Longs(dataSet); - Longs domainB = new Longs(new List(dataSet)); - Longs domainC = new Longs((List) new List(dataSet)); + fflib_Longs domainA = new fflib_Longs(dataSet); + fflib_Longs domainB = new fflib_Longs(new List(dataSet)); + fflib_Longs domainC = new fflib_Longs((List) new List(dataSet)); System.assert(domainA.getLongSet().containsAll(domainB.getLongs())); System.assert(domainA.getLongSet().containsAll(domainC.getLongs())); @@ -174,9 +174,9 @@ private class PrimitiveDomainsTest { final Set dataSet = new Set {'Hello', 'World'}; - Strings domainA = new Strings(dataSet); - Strings domainB = new Strings(new List(dataSet)); - Strings domainC = new Strings((List) new List(dataSet)); + fflib_Strings domainA = new fflib_Strings(dataSet); + fflib_Strings domainB = new fflib_Strings(new List(dataSet)); + fflib_Strings domainC = new fflib_Strings((List) new List(dataSet)); System.assert(domainA.getStringSet().containsAll(domainB.getStrings())); System.assert(domainA.getStringSet().containsAll(domainC.getStrings())); diff --git a/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls b/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls index 1bc8d99..f8a9f24 100644 --- a/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls @@ -211,7 +211,7 @@ private class SObjectsTest static void itShouldReturnRecordsById() { final Id idA = fflib_IDGenerator.generate(Schema.Account.SObjectType); - final Ids ids = new Ids(new Set {idA}); + final fflib_Ids ids = new fflib_Ids(new Set {idA}); DomainAccounts domain = new DomainAccounts( new List { @@ -336,7 +336,7 @@ private class SObjectsTest } - private class DomainAccounts extends SObjects + private class DomainAccounts extends fflib_SObjects2 { public DomainAccounts(List records) { From 797c93196ed4b890857553a3d66a48d13a46f382 Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Thu, 7 Oct 2021 10:15:59 +0100 Subject: [PATCH 09/10] Add "fflib_" prefix to primitive domain test classes --- ...{PrimitiveDomainsTest.cls => fflib_PrimitiveDomainsTest.cls} | 2 +- ...est.cls-meta.xml => fflib_PrimitiveDomainsTest.cls-meta.xml} | 0 .../domains/{SObjectsTest.cls => fflib_SObjects2Test.cls} | 2 +- ...bjectsTest.cls-meta.xml => fflib_SObjects2Test.cls-meta.xml} | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename sfdx-source/apex-extensions/tests/classes/domains/{PrimitiveDomainsTest.cls => fflib_PrimitiveDomainsTest.cls} (99%) rename sfdx-source/apex-extensions/tests/classes/domains/{PrimitiveDomainsTest.cls-meta.xml => fflib_PrimitiveDomainsTest.cls-meta.xml} (100%) rename sfdx-source/apex-extensions/tests/classes/domains/{SObjectsTest.cls => fflib_SObjects2Test.cls} (99%) rename sfdx-source/apex-extensions/tests/classes/domains/{SObjectsTest.cls-meta.xml => fflib_SObjects2Test.cls-meta.xml} (100%) diff --git a/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls b/sfdx-source/apex-extensions/tests/classes/domains/fflib_PrimitiveDomainsTest.cls similarity index 99% rename from sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls rename to sfdx-source/apex-extensions/tests/classes/domains/fflib_PrimitiveDomainsTest.cls index 40e58e7..fe7d14a 100644 --- a/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/domains/fflib_PrimitiveDomainsTest.cls @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @IsTest(IsParallel=true) -private class PrimitiveDomainsTest +private class fflib_PrimitiveDomainsTest { @IsTest static void testDates() diff --git a/sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/domains/fflib_PrimitiveDomainsTest.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/tests/classes/domains/PrimitiveDomainsTest.cls-meta.xml rename to sfdx-source/apex-extensions/tests/classes/domains/fflib_PrimitiveDomainsTest.cls-meta.xml diff --git a/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls b/sfdx-source/apex-extensions/tests/classes/domains/fflib_SObjects2Test.cls similarity index 99% rename from sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls rename to sfdx-source/apex-extensions/tests/classes/domains/fflib_SObjects2Test.cls index f8a9f24..ba74a28 100644 --- a/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls +++ b/sfdx-source/apex-extensions/tests/classes/domains/fflib_SObjects2Test.cls @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @IsTest(IsParallel=true) -private class SObjectsTest +private class fflib_SObjects2Test { @IsTest static void itShouldAddErrorMessage() diff --git a/sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/domains/fflib_SObjects2Test.cls-meta.xml similarity index 100% rename from sfdx-source/apex-extensions/tests/classes/domains/SObjectsTest.cls-meta.xml rename to sfdx-source/apex-extensions/tests/classes/domains/fflib_SObjects2Test.cls-meta.xml From d4e6cff6119655af75b0b2f7be4dd9af5288bfd2 Mon Sep 17 00:00:00 2001 From: WimVelzeboer Date: Thu, 30 Sep 2021 11:14:55 +0100 Subject: [PATCH 10/10] Package version upgrade to API 53.0 --- .../intelliJ/fileTemplates/includes/AEPE ApexClassMeta.xml | 2 +- .../tests/classes/criteria/fflib_ComparatorTest.cls-meta.xml | 2 +- .../tests/classes/criteria/fflib_CriteriaTest.cls-meta.xml | 2 +- .../classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev-tools/assets/intelliJ/fileTemplates/includes/AEPE ApexClassMeta.xml b/dev-tools/assets/intelliJ/fileTemplates/includes/AEPE ApexClassMeta.xml index dd61d1f..f928c8e 100644 --- a/dev-tools/assets/intelliJ/fileTemplates/includes/AEPE ApexClassMeta.xml +++ b/dev-tools/assets/intelliJ/fileTemplates/includes/AEPE ApexClassMeta.xml @@ -1,5 +1,5 @@ - 52.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/tests/classes/criteria/fflib_ComparatorTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/criteria/fflib_ComparatorTest.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/tests/classes/criteria/fflib_ComparatorTest.cls-meta.xml +++ b/sfdx-source/apex-extensions/tests/classes/criteria/fflib_ComparatorTest.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/tests/classes/criteria/fflib_CriteriaTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/criteria/fflib_CriteriaTest.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/tests/classes/criteria/fflib_CriteriaTest.cls-meta.xml +++ b/sfdx-source/apex-extensions/tests/classes/criteria/fflib_CriteriaTest.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active diff --git a/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml b/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml index f3bac1f..f928c8e 100644 --- a/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml +++ b/sfdx-source/apex-extensions/tests/classes/logger/fflib_ALogAppenderFilterTest.cls-meta.xml @@ -1,5 +1,5 @@ - 41.0 + 53.0 Active