Class AbstractPreDeleteCustomizer
java.lang.Object
com.kingsrook.qqq.backend.core.actions.customizers.AbstractPreDeleteCustomizer
- All Implemented Interfaces:
TableCustomizerInterface
- Direct Known Subclasses:
HelpContentPreDeleteCustomizer
public abstract class AbstractPreDeleteCustomizer
extends Object
implements TableCustomizerInterface
Abstract class that a table can specify an implementation of, to provide
custom actions before a delete takes place.
It's important for implementations to be aware of the isPreview field, which
is set to true when the code is running to give users advice, e.g., on a review
screen - vs. being false when the action is ACTUALLY happening. So, if you're doing
things like storing data, you don't want to do that if isPreview is true!!
General implementation would be, to iterate over the records (which the DeleteAction
would look up based on the inputs to the delete action), and look at their values:
- possibly adding Errors (`addError`) or Warnings (`addWarning`) to the records
- possibly throwing an exception - if you really don't want the delete operation to continue.
- doing "whatever else" you may want to do.
- returning the list of records (can be the input list) - this is how errors
and warnings are propagated to the DeleteAction. Note that any records with
an error will NOT proceed to the backend's delete interface - but those with
warnings will.
Note that the full deleteInput is available as a field in this class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizerInterface
TableCustomizerInterface.NotImplementedHereException
-
Field Summary
FieldsFields inherited from interface com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizerInterface
LOG
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGetter for deleteInputboolean
Getter for isPreviewpreDelete
(DeleteInput deleteInput, List<QRecord> records, boolean isPreview) Custom actions before a delete takes place.void
setDeleteInput
(DeleteInput deleteInput) Setter for deleteInputvoid
setIsPreview
(boolean isPreview) Setter for isPreviewwithIsPreview
(boolean isPreview) Fluent setter for isPreviewMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizerInterface
oldRecordListToMap, postDelete, postInsert, postInsertOrUpdate, postQuery, postUpdate, preInsert, preInsertOrUpdate, preUpdate, whenToRunPreInsert
-
Field Details
-
deleteInput
-
isPreview
protected boolean isPreview
-
-
Constructor Details
-
AbstractPreDeleteCustomizer
public AbstractPreDeleteCustomizer()
-
-
Method Details
-
preDelete
public List<QRecord> preDelete(DeleteInput deleteInput, List<QRecord> records, boolean isPreview) throws QException Description copied from interface:TableCustomizerInterface
Custom actions before a delete takes place. It's important for implementations to be aware of the isPreview param, which is set to true when the code is running to give users advice, e.g., on a review screen - vs. being false when the action is ACTUALLY happening. So, if you're doing things like storing data, you don't want to do that if isPreview is true!! General implementation would be, to iterate over the records (which the DeleteAction would look up based on the inputs to the delete action), and look at their values: - possibly adding Errors (`addError`) or Warnings (`addWarning`) to the records - possibly throwing an exception - if you really don't want the delete operation to continue. - doing "whatever else" you may want to do. - returning the list of records (can be the input list) - this is how errors and warnings are propagated to the DeleteAction. Note that any records with an error will NOT proceed to the backend's delete interface - but those with warnings will.- Specified by:
preDelete
in interfaceTableCustomizerInterface
- Throws:
QException
-
apply
- Throws:
QException
-
getDeleteInput
Getter for deleteInput -
setDeleteInput
Setter for deleteInput -
getIsPreview
public boolean getIsPreview()Getter for isPreview -
setIsPreview
public void setIsPreview(boolean isPreview) Setter for isPreview -
withIsPreview
Fluent setter for isPreview
-