Class QRecordEntity
java.lang.Object
com.kingsrook.qqq.backend.core.model.data.QRecordEntity
- Direct Known Subclasses:
APILog
,AvailablePermission
,HelpContent
,OutboundAPILog
,ProcessLock
,ProcessLockType
,QQQProcess
,QQQTable
,QueryStat
,QueryStatCriteriaField
,QueryStatJoinTable
,QueryStatOrderByField
,RenderedReport
,SavedBulkLoadProfile
,SavedReport
,SavedView
,ScheduledJob
,ScheduledJobParameter
,ScheduledReport
,Script
,ScriptLog
,ScriptLogLine
,ScriptRevision
,ScriptRevisionFile
,ScriptType
,ScriptTypeFileSchema
,SharedSavedBulkLoadProfile
,SharedSavedReport
,SharedSavedView
,TableTrigger
,UserSession
Base class for entity beans that are interoperable with QRecords.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends QRecordEntity>
TfromQRecord
(Class<T> c, QRecord qRecord) Build an entity of this QRecord type from a QRecordstatic <T extends QRecordEntity>
TfromQRecord
(Class<T> c, QRecord qRecord, String fieldNamePrefix) Build an entity of this QRecord type from a QRecord - where the fields for this entity have the given prefix - e.g., if they were selected as part of a join.static <A extends Annotation>
Optional<A> getAnnotationOnField
(Class<? extends QRecordEntity> c, Class<A> annotationClass, String fieldName) static List
<QRecordEntityAssociation> getAssociationList
(Class<? extends QRecordEntity> c) static List
<QRecordEntityField> getFieldList
(Class<? extends QRecordEntity> c) static String
getFieldNameFromGetter
(Method getter) static Optional
<QAssociation> getQAssociationAnnotation
(Class<? extends QRecordEntity> c, String fieldName) getQFieldAnnotation
(Class<? extends QRecordEntity> c, String fieldName) getQIgnoreAnnotation
(Class<? extends QRecordEntity> c, String ignoreName) static String
getTableName
(Class<? extends QRecordEntity> entityClass) protected void
populateFromQRecord
(QRecord qRecord) Build an entity of this QRecord type from a QRecordprotected <T extends QRecordEntity>
voidpopulateFromQRecord
(QRecord qRecord, String fieldNamePrefix) Build an entity of this QRecord type from a QRecord - where the fields for this entity have the given prefix - e.g., if they were selected as part of a join.static void
registerTable
(Class<? extends QRecordEntity> entityClass, QTableMetaData table) register a mapping between an entity class and a table that it is associated with.named without the 'get' to avoid conflict w/ entity fields named that...Convert this entity to a QRecord.Deprecated.toQRecordOnlyChangedFields
(boolean includePrimaryKey) Useful for the use-case of: - fetch a QRecord (e.g., QueryAction or GetAction) - build a QRecordEntity out of it - change a field (or two) in it - want to pass it into an UpdateAction, and want to see only the fields that you know you changed get passed in to UpdateAction (e.g., PATCH semantics).
-
Constructor Details
-
QRecordEntity
public QRecordEntity()
-
-
Method Details
-
fromQRecord
public static <T extends QRecordEntity> T fromQRecord(Class<T> c, QRecord qRecord) throws QException Build an entity of this QRecord type from a QRecord- Throws:
QException
-
fromQRecord
public static <T extends QRecordEntity> T fromQRecord(Class<T> c, QRecord qRecord, String fieldNamePrefix) throws QException Build an entity of this QRecord type from a QRecord - where the fields for this entity have the given prefix - e.g., if they were selected as part of a join.- Throws:
QException
-
registerTable
register a mapping between an entity class and a table that it is associated with. -
populateFromQRecord
Build an entity of this QRecord type from a QRecord- Throws:
QRuntimeException
-
populateFromQRecord
protected <T extends QRecordEntity> void populateFromQRecord(QRecord qRecord, String fieldNamePrefix) throws QRuntimeException Build an entity of this QRecord type from a QRecord - where the fields for this entity have the given prefix - e.g., if they were selected as part of a join.- Throws:
QRuntimeException
-
toQRecord
Convert this entity to a QRecord. ALL fields in the entity will be set in the QRecord. Note that, if you're using this for an input to the UpdateAction, that this could cause values to be set to null, e.g., if you constructed a entity from scratch, and didn't set all values in it!!- Throws:
QRuntimeException
-
toQRecordOnlyChangedFields
Deprecated.Overload of toQRecordOnlyChangedFields that preserves original behavior of that method, which is, to NOT includePrimaryKey -
toQRecordOnlyChangedFields
Useful for the use-case of: - fetch a QRecord (e.g., QueryAction or GetAction) - build a QRecordEntity out of it - change a field (or two) in it - want to pass it into an UpdateAction, and want to see only the fields that you know you changed get passed in to UpdateAction (e.g., PATCH semantics). But also - per the includePrimaryKey param, include the primaryKey in the records (e.g., to tell the Update which records to update). Also, useful for: - construct new entity, calling setters to populate some fields - pass that entity into -
getFieldList
-
getAssociationList
-
getQFieldAnnotation
public static Optional<QField> getQFieldAnnotation(Class<? extends QRecordEntity> c, String fieldName) -
getQIgnoreAnnotation
public static Optional<QIgnore> getQIgnoreAnnotation(Class<? extends QRecordEntity> c, String ignoreName) -
getQAssociationAnnotation
public static Optional<QAssociation> getQAssociationAnnotation(Class<? extends QRecordEntity> c, String fieldName) -
getAnnotationOnField
public static <A extends Annotation> Optional<A> getAnnotationOnField(Class<? extends QRecordEntity> c, Class<A> annotationClass, String fieldName) -
getFieldNameFromGetter
-
getTableName
- Throws:
QException
-
tableName
named without the 'get' to avoid conflict w/ entity fields named that...- Throws:
QException
-