diff --git a/README.md b/README.md index ea3310f..6c384a1 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,22 @@ 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 +Some of the changes that have major impact are listed here; + +### August 2021 +**Added criteria based on formula; (1 OR 2) AND 3)** + +```apex +new fflib_Criteria() + .formulaCriteria('(1 OR 2) AND 3') + .equalTo(Account.AccountNumber, '0001') + .equalTo(Account.AccountNumber, '0002') + .equalTo(Account.ShippingCountry, 'USA') + +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-source/apex-extensions/main/default/classes/domains/DateTimes.cls b/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls index 2886ef8..950618b 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/DateTimes.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. */ public virtual with sharing class DateTimes - extends fflib_Objects + extends Objects { public DateTimes(Set dateTimes) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls index 9df6ef3..5edb622 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Dates.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Dates.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. */ public virtual class Dates - extends fflib_Objects + extends Objects { public Dates(Set dates) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls index 3596fa4..673a2f4 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Decimals.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. */ public virtual with sharing class Decimals - extends fflib_Objects + extends Objects { public Decimals(Set decimals) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls index 62fe54b..e1b18ca 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Doubles.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. */ public virtual with sharing class Doubles - extends fflib_Objects + extends Objects { public Doubles(Set doubles) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls index 8da9d25..48228a3 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Ids.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Ids.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. */ public virtual with sharing class Ids - extends fflib_Objects + extends Objects { public Ids(Set idSet) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls index c43e054..f362643 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Integers.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Integers.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. */ public virtual with sharing class Integers - extends fflib_Objects + extends Objects { public Integers(Set integerSet) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls index 4e8c048..ef724c1 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Longs.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Longs.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. */ public virtual with sharing class Longs - extends fflib_Objects + extends Objects { public Longs(Set longs) { diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls new file mode 100644 index 0000000..061982c --- /dev/null +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls @@ -0,0 +1,48 @@ +/** + * File Name: Objects + * @description Primitive domain for the type 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 virtual with sharing class Objects + extends fflib_Objects +{ + public Objects(List elements) + { + super(elements); + } + + /** + * @return Returns only the first occurrence in the list of strings contained in the domain. + */ + public Object getFirstObject() + { + if (isEmpty()) return null; + + return getObjects().get(0); + } +} \ No newline at end of file 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 new file mode 100644 index 0000000..d75b058 --- /dev/null +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Objects.cls-meta.xml @@ -0,0 +1,5 @@ + + + 51.0 + Active + diff --git a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls b/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls index 90912a7..392aa6e 100644 --- a/sfdx-source/apex-extensions/main/default/classes/domains/Strings.cls +++ b/sfdx-source/apex-extensions/main/default/classes/domains/Strings.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. */ public virtual with sharing class Strings - extends fflib_Objects + extends Objects { public Strings(Set stringSet) { @@ -38,12 +38,13 @@ public virtual with sharing class Strings public Strings(List stringList) { - super((List) stringList); + super(stringList); } public Strings(List elements) { super(elements); + } /** @@ -61,4 +62,14 @@ public virtual with sharing class Strings { return (List) getObjects(); } + + /** + * @return Returns only the first occurrence in the list of strings contained in the domain. + */ + public String getFirst() + { + if (isEmpty()) return null; + + return (String) getFirstObject(); + } } \ No newline at end of file