Interface RecordCustomizerUtilityInterface


public interface RecordCustomizerUtilityInterface
Interface with utility methods that pre insert/update/delete customizers may want to use.
  • Field Details

  • Method Details

    • getChanges

      default Map<String,RecordCustomizerUtilityInterface.Change> getChanges(String tableName, QRecord oldRecord, QRecord newRecord)
    • errorIfNoValue

      default void errorIfNoValue(Serializable value, QRecord record, String errorMessage)
    • errorIfEditedValue

      default void errorIfEditedValue(QRecord oldRecord, QRecord newRecord, String fieldName, String errorMessage)
    • isChangedValue

      default boolean isChangedValue(Serializable oldValue, Serializable newValue)
    • errorIfAnyValue

      default void errorIfAnyValue(Serializable value, QRecord record, String errorMessage)
    • errorIf

      default void errorIf(boolean condition, QRecord record, String errorMessage)
    • 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 record
      record - the record to be stored, which may be sparsely populated
      primaryKey - pkey value of the record being stored
      oldRecordMap - optional map of old records, e.g., as built by getOldRecordMap(List, UpdateInput) or TableCustomizerInterface.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.