Skip to content

Commit

Permalink
Merge cdecc0a into feature/238__rdMigrationRemoveTotal
Browse files Browse the repository at this point in the history
  • Loading branch information
salesforce-org-metaci[bot] authored Feb 5, 2022
2 parents d0253b9 + cdecc0a commit 658e5a2
Show file tree
Hide file tree
Showing 260 changed files with 32,986 additions and 238 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/**
* Copyright (c), FinancialForce.com, inc
* 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 copyright 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 FinancialForce.com, inc 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.
**/

/**
* Class provides inner classes implementing factories for the main components
* of the Apex Enterprise Patterns, Service, Unit Of Work, Selector and Domain.
* See the sample applications Application.cls file for an example
**/
public virtual class fflib_Application
{
/**
* Class implements a Unit of Work factory
**/
public virtual class UnitOfWorkFactory
{
private List<SObjectType> m_objectTypes;
private fflib_ISObjectUnitOfWork m_mockUow;

/**
* Constructs a Unit Of Work factory
**/
public UnitOfWorkFactory() { }

/**
* Constructs a Unit Of Work factory
*
* @param objectTypes List of SObjectTypes in dependency order
**/
public UnitOfWorkFactory(List<SObjectType> objectTypes)
{
m_objectTypes = objectTypes.clone();
}

/**
* Returns a new fflib_SObjectUnitOfWork configured with the
* SObjectType list provided in the constructor, returns a Mock implementation
* if set via the setMock method
**/
public virtual fflib_ISObjectUnitOfWork newInstance()
{
// Mock?
if(m_mockUow!=null)
return m_mockUow;
return new fflib_SObjectUnitOfWork(m_objectTypes);
}

/**
* Returns a new fflib_SObjectUnitOfWork configured with the
* SObjectType list provided in the constructor, returns a Mock implementation
* if set via the setMock method
**/
public virtual fflib_ISObjectUnitOfWork newInstance(fflib_SObjectUnitOfWork.IDML dml)
{
// Mock?
if(m_mockUow!=null)
return m_mockUow;
return new fflib_SObjectUnitOfWork(m_objectTypes, dml);
}

/**
* Returns a new fflib_SObjectUnitOfWork configured with the
* SObjectType list specified, returns a Mock implementation
* if set via the setMock method
*
* @remark If mock is set, the list of SObjectType in the mock could be different
* then the list of SObjectType specified in this method call
**/
public virtual fflib_ISObjectUnitOfWork newInstance(List<SObjectType> objectTypes)
{
// Mock?
if(m_mockUow!=null)
return m_mockUow;
return new fflib_SObjectUnitOfWork(objectTypes);
}

/**
* Returns a new fflib_SObjectUnitOfWork configured with the
* SObjectType list specified, returns a Mock implementation
* if set via the setMock method
*
* @remark If mock is set, the list of SObjectType in the mock could be different
* then the list of SObjectType specified in this method call
**/
public virtual fflib_ISObjectUnitOfWork newInstance(List<SObjectType> objectTypes, fflib_SObjectUnitOfWork.IDML dml)
{
// Mock?
if(m_mockUow!=null)
return m_mockUow;
return new fflib_SObjectUnitOfWork(objectTypes, dml);
}

@TestVisible
protected virtual void setMock(fflib_ISObjectUnitOfWork mockUow)
{
m_mockUow = mockUow;
}
}

public class ApplicationException extends Exception { }

/**
* Exception representing a developer coding error, not intended for end user eyes
**/
public class DeveloperException extends Exception { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* 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_Domain
public interface fflib_IDomain
{
Object getType();
List<Object> getObjects();
Object getType();
List<Object> getObjects();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright (c), FinancialForce.com, inc
* 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 copyright 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 FinancialForce.com, inc 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_IDomainConstructor
{
fflib_IDomain construct(List<Object> objects);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,73 +23,57 @@
* 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 fflib_Objects implements fflib_Domain
public interface fflib_IObjects extends fflib_IDomain
{
protected List<Object> Objects { get; private set;}
/**
* @param value Values to check if they are part of the domain
*
* @return True if the provided value is part of the domain
*/
Boolean contains(Object value);

/**
* Class constructor
*/
public fflib_Objects(List<Object> objects)
{
this.Objects = objects.clone();
}
/**
* @param values Values to check if they are part of the domain
*
* @return True if all the provided values are part of the domain
*/
Boolean containsAll(List<Object> values);

public virtual Object getType()
{
return Object.class;
}
/**
* @param values Values to check if they are part of the domain
*
* @return True if all the provided values are part of the domain
*/
Boolean containsAll(Set<Object> values);

public List<Object> getObjects()
{
return this.Objects;
}
/**
* @param value Value to check if it is part of the domain
*
* @return True if the provided value is not part of the domain
*/
Boolean containsNot(Object value);

public Boolean contains(Object value)
{
return getObjects().contains(value);
}
/**
* @param values Values to check if they are part of the domain
*
* @return True if all the provided values are not part of the domain
*/
Boolean containsNot(List<Object> values);

public Boolean containsAll(List<Object> values)
{
return containsAll(new Set<Object>(values));
}
/**
* @param values Values to check if they are part of the domain
*
* @return True if all the provided values are not part of the domain
*/
Boolean containsNot(Set<Object> values);

public Boolean containsAll(Set<Object> values)
{
for (Object value : values)
{
if (!getObjects().contains(value)) return false;
}
return true;
}
/**
* @return Returns True is the domain is empty
*/
Boolean isEmpty();

public Boolean containsNot(Object value)
{
return !contains(value);
}

public Boolean containsNot(List<Object> values)
{
return containsNot(new Set<Object>(values));
}

public Boolean containsNot(Set<Object> values)
{
for (Object value : values)
{
if (getObjects().contains(value)) return false;
}
return true;
}

public Boolean isEmpty()
{
return (getObjects() == null || getObjects().isEmpty());
}

public Boolean isNotEmpty()
{
return !isEmpty();
}
/**
* @return Returns True is the domain has objects
*/
Boolean isNotEmpty();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>53.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright (c), FinancialForce.com, inc
* 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 copyright 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 FinancialForce.com, inc 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_ISObjectDomain extends fflib_IDomain
{
/**
* Returns the SObjectType this Domain class represents
**/
Schema.SObjectType sObjectType();

/**
* Alternative to the Records property, provided to support mocking of Domain classes
**/
List<SObject> getRecords();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>53.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright (c), FinancialForce.com, inc
* 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 copyright 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 FinancialForce.com, inc 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_ISObjectSelector
{
/**
* Provides the SObjectType for the object the given Selector is providing query logic for
**/
Schema.SObjectType sObjectType();

/**
* Selects by Id records using the fields defined by the Selector configuration
**/
List<SObject> selectSObjectsById(Set<Id> idSet);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>53.0</apiVersion>
<status>Active</status>
</ApexClass>
Loading

0 comments on commit 658e5a2

Please sign in to comment.