Interface RecordCustomizerUtilityInterface
public interface RecordCustomizerUtilityInterface
Interface with utility methods that pre insert/update/delete customizers
may want to use.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
Container for an old value and a new value. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault void
default void
errorIfAnyValue
(Serializable value, QRecord record, String errorMessage) default void
errorIfEditedValue
(QRecord oldRecord, QRecord newRecord, String fieldName, String errorMessage) default void
errorIfNoValue
(Serializable value, QRecord record, String errorMessage) getChanges
(String tableName, QRecord oldRecord, QRecord newRecord) default Map
<Serializable, QRecord> getOldRecordMap
(List<QRecord> oldRecordList, UpdateInput updateInput) static Serializable
getValueFromRecordElseFromOldRecord
(String fieldName, QRecord record, Serializable primaryKey, Optional<Map<Serializable, QRecord>> oldRecordMap) For an update customizer, in the case the record being updated is sparse (e.g., don't have all fields), but if you need a value from a field, you might want it from the old record if it's available.static <T extends Serializable>
TgetValueFromRecordOrOldRecord
(String fieldName, QRecord record, Serializable primaryKey, Optional<Map<Serializable, QRecord>> oldRecordMap) Deprecated.default boolean
isChangedValue
(Serializable oldValue, Serializable newValue)
-
Field Details
-
LOG
-
-
Method Details
-
getChanges
-
errorIfNoValue
-
errorIfEditedValue
-
isChangedValue
-
errorIfAnyValue
-
errorIf
-
getOldRecordMap
default Map<Serializable,QRecord> getOldRecordMap(List<QRecord> oldRecordList, UpdateInput updateInput) -
getValueFromRecordOrOldRecord
@Deprecated(since="Preferred to use getValueFromRecordElseFromOldRecord, wrapping with a ValueUtils.getValueAsXyz wrapper, instead of this method's internal cast.") static <T extends Serializable> T getValueFromRecordOrOldRecord(String fieldName, QRecord record, Serializable primaryKey, Optional<Map<Serializable, QRecord>> oldRecordMap) Deprecated. -
getValueFromRecordElseFromOldRecord
static Serializable getValueFromRecordElseFromOldRecord(String fieldName, QRecord record, Serializable primaryKey, Optional<Map<Serializable, QRecord>> oldRecordMap) For an update customizer, in the case the record being updated is sparse (e.g., don't have all fields), but if you need a value from a field, you might want it from the old record if it's available. This method does that - returning the value from the input record (e.g, the one being passed to UpdateAction eventually), but if the field isn't set in that record, then it gets the value from the corresponding old record if it can.Returns value as Serializable, so recommended to wrap calls in
ValueUtils
's various getValueAsXyz methods (e.g., to nicely convert strings (which may be in the record from frontends) to, e.g., Integer, etc- Parameters:
fieldName
- name of the field to get from the record or old recordrecord
- the record to be stored, which may be sparsely populatedprimaryKey
- pkey value of the record being storedoldRecordMap
- optional map of old records, e.g., as built bygetOldRecordMap(List, UpdateInput)
orTableCustomizerInterface.oldRecordListToMap(String, Optional)
- Returns:
- value from new record if it was set there (even if set to null, as that would signal the field is being set to null), else value from old record, else null.
-