diff --git a/framework/default/ortoo-core/default/labels/ortoo-core-CustomLabels.labels-meta.xml b/framework/default/ortoo-core/default/labels/ortoo-core-CustomLabels.labels-meta.xml
index e71bc8d9ff0..7c5e114962a 100644
--- a/framework/default/ortoo-core/default/labels/ortoo-core-CustomLabels.labels-meta.xml
+++ b/framework/default/ortoo-core/default/labels/ortoo-core-CustomLabels.labels-meta.xml
@@ -7,4 +7,60 @@
Message when validation errors caught by the SObject Validator structures occur.
Validation Errors Occurred
+
+ ortoo_core_insert
+ en_US
+ false
+ The word 'insert'.
+ insert
+
+
+ ortoo_core_update
+ en_US
+ false
+ The word 'update'.
+ update
+
+
+ ortoo_core_upsert
+ en_US
+ false
+ The word 'upsert'.
+ upsert
+
+
+ ortoo_core_fls_violation
+ en_US
+ false
+ Message when FLS violation occurs on a DML operation.
+ Attempted to {0} {1} with fields that are not accessible: {2}
+
+
+ ortoo_core_crud_insert_violation
+ en_US
+ false
+ Message when CRUD violation occurs on an insert. {0} is the name of the SObject.
+ Attempted to insert {0} records without the required permission
+
+
+ ortoo_core_crud_update_violation
+ en_US
+ false
+ Message when CRUD violation occurs on an update. {0} is the name of the SObject.
+ Attempted to update {0} records without the required permission
+
+
+ ortoo_core_crud_delete_violation
+ en_US
+ false
+ Message when CRUD violation occurs on a delete. {0} is the name of the SObject.
+ Attempted to delete {0} records without the required permission
+
+
+ ortoo_core_crud_publish_violation
+ en_US
+ false
+ Message when CRUD violation occurs on a publish. {0} is the name of the Event.
+ Attempted to publish {0} events without the required permission
+
\ No newline at end of file
diff --git a/framework/main/default/classes/SecureDml.cls b/framework/main/default/classes/SecureDml.cls
index 869d95607c2..0a3727d2ce9 100644
--- a/framework/main/default/classes/SecureDml.cls
+++ b/framework/main/default/classes/SecureDml.cls
@@ -1,6 +1,4 @@
// TODO: test
-// TODO: error codes
-// TODO: labels
/**
* Is an implementation of the IDml interface used to manage the DML operations in an SObject Unit of Work.
*
@@ -433,7 +431,7 @@ public inherited sharing class SecureDml extends fflib_SobjectUnitOfWork.SimpleD
*/
public void handleUnableToInsertRecords( List objList )
{
- throwUnableException( FrameworkErrorCodes.DML_INSERT_NOT_ALLOWED, 'Attempted to insert {0} records without the required permission', objList ); // TODO: label
+ throwUnableException( FrameworkErrorCodes.DML_INSERT_NOT_ALLOWED, Label.ortoo_core_crud_insert_violation, objList );
}
/**
@@ -443,7 +441,7 @@ public inherited sharing class SecureDml extends fflib_SobjectUnitOfWork.SimpleD
*/
public void handleUnableToUpdateRecords( List objList )
{
- throwUnableException( FrameworkErrorCodes.DML_UPDATE_NOT_ALLOWED, 'Attempted to update {0} records without the required permission', objList ); // TODO: label
+ throwUnableException( FrameworkErrorCodes.DML_UPDATE_NOT_ALLOWED, Label.ortoo_core_crud_update_violation, objList );
}
/**
@@ -453,7 +451,7 @@ public inherited sharing class SecureDml extends fflib_SobjectUnitOfWork.SimpleD
*/
public void handleUnableToDeleteRecords( List objList )
{
- throwUnableException( FrameworkErrorCodes.DML_DELETE_NOT_ALLOWED, 'Attempted to delete {0} records without the required permission', objList ); // TODO: label
+ throwUnableException( FrameworkErrorCodes.DML_DELETE_NOT_ALLOWED, Label.ortoo_core_crud_delete_violation, objList );
}
/**
@@ -463,7 +461,7 @@ public inherited sharing class SecureDml extends fflib_SobjectUnitOfWork.SimpleD
*/
public void handleUnableToPublishEvents( List objList )
{
- throwUnableException( FrameworkErrorCodes.DML_PUBLISH_NOT_ALLOWED, 'Attempted to publish {0} events without the required permission', objList ); // TODO: label
+ throwUnableException( FrameworkErrorCodes.DML_PUBLISH_NOT_ALLOWED, Label.ortoo_core_crud_publish_violation, objList );
}
private void throwUnableException( String errorCode, String label, List objList )
@@ -492,12 +490,12 @@ public inherited sharing class SecureDml extends fflib_SobjectUnitOfWork.SimpleD
public void handleInaccessibleFields( AccessType mode, SobjectType sobjectType, Set fieldsInViolation )
{
Map descriptionByMode = new Map{
- AccessType.CREATABLE => 'insert', // TODO: label
- AccessType.UPDATABLE => 'update', // TODO: label
- AccessType.UPSERTABLE => 'upsert' // TODO: label
+ AccessType.CREATABLE => Label.ortoo_core_insert,
+ AccessType.UPDATABLE => Label.ortoo_core_update,
+ AccessType.UPSERTABLE => Label.ortoo_core_upsert
};
- String label = 'Attempted to {0} {1} with fields that are not accessible: {2}'; // TODO: label
+ String label = Label.ortoo_core_fls_violation;
String modeDescription = descriptionByMode.get( mode );
String sobjectTypeName = SobjectUtils.getSobjectName( sobjectType );