Class QRecord
java.lang.Object
com.kingsrook.qqq.backend.core.model.data.QRecord
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
QRecordWithJoinedRecords
Data Record within qqq. e.g., a single row from a database.
Actual values (e.g., as stored in the backend system) are in the `values`
map. Keys in this map are fieldNames from the QTableMetaData.
"Display values" (e.g., labels for possible values, or formatted numbers
(e.g., quantities with commas)) are in the displayValues map.
backendDetails are additional data about a record, that aren't strictly
values, but are more like meta-data - e.g., for a file-backend, what file the
record came from.
Errors are meant to hold information about things that went wrong when
processing a record - e.g., in a list of records that may be the output of an
action, like a bulk load. Warnings play a similar role, but are just advice
- they don't mean that the action was failed, just something you may need to know.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQRecord()Default constructor.Copy constructor.QRecord(QTableMetaData tableMetaData, Serializable primaryKeyValue) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBackendDetail(String key, Serializable value) Add one backendDetail to this recordvoidaddError(QErrorMessage error) Add one error to this recordvoidaddJoinedRecordValues(String joinTableName, QRecord joinedRecord) copy all values from 'joinedRecord' into this record's values map, prefixing field names with joinTableNam + "."voidaddWarning(QWarningMessage warning) Add one warning to this recordGetter for associatedRecordsgetBackendDetail(String key) Get one backendDetail from this recordGetter for backendDetailsGet one backendDetail from this record as a StringgetDisplayValue(String fieldName) Getter for a single field's valueGetter for displayValuesGetter for errorsGetter for errorsGetter for recordLabelGetter for tableNameGetter for a single field's valuegetValueBigDecimal(String fieldName) getValueBoolean(String fieldName) byte[]getValueByteArray(String fieldName) getValueInstant(String fieldName) getValueInteger(String fieldName) Getter for a single field's valuegetValueLocalDate(String fieldName) getValueLocalTime(String fieldName) getValueLong(String fieldName) Getter for a single field's valueGetter for valuesgetValueString(String fieldName) Getter for a single field's valueGetter for warningsGetter for warningsvoidremoveValue(String fieldName) voidsetAssociatedRecords(Map<String, List<QRecord>> associatedRecords) Setter for associatedRecordsvoidsetBackendDetails(Map<String, Serializable> backendDetails) Setter for backendDetailsvoidsetDisplayValue(String fieldName, String displayValue) voidsetDisplayValues(Map<String, String> displayValues) Setter for displayValuesvoidsetErrors(List<QErrorMessage> errors) Setter for errorsvoidsetRecordLabel(String recordLabel) Setter for recordLabelvoidsetTableName(String tableName) Setter for tableNamevoidsetValue(QFieldMetaData field, Serializable value) voidsetValue(String fieldName, Serializable value) voidAdded when QRecords got exposed in scripts, and passing a constant String raised a class-cast exception, because it was some nashorn non-serializable type (though once inside *this* method, the value was a java.lang.String...)voidsetValues(Map<String, Serializable> values) Setter for valuesvoidsetWarnings(List<QWarningMessage> warnings) Setter for warnings<T extends QRecordEntity>
TConvert this record to an QRecordEntitytoString()withAssociatedRecord(String name, QRecord associatedRecord) Fluent setter for associatedRecordwithAssociatedRecords(String name, List<QRecord> associatedRecords) Fluent setter for associatedRecordswithAssociatedRecords(Map<String, List<QRecord>> associatedRecords) Fluent setter for associatedRecordswithBackendDetail(String key, Serializable value) Fluently Add one backendDetail to this recordwithDisplayValue(String fieldName, String displayValue) withError(QErrorMessage error) Fluently Add one error to this recordwithRecordLabel(String recordLabel) Fluent setter for recordLabelwithTableName(String tableName) Setter for tableNamewithValue(String fieldName, Serializable value) withWarning(QWarningMessage warning) Fluently Add one warning to this recordwithWarnings(List<QWarningMessage> warnings) Fluent setter for warnings
-
Field Details
-
BACKEND_DETAILS_TYPE_JSON_SOURCE_OBJECT
/////////////////////////////////////////////- See Also:
-
BACKEND_DETAILS_TYPE_HEAVY_FIELD_LENGTHS
- See Also:
-
-
Constructor Details
-
QRecord
public QRecord()Default constructor. -
QRecord
-
QRecord
Copy constructor. Makes a deep clone.
-
-
Method Details
-
toString
-
setValue
-
addJoinedRecordValues
-
setValue
-
removeValue
-
setValue
-
withValue
-
setDisplayValue
-
withDisplayValue
-
getTableName
Getter for tableName -
setTableName
Setter for tableName -
withTableName
-
getRecordLabel
Getter for recordLabel -
setRecordLabel
Setter for recordLabel -
withRecordLabel
-
getValues
Getter for values -
setValues
Setter for values -
getValue
Getter for a single field's value -
getDisplayValues
-
setDisplayValues
-
getDisplayValue
-
getValueString
-
getValueInteger
-
getValueLong
-
getValueBigDecimal
-
getValueBoolean
-
getValueLocalTime
-
getValueLocalDate
-
getValueByteArray
-
getValueInstant
-
getBackendDetails
Getter for backendDetails -
setBackendDetails
Setter for backendDetails -
addBackendDetail
Add one backendDetail to this record -
withBackendDetail
Fluently Add one backendDetail to this record -
getBackendDetail
Get one backendDetail from this record -
getBackendDetailString
-
getErrors
Getter for errors -
getErrorsAsString
Getter for errors -
setErrors
Setter for errors -
addError
Add one error to this record -
withError
Fluently Add one error to this record -
toEntity
Convert this record to an QRecordEntity- Throws:
QException
-
getAssociatedRecords
-
setAssociatedRecords
-
withAssociatedRecords
-
withAssociatedRecords
-
withAssociatedRecord
-
getWarnings
Getter for warnings -
getWarningsAsString
Getter for warnings -
setWarnings
Setter for warnings -
withWarning
Fluently Add one warning to this record -
withWarnings
Fluent setter for warnings -
addWarning
Add one warning to this record
-